Task #0001530: Réécriture PRINTJRN

Rename file template/acc_history_ledger_sale_oneline.php to template/acc_ledger_history_sale_oneline.php
Manage PURCHASE - oneline,detailled , extended and accounting
Adapt test file
This commit is contained in:
Dany De Bontridder 2018-01-21 14:48:47 +01:00
parent 2e40252b77
commit 0708cd16ca
11 changed files with 763 additions and 26 deletions

View file

@ -26,6 +26,7 @@
*/
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_generic.class.php";
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_sale.class.php";
require_once NOALYSS_INCLUDE."/class/acc_ledger_history_purchase.class.php";
/**
* @brief Display history of operation
*/
@ -125,7 +126,7 @@ abstract class Acc_Ledger_History
static function factory(Database $cn, $pa_ledger, $p_from, $p_to, $p_mode)
{
// For Accounting writing , we use Acc_Ledger_History
if ($p_mode=="E")
if ($p_mode=="A")
{
$ret=new Acc_Ledger_History_Generic($cn, $pa_ledger, $p_from, $p_to,
$p_mode);
@ -236,8 +237,8 @@ abstract class Acc_Ledger_History
*/
protected function prepare_reconcile_date()
{
static $prepare=0;
if ($prepare==0)
$prepare=$this->db->is_prepare("reconcile_date");
if ($prepare==FALSE)
{
$this->db->prepare('reconcile_date',
'select *
@ -256,7 +257,6 @@ abstract class Acc_Ledger_History
from jrn_rapt
where jra_concerned=$1)');
}
$prepare=1;
}
/**
* display accounting of operations m_mode=A

View file

@ -21,6 +21,209 @@
/**
* @file
* @brief
* @brief class Acc_Ledger_History_Purchase , list of operations
*/
?>
require_once NOALYSS_INCLUDE."/class/acc_ledger_history.class.php";
/**
* @brief Display the operations for Purchase
*/
class Acc_Ledger_History_Purchase extends Acc_Ledger_History
{
private $data; //!< Contains rows from SQL
public function __construct(\Database $cn, $pa_ledger, $p_from, $p_to,
$p_mode)
{
parent::__construct($cn, $pa_ledger, $p_from, $p_to, $p_mode);
}
/**
* @brief display the accounting
*/
public function export_accounting_html()
{
$ledger_history=new Acc_Ledger_History_Generic($this->db,
$this->ma_ledger, $this->m_from, $this->m_to, $this->m_mode);
$ledger_history->export_accounting_html();
}
public function export_detail_html()
{
$own=new Noalyss_Parameter_Folder($this->db);
$this->get_row();
$this->add_vat_info();
$this->prepare_reconcile_date();
include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_detail.php";
}
public function export_extended_html()
{
$this->get_row();
$this->add_vat_info();
$this->prepare_detail();
$this->prepare_reconcile_date();
include NOALYSS_TEMPLATE."/acc_ledger_history_purchase_extended.php";
}
/**
* @brief display in HTML following the mode
*/
function export_html()
{
switch ($this->m_mode)
{
case "E":
$this->export_extended_html();
break;
case "D":
$this->export_detail_html();
break;
case "L":
$this->export_oneline_html();
break;
case "A":
$this->export_accounting_html();
break;
default:
break;
}
}
/**
* display in HTML one operation by line
*/
public function export_oneline_html()
{
$this->get_row();
$this->prepare_reconcile_date();
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_purchase_oneline.php';
}
/**
* Get the rows from jrnx and quant* tables
* @param int $p_limit max of rows to returns
* @param int $p_offset the number of rows to skip
*/
public function get_row($p_limit=-1, $p_offset="")
{
$periode=sql_filter_per($this->db, $this->m_from, $this->m_to, 'p_id',
'jr_tech_per');
$cond_limite=($p_limit!=-1)?" limit ".$p_limit." offset ".$p_offset:"";
$ledger_list=join(",", $this->ma_ledger);
$sql="
with row_sale as
(select qp_internal,
qp_supplier,sum(qp_price) as novat,
sum(qp_vat) as vat ,
sum(qp_vat_sided) as tva_sided ,
sum(qp_nd_amount) as noded_amount,
sum(qp_nd_tva) as noded_vat,
sum(qp_dep_priv) as private_amount
from
quant_purchase group by qp_supplier,qp_internal),
supplier_detail as (
select x.f_id as f_id,
(select ad_value from fiche_detail where ad_id=1 and f_id=x.f_id) as name,
(select ad_value from fiche_detail where ad_id=32 and f_id=x.f_id) as first_name,
(select ad_value from fiche_detail where ad_id=23 and f_id=x.f_id) as qcode
from
fiche as x)
select
name,
first_name,
qcode,
jr_id,
jr_pj_number,
jr_date,
jr_date_paid,
jr_internal,
qp_supplier,
jrn.jr_comment,
jr_pj_name,
vat,
tva_sided,
novat,
noded_amount,
noded_vat,
private_amount,
novat+vat-tva_sided as tvac
from
jrn
join row_sale on (qp_internal=jr_internal)
join supplier_detail on (qp_supplier=f_id)
where
jr_def_id in ({$ledger_list})
and {$periode}
{$cond_limite}";
$this->data=$this->db->get_array($sql);
}
/**
* @brief preprare the query for fetching the detailed VAT of an operation
* @staticvar int $prepare
*/
private function add_vat_info()
{
$prepare=$this->db->is_prepare("vat_infop");
if ($prepare==0)
{
$this->db->prepare("vat_infop",
"
select
sum(qp_vat) vat_amount ,
qp_vat_code
from
quant_purchase
where
qp_internal = $1
group by qp_vat_code,qp_internal order by qp_vat_code");
}
$prepare=1;
$nb_row=count($this->data);
for ($i=0; $i<$nb_row; $i++)
{
$ret=$this->db->execute("vat_infop",
array($this->data[$i]["jr_internal"]));
$array=Database::fetch_all($ret);
$this->data[$i]["detail_vat"]=$array;
}
}
/**
* Prepare the query for fetching detail of an operation
*/
private function prepare_detail()
{
if ($this->db->is_prepare("detail_purchase")==FALSE)
{
$this->db->prepare("detail_purchase",
"
with card_name as
(select f_id,ad_value as name
from fiche_detail where ad_id=1),
card_qcode as
(select f_id,ad_value as qcode
from fiche_detail where ad_id=23)
select qp_price,qp_quantite,qp_vat,qp_vat_code,qp_unit,qp_vat_sided,name,qcode,tva_label,
qp_price+qp_vat-qp_vat_sided as tvac
from
quant_purchase
join jrnx using (j_id)
join card_name on (card_name.f_id=qp_fiche)
join card_qcode on (card_qcode.f_id=qp_fiche)
join tva_rate on ( qp_vat_code=tva_id)
where
qp_internal=$1
");
}
}
}

View file

@ -71,12 +71,11 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
}
/**
* Prepare the query for fetching detail of an operation
* @staticvar int $prepare
*/
private function prepare_detail()
{
static $prepare=0;
if ( $prepare == 0)
if ( $this->db->is_prepare("detail_sale")== FALSE)
{
$this->db->prepare("detail_sale","
with card_name as
@ -98,7 +97,6 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
");
}
$prepare=1;
}
/**
* Get the rows from jrnx and quant* tables
@ -161,8 +159,8 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
*/
private function add_vat_info()
{
static $prepare=0;
if ( $prepare==0) {
$prepare=$this->db->is_prepare("vat_info");
if ( $prepare==FALSE) {
$this->db->prepare("vat_info","
select
sum(qs_vat) vat_amount ,
@ -175,7 +173,6 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
}
$prepare=1;
$nb_row=count($this->data);
for ($i=0;$i<$nb_row;$i++)
{
@ -215,7 +212,7 @@ class Acc_Ledger_History_Sale extends Acc_Ledger_History
{
$this->get_row();
$this->prepare_reconcile_date();
require_once NOALYSS_TEMPLATE.'/acc_history_ledger_sale_oneline.php';
require_once NOALYSS_TEMPLATE.'/acc_ledger_history_sale_oneline.php';
}

View file

@ -144,13 +144,15 @@ print td('Jusque ') . $w->input('to_periode', $periode_end);
print "</TR><TR>";
$a = array(
array('value' => 'L', 'label' => _('Liste opérations')),
array('value' => 'E', 'label' => _('Ecriture comptable')),
array('value' => 'D', 'label' => _('Avec Détails opérations '))
array('value' => 'E', 'label' => _('Liste détaillées opérations ')),
array('value' => 'A', 'label' => _('Ecriture comptable')),
array('value' => 'D', 'label' => _('Détails TVA'))
);
$w->selected = 1;
print '</TR>';
print '<TR>';
$w->selected = (isset($simple)) ? $simple : '1';
$simple=$http->get("p_simple","string","L");
$w->selected = $simple;
echo '<td>Style d\'impression '.Icon_Action::infobulle(32).'</td>' . $w->input('p_simple', $a);
print "</TR>";
@ -169,7 +171,7 @@ echo '<hr>';
if (isset($_REQUEST['bt_html']))
{
// Type of report : listing=1 , Accounting writing=0, detail =2
$simple=$http->get("p_simple","string");
$jrn_id=$http->get("jrn_id","number");
/*

View file

@ -0,0 +1,196 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief Display one purchase operation on one line , with the sum of VAT, ND...
*/
?>
<TABLE class="result">
<tr>
<th><?php echo _("Pièce")?></th>
<th><?php echo _("Date")?></th>
<th><?php echo _("Paiement")?></th>
<th><?php echo _("Ref")?></th>
<th><?php echo _("Fournisseur")?></th>
<th><?php echo _("Description")?></th>
<th style="text-align:right">HTVA</th>
<th style="text-align:right">Privé</th>
<th style="text-align:right">DNA</th>
<?php
$col_tva="";
if ( $own->MY_TVA_USE=='Y')
{
echo '<th style="text-align:right">TVA ND</th>';
$a_Tva=$this->db->get_array("select tva_id,tva_label from tva_rate where tva_rate != 0.0000 order by tva_id");
foreach($a_Tva as $line_tva)
{
$col_tva.='<th style="text-align:right">Tva '.$line_tva['tva_label'].'</th>';
}
}
echo $col_tva;
?>
<th style="text-align:right">TVAC</th>
<th><?php echo _("Opérations rapprochées")?></th>
</tr>
<?php
$i = 0;
$tot['htva']=0;
$tot['private_amount']=0;
$tot['noded_amount']=0;
$tot['tva_nd']=0;
$tot['tvac']=0;
$tot['tva']=array();
bcscale(4);
foreach ($this->data as $line) {
$i++;
/*
* Get date of reconcile operation
*/
$ret_reconcile=$this->db->execute('reconcile_date',array($line['jr_id']));
$class = ($i % 2 == 0) ? ' class="even" ' : ' class="odd" ';
echo "<tr $class>";
// Receipt number
echo "<TD>" . h($line['jr_pj_number']) . "</TD>";
// Date
echo "<TD>" . smaller_date($line['jr_date']) . "</TD>";
echo "<TD>" . smaller_date($line['jr_date_paid']) . "</TD>";
// Internal with detail
echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
// find the tiers (normally in $Row !
$tiers =HtmlInput::history_card($line['qp_supplier'],h($line['name'].' '.$line['first_name'])."[{$line['qcode']}]");
echo td($tiers);
// Label
echo "<TD>" . h($line['jr_comment']) . "</TD>";
// Private expense
$private_amount=($line['private_amount']==0)?"":nbm(round($line['private_amount'],2),2);
$tot['private_amount']=bcadd($tot['private_amount'], floatval($line['private_amount']));
// No deductible
$noded_amount=($line['noded_amount']==0)?"":nbm(round($line['noded_amount'],2),2);
$tot['noded_amount']=bcadd($tot['noded_amount'],round(floatval($line['noded_amount'])),2);
// HTVA amount
echo "<TD class=\"num\">" . nbm(round($line['novat'],2),2) . "</TD>";
$tot['htva']=bcadd($tot['htva'], round(floatval($line['novat']),2));
echo "<TD class=\"num\">" .$private_amount . "</TD>";
echo "<TD class=\"num\">" . $noded_amount . "</TD>";
//--------------------------------------------------------------------------
// If VAT then display it
//--------------------------------------------------------------------------
if ($own->MY_TVA_USE == 'Y' )
{
$tva_dna=($line['noded_vat']==0)?"":nbm(round($line['noded_vat']),2);
$tot['tva_nd']=bcadd($tot['tva_nd'], round(floatval($line['noded_vat']),2));
echo "<TD class=\"num\">" . $tva_dna. "</TD>";
$a_tva_amount=array();
foreach ($line['detail_vat'] as $lineTVA)
{
foreach ($a_Tva as $idx=>$line_tva)
{
if ($line_tva['tva_id'] == $lineTVA['qp_vat_code'])
{
$a=$line_tva['tva_id'];
$a_tva_amount[$a]=$lineTVA['vat_amount'];
}
}
}
foreach ($a_Tva as $line_tva)
{
$a=$line_tva['tva_id'];
if ( isset($a_tva_amount[$a]) && $a_tva_amount[$a] != 0) {
echo '<td class="num">'.nbm(round($a_tva_amount[$a],2)).'</td>';
$tot['tva'][$a]=(isset($tot['tva'][$a]))?bcadd($tot['tva'][$a],round(floatval($a_tva_amount[$a]),2)):round(floatval($a_tva_amount[$a]),2);
}
else
printf("<td class=\"num\"></td>");
}
}
echo '<td class="num">'.nbm($line['tvac'],2).'</td>';
$tot['tvac']=bcadd($tot['tvac'], round($line['tvac'],2));
/*
* If reconcile print them
*/
echo '<td>';
$max=Database::num_row($ret_reconcile);
if ($max > 0) {
$sep="";
for ($e=0;$e<$max;$e++) {
$row=Database::fetch_array($ret_reconcile, $e);
echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
$sep=' ,';
}
}
echo '</td>';
echo "</tr>";
}
/**
* summary
*/
?>
<tr class="highlight">
<td>
<?php echo _('Totaux')?>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="num"><?php echo nbm($tot['htva']); ?></td>
<td class="num"><?php echo nbm($tot['private_amount']) ?></td>
<td class="num"><?php echo nbm($tot['noded_amount'])?></td>
<?php if ($own->MY_TVA_USE == 'Y' ): ?>
<td><?php echo nbm($tot['tva_nd']) ?></td>
<?php foreach ($a_Tva as $line_tva) :
$a=$line_tva['tva_id'];
if ( isset($tot['tva'][$a])) :
?>
<td class="num"><?php echo nbm($tot['tva'][$a])?></td>
<?php else : ?>
<td>
</td>
<?php endif; ?>
<?php endforeach;?>
<?php endif; ?>
<td class="num"><?php echo nbm($tot['tvac'])?></td>
<td></td>
</tr>
</table>

View file

@ -0,0 +1,173 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
/**
* @file
* @brief detail of the list of operation with VAT and items
*/
?>
<table class="result">
<tr>
<th>
<?=_('Date')?>
</th>
<th>
<?=_('Date paiement')?>
</th>
<th>
<?=_('Pièce')?>
</th>
<th>
<?=_('Interne')?>
</th>
<th>
<?=_('Client')?>
</th>
<th>
<?=_('Description')?>
</th>
<th>
<?=_('HTVA')?>
</th>
<th>
<?=_('TVA')?>
</th>
<th>
<?=_('TVAC')?>
</th>
</tr>
<?php
$nb_data=count($this->data);
$tot_amount_novat=0;
$tot_amount_vat=0;
$tot_amount_tvac=0;
for ($i=0;$i<$nb_data;$i++):
$odd=' class="odd" ';
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
?>
<tr <?=$odd?> >
<td>
<?=$this->data[$i]['jr_date']?>
</td>
<td>
<?=$this->data[$i]['jr_date_paid']?>
</td>
<td>
<?=$this->data[$i]['jr_pj_number']?>
</td>
<td>
<?=HtmlInput::detail_op($this->data[$i]['jr_id'], $this->data[$i]['jr_internal'])?>
</td>
<td>
<?=HtmlInput::history_card($this->data[$i]['qp_supplier'],h($this->data[$i]['name'].' '.$this->data[$i]['first_name']))?>
</td>
<td>
<?=h($this->data[$i]['jr_comment'])?>
</td>
<td class="num">
<?=nbm($this->data[$i]['novat'])?>
</td>
<td class="num">
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
</td>
<td class="num">
<?=nbm($this->data[$i]['tvac'])?>
</td>
<td>
<?php
$ret_reconcile=$this->db->execute('reconcile_date',array($this->data[$i]['jr_id']));
$max=Database::num_row($ret_reconcile);
if ($max > 0) {
$sep="";
for ($e=0;$e<$max;$e++) {
$row=Database::fetch_array($ret_reconcile, $e);
echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
$sep=' ,';
}
} ?>
</td>
</tr>
<tr>
<td></td>
<td></td>
<td class="width:auto" colspan="8" style="border-style: solid;border-width:1px;border-color: blue">
<?php
/// Detail opération
$det=$this->db->execute("detail_purchase",array($this->data[$i]['jr_internal']));
$a_detail=Database::fetch_all($det);
?>
<table style="width: 100%">
<tr>
<th><?=_("Item")?></th>
<th class="num"><?=_("Prix Unit")?></th>
<th class="num"><?=_("Quantité")?></th>
<th class="num"><?=_("HTVA")?></th>
<th class="num"><?=_("TVA")?></th>
<th class="num"><?=_("Code TVA")?></th>
<th class="num"><?=_("TVAC")?></th>
</tr>
<?php
$nb_detail=count($a_detail);
for ($j=0;$j<$nb_detail;$j++):
?>
<tr >
<td><?=$a_detail[$j]['qcode']?>
<?=$a_detail[$j]['name']?> </td>
<td class="num" style="width:10%"><?=$a_detail[$j]['qp_quantite']?> </td>
<td class="num" style="width:10%"><?=$a_detail[$j]['qp_unit']?> </td>
<td class="num" style="width:10%"><?=nbm($a_detail[$j]['qp_price'])?> </td>
<td class="num" style="width:10%"><?=nbm($a_detail[$j]['qp_vat'])?> </td>
<td class="num" style="width:10%"><?=$a_detail[$j]['tva_label']?> </td>
<td class="num" style="width:10%"><?=nbm($a_detail[$j]['tvac'])?> </td>
</tr>
<?php
endfor;
?>
</table>
</td>
</tr>
<?php
endfor;
?>
<tfoot>
<tr class="highlight">
<td>
<?=_("Totaux")?>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td><?=nbm($tot_amount_novat)?></td>
<td><?=nbm($tot_amount_vat)?></td>
<td><?=nbm($tot_amount_tvac)?></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>

View file

@ -0,0 +1,152 @@
<?php
/*
* This file is part of NOALYSS.
*
* PhpCompta is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* PhpCompta is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with PhpCompta; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
// Copyright (2018) Author Dany De Bontridder <dany@alchimerys.be>
if (!defined('ALLOWED'))
die('Appel direct ne sont pas permis');
/**
* @file
* @brief display purchase on one line with sum of VAT, Operation, Private exp.
* @todo prévoir aussi pour les non assujetti : faire disparaître les montants TVA
*/
?>
<table class="result">
<tr>
<th>
<?=_('Date')?>
</th>
<th>
<?=_('Date paiement')?>
</th>
<th>
<?=_('Pièce')?>
</th>
<th>
<?=_('Interne')?>
</th>
<th>
<?=_('Client')?>
</th>
<th>
<?=_('Description')?>
</th>
<th>
<?=_('HTVA')?>
</th>
<th>
<?=_('Non ded')?>
</th>
<th>
<?=_('TVA')?>
</th>
<th>
<?=_('TVAC')?>
</th>
</tr>
<?php
$nb_data=count($this->data);
$tot_amount_novat=0;
$tot_amount_vat=0;
$tot_amount_tvac=0;
$tot_amount_private=0;
$tot_nonded_vat=0;
$tot_nonded_amount=0;
for ($i=0;$i<$nb_data;$i++):
$odd=($i%2==0)?' class="even" ':' class="odd" ';
$tot_amount_novat=bcadd($tot_amount_novat,$this->data[$i]['novat']);
$tot_amount_vat=bcadd($tot_amount_vat,$this->data[$i]['vat']);
$tot_amount_vat=bcsub($tot_amount_vat,$this->data[$i]['tva_sided']);
$tot_amount_tvac=bcadd($tot_amount_tvac,$this->data[$i]['tvac']);
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['noded_amount']);
$tot_nonded_amount=bcadd($tot_nonded_amount,$this->data[$i]['private_amount']);
$tot_nonded_vat=bcadd($tot_nonded_vat, $this->data[$i]['noded_vat']);
?>
<tr <?=$odd?> >
<td>
<?=$this->data[$i]['jr_date']?>
</td>
<td>
<?=$this->data[$i]['jr_date_paid']?>
</td>
<td>
<?=$this->data[$i]['jr_pj_number']?>
</td>
<td>
<?=HtmlInput::detail_op($this->data[$i]['jr_id'], $this->data[$i]['jr_internal'])?>
</td>
<td>
<?=HtmlInput::history_card($this->data[$i]['qp_supplier'],h($this->data[$i]['name'].' '.$this->data[$i]['first_name']." [ {$this->data[$i]['qcode']} ]"))?>
</td>
<td>
<?=h($this->data[$i]['jr_comment'])?>
</td>
<td class="num">
<?=nbm($this->data[$i]['novat'])?>
</td>
<td class="num">
<?=nbm(bcadd($this->data[$i]['noded_amount'],$this->data[$i]['private_amount']));?>
</td>
<td class="num">
<?=nbm(bcsub($this->data[$i]['vat'],$this->data[$i]['tva_sided']))?>
</td>
<td class="num">
<?=nbm($this->data[$i]['tvac'])?>
</td>
<td>
<?php
$ret_reconcile=$this->db->execute('reconcile_date',array($this->data[$i]['jr_id']));
$max=Database::num_row($ret_reconcile);
if ($max > 0) {
$sep="";
for ($e=0;$e<$max;$e++) {
$row=Database::fetch_array($ret_reconcile, $e);
echo $sep.HtmlInput::detail_op($row['jr_id'],$row['jr_date'].' '. $row['jr_internal']);
$sep=' ,';
}
} ?>
</td>
</tr>
<?php
endfor;
?>
<tfoot>
<tr class="highlight">
<td>
<?=_("Totaux")?>
</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
<td class="num"><?=nbm($tot_amount_novat)?></td>
<td class="num"><?=nbm($tot_nonded_amount)?></td>
<td class="num"><?=nbm($tot_amount_vat)?></td>
<td class="num"><?=nbm($tot_amount_tvac)?></td>
<td></td>
<td></td>
</tr>
</tfoot>
</table>

View file

@ -83,7 +83,7 @@ foreach ($this->data as $line) {
// Internal with detail
echo "<TD>" . HtmlInput::detail_op($line['jr_id'], $line['jr_internal']) . "</TD>";
// find the tiers (normally in $Row !
// find the tiers (normally in $this->data !
$tiers =HtmlInput::history_card($line['qs_client'],h($line['name'].' '.$line['first_name'])."[{$line['qcode']}]");
echo td($tiers);

View file

@ -78,7 +78,7 @@ for ($i=0;$i<$nb_data;$i++):
<?=$this->data[$i]['jr_pj_number']?>
</td>
<td>
<?=$this->data[$i]['jr_internal']?>
<?=HtmlInput::detail_op($this->data[$i]['jr_id'], $this->data[$i]['jr_internal'])?>
</td>
<td>
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].' '.$this->data[$i]['first_name']))?>
@ -111,7 +111,9 @@ for ($i=0;$i<$nb_data;$i++):
</td>
</tr>
<tr>
<td class="width:auto" colspan="8">
<td></td>
<td></td>
<td class="width:auto" colspan="8" style="border-style: solid;border-width:1px;border-color: blue">
<?php
/// Detail opération
$det=$this->db->execute("detail_sale",array($this->data[$i]['jr_internal']));

View file

@ -79,7 +79,7 @@ for ($i=0;$i<$nb_data;$i++):
<?=$this->data[$i]['jr_pj_number']?>
</td>
<td>
<?=$this->data[$i]['jr_internal']?>
<?=HtmlInput::detail_op($this->data[$i]['jr_id'], $this->data[$i]['jr_internal'])?>
</td>
<td>
<?=HtmlInput::history_card($this->data[$i]['qs_client'],h($this->data[$i]['name'].' '.$this->data[$i]['first_name']." [ {$this->data[$i]['qcode']} ]"))?>

View file

@ -34,18 +34,17 @@ $cn=Dossier::connect();
$ledger_history=Acc_Ledger_History::factory($cn, $ledger, 216, 217, "E");
echo h1("Detailled Accounting");
echo h2(_("export detail html all ledgers result = Detailled Accounting"));
echo h2(_("export detail html all ledgers result = Detailled Accounting from Acc_Ledger_History_Generic"));
$ledger_history->export_detail_html();
echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting" ));
echo h2(_("Set mode to D etailled all_ledgers result = Detailled Accounting from Acc_Ledger_History_Generic" ));
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h2(_("Only VEN"));
echo h1(_("Only VEN from Acc_Ledger_History_Sale"));
$ledger_history=Acc_Ledger_History::factory($cn, [2], 216, 217, "L");
$ledger_history->export_detail_html();
echo h1("One line");
echo h2(_("Only VEN one line"));
$ledger_history->set_a_ledger([2]);
$ledger_history->set_m_mode("L");
@ -66,3 +65,16 @@ $ledger_history=Acc_Ledger_History::factory($cn, [3,2], 216, 217, "L");
$ledger_history->export_oneline_html();
echo h1("ACH from Acc_Ledger_History_Purchase");
echo h2("Detailled accouting");
$ledger_history=new Acc_Ledger_History_Purchase($cn,[3],216,217,"A");
$ledger_history->export_html();
echo h2("Ach one line");
$ledger_history->set_m_mode("L");
$ledger_history->export_html();
echo h2("Ach Detail");
$ledger_history->set_m_mode("D");
$ledger_history->export_html();
echo h2("Ach Extended");
$ledger_history->set_m_mode("E");
$ledger_history->export_html();