';
echo '
';
$l=(isset($_REQUEST['letter']))?2:0;
$s=(isset($_REQUEST['solded']))?1:0;
foreach ($a_poste as $poste_id )
{
$Poste=new Acc_Account_Ledger ($cn, $poste_id['pcm_val']);
$Poste->load();
$Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$l,$s);
if ( empty($Poste->row))
{
continue;
}
echo '
'. $poste_id['pcm_val'].' '.h($Poste->label).'
|
';
echo '
Date |
Référence |
Libellé |
Pièce |
Débit |
Crédit |
Solde |
Let. |
';
$solde = 0.0;
$solde_d = 0.0;
$solde_c = 0.0;
bcscale(2);
$i=0;
$current_exercice="";
foreach ($Poste->row as $detail)
{
/*
* separation per exercice
*/
if ( $current_exercice == "") $current_exercice=$detail['p_exercice'];
if ( $current_exercice != $detail['p_exercice']) {
echo '
'.$current_exercice.' |
'.''.' |
'.'Total du compte '.$poste_id['pcm_val'].' |
'.''.' |
'.($solde_d > 0 ? nbm( $solde_d) : '').' |
'.($solde_c > 0 ? nbm( $solde_c) : '').' |
'.nbm( abs($solde_c-$solde_d)).' |
';
if ($solde_c > $solde_d ) echo _("Crédit");
if ($solde_c < $solde_d ) echo _("Débit");
if ($solde_c == $solde_d ) echo "=";
echo ' | '.
'
';
/*
* reset total and current_exercice
*/
$current_exercice=$detail['p_exercice'];
$solde = 0.0;
$solde_d = 0.0;
$solde_c = 0.0;
}
if ($detail['cred_montant'] > 0)
{
$solde=bcsub($solde, $detail['cred_montant']);
$solde_c=bcadd($solde_c,$detail['cred_montant']);
}
if ($detail['deb_montant'] > 0)
{
$solde = bcadd($solde,$detail['deb_montant']);
$solde_d = bcadd($solde_d,$detail['deb_montant']);
}
$side=" ".$Poste->get_amount_side($solde);
$letter="";
$html_let="";
if ($detail['letter']!=-1) {
$letter=strtoupper(base_convert($detail['letter'],10,36));
$html_let = HtmlInput::show_reconcile("", $letter);
}
$i++;
if (($i % 2 ) == 0) $class="odd"; else $class="even";
echo '
'.$detail['j_date_fmt'].' |
'.HtmlInput::detail_op($detail['jr_id'],$detail['jr_internal']).' |
'.$detail['description'].' |
'.$detail['jr_pj_number'].' |
'.($detail['deb_montant'] > 0 ? nbm($detail['deb_montant']) : '').' |
'.($detail['cred_montant'] > 0 ? nbm($detail['cred_montant']) : '').' |
'.nbm(abs($solde)).$side.' |
'.$html_let.' |
';
}
echo '
'.$current_exercice.' |
'.''.' |
'.''.'Total du compte '.$poste_id['pcm_val'].''.' |
'.''.' |
'.''.($solde_d > 0 ? nbm( $solde_d) : '').''.' |
'.''.($solde_c > 0 ? nbm( $solde_c) : '').''.' |
'.''.nbm( abs($solde_c-$solde_d)).''.' |
';
if ($solde_c > $solde_d ) echo "Crédit";
if ($solde_c < $solde_d ) echo "Débit";
if ($solde_c == $solde_d ) echo "=";
echo ' | '.
'
';
}
echo '
';
echo Acc_Account_Ledger::HtmlTableHeader("gl_comptes");
echo "
";
exit;
}
?>