';
echo $Ledger->display_search_form();
$p_array=$_GET;
/* by default we should the default period */
if ( ! isset($p_array['date_start']))
{
$period=$User->get_periode();
$per=new Periode($cn,$period);
list($date_start,$date_end)=$per->get_date_limit();
$p_array['date_start']=$date_start;
$p_array['date_end']=$date_end;
}
/* compute the sql stmt */
list($sql,$where)=$Ledger->build_search_sql($p_array);
$max_line=$cn->count_sql($sql);
$step=$_SESSION['g_pagesize'];
$page=(isset($_GET['offset']))?$_GET['page']:1;
$offset=(isset($_GET['offset']))?$_GET['offset']:0;
$bar=jrn_navigation_bar($offset,$max_line,$step,$page);
echo HtmlInput::hidden("sa","lnp");
echo HtmlInput::hidden("p_action","ach");
echo dossier::hidden();
echo $bar;
list($count,$html)= $Ledger->list_operation($sql,$offset);
echo $html;
echo $bar;
echo '
';
exit();
}
//--------------------------------------------------------------------------------
// Show the saldo
//--------------------------------------------------------------------------------
if ( $def==3)
{
require_once ('class_acc_parm_code.php');
echo '';
$fiche=new Fiche($cn);
$array=$fiche->get_bk_account();
echo '
';
echo '
';
echo tr(th('Quick Code').th('Compte en banque').th('solde').th('solde rapproché').th('solde extrait / relevé'));
// Filter the saldo
// on the current year
$filter_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$User->get_exercice()."')";
// for highligting tje line
$idx=0;
// for each account
for ( $i = 0; $i < count($array);$i++)
{
// get the saldo
$m=$array[$i]->get_solde_detail($filter_year);
$solde=$m['debit']-$m['credit'];
// print the result if the saldo is not equal to 0
if ( $m['debit'] != 0.0 || $m['credit'] != 0.0)
{
/* get saldo for not reconcilied operations */
$saldo_not_reconcilied=$array[$i]->get_solde_detail($filter_year." and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) ='' or jr_pj_number is null)" );
/* get saldo for reconcilied operation */
$saldo_reconcilied=$array[$i]->get_solde_detail($filter_year." and j_grpt in (select jr_grpt_id from jrn where trim(jr_pj_number) != '' and jr_pj_number is not null)" );
if ( $idx%2 != 0 )
$odd="odd";
else
$odd="";
$idx++;
echo "";
echo "| ".
IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)).
" | ";
echo "".
$array[$i]->strAttribut(ATTR_DEF_NAME).
" | ".
"".
$solde.
" | ".
"".
sprintf('%.2f',($saldo_reconcilied['debit']-$saldo_reconcilied['credit'])).
" | ".
"".
sprintf('%.2f',($saldo_not_reconcilied['debit']-$saldo_not_reconcilied['credit'])).
" | ".
"
";
}
}// for
echo "
";
echo "
";
exit();
}
//--------------------------------------------------
// Reconcilied
//--------------------------------------------------
if ($def==4)
{
echo '
';
$Ledger=new Acc_Ledger_Fin($cn,0);
if ( !isset($_REQUEST['p_jrn']))
{
$a=$Ledger->get_first('fin');
$Ledger->id=$a['jrn_def_id'];
}
else
$Ledger->id=$_REQUEST['p_jrn'];
$jrn_priv=$User->get_ledger_access($Ledger->id);
if ( isset($_GET["p_jrn"]) && $jrn_priv=="X")
{
NoAccess();
exit();
}
//-------------------------
// save
//-------------------------
if (isset ($_POST['save']))
{
if (trim($_POST['ext']) != '' && isset($_POST['op']))
{
$array=$_POST['op'];
$tot=0;
for ($i=0;$i
exec_sql('update jrn set jr_pj_number=$1 where jr_id=$2',
array($_POST['ext'],$array[$i]));
$tot=bcadd($tot,$cn->get_value('select qf_amount from quant_fin where jr_id=$1',array($array[$i])));
}
$diff=bcsub($_POST['start_extrait'],$_POST['end_extrait']);
if ( $diff != 0 && $diff != $tot )
{
echo_warning("D'après l'extrait il y aurait du avoir un montant de $diff à rapprocher alors qu'il n'y a que $tot rapprochés");
}
}
}
//-------------------------
// show the operation of this ledger
// without receipt number
//-------------------------
echo '';
exit();
}