00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 include_once('postgres.php');
00023 include_once('class_fiche.php');
00024 include_once("class_widget.php");
00025
00026 $cn=DbConnect($_SESSION['g_dossier']);
00027
00028
00029 if ( isset ($_REQUEST['fd_id'])) {
00030
00031 $with_amount= (isset($_REQUEST['with_amount']))?true:false;
00032 if ($with_amount)
00033 include_once("class_poste.php");
00034
00035 echo '<div class="u_content">';
00036 $submit=new widget();
00037 $hid=new widget("hidden");
00038 $fiche_id=new widget("hidden");
00039 $w=new widget("select");
00040 $fiche_def=new fiche_def($cn);
00041
00042 echo '<form method="POST" ACTION="fiche_csv.php">'.
00043 $submit->Submit('bt_csv',"Export CSV").
00044 $hid->IOValue("type","fiche").
00045 $fiche_id->IOValue("fd_id",$_REQUEST['fd_id']);
00046 if ($with_amount) {
00047 echo $hid->IOValue("with_amount");
00048 echo $hid->IOValue("from_periode",$_REQUEST['from_periode']);
00049 echo $hid->IOValue("to_periode",$_REQUEST['to_periode']);
00050 }
00051 echo "</form>";
00052 echo '<form method="Post" action="?type=fiche">'.$submit->Submit("bt_submit","Autres fiches")."</form>";
00053
00054 $fiche_def->id=$_REQUEST['fd_id'];
00055
00056
00057
00058
00059 if ( $fiche_def->HasAttribute(ATTR_DEF_ACCOUNT) == true ) {
00060 echo '<form method="POST" ACTION="user_impress.php">';
00061
00062 $filter_year=" where p_exercice='".$User->getExercice()."'";
00063
00064 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00065
00066 $w->selected=(isset($_POST['from_periode']))?$_POST['from_periode']:"";
00067 print "Depuis ".$w->IOValue('from_periode',$periode_start);
00068 $periode_end=make_array($cn,"select p_id,to_char(p_end,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00069 $w->selected=(isset($_POST['to_periode']))?$_POST['to_periode']:"";
00070 print " Jusque ".$w->IOValue('to_periode',$periode_end);
00071
00072
00073 print $submit->Submit('bt_solde',"Avec solde").
00074 $hid->IOValue("type","fiche").
00075 $fiche_id->IOValue("fd_id",$_REQUEST['fd_id']).
00076 $hid->IOValue("with_amount");
00077
00078 echo "</form>";
00079 }
00080
00081 $fiche=new fiche($cn);
00082 $e=$fiche->GetByType($fiche_def->id);
00083 $l=var_export($e,true);
00084 echo_debug('impress_fiche.php',__LINE__,$l);
00085 $old=-1;
00086 echo "<TABLE class=\"result\">";
00087 echo "<TR>";
00088 $fiche_def->GetAttribut();
00089 foreach ($fiche_def->attribut as $attribut) {
00090 echo "<TH>".$attribut->ad_text."</TH>";
00091
00092
00093 if ($attribut->ad_id==ATTR_DEF_ACCOUNT
00094 && $with_amount==true) {
00095 echo "<TH >Débit</TH>";
00096 echo "<TH >Crédit</TH>";
00097 echo "<TH >Solde</TH>";
00098 }
00099 }
00100
00101 echo "<TR></TR>";
00102 if ( count($e) != 0 ) {
00103 foreach ($e as $detail) {
00104 echo "<TR>";
00105 foreach ( $detail->attribut as $dattribut ) {
00106 echo "<TD>".$dattribut->av_text."</TD>";
00107
00108
00109 if ( $dattribut->ad_id == ATTR_DEF_ACCOUNT &&
00110 $with_amount) {
00111
00112 $account=new poste ($cn,$dattribut->av_text);
00113 $solde= $account->GetSoldeDetail("j_tech_per between ".$_REQUEST['from_periode'].
00114 " and ".
00115 $_REQUEST['to_periode']);
00116 printf ("<td align=\"right\">% 10.2f</td>",$solde['debit']);
00117 printf ("<td align=\"right\">% 10.2f</td>",$solde['credit']);
00118 printf ("<td align=\"right\">% 10.2f</td>",$solde['solde']);
00119
00120 }
00121 }
00122 }
00123 echo "</TR>";
00124 }
00125
00126 echo "</TABLE>";
00127 echo "</div>";
00128 }
00129 else {
00130
00131 $fiche_def=new fiche_def($cn);
00132
00133
00134 $fiche_def->GetAll();
00135
00136 $i=0;
00137 foreach ($fiche_def->all as $l_fiche) {
00138 $a[$i]=array("user_impress.php?type=fiche&fd_id=".$l_fiche->id,$l_fiche->label);
00139 $i++;
00140 }
00141 echo ShowItem($a,'V');
00142 }
00143
00144 ?>