From 0219700f4490917782a8c7fae1c2580ee1ba0e79 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 31 Jan 2024 08:48:07 +0100 Subject: [PATCH] =?UTF-8?q?Task=20#2128=20:=20Comptabilit=C3=A9=20fran?= =?UTF-8?q?=C3=A7aise=20:=20report,=20montre=20le=20solde=20de=20l'ann?= =?UTF-8?q?=C3=A9e=20et=20depuis=20le=20d=C3=A9but=20pour=20les=20fiches,?= =?UTF-8?q?=20postes=20en=20HTML=20et=20PDF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/ajax/ajax_history.php | 2 +- include/class/acc_account_ledger.class.php | 12 ++++++++++++ include/class/fiche.class.php | 14 +++++++++++++- include/export/export_fiche_detail_pdf.php | 15 ++++++++++++++- include/export/export_poste_detail_pdf.php | 15 ++++++++++++++- include/sql/patch/upgrade190.sql | 2 +- 6 files changed, 55 insertions(+), 5 deletions(-) diff --git a/include/ajax/ajax_history.php b/include/ajax/ajax_history.php index 56a736be1..51e2cdfb8 100644 --- a/include/ajax/ajax_history.php +++ b/include/ajax/ajax_history.php @@ -110,7 +110,7 @@ if ( isset($_GET['f_id'])) ob_start(); require_once NOALYSS_TEMPLATE.'/history_top.php'; - $detail_card=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),$fiche->getName()); + $detail_card=HtmlInput::card_detail($fiche->strAttribut(ATTR_DEF_QUICKCODE),$fiche->getName()." ".$fiche->strAttribut(ATTR_DEF_FIRST_NAME,0)); echo h2( $fiche->getName().'['.$fiche->strAttribut(ATTR_DEF_QUICKCODE).']',' class="title" '); echo '

'.$detail_card.'

'; diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index 61d33887e..2e3aa4079 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -448,6 +448,7 @@ class Acc_Account_Ledger { if ( $p_array==null)$p_array=$_REQUEST; + global $g_parameter; $this->get_name(); list($array,$tot_deb,$tot_cred)=$this->get_row_date( $p_array['from_periode'], $p_array['to_periode'],$let @@ -592,6 +593,17 @@ class Acc_Account_Ledger echo "$solde_type". "".nbm(abs($diff))."". ""; + // take saldo from 1st day until last + if ($g_parameter->MY_REPORT=='N') { + $solde_until_now=$this->get_solde_detail(" j_date <= to_date('{$p_array['to_periode']}','DD.MM.YYYY') "); + echo ''; + echo td(_("Solde global")); + echo td("D : ".nbm($solde_until_now['debit']),'class="num"'); + echo td("C : ".nbm($solde_until_now['credit']),'class="num"'); + echo td("Delta : ".nbm($solde_until_now['solde'])." ".$this->get_amount_side($solde_until_now['debit']-$solde_until_now['credit']),'class="num"'); + echo ''; + + } echo ''; echo ''; diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php index 62e124acb..fd1028383 100644 --- a/include/class/fiche.class.php +++ b/include/class/fiche.class.php @@ -965,6 +965,7 @@ class Fiche { if ( $p_array == null) $p_array=$_REQUEST; + global $g_parameter; $progress=0; // if from_periode is greater than to periode then swap the values if (cmpDate($p_array['from_periode'],$p_array['to_periode']) > 0) @@ -1085,7 +1086,7 @@ class Fiche $old_exercice=$op['p_exercice']; } - $solde_type=($sum_deb>$sum_cred)?_("solde débiteur"):_("solde créditeur"); + $solde_type=_("Année ").($sum_deb>$sum_cred)?_("solde débiteur"):_("solde créditeur"); $solde_side=($sum_deb>$sum_cred)?"D":"C"; $diff=abs(bcsub($sum_deb,$sum_cred)); echo ''; @@ -1109,6 +1110,17 @@ class Fiche "".nbm($diff)."". "". ""; + // take saldo from 1st day until last + if ($g_parameter->MY_REPORT=='N') { + $solde_until_now=$this->get_solde_detail(" j_date <= to_date('{$p_array['to_periode']}','DD.MM.YYYY') "); + echo ''; + echo td(_("Solde global")); + echo td("D : ".nbm($solde_until_now['debit']),'class="num"'); + echo td("C : ".nbm($solde_until_now['credit']),'class="num"'); + echo td("Delta : ".nbm($solde_until_now['solde'])." ".$this->get_amount_side($solde_until_now['debit']-$solde_until_now['credit']),'class="num"'); + echo ''; + + } echo ''; echo ''; diff --git a/include/export/export_fiche_detail_pdf.php b/include/export/export_fiche_detail_pdf.php index 7034c644a..4f623caf5 100644 --- a/include/export/export_fiche_detail_pdf.php +++ b/include/export/export_fiche_detail_pdf.php @@ -28,7 +28,7 @@ include_once("lib/ac_common.php"); include_once("lib/impress.class.php"); require_once NOALYSS_INCLUDE.'/header_print.php'; $http=new HttpInput(); - +global $g_parameter; $f_id=$http->request("f_id", "number"); $from_periode=$http->get("from_periode","date"); $to_periode=$http->get("to_periode","date"); @@ -229,6 +229,19 @@ $pdf->write_cell(160,5,'Solde '.$solde,0,0,'R'); $pdf->write_cell(30,5,$str_diff_solde,0,0,'R'); $pdf->line_new(); +// take saldo from 1st day until last +if ($g_parameter->MY_REPORT=='N') { + + $solde_until_now=$Fiche->get_solde_detail(" j_date <= to_date('$to_periode','DD.MM.YYYY') "); + + $pdf->write_cell(40,5,"Solde global",0,0,'R'); + $pdf->write_cell(40,5,"D : ".nbm($solde_until_now['debit']),0,0,'R'); + $pdf->write_cell(40,5,"C : ".nbm($solde_until_now['credit']),0,0,'R'); + $pdf->write_cell(40,5,"Delta : ".nbm($solde_until_now['solde'])." ".$Fiche->get_amount_side($solde_until_now['debit']-$solde_until_now['credit']),0,0,'R'); + $pdf->line_new(); + +} + $fDate=date('dmy-Hi'); $pdf->Output('fiche-'.$fDate.'.pdf','D'); diff --git a/include/export/export_poste_detail_pdf.php b/include/export/export_poste_detail_pdf.php index 8559aa45e..cda145a4a 100644 --- a/include/export/export_poste_detail_pdf.php +++ b/include/export/export_poste_detail_pdf.php @@ -25,6 +25,8 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis'); require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/header_print.php'; +global $g_parameter; + $http=new HttpInput(); $poste_id=$http->request("poste_id"); @@ -32,7 +34,6 @@ $from_periode=$http->request("from_periode"); $to_periode=$http->request("to_periode"); $ople=$http->request("ople"); $poste_fille=$http->request("poste_fille","string",-1); - $gDossier=dossier::id(); /* Security */ @@ -247,6 +248,18 @@ foreach ($a_poste as $poste) $pdf->write_cell(30,5,$str_diff_solde,0,0,'R'); $pdf->line_new(); + // take saldo from 1st day until last + if ($g_parameter->MY_REPORT=='N') { + + $solde_until_now=$Poste->get_solde_detail(" j_date <= to_date('$to_periode','DD.MM.YYYY') "); + + $pdf->write_cell(40,5,"Solde global",0,0,'R'); + $pdf->write_cell(40,5,"D : ".nbm($solde_until_now['debit']),0,0,'R'); + $pdf->write_cell(40,5,"C : ".nbm($solde_until_now['credit']),0,0,'R'); + $pdf->write_cell(40,5,"Delta : ".nbm($solde_until_now['solde'])." ".$Poste->get_amount_side($solde_until_now['debit']-$solde_until_now['credit']),0,0,'R'); + $pdf->line_new(); + + } } $fDate=date('dmy-Hi'); $pdf->Output('poste-'.$fDate.'-'.$poste_id.'.pdf','D'); diff --git a/include/sql/patch/upgrade190.sql b/include/sql/patch/upgrade190.sql index e58122b77..8ef59c4e1 100644 --- a/include/sql/patch/upgrade190.sql +++ b/include/sql/patch/upgrade190.sql @@ -35,7 +35,7 @@ create trigger fiche_detail_check_qcode_trg before insert update fiche_detail set ad_value=ad_value where ad_id in (select ad_id from attr_def where ad_type='card'); -insert into parameter values ('MY_REPORT','N') ON CONFLICT DO NOTHING; +insert into parameter values ('MY_REPORT','Y') ON CONFLICT DO NOTHING; update menu_ref set me_file='payment_method.inc.php' where me_code='CFGPAY';