$content) { ${"$name"}=$content; } // Verify the date if ( isDate($e_date) == null ) { echo_error('user_form_fin.php',__LINE__,"Invalid date $e_date"); echo ""; return null; } // Check if the fiche is in the jrn if (IsFicheOfJrn($p_cn , $p_jrn, $e_bank_account,'deb') == 0 ) { $msg="Mauvais compte en banque"; echo_error('user_form_fin.php',__LINE__,$msg); echo ""; return null; } // Check if the card has a valid account if ( CheckPoste($p_cn,$e_bank_account) == null ) return null; // check if all e_march are in fiche for ($i=0;$i<$p_number;$i++) { if ( trim(${"e_other$i"}) == "" ) { // nothing to do continue; } // Check amount if ( isNumber(${"e_other".$i."_amount"}) == 0) { $msg="Montant invalide !!! "; echo_error('user_form_fin.php',__LINE__,$msg); echo ""; return null; } // Check if ( isFicheOfJrn($p_cn,$p_jrn,${"e_other$i"},'cred') == 0 ) { $msg="Fiche inexistante !!! "; echo_error('user_form_fin.php',__LINE__,$msg); echo ""; return null; } // Check if the card has a valid account if ( CheckPoste($p_cn,${"e_other".$i}) == null ) return null; } // Verify the userperiode // p_periode contient la periode par default list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode); // Date dans la periode active echo_debug ('user_form_fin',__LINE__,"date start periode $l_date_start date fin periode $l_date_end date demande $e_date"); if ( cmpDate($e_date,$l_date_start)<0 || cmpDate($e_date,$l_date_end)>0 ) { $msg="Not in the active periode please change your preference"; echo_debug('user_form_fin.php',__LINE__,$msg); echo ""; return null; } // Periode ferm� if ( PeriodeClosed ($p_cn,$p_periode)=='t' ) { $msg="This periode is closed please change your preference"; echo_debug('user_form_fin.php',__LINE__,$msg); echo ""; return null; } return true; } /*! * \brief Display the form for financial * Used to show detail, encode a new fin op * or update one * * \param $p_cn database connection * \param $p_jrn ledger id (jr_id) * \param $p_submit contains the submit string * \param $p_array (default=null) containing the $_POST * \param $p_view_only (default=true) true if we cannot change it (no right or centralized op) * \param $p_item number of article (default=4) * \param $p_save (default false) if the operation is already recorded * * * \return string with the form, in readonly or writable mode */ function FormFin($p_cn,$p_jrn,$p_periode,$p_submit,$p_array=null,$pview_only=true,$p_item=4,$p_save=false) { include_once("poste.php"); if ( $p_array != null ) { // array contains old value foreach ( $p_array as $a=>$v) { ${"$a"}=$v; } } // The date list ($l_date_start,$l_date_end)=GetPeriode($p_cn,$p_periode); $flag=(isset($e_date))?1:0; // $e_date=( ! isset($e_date) ) ? substr($l_date_start,2,8):$e_date; $e_date=( ! isset($e_date) ) ? $l_date_start:$e_date; // Comment $e_comment=(isset($e_comment))?$e_comment:""; $r=""; if ( $pview_only == false) { $r.=JS_SEARCH_CARD; $r.=JS_CONCERNED_OP; } // Compute href // $href=basename($_SERVER['PHP_SELF']); $href=basename($_SERVER['PHP_SELF']); switch ($href) { // user_jrn.php module "Comptable" case 'user_jrn.php': $href="user_jrn.php?action=new&p_jrn=$p_jrn"; break; // commercial.php module "Gestion" case 'commercial.php': $href="commercial.php?p_action=bank&p_jrn=$p_jrn"; break; default: echo_error('user_form_fin.php',__LINE__,'Erreur invalid request uri'); exit (-1); } $r.="
"; // if view_only is true //Put the new saldo here (old saldo - operation) if ( $pview_only==true) { $solde=round($solde,2); $new_solde=round($new_solde,2); // if not recorded the new amount must be recalculate if ( $p_save == false) { $r.=" Ancien Solde = ".$solde."