Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00026
00027 require_once ('class_user.php');
00028 require_once('class_acc_bilan.php');
00029
00030 global $g_captcha,$g_failed,$g_succeed;
00031
00032 $cn=new Database(dossier::id());
00033 $exercice=$g_user->get_exercice();
00034 echo '<div class="content">';
00035
00036 $sql_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
00037 echo '<div class="myfieldset"><h1 class="legend">'._('Vérification des journaux').'</h1>';
00038
00039 $sql="select jrn_def_id,jrn_def_name from jrn_def";
00040 $res=$cn->exec_sql($sql);
00041 $jrn=Database::fetch_all($res);
00042 echo '<table class="result">';
00043 echo tr(th(_('Journal')).th(_('Débit'),' style="display:right"').th(_("Crédit"),' style="display:right"').th(_("Différence"),' style="display:right"').th(''));
00044 $ix=0;
00045 foreach ($jrn as $l)
00046 {
00047 $id=$l['jrn_def_id'];
00048 $name=$l['jrn_def_name'];
00049 $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' and j_jrn_def=$id $sql_year ");
00050 $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' and j_jrn_def=$id $sql_year ");
00051
00052 if ( $cred == $deb )
00053 {
00054 $result =$g_succeed;
00055 }
00056 else
00057 {
00058 $result = $g_failed;
00059 }
00060 $class=($ix%2==0)?'odd':"even";
00061 print tr(td($name).td(nbm($deb),'class="num"').td(nbm($cred),'class="num"').td(nbm($result),'class="num"').td($result),"class=\"$class\"");
00062 $ix++;
00063
00064 }
00065
00066 $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' $sql_year ");
00067 $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' $sql_year ");
00068
00069 if ( $cred == $deb )
00070 {
00071 $result =$g_succeed;
00072 }
00073 else
00074 {
00075 $result = $g_failed;
00076 }
00077 $class=($ix%2==0)?'odd':"even";
00078 print tr(td(_('Grand livre')).td(nbm($deb),' class="num"').td(nbm($cred),' class="num"').td(nbm($result),' class="num"')
00079 .td($result),"class=\"$class\"");
00080
00081 echo '</table>';
00082 echo '</div>';
00083 echo '<hr>';
00084 echo '<div class="myfieldset"><h1 class="legend">'._('Vérification des comptes').'</h1>';
00085 $bilan=new Acc_Bilan($cn);
00086 $periode=new Periode($cn);
00087 list ($start_periode,$end_periode)=$periode->get_limit($exercice);
00088 $bilan->from=$start_periode->p_id;
00089 $bilan->to=$end_periode->p_id;
00090 $bilan->verify();
00091 echo '</div>';
00092 ?>
00093 <hr>
00094 <div class="myfieldset">
00095 <h1 class="legend">
00096 <?php echo _("Vérification des fiches").'</legend>';?>
00097 </h1>
00098 <h2>
00099 <?php echo _('Fiches ayant changé de poste comptable');?>
00100 </h2>
00101 <?php
00102 $sql_year_target=" target.j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
00103 $sql_year_source=" source.j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
00104
00105 $sql_qcode="select distinct source.f_id,source.j_qcode
00106 from jrnx as source ,jrnx as target
00107 where
00108 source.j_id < target.j_id
00109 and source.j_poste<>target.j_poste
00110 and source.j_qcode = target.j_qcode
00111 and $sql_year_source and $sql_year_target
00112 ";
00113 $sql_poste="select distinct j_poste,pcm_lib from jrnx join tmp_pcmn on (pcm_val=j_poste) where j_qcode =$1 $sql_year";
00114 $a_qcode=$cn->get_array($sql_qcode);
00115 $res=$cn->prepare('get_poste',$sql_poste);
00116 echo _("Résultat");
00117 if (count($a_qcode) == 0) { echo " OK $g_succeed";} else { echo " "._('Attention ').$g_failed;}
00118 ?>
00119 <ol>
00120 <?php
00121 for ($i=0;$i<count($a_qcode);$i++):
00122 $poste=$cn->execute('get_poste',array($a_qcode[$i]['j_qcode']));
00123 ?>
00124 <li><?php
00125 echo HtmlInput::card_detail($a_qcode[$i]["j_qcode"],$a_qcode[$i]["j_qcode"],' style="display:inline"') ;
00126 echo " ";
00127 echo HtmlInput::history_card($a_qcode[$i]["f_id"],_("Hist."),' display:inline');
00128
00129 ?>
00130
00131 </li>
00132 <ul>
00133 <?php $all_dep=Database::fetch_all($poste);
00134 for ($e=0;$e<count($all_dep);$e++):
00135 ?>
00136 <li>
00137 <?php echo HtmlInput::history_account($all_dep[$e]['j_poste'],$all_dep[$e]['j_poste'],' display:inline ')?>
00138 <?php echo h($all_dep[$e]['pcm_lib'])?>
00139 </li>
00140 <?php
00141 endfor;
00142 ?>
00143 </ul>
00144 <?php
00145 endfor;
00146 ?>
00147 </ol>
00148
00149 <h2><?php echo _('Poste comptable utilisé sans la fiche correspondante') ?></h2>
00150 <p class="notice">
00151 <?php echo _('Cela pourrait causer des différences entre les balances par fiches et celle par postes comptables, utilisez le plugin
00152 "OUTIL COMPTABLE" pour corriger');
00153 ?>
00154 </p>
00155
00156 <?php
00157 $sql_account_used="
00158 select distinct vw.f_id,j_poste ,vw_name,quick_code
00159 from vw_poste_qcode as vw
00160 join jrnx using (j_poste)
00161 join vw_fiche_attr as v_attr on (vw.f_id=v_attr.f_id)
00162 join jrn on (jrnx.j_grpt=jrn.jr_grpt_id)
00163 where
00164 jrnx.f_id is null $sql_year order by 1
00165 ";
00166
00167 $sql_concerned_operation="select vw.f_id,jrnx.j_date,jrnx.j_id,jrn.jr_id,jrnx.j_poste,jr_internal ,jr_comment
00168 from vw_poste_qcode as vw
00169 join jrnx using (j_poste)
00170 join jrn on (jrnx.j_grpt=jrn.jr_grpt_id)
00171 where
00172 jrnx.f_id is null and vw.f_id= $1 $sql_year";
00173 $a_account_used=$cn->get_array($sql_account_used);
00174 $nb_account_used=count ($a_account_used);
00175 if ( $nb_account_used == 0 )
00176 {
00177 echo _('Résultat')." ".$g_succeed;
00178 }
00179 $ret=$cn->prepare('get_operation',$sql_concerned_operation);
00180
00181 ?>
00182
00183 <?php for ($i=0;$i<$nb_account_used;$i++): ?>
00184 <h3>
00185 <?php
00186 echo _('Poste comptable ').$a_account_used[$i]['j_poste']._(' pour la fiche ').$a_account_used[$i]['quick_code']." ".$a_account_used[$i]['vw_name'];
00187 ?>
00188 </h3>
00189 <?php
00190 $ret_operation=$cn->execute('get_operation',array($a_account_used[$i]['f_id']));
00191 $a_operation=Database::fetch_all($ret_operation);
00192 $nb_operation=count($a_operation);
00193 ?>
00194 <table class="result">
00195 <?php for ($x=0;$x<$nb_operation;$x++):?>
00196 <tr>
00197 <td>
00198 <?php echo $a_operation[$x]['j_date']; ?>
00199 </td>
00200 <td>
00201 <?php echo h($a_operation[$x]['jr_comment']); ?>
00202 </td>
00203 <td>
00204 <?php echo HtmlInput::detail_op($a_operation[$x]['jr_id'],$a_operation[$x]['jr_internal']); ?>
00205 </td>
00206 <td>
00207
00208 </td>
00209 </tr>
00210 <?php endfor;?>
00211 </table>
00212 <?php endfor;?>
00213 </div>