diff --git a/include/class/fiche.class.php b/include/class/fiche.class.php
index 0858e6b8d..3729e33a8 100644
--- a/include/class/fiche.class.php
+++ b/include/class/fiche.class.php
@@ -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").'';
+ }
+ if (in_array($type,array('PRO','PAS','ACTINV','CHAINV')) && $tot_deb>$tot_cred)
+ {
+
+ $label.=_("Solde débiteur au lieu de créditeur")." ".'';
+ }
+ if ( $label !="" )
+ echo ''.$label.'';
$rep="";
if ( $from_div==1)
{
diff --git a/include/export/export_fiche_detail_pdf.php b/include/export/export_fiche_detail_pdf.php
index 6ea2d042e..a8d9fe916 100644
--- a/include/export/export_fiche_detail_pdf.php
+++ b/include/export/export_fiche_detail_pdf.php
@@ -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');
diff --git a/include/export/export_poste_detail_pdf.php b/include/export/export_poste_detail_pdf.php
index e44027875..ebd5dc578 100644
--- a/include/export/export_poste_detail_pdf.php
+++ b/include/export/export_poste_detail_pdf.php
@@ -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');
diff --git a/include/impress_poste.inc.php b/include/impress_poste.inc.php
index fe9f1946e..1b2be1500 100644
--- a/include/impress_poste.inc.php
+++ b/include/impress_poste.inc.php
@@ -117,18 +117,18 @@ echo '';
//-----------------------------------------------------
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 '';
- echo Acc_Account_Ledger::HtmlTableHeader();
+ Acc_Account_Ledger::HtmlTableHeader();
}
else
{
@@ -198,7 +198,7 @@ if ( isset( $_REQUEST['bt_html'] ) )
}
echo '';
- echo Acc_Account_Ledger::HtmlTableHeader();
+ Acc_Account_Ledger::HtmlTableHeader();
}
echo "";
exit;