noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
cfgledger.inc.php
Go to the documentation of this file.
00001 <?php
00002 
00003 /*
00004  *   This file is part of NOALYSS.
00005  *
00006  *   NOALYSS is free software; you can redistribute it and/or modify
00007  *   it under the terms of the GNU General Public License as published by
00008  *   the Free Software Foundation; either version 2 of the License, or
00009  *   (at your option) any later version.
00010  *
00011  *   NOALYSS is distributed in the hope that it will be useful,
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  *   GNU General Public License for more details.
00015  *
00016  *   You should have received a copy of the GNU General Public License
00017  *   along with NOALYSS; if not, write to the Free Software
00018  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00019  */
00020 
00021 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00022 
00023 /**
00024  * @file
00025  *
00026  * @brief Create, update and delete ledgers
00027  *
00028  */
00029 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00030 require_once('class_dossier.php');
00031 require_once ("ac_common.php");
00032 require_once('class_database.php');
00033 require_once ("class_user.php");
00034 require_once ("user_menu.php");
00035 require_once 'class_acc_ledger.php';
00036 
00037 $gDossier=dossier::id();
00038 global $cn;
00039 
00040 $ledger=new Acc_Ledger($cn,-1);
00041 $sa=HtmlInput::default_value("sa","",$_REQUEST);
00042 //////////////////////////////////////////////////////////////////////////
00043 // Perform request action : update
00044 //////////////////////////////////////////////////////////////////////////
00045 if (isset($_POST['update']))
00046 {
00047         try
00048         {
00049                 $ledger->id=$_POST['p_jrn'];
00050                 if ( $ledger->load() == -1) throw new Exception (_('Journal inexistant'));
00051                 $ledger->verify_ledger($_POST);
00052                 $ledger->update($_POST);
00053         } catch (Exception $e)
00054         {
00055                 alert($e->getMessage());
00056         }
00057 }
00058 
00059 //////////////////////////////////////////////////////////////////////////
00060 // Perform request action : delete
00061 //////////////////////////////////////////////////////////////////////////
00062 if (isset($_POST['efface']))
00063 {
00064         $ledger->jrn_def_id=$_POST['p_jrn'];
00065         $ledger->id=$_POST['p_jrn'];
00066         $ledger->load();
00067         $name=$ledger->get_name();
00068         try {
00069                 $ledger->delete_ledger();
00070                 $sa="";
00071                 echo '<div id="jrn_name_div">';
00072                 echo '<h2 id="jrn_name">'.h($name). "  est effacé"."</h2>";
00073                 echo '</div>';
00074         }
00075         catch (Exception $e)
00076         {
00077                 alert ($e->getMessage());
00078         }
00079 
00080 }
00081 
00082 //////////////////////////////////////////////////////////////////////////
00083 // Perform request action : add
00084 //////////////////////////////////////////////////////////////////////////
00085 if (isset($_POST['add']))
00086 {
00087         try
00088         {
00089                 $ledger->verify_ledger($_POST);
00090                 $ledger->save_new($_POST);
00091                 $sa="detail";
00092                 $_REQUEST['p_jrn']=$ledger->jrn_def_id;
00093         }
00094         catch (Exception $e)
00095         {
00096                 alert($e->getMessage());
00097         }
00098 }
00099 
00100 //////////////////////////////////////////////////////////////////////////
00101 // Display list of ledgers
00102 //////////////////////////////////////////////////////////////////////////
00103 echo '<div class="lmenu">';
00104 echo $ledger->listing();
00105 echo '</div>';
00106 
00107 
00108 
00109 //////////////////////////////////////////////////////////////////////////
00110 //Display detail of ledger
00111 //////////////////////////////////////////////////////////////////////////
00112 
00113 switch ($sa)
00114 {
00115         case 'detail': /* detail of a ledger */
00116                 try
00117                 {
00118                         $ledger->id=$_REQUEST['p_jrn'];
00119                         echo '<div class="redcontent">';
00120                         echo '<form method="POST">';
00121                         echo $ledger->display_ledger();
00122                         echo '<INPUT TYPE="SUBMIT" class="button" VALUE="'._("Sauve").'" name="update">
00123                         <INPUT TYPE="RESET" class="button" VALUE="Reset">
00124                         <INPUT TYPE="submit" class="button"  name="efface" value="'._("Efface").'" onClick="return confirm(\'Vous effacez ce journal ?\')">';
00125                         echo '</FORM>';
00126                         echo "</div>";
00127                 }
00128                 catch (Exception $e)
00129                 {
00130                         alert($e->getMessage());
00131                 }
00132                 break;
00133         case 'add': /* Add a new ledger */
00134                 echo '<div class="redcontent">';
00135                 echo '<FORM METHOD="POST">';
00136                 $ledger->input_new();
00137                 echo HtmlInput::submit('add','Sauver');
00138                 echo '<INPUT TYPE="RESET" class="button" VALUE="Reset">';
00139                 echo '</FORM>';
00140                 echo "</DIV>";
00141 }
00142 
00143 
00144 
00145 
00146 
00147 html_page_stop();
00148 
00149 
00150 
00151 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations