noalyss Version-9
operation_ods_new.inc.php
Go to the documentation of this file.
1<?php
2/*
3 * This file is part of NOALYSS.
4 *
5 * NOALYSS is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * NOALYSS is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with NOALYSS; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18*/
19
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
21
22/*!\file
23 *
24 *
25 * \brief to write into the ledgers ODS a new operation
26 */
27if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
29
30
33
34$id_predef = $http->request('p_jrn_predef','number',-1);
35$id_ledger = $http->request('p_jrn','number',$id_predef);
36
38$first_ledger=$ledger->get_first('ODS');
39$ledger->id = ($ledger->id == -1) ? $first_ledger['jrn_def_id'] : $id_ledger;
40
41// check if we can write in the ledger
42if ( $g_user->check_jrn($ledger->id)=='X')
43{
44 alert(_("Vous ne pouvez pas écrire dans ce journal, contactez votre administrateur"));
45 echo '<span class="warning">'.
46 _("Vous ne pouvez pas écrire dans ce journal, contactez votre administrateur").
47 '</span>';
48 return;
49}
50echo '<div class="content">';
51
52
53echo '<div id="jrn_name_div">';
54echo '<h1 id="jrn_name" style="display:inline">' . $ledger->get_name() . '</h1>';
55echo '</div>';
56
57// Show the predef operation
58// Don't forget the p_jrn
60if ( isset ($_GET['action']) && ! isset($_POST['correct']) && ! isset($correct) )
61{
62 if ( $_GET['action']=='use_opd')
63 {
64 // get data from predef. operation
66 $p_post=null;
67 if ( isset($_REQUEST['pre_def']) && $_REQUEST['pre_def'] != '')
68 {
69 $op->set_od_id($http->request('pre_def','number'));
70 $p_post=$op->compute_array();
71 // operation description are not in the same variable
72 $p_post['desc']=$p_post['e_comm'];
73 }
74 }
75}
76$p_msg=(isset($p_msg))?$p_msg:"";
77if ( !empty ($p_msg))
78{
79 print '<span class="warning">'.$p_msg.'</span>';
80}
81echo '<form method="post" class="print" onsubmit="return controleBalance();" >';
82echo dossier::hidden();
83echo HtmlInput::request_to_hidden(array('ac','jr_optype'));
84
86
87echo $ledger->input($p_post);
88
89$style=' style="display:inline-block;width: 15rem;text-align: right"';
90?>
91<div style="position:absolute;right:20px">
92 <table class="info_op">
93 <tr>
94 <td style="border:1px solid "><?=_('Totaux')?></td>
95 <td style="border:1px solid lightgrey"><?= _('Débit') ?>
96 <span id="totalDeb" <?=$style?>></span>
97 </td>
98 <td style="border:1px solid lightgrey"><?= _('Crédit') ?>
99 <span id="totalCred" <?=$style?>></span>
100 </td>
101 <td style="border:1px solid lightgrey"><?= _('Difference') ?>
102 <span id="totalDiff" <?=$style?>></span>
103 </td>
104 </tr>
105 <?php // For currency ?>
106 <tr id="row_currency">
107 <td style="border:1px solid "><?=$default_currency->get_code()?></td>
108
109 <td style="border:1px solid lightgrey"><?= _('Débit') ?>
110 <span id="default_currency_deb" <?=$style?>></span>
111 </td>
112
113 <td style="border:1px solid lightgrey"><?= _('Crédit') ?>
114 <span id="default_currency_cred" <?=$style?>></span>
115 </td>
116
117 <td></td>
118 </tr>
119 </table>
120
121</div>
122
123<?php
124
125$iconcerned=new IConcerned('jrn_concerned');
126$iconcerned->amount_id="totalDeb";
127printf (_("Opération rapprochée : %s"),$iconcerned->input());
128
129echo '<p>';
131echo HtmlInput::submit('summary', _('Sauvez'));
132echo '</p>';
133
134echo '</form>';
135
136echo "<script>checkTotalDirect();</script>";
137echo create_script(" update_name()");
138
139$e_date=$http->request("e_date","string","");
140
141if ($e_date=="" && $g_parameter->MY_DATE_SUGGEST=='Y') {
142 echo create_script(" get_last_date()");
143 }
144
145echo '</div>';
146
147?>
span($p_string, $p_extra='')
Definition: ac_common.php:43
tr($p_string, $p_extra='')
Definition: ac_common.php:88
td($p_string='', $p_extra='')
surround the string with td
Definition: ac_common.php:83
alert($p_msg, $buffer=false)
alert in javascript
Definition: ac_common.php:738
$op
Definition: ajax_admin.php:38
$opd_description style
$_REQUEST['ac']
$_GET['qcode']
display currency , convert to euro , and save them if used.
static connect()
static ledger_add_item($p_ledger)
Build a HTML string for adding multiple rows.
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
Html Input.
static echo_file($msg, $print=true)
display the file
Definition: dbg.php:88
manage the predefined operation, link to the table op_def and op_def_detail
$all table
$_POST['ac']
Definition: do.php:310
create_script($p_string)
create the HTML for adding the script tags around of the script
print
Type of printing.
global $http
global $g_user
if(isset($_GET['action']) &&! isset($_POST['correct']) &&! isset($correct)) $p_msg
< tr id="row_currency">< td style="border:1px solid "><?=$default_currency-> get_code()?></td >< td style $iconcerned
global $g_parameter