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

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 */
00020 // Auteur Dany De Bontridder ddebontridder@yahoo.fr
00021 // /* $Revision$ */
00026 include_once ("ac_common.php");
00027 include_once("preference.php");
00028 include_once ("class_widget.php");
00029 include_once("class_balance.php");
00030 if ( $User->CheckAction($cn,BALANCE) == 0)
00031   {
00032     NoAccess();
00033     exit;
00034   }
00035 echo '<div class="u_content">';
00036 
00038 // Form
00040 // Show the export button
00041 if ( isset ($_POST['view']  ) ) {
00042   $submit=new widget();
00043   $hid=new widget("hidden");
00044 
00045   echo "<table>";
00046   echo '<TR>';
00047   echo '<TD><form method="POST" ACTION="print_balance.php">'.
00048     $submit->Submit('bt_pdf',"Export PDF").
00049     $hid->IOValue("from_periode",$_POST['from_periode']).
00050     $hid->IOValue("to_periode",$_POST['to_periode']);
00051 
00052   echo "</form></TD>";
00053   echo '<TD><form method="POST" ACTION="bal_csv.php">'.
00054     $submit->Submit('bt_csv',"Export CSV").
00055     $hid->IOValue("from_periode",$_POST['from_periode']).
00056     $hid->IOValue("to_periode",$_POST['to_periode']);
00057 
00058   echo "</form></TD>";
00059 
00060   echo "</TR>";
00061 
00062   echo "</table>";
00063 }
00064 
00065 // Show the form for period
00066 echo '<FORM action="user_impress.php?type=bal" method="post">';
00067 $w=new widget("select");
00068 $w->table=1;
00069 
00070 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
00071 $w->label="Depuis";
00072 if ( isset ($_POST['from_periode']) )
00073   $w->selected=$_POST['from_periode'];
00074 
00075 echo $w->IOValue('from_periode',$periode_start);
00076 $w->label=" jusqu'à ";
00077 $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode order by p_id");
00078 if ( isset ($_POST['to_periode']) )
00079   $w->selected=$_POST['to_periode'];
00080 
00081 echo $w->IOValue('to_periode',$periode_end);
00082 $c=new widget("checkbox");
00083 $c->label="centralisé";
00084 echo $c->IOValue('central');
00085 
00086 //$a=FormPeriodeMult($cn);
00087 //echo $a;
00088 echo '<input type="submit" name="view" value="ok">';
00089 
00090 
00092 // Display result
00094 if ( isset($_POST['view'] ) ) {
00095   $bal=new Balance($cn);
00096   
00097   $t_cent="";
00098   //$per=join(',',$periode);
00099   if ( isset($_POST['central']) ) {
00100     $bal->central='Y';
00101     $t_cent="centralisée";
00102   }
00103   else
00104   $bal->central='N';
00105 
00106   $row=$bal->GetRow($_POST['from_periode'],
00107                   $_POST['to_periode']);
00108     $a=GetPeriode($cn,$_POST['from_periode']);
00109     $b=GetPeriode($cn,$_POST['to_periode']);
00110     echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
00111 
00112   echo '<table width="100%">';  
00113   $i=0;
00114   foreach ($row as $r) {
00115     $i++;
00116     if ( $i%2 == 0 )
00117       $tr="even";
00118     else
00119       $tr="odd";
00120 
00121     echo '<TR class="'.$tr.'">';
00122     echo '<TD>'.$r['poste'].'</TD>';
00123     echo '<TD>'.$r['label'].'</TD>';
00124     echo '<TD>'.$r['sum_deb'].'</TD>';
00125     echo '<TD>'.$r['sum_cred'].'</TD>';
00126     echo '<TD>'.$r['solde_deb'].'</TD>';
00127     echo '<TD>'.$r['solde_cred'].'</TD>';
00128     echo '</TR>';
00129   }
00130   echo '</table>';
00131 
00132  }// end submit
00133   echo "</div>";
00134 ?>

Generated on Fri Jun 23 00:12:45 2006 for phpcompta by  doxygen 1.4.4