'; echo ShowItem($menu,'H','mtitle','mtitle',$def); echo ''; $href=basename($_SERVER['PHP_SELF']); $Ledger=new Acc_Ledger_Fin($cn,0); //-------------------------------------------------------------------------------- // Encode a new financial operation //-------------------------------------------------------------------------------- if ( $def == 1 ) { $href=basename($_SERVER['PHP_SELF']); if ( isset($_REQUEST['p_jrn'])) $Ledger->id=$_REQUEST['p_jrn']; else { $def_ledger=$Ledger->get_first('fin'); $Ledger->id=$def_ledger['jrn_def_id']; } $jrn_priv=$User->check_action($Ledger->id); // Check privilege if ( isset($_REQUEST['p_jrn']) && ( $jrn_priv == 'X')) { NoAccess(); exit -1; } //---------------------------------------- // Confirm the operations //---------------------------------------- if ( isset($_POST['save'])) { try { $Ledger->verify($_POST); } catch (AcException $e) { echo ''; $correct=1; } if ( ! isset ($correct )) { echo '
'; echo '
'; echo widget::hidden('p_action','bank'); echo $Ledger->confirm($_POST); echo widget::submit('confirm','Confirmer'); echo widget::submit('correct','Corriger'); echo '
'; echo '
'; exit(); } } //---------------------------------------- // Confirm and save the operations // into the database //---------------------------------------- if ( isset($_POST['confirm'])) { try { $Ledger->verify($_POST); } catch (AcException $e) { echo ''; $correct=1; } if ( !isset($correct)) { echo '
'; $a= $Ledger->insert($_POST); echo '

Opération sauvée

'; echo widget::button_href('Nouvelle extrait',$href.'?p_action=bank&sa=n&'.dossier::get()); echo $a; echo '
'; exit(); } } //---------------------------------------- // Correct the operations //---------------------------------------- if ( isset($_POST['correct'])) { $correct=1; } //---------------------------------------- // Blank form //---------------------------------------- echo JS_PROTOTYPE; echo '
'; echo '
'; echo widget::hidden('p_action','bank'); echo widget::hidden('sa','n'); $array=( isset($correct))?$_POST:null; // show select ledger echo $Ledger->display_form($array); echo widget::button('add_item','Ajout article', ' onClick="ledger_fin_add_row()"'); echo widget::submit('save','Sauve'); echo widget::reset('Effacer '); echo '
'; echo JS_CALC_LINE; echo '
'; exit(); } //-------------------------------------------------------------------------------- // Show the listing //-------------------------------------------------------------------------------- if ( $def == 2) { echo '
'; if ( isset($_REQUEST['p_jrn'])) $Ledger->id=$_REQUEST['p_jrn']; else { $def_ledger=$Ledger->get_first('fin'); $Ledger->id=$def_ledger['jrn_def_id']; } $jrn_priv=$User->check_action($Ledger->id); // Check privilege if ( isset($_REQUEST['p_jrn']) && $jrn_priv=='X') { NoAccess(); exit -1; } $Ledger->show_ledger(); echo '
'; exit(); } //-------------------------------------------------------------------------------- // Show the saldo //-------------------------------------------------------------------------------- if ( $def==3) { require_once("poste.php"); require_once ('class_acc_parm_code.php'); echo '
'; // find the bank account // NOTE : those values are in a table because // they are _national_ parameters $banque=new Acc_Parm_Code($cn,'BANQUE'); $caisse=new Acc_Parm_Code($cn,'CAISSE'); $vir_interne=new Acc_Parm_Code($cn,'VIREMENT_INTERNE'); $accountSql="select distinct pcm_val::text,pcm_lib from tmp_pcmn where pcm_val::text like '".$banque->p_value."%' or pcm_val::text like '".$vir_interne->p_value."%' or pcm_val::text like '".$caisse->p_value."%' order by pcm_val::text"; $ResAccount=ExecSql($cn,$accountSql); echo '
'; echo ""; // Filter the saldo // on the current year $filter_year=" and j_tech_per in (select p_id from parm_periode where p_exercice='".$User->get_exercice()."')"; // for each account for ( $i = 0; $i < pg_NumRows($ResAccount);$i++) { // get the saldo $l=pg_fetch_array($ResAccount,$i); $m=get_solde($cn,$l['pcm_val'],$filter_year); // print the result if the saldo is not equal to 0 if ( $m != 0.0 ) { echo ""; echo "". ""."".""; } }// for echo "
". $l['pcm_val']. "". $l['pcm_lib']. "". $m. "
"; echo "
"; exit(); }