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 $show_menu=1;
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                 $show_menu=1;
00054         } catch (Exception $e)
00055         {
00056                 alert($e->getMessage());
00057         }
00058 }
00059 
00060 //////////////////////////////////////////////////////////////////////////
00061 // Perform request action : delete
00062 //////////////////////////////////////////////////////////////////////////
00063 if (isset($_POST['efface']))
00064 {
00065         $ledger->jrn_def_id=$_POST['p_jrn'];
00066         $ledger->id=$_POST['p_jrn'];
00067         $ledger->load();
00068         $name=$ledger->get_name();
00069         try {
00070                 $ledger->delete_ledger();
00071                 $sa="";
00072                 echo '<div id="jrn_name_div">';
00073                 echo '<h2 id="jrn_name">'.h($name). "  est effacé"."</h2>";
00074                 echo '</div>';
00075                 $show_menu=1;
00076         }
00077         catch (Exception $e)
00078         {
00079                 alert ($e->getMessage());
00080         }
00081 
00082 }
00083 
00084 //////////////////////////////////////////////////////////////////////////
00085 // Perform request action : add
00086 //////////////////////////////////////////////////////////////////////////
00087 if (isset($_POST['add']))
00088 {
00089         try
00090         {
00091                 $ledger->verify_ledger($_POST);
00092                 $ledger->save_new($_POST);
00093                 $sa="detail";
00094                 $_REQUEST['p_jrn']=$ledger->jrn_def_id;
00095                 $show_menu=1;
00096         }
00097         catch (Exception $e)
00098         {
00099                 alert($e->getMessage());
00100         }
00101 }
00102 
00103 
00104 
00105 
00106 
00107 //////////////////////////////////////////////////////////////////////////
00108 //Display detail of ledger
00109 //////////////////////////////////////////////////////////////////////////
00110 
00111 switch ($sa)
00112 {
00113         case 'detail': /* detail of a ledger */
00114                 try
00115                 {
00116                         $ledger->id=$_REQUEST['p_jrn'];
00117                         echo '<div class="content">';
00118                         echo '<form method="POST">';
00119                         echo $ledger->display_ledger();
00120                         echo '<INPUT TYPE="SUBMIT" class="smallbutton" VALUE="'._("Sauve").'" name="update">
00121                         <INPUT TYPE="RESET" class="smallbutton" VALUE="Reset">
00122                         <INPUT TYPE="submit" class="smallbutton"  name="efface" value="'._("Efface").'" onClick="return confirm(\'Vous effacez ce journal ?\')">';
00123                         $href=http_build_query(array('ac'=>$_REQUEST['ac'],'gDossier'=>$_REQUEST['gDossier']));
00124                         echo '<a style="display:inline" class="smallbutton" href="do.php?'.$href.'">'._('Retour').'</a>';
00125                         echo '</FORM>';
00126                         echo "</div>";
00127                         $show_menu=0;
00128                 }
00129                 catch (Exception $e)
00130                 {
00131                         alert($e->getMessage());
00132                 }
00133                 break;
00134         case 'add': /* Add a new ledger */
00135                 echo '<div class="content">';
00136                 echo '<FORM METHOD="POST">';
00137                 $ledger->input_new();
00138                 echo HtmlInput::submit('add',_('Sauver'));
00139                 echo '<INPUT TYPE="RESET" class="smallbutton" VALUE="Reset">';
00140                 echo '</FORM>';
00141                 echo "</DIV>";
00142                 $show_menu=0;
00143 }
00144 
00145 //////////////////////////////////////////////////////////////////////////
00146 // Display list of ledgers
00147 //////////////////////////////////////////////////////////////////////////
00148 if ( $show_menu == 1 ) {
00149     echo '<div class="content">';
00150     echo $ledger->listing();
00151     echo '</div>';
00152 }
00153 
00154 
00155 html_page_stop();
00156 
00157 
00158 
00159 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations