00001 <?
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00025 echo_debug('user_action_ods.php',__LINE__,"include user_action_ods.php");
00026 include_once("user_form_ods.php");
00027 include_once("class_widget.php");
00028
00029 $cn=DbConnect($_SESSION['g_dossier']);
00030
00031 if ( ! isset ($_GET['action']) && ! isset ($_POST["action"]) ) {
00032 exit;
00033
00034 }
00035 include_once ("preference.php");
00036 include_once ("user_common.php");
00037
00038
00039 $action=(isset($_GET['action']))?$_GET['action']:$_POST['action'];
00040
00041
00042 if ( $action == 'new' ) {
00043
00044
00045 if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn']) != 2 ) {
00046 NoAccess();
00047 exit -1;
00048 }
00049
00050
00051 if ( isset($_GET['blank'] )) {
00052
00053 $submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout poste">
00054 <INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Confirmer">';
00055
00056
00057
00058 $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,null,false);
00059 echo '<div class="u_redcontent">';
00060 echo $r;
00061 echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
00062 echo "</div>";
00063
00064
00065 }
00066
00067
00068 if ( isset ($_POST['add_item'])) {
00069
00070 $nb_number=$_POST["nb_item"];
00071 $nb_number++;
00072
00073
00074 $submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
00075 <INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">';
00076
00077 $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS,false, $nb_number);
00078 echo '<div class="u_redcontent">';
00079 echo $r;
00080 echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
00081 echo "</div>";
00082 }
00083
00084 if ( isset ($_POST['correct'])) {
00085
00086 $nb_number=$_POST["nb_item"];
00087
00088
00089 $submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
00090 <INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">';
00091
00092 $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS,false, $nb_number);
00093 echo '<div class="u_redcontent">';
00094 echo $r;
00095 echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
00096 echo "</div>";
00097 }
00098
00099
00100
00101
00102
00103 if ( isset ($_POST['view_invoice']) ) {
00104 $nb_number=$_POST["nb_item"];
00105 $submit='<INPUT TYPE="SUBMIT" name="save" value="Confirmer">';
00106 $submit.='<INPUT TYPE="SUBMIT" name="correct" value="Corriger">';
00107
00108 $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS,true,$nb_number);
00109
00110
00111 if ( $r == null ) {
00112
00113 $submit='<INPUT TYPE="SUBMIT" NAME="add_item" VALUE="Ajout Poste">
00114 <INPUT TYPE="SUBMIT" NAME="view_invoice" VALUE="Sauver">';
00115
00116 $r=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS,false, $nb_number);
00117 }
00118 echo '<div class="u_redcontent">';
00119 echo $r;
00120 echo "<div><h4>On-line calculator</h4>".JS_CALC_LINE."<div>";
00121 echo "</div>";
00122 }
00123
00124 if ( isset($_POST['save'] )) {
00125 $r=RecordODS($cn,$HTTP_POST_VARS,$User,$_GET['p_jrn']);
00126
00127 $nb_number=$_POST["nb_item"];
00128
00129
00130 $submit='<h2 class="info">Recorded</h2>';
00131
00132 $r.=FormODS($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$HTTP_POST_VARS,true, $nb_number,true);
00133 echo '<div class="u_redcontent">';
00134 echo $r;
00135 echo "</div>";
00136
00137 }
00138
00139
00140 }
00141 if ( $action == 'voir_jrn' ) {
00142
00143 if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn']) < 1 ) {
00144 NoAccess();
00145 exit -1;
00146 }
00147
00148
00149 echo_debug ("user_action_ods.php");
00150
00151 ?>
00152 <div class="u_redcontent">
00153
00154 <form method= "get" action="user_jrn.php">
00155
00156 <?
00157 $hid=new widget("hidden");
00158
00159 $hid->name="p_jrn";
00160 $hid->value=$p_jrn;
00161 echo $hid->IOValue();
00162
00163 $hid->name="action";
00164 $hid->value="voir_jrn";
00165 echo $hid->IOValue();
00166
00167
00168 $hid->name="jrn_type";
00169 $hid->value=$jrn_type;
00170 echo $hid->IOValue();
00171
00172
00173
00174 $w=new widget("select");
00175
00176 $filter_year=" where p_exercice='".$User->getExercice()."'";
00177
00178 $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode $filter_year order by p_id");
00179 $User=new cl_user($cn);
00180 $current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode();
00181 $w->selected=$current;
00182
00183 echo 'Période '.$w->IOValue("p_periode",$periode_start).$w->Submit('gl_submit','Valider');
00184 ?>
00185 </form>
00186 <?
00187 $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_id=".$_GET['p_jrn'] ;
00188 $step=$_SESSION['g_pagesize'];
00189 $page=(isset($_GET['offset']))?$_GET['page']:1;
00190 $offset=(isset($_GET['offset']))?$_GET['offset']:0;
00191 list ($max_line,$list)=ListJrn($cn,$_GET['p_jrn'],$sql,null,$offset);
00192 $bar=jrn_navigation_bar($offset,$max_line,$step,$page);
00193 echo $bar;
00194 echo $list;
00195 echo $bar;
00196 echo '</div>';
00197 }
00198
00199
00200 if ( $action == 'search' ) {
00201
00202 if ( CheckJrn($_SESSION['g_dossier'],$_SESSION['g_user'],$_GET['p_jrn']) <1 ) {
00203 NoAccess();
00204 exit -1;
00205 }
00206
00207
00208 $sessid=(isset ($_POST['PHPSESSID']))?$_POST['PHPSESSID']:$_GET['PHPSESSID'];
00209
00210
00211 $search_box=u_ShowMenuRecherche($cn,$_GET['p_jrn'],$sessid,$HTTP_POST_VARS);
00212 echo '<DIV class="u_redcontent">';
00213 echo $search_box;
00214
00215 if ( isset ($_GET['nofirst'] ) ) {
00216 list ($max_line,$a)=ListJrn($cn,$_GET['p_jrn'],"",$HTTP_POST_VARS);
00217 echo $a;
00218 }
00219 echo '</DIV>';
00220 }
00221 include("user_update.php");
00222 ?>