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

impress_poste.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$ */
00020 // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr
00021 include_once("class_widget.php");
00026 
00027 // If print is asked
00028 // First time in html
00029 // after in pdf or cvs
00031 if ( isset( $_POST['bt_html'] ) ) {
00032 include("class_poste.php");
00033   $Poste=new poste($cn,$_POST['poste_id']);
00034   $Poste->GetName();
00035   list($array,$tot_deb,$tot_cred)=$Poste->GetRow( $_POST['from_periode'],
00036                                                   $_POST['to_periode']
00037                                                   );
00038 
00039   $rep="";
00040   $submit=new widget();
00041   $hid=new widget("hidden");
00042   echo '<div class="u_content">';
00043   echo '<h2 class="info">'.$Poste->id." ".$Poste->name.'</h2>';
00044   echo "<table >";
00045   echo '<TR>';
00046   echo '<TD><form method="GET" ACTION="user_impress.php">'.
00047     $submit->Submit('bt_other',"Autre poste").
00048     $hid->IOValue("type","poste")."</form></TD>";
00049 
00050   echo '<TD><form method="POST" ACTION="poste_pdf.php">'.
00051     $submit->Submit('bt_pdf',"Export PDF").
00052     $hid->IOValue("type","poste").
00053     $hid->IOValue("poste_id",$Poste->id).
00054     $hid->IOValue("from_periode",$_POST['from_periode']).
00055     $hid->IOValue("to_periode",$_POST['to_periode']);
00056 
00057   echo "</form></TD>";
00058   echo '<TD><form method="POST" ACTION="poste_csv.php">'.
00059     $submit->Submit('bt_csv',"Export CSV").
00060     $hid->IOValue("type","poste").
00061     $hid->IOValue("poste_id",$Poste->id).
00062     $hid->IOValue("from_periode",$_POST['from_periode']).
00063     $hid->IOValue("to_periode",$_POST['to_periode']);
00064 
00065   echo "</form></TD>";
00066 
00067   echo "</TR>";
00068 
00069   echo "</table>";
00070   if ( count($Poste->row ) == 0 ) 
00071         exit;
00072 
00073   echo "<TABLE class=\"result\" width=\"100%\">";
00074       echo "<TR>".
00075         "<TH> Code interne </TH>".
00076         "<TH> Date</TH>".
00077         "<TH> Description </TH>".
00078         "<TH> Débit  </TH>".
00079         "<TH> Crédit </TH>".
00080         "</TR>";
00081 
00082   foreach ( $Poste->row as $op ) { 
00083       echo "<TR>".
00084         "<TD>".$op['jr_internal']."</TD>".
00085         "<TD>".$op['j_date']."</TD>".
00086         "<TD>".$op['description']."</TD>".
00087         "<TD>".$op['deb_montant']."</TD>".
00088         "<TD>".$op['cred_montant']."</TD>".
00089         "</TR>";
00090     
00091   }
00092   $solde_type=($tot_deb>$tot_cred)?"solde débiteur":"solde créditeur";
00093   $diff=abs($tot_deb-$tot_cred);
00094   echo "<TR>".
00095     "<TD>$solde_type</TD>".
00096     "<TD>$diff</TD>".
00097     "<TD></TD>".
00098     "<TD>$tot_deb</TD>".
00099     "<TD>$tot_cred</TD>".
00100     "</TR>";
00101 
00102   echo "</table>";
00103   echo "</div>";
00104   exit;
00105 }
00106 
00108 // Show the jrn and date
00110 include_once("postgres.php");
00111 $ret=make_array($cn,"select distinct j_poste::text ,j_poste::text||'  '||pcm_lib
00112                  from jrnx inner join tmp_pcmn on (pcm_val=j_poste)
00113                  order by j_poste::text");
00115 // Form
00117 echo '<div class="u_content">';
00118 echo '<FORM ACTION="?type=poste" METHOD="POST">';
00119 echo '<TABLE><TR>';
00120 $w=new widget("select");
00121 $w->table=1;
00122 $w->label="Choississez le poste";
00123 print $w->IOValue("poste_id",$ret);
00124 print '</TR>';
00125 print '<TR>';
00126 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id");
00127 $w->label="Depuis";
00128 print $w->IOValue('from_periode',$periode_start);
00129 $w->label=" jusqu'à ";
00130 $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode order by p_id");
00131 print $w->IOValue('to_periode',$periode_end);
00132 print "</TR>";
00133 print "<TR><TD>";
00134 $all=new widget("checkbox");
00135 $all->label="Tous les postes";
00136 $all->disabled=true;
00137 echo $all->IOValue("poste_id","");
00138 echo '</TABLE>';
00139 print $w->Submit('bt_html','Impression');
00140 
00141 echo '</FORM>';
00142 echo '</div>';
00143 ?>

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