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

poste_pdf.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 */
00020 
00021 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00022 // $Revision: 1.4 $
00026 include_once("class_poste.php");
00027 include_once("ac_common.php");
00028 include_once("postgres.php");
00029 include_once("class.ezpdf.php");
00030 include_once("impress_inc.php");
00031 include("poste.php");
00032 
00033     $cn=DbConnect($_SESSION['g_dossier']);
00034 foreach ($HTTP_POST_VARS as $key=>$element) {
00035   ${"$key"}=$element;
00036 }
00037 // if ( isset ( $all_poste) ){ //choisit de voir tous les postes
00038 //   $r_poste=ExecSql($cn,"select pcm_val from tmp_pcmn where pcm_val = any ".
00039 //                 " (select j_poste from jrnx) order by pcm_val::text");
00040 //   $nPoste=pg_numRows($r_poste);
00041 //   for ( $i=0;$i<$nPoste;$i++) {
00042 //     $t_poste=pg_fetch_array($r_poste,$i);
00043 //     $poste[]=$t_poste['pcm_val'];
00044 //   } 
00045 // }      
00046 
00047 
00048     $ret="";
00049     $pdf=& new Cezpdf();
00050     $pdf->selectFont('./addon/fonts/Helvetica.afm');
00051 
00052 //$rap_deb=0;$rap_cred=0;
00053 //for ( $i =0;$i<count($poste);$i++) {
00054 $Poste=new poste($cn,$poste_id);
00055 list($array,$tot_deb,$tot_cred)=$Poste->GetRow($from_periode,$to_periode);
00056     // don't print empty account
00057 // if ( count($array) == 0 ) {
00058 //   continue;
00059 //  }
00060 $Libelle=sprintf("(%s) %s ",$Poste->id,$Poste->GetName());
00061     
00062     //  $pdf->ezText($Libelle,30);
00063     $pdf->ezTable($array,
00064                   array ('jr_internal'=>'Opération',
00065                        'j_date' => 'Date',
00066                        'jrn_name'=>'Journal',
00067                          'description'=>'Description',
00068                        'deb_montant'=> 'Montant',
00069                        'cred_montant'=> 'Montant'
00070                        ),$Libelle,
00071                 array('shaded'=>0,'showHeadings'=>1,'width'=>500,
00072                       'cols'=>array('montant'=> array('justification'=>'right'),
00073                                     )));
00074 $str_debit=sprintf("Débit  % 12.2f",$tot_deb);
00075 $str_cred=sprintf("Crédit % 12.2f",$tot_cred);
00076 $diff_solde=$tot_deb-$tot_cred;
00077 if ( $diff_solde < 0 ) {
00078         $solde=" C ";
00079         $diff_solde*=-1;
00080         } else 
00081         {
00082         $solde=" D ";
00083         }
00084 $str_solde=sprintf(" Solde %s %12.2f",$solde,$diff_solde);
00085 
00086  $pdf->ezText($str_debit,10,array('justification'=>'right'));
00087  $pdf->ezText($str_cred,10,array('justification'=>'right'));
00088  $pdf->ezText($str_solde,14,array('justification'=>'right'));
00089 
00090   //New page
00091   //$pdf->ezNewPage();
00092 //}    
00093 
00094 $pdf->ezStream();
00095 
00096 ?>