GetName();
if ( $_POST['p_simple']==0 )
{
$Jrn->GetRow( $_POST['from_periode'],
$_POST['to_periode'],
$p_cent);
}
else
{
$Row=$Jrn->GetRowSimple($_POST['from_periode'],
$_POST['to_periode'],
$p_cent);
// var_dump($Row);
}
$rep="";
$submit=new widget();
$hid=new widget("hidden");
echo '
';
echo '
'.$Jrn->name.'
';
echo "
";
echo '';
echo ' | ";
echo ' | ";
echo ' | ";
echo "
";
echo "
";
if ( count($Jrn->row ) == 0
&& $Row==null)
exit;
echo '
';
if ( $_POST['p_simple'] == 0 ) {
// detailled printing
//---
foreach ( $Jrn->row as $op ) {
echo "";
// centralized
if ( $p_cent == 'on') {
echo "| ".$op['j_id']." | ";
}
echo "".$op['internal']." | ".
"".$op['j_date']." | ".
"".$op['poste']." | ".
"".$op['description']." | ".
"".$op['deb_montant']." | ".
"".$op['cred_montant']." | ".
"
";
}// end loop
} // if
else
{
include_once("jrn.php");
// Simple printing
//---
echo "".
"| operation ".
" | Date | ".
" commentaire | ".
"internal | ".
/* "Pièce justificative | ". */
" montant | ".
"
";
foreach ($Row as $line)
{
echo "";
echo "| ".$line['num']." | ";
echo "".$line['date']." | ";
echo "".$line['comment']." | ";
echo "".$line['jr_internal']." | ";
// echo "".$line['pj']." | ";
// If the ledger is financial :
// the credit must be negative and written in red
// Get the jrn type
if ( $line['jrn_def_type'] == 'FIN' ) {
$positive = CountSql($cn,"select * from jrn inner join jrnx on jr_grpt_id=j_grpt ".
" where jr_id=".$line['jr_id']." and (j_poste like '55%' or j_poste like '57%' )".
" and j_debit='f'");
echo "";
echo ( $positive != 0 )?" - ".sprintf("%8.2f",$line['montant'])."":sprintf("%8.2f",$line['montant']);
echo " | ";
}
else
{
echo "".sprintf("% 8.2f",$line['montant'])." | ";
}
echo "
";
}
} //else
echo "
";
// show the saldo
$solde=$Jrn->get_solde( $_POST['from_periode'],
$_POST['to_periode'],
$p_cent);
echo "solde débiteur:".$solde[0]."
";
echo "solde créditeur:".$solde[1];
echo "
";
exit;
}
//-----------------------------------------------------
// Show the jrn and date
//-----------------------------------------------------
include_once("postgres.php");
if ( $User->Admin() ==0) {
$ret=make_array($cn,"select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->id'
and uj_priv !='X'
");
} else {
$ret=make_array($cn,"select jrn_def_id,jrn_def_name
from jrn_def join jrn_type on jrn_def_type=jrn_type_id");
}
// Count the forbidden journaux
$NoPriv=CountSql($cn,"select jrn_def_id,jrn_def_name,jrn_def_class_deb,jrn_def_class_cred,jrn_type_id,jrn_desc,uj_priv,
jrn_deb_max_line,jrn_cred_max_line
from jrn_def join jrn_type on jrn_def_type=jrn_type_id
join user_sec_jrn on uj_jrn_id=jrn_def_id
where
uj_login='$User->id'
and uj_priv ='X'
");
// Pour voir tout les journal ?
if ( $NoPriv == 0 ) {
$a=count($ret);
$all=array('value'=>0,'label'=>'Grand Livre');
$ret[$a]=$all;
}
if ( count($ret) < 1 )
NoAccess();
//-----------------------------------------------------
// Form
//-----------------------------------------------------
echo '