',urldecode($_REQUEST['url'])); $h_url=sprintf('',urldecode($_REQUEST['url'])); } $sub_action=(isset($_REQUEST['sa']))?$_REQUEST['sa']:""; //////////////////////////////////////////////////////////////////////////////// // If a list of depense is asked // if ( $sub_action == "list") { // show the menu with the list item selected echo '
'; echo ShowMenuJrnUser($_SESSION['g_dossier'],'FIN',0,'Liste'); echo '
'; echo '
'; $hid=new widget("hidden"); $hid->name="p_action"; $hid->value="bank"; echo $hid->IOValue(); $hid->name="sa"; $hid->value="list"; echo $hid->IOValue(); $w=new widget("select"); $periode_start=make_array($cn,"select p_id,to_char(p_start,'DD-MM-YYYY') from parm_periode order by p_id"); // User is already set User=new cl_user($cn); $current=(isset($_GET['p_periode']))?$_GET['p_periode']:$User->GetPeriode(); $w->selected=$current; echo 'Période '.$w->IOValue("p_periode",$periode_start).$w->Submit('gl_submit','Valider'); $qcode=(isset($_GET['qcode']))?$_GET['qcode']:""; printf ('Tiers QuickCode: ', $qcode); echo $retour; // Show list of sell // Date - date of payment - Customer - amount $sql=SQL_LIST_ALL_INVOICE." and jr_tech_per=".$current." and jr_def_type='FIN'" ; $step=$_SESSION['g_pagesize']; $page=(isset($_GET['offset']))?$_GET['page']:1; $offset=(isset($_GET['offset']))?$_GET['offset']:0; $l=""; // check if qcode contains something if ( $qcode != "" ) { // add a condition to filter on the quick code $l=" and jr_grpt_id in (select j_grpt from jrnx where j_qcode='$qcode') "; } list($max_line,$list)=ListJrn($cn,0,"where jrn_def_type='FIN' and jr_tech_per=$current $l " ,null,$offset,0); $bar=jrn_navigation_bar($offset,$max_line,$step,$page); echo "
$bar"; echo $list; echo "$bar
"; echo $retour; echo '
'; exit(); } //////////////////////////////////////////////////////////////////////////////// echo '
'; echo ShowMenuJrnUser($_SESSION['g_dossier'],'FIN',$p_jrn,'Liste'); echo '
'; //////////////////////////////////////////////////////////////////////////////// // if we request to add an item // the $_POST['add_item'] is set // or if we ask to correct the invoice if ( isset ($_POST['add_item']) || isset ($_POST['correct']) ) { $nb_item=$_POST['nb_item']; if ( isset ($_POST['add_item'])) $nb_item++; // Submit button in the form $submit=' '; $form=FormFin($cn,$_GET['p_jrn'],$User->GetPeriode(),$submit,$_POST,false, $nb_item); //$form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,$_POST,false, $nb_number); echo '
'; echo $form; echo '
'; exit(); } //////////////////////////////////////////////////////////////////////////////// // Save : record // if ( isset($_POST['save'])) { // we save the expense $r=RecordFin($cn,$_POST,$User,$p_jrn); $nb_number=$_POST['nb_item']; $submit='

Opération '.$r.' enregistré

'; $form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,$_POST,true,$nb_number,true); echo '
'; echo $form; echo '
'; echo ''; echo ' '; exit(); } //////////////////////////////////////////////////////////////////////////////// // we show the confirmation screen // if ( isset ($_POST['view_invoice']) ) { $nb_number=$_POST["nb_item"]; $submit=''; $submit.=''; if ( form_verify_input ($cn,$p_jrn,$User->GetPeriode(),$_POST,$nb_number) != null ) { // Should use a read only view instead of FormFin // where we can check $form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,$_POST,true, $nb_number,false); } else { // if something goes wrong, correct it $submit=' '; $form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,$_POST,false, $nb_number); } echo '
'; echo $form; echo '
'; exit(); } //////////////////////////////////////////////////////////////////////////////// // By default we add a new invoice if ( $p_jrn != -1 ) { $jrn=new jrn($cn, $p_jrn); echo_debug('depense.inc.php',__LINE__,"Blank form"); // Submit button in the form $submit=' '; // Show an empty form of invoice $form=FormFin($cn,$p_jrn,$User->GetPeriode(),$submit,null,false,$jrn->GetDefLine('deb')); echo '
'; echo $form; echo '
'; }