00001
00002 <?
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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
00040
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
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
00087
00088 echo '<input type="submit" name="view" value="ok">';
00089
00090
00092
00094 if ( isset($_POST['view'] ) ) {
00095 $bal=new Balance($cn);
00096
00097 $t_cent="";
00098
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 }
00133 echo "</div>";
00134 ?>