noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
compta_fin_saldo.inc.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**\file
00024  *
00025  *
00026  * \brief show bank saldo
00027  *
00028  */
00029 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00030 require_once ('class_acc_parm_code.php');
00031     echo '<div class="content">';
00032     $fiche=new Fiche($cn);
00033 
00034     $array=$fiche->get_bk_account();
00035 
00036     echo '<div class="content">';
00037     echo dossier::hidden();
00038     echo _('Filtre :').HtmlInput::filter_table("fin_saldo_tb", '0,1,2,3', '1');
00039     echo '<table class="sortable"  style="margin-left:10%;width:60%" class="result" id="fin_saldo_tb">';
00040     echo tr(th('Quick Code',' class=" sorttable_sorted_reverse"',HtmlInput::infobulle(17).'<span id="sorttable_sortrevind">&nbsp;&blacktriangle;</span>')
00041             .th('Compte en banque',' style="text-align:left"')
00042             .th('Journal',' style="text-align:center"')
00043             .th('Description',' style="text-align:center"')
00044             .th('solde opération',' style="text-align:right" class="sorttable_numeric"')
00045             .th('solde extrait/relevé',' style="text-align:right" class="sorttable_numeric"')
00046             .th('différence',' style="text-align:right" class="sorttable_numeric"')
00047             );
00048     // Filter the saldo
00049     //  on the current year
00050     $filter_year="  j_tech_per in (select p_id from parm_periode where  p_exercice='".$g_user->get_exercice()."')";
00051     // for highligting tje line
00052     $idx=0;
00053     bcscale(2);
00054     $tot_extrait=0;$tot_diff=0;$tot_operation=0;
00055     // for each account
00056     for ( $i = 0; $i < count($array);$i++)
00057     {
00058                 if ( $array[$i]->id==0) {
00059                         echo '<tr >';
00060                         echo td(h2("Journal mal configuré",' class="error" '),' colspan="5" style="width:auto" ');
00061                         echo '</tr>';
00062                         continue;
00063                 }
00064         // get the saldo
00065         $m=$array[$i]->get_solde_detail($filter_year);
00066 
00067         $solde=$m['debit']-$m['credit'];
00068 
00069         // print the result if the saldo is not equal to 0
00070         if ( $m['debit'] != 0.0 || $m['credit'] != 0.0)
00071         {
00072             /*  get saldo for not reconcilied operations  */
00073             $saldo_not_reconcilied=$array[$i]->get_bk_balance($filter_year." and (trim(jr_pj_number) ='' or jr_pj_number is null)" );
00074 
00075             /*  get saldo for reconcilied operation  */
00076 
00077             $saldo_reconcilied=$array[$i]->get_bk_balance($filter_year." and ( trim(jr_pj_number) != '' and jr_pj_number is not null)" );
00078 
00079             if ( $idx%2 != 0 )
00080                 $odd="odd";
00081             else
00082                 $odd="even";
00083 
00084             $idx++;
00085             echo "<tr class=\"$odd\">";
00086             echo "<TD >".
00087             IButton::history_card($array[$i]->id,$array[$i]->strAttribut(ATTR_DEF_QUICKCODE)).
00088             "</TD>";
00089 
00090             $saldo_rec=bcsub($saldo_reconcilied['debit'],$saldo_reconcilied['credit']);
00091             $diff=bcsub($saldo_not_reconcilied['debit'],$saldo_not_reconcilied['credit']);
00092             echo "<TD >".
00093             $array[$i]->strAttribut(ATTR_DEF_NAME).
00094             "</TD>".
00095              td(h($array[$i]->ledger_name)).
00096              td(h($array[$i]->ledger_description)).
00097             '<TD class="sorttable_numeric" sorttable_customkey="'.$solde.'"  style="text-align:right">'.
00098               nbm($solde).
00099             "</TD>".
00100             '<TD class="sorttable_numeric" sorttable_customkey="'.$saldo_rec.'"  style="text-align:right">'.
00101               nbm($saldo_rec).
00102             "</TD>".
00103             '<TD class="sorttable_numeric" sorttable_customkey="'.$diff.'"  style="text-align:right">'.
00104               nbm($diff).
00105             "</TD>".
00106             "</TR>";
00107             $tot_extrait=bcadd($tot_extrait,$solde);
00108             $tot_operation=bcadd($tot_operation,$saldo_rec);
00109             $tot_diff=bcadd($tot_diff,$diff);
00110         }
00111     }// for
00112     echo '<tfoot>';
00113     echo '<tr>';
00114     echo td('');
00115     echo td('');
00116     echo td('');
00117     echo td(' TOTAUX ','style="font-weight:bold"');
00118     echo td(nbm($tot_extrait),'style="font-weight:bold" class="num"');
00119     echo td(nbm($tot_operation),' style="font-weight:bold" class="num"');
00120     echo td(nbm($tot_diff),' style="font-weight:bold" class="num"');
00121     echo '</tr>';
00122     
00123     echo '</tfoot>';
00124     echo "</table>";
00125     echo "</div>";
00126     exit();
00127 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations