Warning if Accounting side incorrect from P0PST

This commit is contained in:
sparkyx 2025-11-25 12:03:42 +01:00
parent 340c02d851
commit 238450c43d
4 changed files with 68 additions and 8 deletions

View file

@ -860,7 +860,7 @@ class Fiche
join jrn on (jr_grpt_id=j_grpt)
join tmp_pcmn on (j_poste=pcm_val)
join parm_periode on (p_id=jr_tech_per)
where j_qcode=$1 and
where f_id=$1 and
( to_date($2,'DD.MM.YYYY') <= j_date and
to_date($3,'DD.MM.YYYY') >= j_date )
and $filter_sql $sql_let ) as m",array($this->id,$p_from,$p_to));
@ -1020,7 +1020,23 @@ class Fiche
if ( count($this->row ) == 0 )
return -1;
$acc_account_ledger=new Acc_Account_Ledger($this->cn,$this->get_attribute(ATTR_DEF_ACCOUNT));
$type=$acc_account_ledger->get_type();
// label warning if the saldo is incorrect
$label="";
if (in_array($type,array('CHA','ACT','PASINV','PROINV')) && $tot_deb<$tot_cred)
{
$label.=_("Solde créditeur au lieu de débiteur").'<span class="icon">&#xe80e;</span>';
}
if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred)
{
$label.=_("Solde débiteur au lieu de créditeur")." ".'<span class="icon">&#xe80e;</span>';
}
if ( $label !="" )
echo '<span class="notice" >'.$label.'</span>';
$rep="";
if ( $from_div==1)
{

View file

@ -56,6 +56,23 @@ if ( count($array) == 0 )
{
exit;
}
$acc_account_ledger=new Acc_Account_Ledger($cn,$Fiche->get_attribute(ATTR_DEF_ACCOUNT));
$type=$acc_account_ledger->get_type();
// label warning if the saldo is incorrect
$label="";
if (in_array($type,array('CHA','ACT','PASINV','PROINV')) && $tot_deb<$tot_cred)
{
$label=_("Solde créditeur au lieu de débiteur").mb_chr(9888);
}
if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred)
{
$label=_("Solde débiteur au lieu de créditeur").mb_chr(9888);
}
$size=array(13,25,20,60,12,20,20,20);
$align=array('L','C','C','L','R','R','R','R');
@ -63,8 +80,14 @@ $Libelle=sprintf("(%s) %s %s [ %s ]",$Fiche->id,$Fiche->getName(),$Fiche->get_at
$pdf->SetFont('DejaVu','',10);
$pdf->write_cell(0,8,$Libelle,1,0,'C');
$pdf->line_new();
if ( $label !="" )
{
// warning about side
$pdf->SetTextColor(255,39,24);
$pdf->write_cell(0,8,$label,1,0,'C',fill: false);
$pdf->line_new();
}
$pdf->SetTextColor(0);
$pdf->SetFont('DejaVuCond','',8);
$l=0;
$pdf->write_cell($size[$l],6,'Date',0,0,'L');

View file

@ -82,6 +82,27 @@ foreach ($a_poste as $poste)
$pdf->write_cell(0,8,$Libelle,1,0,'C');
$pdf->line_new();
$type=$Poste->get_type();
// label warning if the saldo is incorrect
$label="";
if (in_array($type,array('CHA','ACT','PASINV','PROINV')) && $tot_deb<$tot_cred)
{
$label=_("Solde créditeur au lieu de débiteur").mb_chr(9888);
}
if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred)
{
$label=_("Solde débiteur au lieu de créditeur").mb_chr(9888);
}
if ( $label !="" )
{
// warning about side
$pdf->SetTextColor(255,39,24);
$pdf->write_cell(0,8,$label,1,0,'C',fill:false);
$pdf->line_new();
}
$pdf->SetTextColor(0);
$pdf->SetFont('DejaVuCond','',8);
$l=0;
$pdf->write_cell($size[$l],8,_('Date'),0,0,'L');

View file

@ -117,18 +117,18 @@ echo '</div>';
//-----------------------------------------------------
if ( isset( $_REQUEST['bt_html'] ) )
{
if ( isDate($_REQUEST['from_periode'])==null || isDate($_REQUEST['to_periode'])==null)
if ( isDate($http->request('from_periode'))==null || isDate($http->request('to_periode'))==null)
{
echo alert(_('Date malformée, désolée'));
return;
}
$go=0;
// we ask a poste_id
if ( isset($_GET['poste_id']) && noalyss_strlentrim($_GET['poste_id']) != 0 )
if ( isset($_GET['poste_id']) && noalyss_strlentrim($http->get('poste_id')) != 0 )
{
if ( isset ($_GET['poste_fille']) )
{
$parent=sql_string($_GET['poste_id']);
$parent=sql_string($http->get('poste_id'));
$a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '$parent%' order by pcm_val::text");
$go=3;
}
@ -168,7 +168,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
echo $table;
}
echo '</div>';
echo Acc_Account_Ledger::HtmlTableHeader();
Acc_Account_Ledger::HtmlTableHeader();
}
else
{
@ -198,7 +198,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
}
echo '</table>';
echo Acc_Account_Ledger::HtmlTableHeader();
Acc_Account_Ledger::HtmlTableHeader();
}
echo "</div>";
exit;