diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index 15968f850..111270158 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -1070,6 +1070,8 @@ class Acc_Ledger extends jrn_def_sql $p_array['TVA'] = array(); $p_array['AMOUNT_TVA'] = 0.0; $p_array['dep_priv'] = 0; + $p_array['dna'] = 0; + $p_array['tva_dna'] = 0; $dep_priv = 0.0; // // Retrieve data from jrnx @@ -1179,7 +1181,10 @@ class Acc_Ledger extends jrn_def_sql $purchase->load(); $dep_priv+=$purchase->qp_dep_priv; $p_array['dep_priv'] = $dep_priv; + $p_array['dna']=$purchase->qp_nd_amount; + $p_array['tva_dna']=$purchase->qp_nd_tva; } + } $p_array['TVAC'] = sprintf('% 10.2f', $p_array['TVAC'] ); $p_array['HTVA'] = sprintf('% 10.2f', $p_array['TVAC'] - $p_array['AMOUNT_TVA']); @@ -2912,7 +2917,7 @@ class Acc_Ledger extends jrn_def_sql if ($this->type == 'ACH') { $array = $this->db->get_array('select sum(qp_price) as price,sum(qp_vat) as vat ' . - ',sum(qp_dep_priv) as priv' . + ',coalesce(sum(qp_nd_amount),0)+coalesce(sum(qp_dep_priv),0) as priv' . ',sum(qp_nd_tva_recup)+sum(qp_nd_tva) as tva_nd' . ' from quant_purchase join jrnx using(j_id) where j_grpt=$1 ', array($p_jr_id)); diff --git a/include/class_print_ledger_detail.php b/include/class_print_ledger_detail.php index 41c30a080..d2a569eac 100644 --- a/include/class_print_ledger_detail.php +++ b/include/class_print_ledger_detail.php @@ -59,10 +59,9 @@ class Print_Ledger_Detail extends PDF //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Page number - $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C'); - $this->Ln(3); + $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L'); // Created by PhpCompta - $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'C',false,'http://www.aevalys.eu'); + $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'R',false,'http://www.aevalys.eu'); } function Cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') diff --git a/include/class_print_ledger_simple.php b/include/class_print_ledger_simple.php index c6cf2a17c..935c2d3f3 100644 --- a/include/class_print_ledger_simple.php +++ b/include/class_print_ledger_simple.php @@ -104,7 +104,7 @@ class Print_Ledger_Simple extends PDF $this->Cell(15,6,'HTVA',0,0,'R'); if ( $this->jrn_type=='ACH') { - $this->Cell(15,6,'Privé',0,0,'R'); + $this->Cell(15,6,'Priv/DNA',0,0,'R'); $this->Cell(15,6,'TVA ND',0,0,'R'); } foreach($this->a_Tva as $line_tva) @@ -181,10 +181,9 @@ class Print_Ledger_Simple extends PDF //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Page number - $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C'); - $this->Ln(3); + $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L'); // Created by PhpCompta - $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'C',false,'http://www.aevalys.eu'); + $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'R',false,'http://www.aevalys.eu'); } function Cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') diff --git a/include/class_print_ledger_simple_without_vat.php b/include/class_print_ledger_simple_without_vat.php index 5b8881bb9..4e5e1ca71 100644 --- a/include/class_print_ledger_simple_without_vat.php +++ b/include/class_print_ledger_simple_without_vat.php @@ -132,10 +132,9 @@ class Print_Ledger_Simple_Without_Vat extends PDF //Arial italic 8 $this->SetFont('Arial', 'I', 8); //Page number - $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'C'); - $this->Ln(3); + $this->Cell(0,8,'Date '.$this->date." - Page ".$this->PageNo().'/{nb}',0,0,'L'); // Created by PhpCompta - $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'C',false,'http://www.aevalys.eu'); + $this->Cell(0,8,'Created by Phpcompta, online on http://www.aevalys.eu',0,0,'R',false,'http://www.aevalys.eu'); } function Cell ($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='') diff --git a/include/export_ledger_csv.php b/include/export_ledger_csv.php index e0943b807..dbca57998 100644 --- a/include/export_ledger_csv.php +++ b/include/export_ledger_csv.php @@ -144,17 +144,20 @@ else $col_tva.='"Tva '.$line_tva['tva_label'].'";'; } } - echo '"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;'.$col_tva.'"TVAC"'."\n\r"; + echo '"Date";"operation";"Client/Fourn.";"Commentaire";"inter.";"HTVA";privé;DNA;tva non ded.;'.$col_tva.'"TVAC"'."\n\r"; foreach ($Row as $line) { - printf('"%s";"%s";"%s";"%s";"%s";%s;%s;', + printf('"%s";"%s";"%s";"%s";"%s";%s;%s;%s;%s;', $line['date'], $line['num'], $Jrn->get_tiers($line['jrn_def_type'],$line['jr_id']), $line['comment'], $line['jr_internal'], nb($line['HTVA']), - nb($line['dep_priv'])); + nb($line['dep_priv']), + nb($line['dna']), + nb($line['tva_dna']) + ); $a_tva_amount=array(); foreach ($line['TVA'] as $lineTVA) { diff --git a/include/impress_jrn.inc.php b/include/impress_jrn.inc.php index b9eacb078..ea1d2b155 100644 --- a/include/impress_jrn.inc.php +++ b/include/impress_jrn.inc.php @@ -64,13 +64,12 @@ $NoPriv = $cn->count_sql("select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_d uj_login='$g_user->id' and uj_priv ='X' "); -// Pour voir tout les journal ? -if ($NoPriv == 0 && $ret != null) -{ - $a = count($ret); - $all = array('value' => 0, 'label' => 'Tous les journaux'); - $ret[$a] = $all; -} +/* + * Show all the available ledgers + */ +$a = count($ret); +$all = array('value' => 0, 'label' => 'Tous les journaux disponibles'); +$ret[$a] = $all; if (count($ret) < 1) NoAccess(); $exercice = (isset($_GET['exercice'])) ? $_GET['exercice'] : $g_user->get_exercice(); @@ -255,6 +254,8 @@ if (isset($_REQUEST['bt_html'])) ///////////////////////////////////////////////////////////////////////////////////// elseif ($_GET['p_simple'] == 1) { + if ( $Jrn->get_type() != 'ACH' && $Jrn->get_type() != 'VEN') + { // Simple printing //--- echo ''; @@ -307,6 +308,14 @@ if (isset($_REQUEST['bt_html'])) echo ""; } echo "
"; + } else { + /* + * Ledger ACH or VEN + */ + $own=new Own($cn); + require_once 'template/print_ledger_simple.php'; + + } } ///////////////////////////////////////////////////////////////////////////////////// // Détaillé