noalyss  Version-6.7.2
 All Data Structures Namespaces Files Functions Variables Enumerations
operation_ods_new.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  *
00024  *
00025  * \brief to write into the ledgers ODS a new operation
00026  */
00027 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
00028 require_once 'class_pre_op_ods.php';
00029 require_once 'class_iconcerned.php';
00030 
00031 global $g_user,$g_parameter;
00032 $cn=new Database(dossier::id());
00033 
00034 $id_predef = (isset($_REQUEST['p_jrn_predef'])) ? $_REQUEST['p_jrn_predef'] : -1;
00035 $id_ledger = (isset($_REQUEST['p_jrn'])) ? $_REQUEST['p_jrn'] : $id_predef;
00036 $ledger = new Acc_Ledger($cn, $id_ledger);
00037 $first_ledger=$ledger->get_first('ODS');
00038 $ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id_ledger;
00039 
00040 // check if we can write in the ledger
00041 if ( $g_user->check_jrn($ledger->id)=='X')
00042 {
00043         alert("Vous ne pouvez pas écrire dans ce journal, contacter votre administrateur");
00044         exit();
00045 }
00046 echo '<div class="content">';
00047 echo '<div id="predef_form">';
00048 echo HtmlInput::hidden('p_jrn_predef', $ledger->id);
00049 $op = new Pre_op_ods($cn);
00050 $op->set('ledger', $ledger->id);
00051 $op->set('ledger_type', "ODS");
00052 $op->set('direct', 't');
00053 $url=http_build_query(array('action'=>'use_opd','p_jrn_predef'=>$ledger->id,'ac'=>$_REQUEST['ac'],'gDossier'=>dossier::id()));
00054 echo $op->form_get('do.php?'.$url);
00055 
00056 echo '</div>';
00057 echo '<div id="jrn_name_div">';
00058 echo '<h2 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h2>';
00059 echo '</div>';
00060 
00061 // Show the predef operation
00062 // Don't forget the p_jrn
00063 $p_post=$_POST;
00064 if ( isset ($_GET['action']) && ! isset($_POST['correct']))
00065 {
00066         if ( $_GET['action']=='use_opd')
00067         {
00068                 // get data from predef. operation
00069                 $op=new Pre_op_advanced($cn);
00070         $p_post=null;
00071         if ( isset($_REQUEST['pre_def']) && $_REQUEST['pre_def'] != '')
00072         {
00073             $op->set_od_id($_REQUEST['pre_def']);
00074             $p_post=$op->compute_array();
00075         }
00076         }
00077 }
00078 
00079 
00080 echo '<form method="post"  class="print">';
00081 echo dossier::hidden();
00082 echo HtmlInput::request_to_hidden(array('ac'));
00083 
00084 echo $ledger->input($p_post);
00085 
00086 
00087 
00088 
00089 echo '<div style="position:absolute;width:40%;right:20px">';
00090 echo '<table class="info_op">'.
00091  '<tr>'.td(_('Débit')) . '<td id="totalDeb"></td>' .
00092  td(_('Crédit')) . ' <td id="totalCred"></td>' .
00093  td(_('Difference')) . ' <td id="totalDiff"></td>';
00094 echo '</table>';
00095 echo '</div>';
00096 
00097 $iconcerned=new IConcerned('jrn_concerned');
00098 $iconcerned->amount_id="totalDeb";
00099 echo "Opération rapprochée : ".$iconcerned->input();
00100 
00101 echo '<p>';
00102 echo HtmlInput::button('add', _('Ajout d\'une ligne'), 'onClick="quick_writing_add_row()"');
00103 echo HtmlInput::submit('summary', _('Sauvez'));
00104 echo '</p>';
00105 
00106 echo '</form>';
00107 
00108 echo "<script>checkTotalDirect();</script>";
00109 echo create_script(" update_name()");
00110 
00111 if ($g_parameter->MY_DATE_SUGGEST=='Y')
00112 {
00113         echo create_script(" get_last_date()");
00114 }
00115 echo '</div>';
00116 
00117 ?>
 All Data Structures Namespaces Files Functions Variables Enumerations