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

bal_csv.php

Go to the documentation of this file.
00001 <?
00002 /*
00003  *   This file is part of PhpCompta.
00004  *
00005  *   PhpCompta 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  *   PhpCompta 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 PhpCompta; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 /* $Revision: 1.5 $ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00024 header('Content-type: application/csv');
00025 header('Content-Disposition: attachment;filename="balance.csv"',FALSE);
00026 include_once ("ac_common.php");
00027 include_once("class_balance.php");
00028 include_once ("postgres.php");
00029 
00030 include("class_jrn.php");
00031 $cn=DbConnect($_SESSION['g_dossier']);
00032 
00033 
00034 include ('class_user.php');
00035 $User=new cl_user(DbConnect());
00036 $User->Check();
00037 if ( $User->CheckAction($cn,BALANCE) == 0)
00038   {
00039     NoAccess();
00040     exit;
00041   }
00042 $bal=new Balance($cn);
00043   
00044 $t_cent="";
00045   //$per=join(',',$periode);
00046 if ( isset($_POST['central']) ) {
00047     $bal->central='Y';
00048     $t_cent="centralisée";
00049   }
00050   else
00051   $bal->central='N';
00052 
00053   $row=$bal->GetRow($_POST['from_periode'],
00054                   $_POST['to_periode']);
00055    foreach ($row as $r) {
00056  
00057     echo $r['poste'].';'.
00058       $r['label'].';'.
00059       $r['sum_deb'].';'.
00060       $r['sum_cred'].';'.
00061       $r['solde_deb'].';'.
00062       $r['solde_cred'];
00063     printf("\n");
00064   }
00065  
00066 
00067 ?>