diff --git a/include/class/acc_account_ledger.class.php b/include/class/acc_account_ledger.class.php index d4f20e663..61d33887e 100644 --- a/include/class/acc_account_ledger.class.php +++ b/include/class/acc_account_ledger.class.php @@ -304,6 +304,18 @@ class Acc_Account_Ledger } return $this->name; } + /*! + * \brief Return the type of a account + * \returns string ACT,ACTINV,CHA,CHAINV,CON,PAS,PRO + */ + function get_type() + { + $type=$this->db->get_value( + "select pcm_type from tmp_pcmn where + pcm_val=$1",array($this->id)); + return $type; + } + /*!\brief check if the poste exist in the tmp_pcmn *\return the number of line (normally 1 or 0) */ @@ -446,6 +458,20 @@ class Acc_Account_Ledger $rep=""; + $type =$this->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")." ".''; + } + echo ''.$label.''; if ( $from_div == 1) echo "