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