Task #2128 : Comptabilité française : report, montre le solde de l'année

et depuis le début pour les fiches, postes en HTML et PDF
This commit is contained in:
sparkyx 2024-01-31 08:48:07 +01:00
parent d1f0bb2ddd
commit bab6b76a67
6 changed files with 55 additions and 5 deletions

View file

@ -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 '<p style="text-align:center;">'.$detail_card.'</p>';

View file

@ -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 "<tr><TD>$solde_type</TD><td></td>".
"<TD style=\"text-align:right\">".nbm(abs($diff))."</TD>".
"</TR>";
// 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 '<tr style="font-weight:bold;color:orangered">';
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 '</tr>';
}
echo '</tfoot>';
echo '</tbody>';

View file

@ -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 '<tfoot>';
@ -1109,6 +1110,17 @@ class Fiche
"<TD style=\"text-align:right\">".nbm($diff)."</TD>".
"<TD></TD>".
"</TR>";
// 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 '<tr style="font-weight:bold;color:orangered">';
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 '</tr>';
}
echo '</tfoot>';
echo '</tbody>';

View file

@ -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');

View file

@ -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');

View file

@ -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';