noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
verif_bilan.inc.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief Verify the saldo of ledger: independant file
00024  */
00025 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00026 require_once ('class_user.php');
00027 require_once('class_acc_bilan.php');
00028 
00029 $cn=new Database(dossier::id());
00030 $exercice=$g_user->get_exercice();
00031 echo '<div class="content">';
00032 
00033 $sql_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$g_user->get_exercice()."')";
00034 echo '<fieldset><legend>Vérification des journaux</legend>';
00035 echo '<ol>';
00036 $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' $sql_year ");
00037 $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' $sql_year ");
00038 
00039 if ( $cred == $deb )
00040 {
00041     $result ='<span style="color:green;font-size:1.2em;font-weight:bold;"> OK </span>';
00042 }
00043 else
00044 {
00045     $result ='<span style="color:red;font-size:1.2em;font-weight:bold;"> NON OK </span>';
00046 }
00047 
00048 printf ('<li> Solde Grand Livre : debit %f credit %f %s</li>',$deb,$cred,$result);
00049 
00050 $sql="select jrn_def_id,jrn_def_name from jrn_def";
00051 $res=$cn->exec_sql($sql);
00052 $jrn=Database::fetch_all($res);
00053 foreach ($jrn as $l)
00054 {
00055     $id=$l['jrn_def_id'];
00056     $name=$l['jrn_def_name'];
00057     $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' and j_jrn_def=$id $sql_year ");
00058     $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' and j_jrn_def=$id  $sql_year ");
00059 
00060     if ( $cred == $deb )
00061     {
00062         $result ='<span style="color:green;font-size:1.2em;font-weight:bold;"> OK </span>';
00063     }
00064     else
00065     {
00066         $result ='<span style="color:red;font-size:1.2em;font-weight:bold;"> NON OK </span>';
00067     }
00068 
00069     printf ('<li> Journal %s Solde   : debit %f credit %f %s</li>',$name,$deb,$cred,$result);
00070 
00071 }
00072 echo '</ol>';
00073 echo '<ol>';
00074 $sql_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$exercice."')";
00075 
00076 $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' $sql_year ");
00077 $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' $sql_year ");
00078 
00079 if ( $cred == $deb )
00080 {
00081     $result ='<span style="color:green;font-size:1.2em;font-weight:bold;"> OK </span>';
00082 }
00083 else
00084 {
00085     $result ='<span style="color:red;font-size:1.2em;font-weight:bold;"> NON OK </span>';
00086 }
00087 
00088 printf ('<li> Total solde Grand Livre : debit %f credit %f %s</li>',$deb,$cred,$result);
00089 $sql="select jrn_def_id,jrn_def_name from jrn_def";
00090 $res=$cn->exec_sql($sql);
00091 $jrn=Database::fetch_all($res);
00092 foreach ($jrn as $l)
00093 {
00094     $id=$l['jrn_def_id'];
00095     $name=$l['jrn_def_name'];
00096     $deb=$cn->get_value("select sum (j_montant) from jrnx where j_debit='t' and j_jrn_def=$id $sql_year ");
00097     $cred=$cn->get_value("select sum (j_montant) from jrnx where j_debit='f' and j_jrn_def=$id  $sql_year ");
00098 
00099     if ( $cred == $deb )
00100     {
00101         $result ='<span style="color:green;font-size:1.2em;font-weight:bold;"> OK </span>';
00102     }
00103     else
00104     {
00105         $result ='<span style="color:red;font-size:1.2em;font-weight:bold;"> NON OK </span>';
00106     }
00107 
00108     printf ('<li> Journal %s total : debit %f credit %f %s</li>',$name,$deb,$cred,$result);
00109 
00110 }
00111 echo '</fieldset>';
00112 echo '<fieldset><legend>Vérification des comptes</legend>';
00113 $bilan=new Acc_Bilan($cn);
00114 $periode=new Periode($cn);
00115 list ($start_periode,$end_periode)=$periode->get_limit($exercice);
00116 $bilan->from=$start_periode->p_id;
00117 $bilan->to=$end_periode->p_id;
00118 $bilan->verify();
00119 echo '</fieldset>';
00120 echo '</div>';
00121 
00122 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations