get_exercice(); echo '
'; $sql_year=" j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')"; echo '

'._('Vérification des journaux').'

'; $sql=" with jdebit as ( select sum (j_montant) as amount,j_debit , jr_def_id from jrnx join jrn on (j_grpt=jr_grpt_id) where $sql_year and j_debit='t' group by jr_def_id,j_debit ), jcredit as ( select sum (j_montant) as amount,j_debit , jr_def_id from jrnx join jrn on (j_grpt=jr_grpt_id) where $sql_year and j_debit='f' group by jr_def_id,j_debit ) select jrn_def_id, jrn_def_name, jdebit.amount as deb, jcredit.amount as cred from jrn_def join jdebit on (Jdebit.jr_def_id=jrn_def.jrn_def_id) join jcredit on (jcredit.jr_def_id=jrn_def.jrn_def_id) where jcredit.amount<>jdebit.amount order by jrn_def_name "; $res=$cn->exec_sql($sql); $jrn=Database::fetch_all($res); $nb_jrn= count($jrn); if ( $jrn ===false ) { echo $g_succeed." "._("Aucune anomalie dans les montants des journaux"); } echo ''; echo tr(th(_('Journal')).th(_('Débit'),' style="display:right"').th(_("Crédit"),' style="display:right"').th(_("Différence"),' style="display:right"').th('')); $nb_jrn=count($jrn); if ( $jrn === false) $nb_jrn=0; $ix=0; for ($i=0;$i<$nb_jrn;$i++) { $l=$jrn[$i]; $id=$l['jrn_def_id']; $name=$l['jrn_def_name']; $deb=$l['deb']; $cred=$l['cred']; $result = $g_failed; $class=($ix%2==0)?'odd':"even"; print tr(td($name).td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(nbm($result),'class="num"').td($result),"class=\"$class\""); $ix++; } $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' and $sql_year "); $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' and $sql_year "); if ( $cred == $deb ) { $result =$g_succeed; } else { $result = $g_failed; } $class=($ix%2==0)?'odd':"even"; print tr(td(_('Grand livre')).td(nbm($deb),' class="num"').td(nbm($cred),' class="num"').td(nbm($result),' class="num"') .td($result),"class=\"$class\""); echo '
'; echo '
'; echo '
'; echo '

'._('Vérification des comptes').'

'; $bilan=new Acc_Bilan($cn); $periode=new Periode($cn); list ($start_periode,$end_periode)=$periode->get_limit($exercice); $bilan->from=$start_periode->p_id; $bilan->to=$end_periode->p_id; $bilan->verify(); echo '
'; ?>

';?>

get_exercice()."')"; $sql_fiche_id=" select count(*),f_id from ( select distinct f_id,j_poste from jrnx where $sql_year_target ) as m group by f_id having count(*) > 1 "; $a_fiche_id=$cn->get_array($sql_fiche_id); $sql_poste="select distinct j_poste,pcm_lib from jrnx join tmp_pcmn on (pcm_val=j_poste) where f_id =$1 and $sql_year"; $sql_qcode="select ad_value as qcode from fiche_detail where f_id=$1 and ad_id=".ATTR_DEF_QUICKCODE; $res=$cn->prepare('get_poste',$sql_poste); $resQcode=$cn->prepare('get_qcode',$sql_qcode); if ( $res == false || $resQcode == false ) { echo "ERREUR ".__FILE__.":".__LINE__."prepare failed"; } echo _("Résultat"); if (count($a_fiche_id) == 0) { echo " OK $g_succeed";} else { echo " "._('Attention ').$g_failed;} ?>
    execute('get_poste',array($a_fiche_id[$i]['f_id'])); $tmp_qcode=$cn->execute('get_qcode',array($a_fiche_id[$i]['f_id'])); $qcode=Database::fetch_all($tmp_qcode); if ( $qcode[0]['qcode']=="") { continue; } ?>

get_array($sql_account_used); $nb_account_used=count ($a_account_used); if ( $nb_account_used == 0 ) { echo _('Résultat')." ".$g_succeed; } $ret=$cn->prepare('get_operation',$sql_concerned_operation); ?>

execute('get_operation',array($a_account_used[$i]['f_id'])); $a_operation=Database::fetch_all($ret_operation); $nb_operation=count($a_operation); ?>