Main Page | Namespace List | Class Hierarchy | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

print_balance.php

Go to the documentation of this file.
00001 <?
00002 
00003 /*
00004  *   This file is part of PhpCompta.
00005  *
00006  *   PhpCompta 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  *   PhpCompta 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 PhpCompta; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00032 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00033 // $Revision: 1.10 $
00034  
00035 include_once("ac_common.php");
00036 include_once("postgres.php");
00037 include_once("class.ezpdf.php");
00038 include_once("poste.php");
00039 include_once("class_balance.php");
00040 include_once("preference.php");
00041 
00042 $cn=DbConnect($_SESSION['g_dossier']);
00043 $rep=DbConnect();
00044 include ('class_user.php');
00045 $User=new cl_user($rep);
00046 $User->Check();
00047 
00048 $bal=new Balance($cn);
00049 if ( $User->CheckAction($cn,BALANCE) == 0)
00050   {
00051     NoAccess();
00052     exit;
00053   }
00054 echo_debug('print_balance.php',__LINE__,"imp pdf journaux");
00055 foreach ($HTTP_POST_VARS as $key=>$element) {
00056   ${"$key"}=$element;
00057   echo_debug('print_balance.php',__LINE__,"key => $key element $element");
00058 }
00059 // if centralized
00060 $t_cent="";
00061 
00062 if ( isset($central) ) {
00063     $bal->central='Y';
00064     $t_cent="centralisée";
00065  }
00066  else 
00067   $bal->central='N';
00068 
00069 $array=$bal->GetRow($from_periode,$to_periode);
00070 
00071 if ( sizeof($array)  == 0 ) {
00072   $pdf=& new Cezpdf('a4');
00073   $pdf->selectFont('./addon/fonts/Helvetica.afm');
00074   $pdf->ezSetCmMargins(2,2,2,2);
00075   $pdf->ezText("Balance compte -- vide");
00076   $pdf->ezStream();
00077   exit();
00078   
00079  }
00080 $a=GetPeriode($cn,$from_periode);
00081 $b=GetPeriode($cn,$to_periode);
00082 $per_text=" période du ".$a['p_start']." au ".$b['p_end'];
00083 $pdf=& new Cezpdf('a4');
00084 $pdf->selectFont('./addon/fonts/Helvetica.afm');
00085 $pdf->ezSetCmMargins(2,2,2,2);
00086 $pdf->ezTable($array,array('poste'=>'Poste','label'=>'Libellé','sum_deb'=>'Total Débit',
00087                            'sum_cred'=>'Total crédit','solde_deb'=>'Solde débiteur',
00088                            'solde_cred'=>'Solde créditeur'),'Balance des comptes '.$t_cent.$per_text);
00089 $pdf->ezStream();
00090 
00091 
00092 ?>