request("sa","string",""); ////////////////////////////////////////////////////////////////////////// // Perform request action : update ////////////////////////////////////////////////////////////////////////// $action_frm = $http->post("action_frm","string",""); if ( $action_frm == 'update') { try { $ledger->id=$http->post('p_jrn',"number"); if ( $ledger->load() == -1) throw new Exception (_('Journal inexistant')); $ledger->verify_ledger($_POST); $ledger->update($_POST); $show_menu=1; } catch (Exception $e) { record_log($e->getTraceAsString()); alert($e->getMessage()); } } ////////////////////////////////////////////////////////////////////////// // Perform request action : delete ////////////////////////////////////////////////////////////////////////// if ($action_frm == 'delete' ) { $ledger->id=$http->post('p_jrn',"number");; $ledger->load(); $name=$ledger->get_name(); try { $ledger->delete_ledger(); $sa=""; echo '
'; echo '

'; printf(_(" %s est effacé"),h($name)); echo "

"; echo '
'; $show_menu=1; } catch (Exception $e) { record_log($e->getTraceAsString()); alert ($e->getMessage()); } } ////////////////////////////////////////////////////////////////////////// // Perform request action : add ////////////////////////////////////////////////////////////////////////// if (isset($_POST['add'])) { try { $ledger->verify_ledger($_POST); $ledger->save_new($_POST); $sa="detail"; $a[]=["key"=>'p_jrn',"value"=>$ledger->id]; put_global($a); $show_menu=1; } catch (Exception $e) { record_log($e->getTraceAsString()); alert($e->getMessage()); } } ////////////////////////////////////////////////////////////////////////// //Display detail of ledger ////////////////////////////////////////////////////////////////////////// switch ($sa) { case 'detail': /* detail of a ledger */ try { $ledger->id=$http->request('p_jrn',"number"); echo '
'; echo '
'; echo $ledger->display_ledger(); echo HtmlInput::hidden('action_frm',''); echo ' '; $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier'])); echo ''._('Retour').''; echo '
'; echo "
"; $show_menu=0; } catch (Exception $e) { record_log($e->getTraceAsString()); alert($e->getMessage()); } break; case 'add': /* Add a new ledger */ echo '
'; echo '
'; $ledger->input_new(); echo HtmlInput::submit('add',_('Sauver')); echo ''; echo '
'; echo "
"; $show_menu=0; } ////////////////////////////////////////////////////////////////////////// // Display list of ledgers ////////////////////////////////////////////////////////////////////////// if ( $show_menu == 1 ) { echo HtmlInput::anchor_action(_("Tout"), 'show_all_row(\'cfgledger_table_id\')','ledger_all_bt','smallbutton '); echo HtmlInput::anchor_action(_("Financier"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'FIN\')','ledger_fin_bt','smallbutton '); echo HtmlInput::anchor_action(_("Achat"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ACH\')','ledger_ach_bt','smallbutton '); echo HtmlInput::anchor_action(_("Opérations Diverses"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'ODS\')','ledger_ods_bt','smallbutton '); echo HtmlInput::anchor_action(_("Vente"), 'show_only_row(\'cfgledger_table_id\',\'ledger_type\',\'VEN\')','ledger_ven_bt','smallbutton '); echo '
'; echo $ledger->listing(); echo '
'; } html_page_stop(); ?>