00001
00002 <?
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00029 include_once ("ac_common.php");
00030 include_once("preference.php");
00031 include_once ("class_widget.php");
00032 include_once("class_balance.php");
00033 if ( $User->CheckAction($cn,BALANCE) == 0)
00034 {
00035 NoAccess();
00036 exit;
00037 }
00038 echo '<div class="u_content">';
00039
00040
00041
00042
00043
00044 if ( isset ($_POST['view'] ) ) {
00045 $submit=new widget();
00046 $hid=new widget("hidden");
00047
00048 echo "<table>";
00049 echo '<TR>';
00050 echo '<TD><form method="POST" ACTION="print_balance.php">'.
00051 $submit->Submit('bt_pdf',"Export PDF").
00052 $hid->IOValue("from_periode",$_POST['from_periode']).
00053 $hid->IOValue("to_periode",$_POST['to_periode']);
00054
00055 echo "</form></TD>";
00056 echo '<TD><form method="POST" ACTION="bal_csv.php">'.
00057 $submit->Submit('bt_csv',"Export CSV").
00058 $hid->IOValue("from_periode",$_POST['from_periode']).
00059 $hid->IOValue("to_periode",$_POST['to_periode']);
00060
00061 echo "</form></TD>";
00062
00063 echo "</TR>";
00064
00065 echo "</table>";
00066 }
00067
00068
00069 echo '<FORM action="user_impress.php?type=bal" method="post">';
00070 $w=new widget("select");
00071 $w->table=1;
00072
00073 $filter_year=" where p_exercice='".$User->getExercice()."'";
00074
00075 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00076 $w->label="Depuis";
00077 if ( isset ($_POST['from_periode']) )
00078 $w->selected=$_POST['from_periode'];
00079
00080 echo $w->IOValue('from_periode',$periode_start);
00081 $w->label=" jusqu'à ";
00082 $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00083 if ( isset ($_POST['to_periode']) )
00084 $w->selected=$_POST['to_periode'];
00085
00086 echo $w->IOValue('to_periode',$periode_end);
00087 $c=new widget("checkbox");
00088 $c->label="centralisé";
00089 echo $c->IOValue('central');
00090
00091
00092
00093 echo '<input type="submit" name="view" value="ok">';
00094
00095
00096
00097
00098
00099 if ( isset($_POST['view'] ) ) {
00100 $bal=new Balance($cn);
00101
00102 $t_cent="";
00103
00104 if ( isset($_POST['central']) ) {
00105 $bal->central='Y';
00106 $t_cent="centralisée";
00107 }
00108 else
00109 $bal->central='N';
00110
00111 $row=$bal->GetRow($_POST['from_periode'],
00112 $_POST['to_periode']);
00113 $a=GetPeriode($cn,$_POST['from_periode']);
00114 $b=GetPeriode($cn,$_POST['to_periode']);
00115 echo "<h2 class=\"info\"> période du ".$a['p_start']." au ".$b['p_end']."</h2>";
00116
00117 echo '<table width="100%">';
00118 $i=0;
00119 foreach ($row as $r) {
00120 $i++;
00121 if ( $i%2 == 0 )
00122 $tr="even";
00123 else
00124 $tr="odd";
00125
00126 echo '<TR class="'.$tr.'">';
00127 echo '<TD>'.$r['poste'].'</TD>';
00128 echo '<TD>'.$r['label'].'</TD>';
00129 echo '<TD>'.$r['sum_deb'].'</TD>';
00130 echo '<TD>'.$r['sum_cred'].'</TD>';
00131 echo '<TD>'.$r['solde_deb'].'</TD>';
00132 echo '<TD>'.$r['solde_cred'].'</TD>';
00133 echo '</TR>';
00134 }
00135 echo '</table>';
00136
00137 }
00138 echo "</div>";
00139 ?>