noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
preod.inc.php
Go to the documentation of this file.
00001 <?php
00002 /*
00003  *   This file is part of NOALYSS.
00004  *
00005  *   NOALYSS is free software; you can redistribute it and/or modify
00006  *   it under the terms of the GNU General Public License as published by
00007  *   the Free Software Foundation; either version 2 of the License, or
00008  *   (at your option) any later version.
00009  *
00010  *   NOALYSS is distributed in the hope that it will be useful,
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  *   GNU General Public License for more details.
00014  *
00015  *   You should have received a copy of the GNU General Public License
00016  *   along with NOALYSS; if not, write to the Free Software
00017  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018 */
00019 
00020 // Copyright Author Dany De Bontridder danydb@aevalys.eu
00021 
00022 /*!\file
00023  * \brief included file for managing the predefined operation
00024  */
00025 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00026 require_once("class_iselect.php");
00027 require_once("class_icheckbox.php");
00028 require_once("class_ihidden.php");
00029 require_once('class_database.php');
00030 require_once('ac_common.php');
00031 require_once('class_pre_operation.php');
00032 
00033 /*
00034  * Value from $_GET or $_REQUEST
00035  */
00036 $request_jrn=HtmlInput::default_value_request("jrn", -1);
00037 $request_ac=HtmlInput::default_value_request("ac", "");
00038 $request_sa=HtmlInput::default_value_request("sa", "");
00039 $get_jrn=HtmlInput::default_value_get('jrn',-1);
00040 
00041 echo '<div class="content">';
00042 echo '<form method="GET">';
00043 $sel=new ISelect();
00044 $sel->name="jrn";
00045 $sel->value=$cn->make_array("select jrn_def_id,jrn_def_name from ".
00046                             " jrn_def where jrn_def_type in ('VEN','ACH','ODS') order by jrn_def_name");
00047 // Show a list of ledger
00048 $sel->selected=$request_jrn;
00049 echo 'Choississez un journal '.$sel->input();
00050 
00051 echo dossier::hidden();
00052 $hid=new IHidden();
00053 echo $hid->input("sa","jrn");
00054 echo $hid->input("ac",$request_ac);
00055 echo '<hr>';
00056 echo HtmlInput::submit('Accepter','Accepter');
00057 echo '</form>';
00058 
00059 // if $_REQUEST[sa] == del delete the predefined operation
00060 if ( $request_sa == 'del')
00061 {
00062     $op=new Pre_operation($cn);
00063     $op->od_id=$_REQUEST['od_id'];
00064     $op->delete();
00065     $request_sa='jrn';
00066 }
00067 
00068 // if $_REQUEST[sa] == jrn show the  predefined operation for this
00069 // ledger
00070 if ( $request_sa== 'jrn' )
00071 {
00072     $op=new Pre_operation($cn);
00073     $op->set_jrn($get_jrn);
00074    $is_ods = $cn->get_value("select count(*)
00075                 from jrn_def where
00076                         jrn_def_id=$1
00077                         and jrn_def_type='ODS'", array($get_jrn));
00078         $op->od_direct = ($is_ods > 0) ? 't' : 'f';
00079         $array = $op->get_list_ledger();
00080         if (empty($array) == true)
00081     {
00082         echo _("Aucun enregistrement");
00083         exit();
00084     }
00085 
00086     echo '<table>';
00087     $count=0;
00088     foreach ($array as $row )
00089     {
00090 
00091       if ( $count %2 == 0 )
00092             echo '<tr class="odd">';
00093         else
00094             echo '<tr class="even">';
00095       $count++;
00096 
00097         echo '<td>'.h($row['od_name']).'</td>';
00098         echo '<td>'.h($row['od_description']).'</td>';
00099         echo '<td>';
00100         echo '<form method="POST" class="print" style="margin:0px;padding:0px;">';
00101         echo dossier::hidden();
00102         echo $hid->input("sa","del");
00103         echo $hid->input("ac",$request_ac);
00104         echo $hid->input("del","");
00105         echo $hid->input("od_id",$row['od_id']);
00106         echo $hid->input("jrn",$get_jrn);
00107 
00108         $b='<input type="submit" class="smallbutton" value="'._("Effacer").'"'.
00109           ' onClick="return confirm(\''._("Voulez-vous vraiment effacer cette operation ?").'\');" >';
00110            echo $b;
00111            echo '</form>';
00112 
00113         echo '</td>';
00114         $b=HtmlInput::button('mod'.$row['od_id'],"Modifier","onclick=\"mod_predf_op('".dossier::id()."','".$row['od_id']."');\"");
00115         echo td($b);
00116         echo '</tr>';
00117 
00118     }
00119     echo '</table>';
00120 }
00121 echo '</div>';
00122 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations