noalyss Version-9
impress_poste.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// Copyright Author Dany De Bontridder danydb@aevalys.eu
20if ( ! defined ('ALLOWED') ) die(_('Non autorisé'));
21/*! \file
22 * \brief Print account (html or pdf)
23 * file included from user_impress
24 *
25 * some variable are already defined $cn, $g_user ...
26 *
27 */
28//-----------------------------------------------------
29// Show the jrn and date
30//-----------------------------------------------------
31global $g_user;
33//-----------------------------------------------------
34// Form
35//-----------------------------------------------------
36echo '<div class="content">';
37
38echo '<FORM action="?" METHOD="GET">';
39echo HtmlInput::hidden('ac',$http->request("ac"));
40echo HtmlInput::hidden('type','poste');
41echo dossier::hidden();
42echo '<TABLE><TR>';
44
45$w=new IPoste('poste_id');
46$w->set_attribute('ipopup','ipop_account');
47$w->set_attribute('label','poste_id_label');
48$w->set_attribute('account','poste_id');
49$w->table=0;
50$w->value=$http->request("poste_id","string","");
51$w->label=_("Choisissez le poste");
52print td(_('Choisissez un poste')).td($w->input());
53echo td($span->input('poste_id_label'));
54echo '</tr><tr>';
55
56$w_poste=new ICard('f_id');
57$w_poste->table=0;
58$w_poste->jrn=0;
59echo td(_("Ou Choisissez la fiche"));
60$w_poste->set_attribute('label','f_id_label');
61$w_poste->set_attribute('ipopup','ipop_card');
62$w_poste->set_attribute('gDossier',dossier::id());
63$w_poste->set_attribute('typecard','all');
64$w_poste->set_function('fill_data');
65$w_poste->set_dblclick("fill_ipopcard(this);");
66
67
68$w_poste->value=$http->request("f_id","string","");
69print td($w_poste->input().$w_poste->search());
70echo td($span->input('f_id_label'));
71print '</TR>';
72print '<TR>';
73
74$date_from=new IDate('from_periode');
75$date_to=new IDate('to_periode');
76$year=$g_user->get_exercice();
77$date_from->value=$http->request("from_periode","string","01.01.".$year);
78$date_to->value=$http->request("to_periode","string","31.12.".$year);
79echo td(_('Depuis').$date_from->input());
80echo td(_('Jusque ').$date_to->input());
81//
82print "<TR><TD>";
84$all->label=_("Tous les postes qui en dépendent");
85$all->disabled=false;
86$all->selected=(isset($_REQUEST['poste_fille']))?true:false;
87echo $all->input("poste_fille");
88echo '</TD></TR><TR><TD>';
90$detail->label=_("Détail des opérations");
91$detail->disabled=false;
92$detail->selected=(isset($_REQUEST['oper_detail']))?true:false;
93echo $detail->input("oper_detail");
94echo '</td></tr>';
95$a_let=array(
96 array('value'=>0,'label'=>_('Toutes les opérations')),
97 array('value'=>1,'label'=>_('Opérations lettrées')),
98 array('value'=>2,'label'=>_('Opérations non lettrées'))
99 );
100echo '</TABLE>';
101$salet=new ISelect('ople');
102$salet->value=$a_let;
103$salet->selected=$http->get("ople","number",0);
104
105echo $salet->input();
106
107print HtmlInput::submit('bt_html',_('Visualisation'));
108
109echo '</FORM>';
110echo '<hr>';
111echo '</div>';
112
113//-----------------------------------------------------
114// If print is asked
115// First time in html
116// after in pdf or cvs
117//-----------------------------------------------------
118if ( isset( $_REQUEST['bt_html'] ) )
119{
120 if ( isDate($_REQUEST['from_periode'])==null || isDate($_REQUEST['to_periode'])==null)
121 {
122 echo alert(_('Date malformée, désolée'));
123 return;
124 }
125 $go=0;
126// we ask a poste_id
127 if ( isset($_GET['poste_id']) && noalyss_strlentrim($_GET['poste_id']) != 0 )
128 {
129 if ( isset ($_GET['poste_fille']) )
130 {
131 $parent=sql_string($_GET['poste_id']);
132 $a_poste=$cn->get_array("select pcm_val from tmp_pcmn where pcm_val::text like '$parent%' order by pcm_val::text");
133 $go=3;
134 }
135 // Check if the post is numeric and exists
136 elseif ( $cn->count_sql('select * from tmp_pcmn where pcm_val=$1',array($_GET['poste_id'])) != 0 )
137 {
138 $Poste=new Acc_Account_Ledger($cn,$http->get("poste_id","number"));
139 $go=1;
140 }
141 }
142 if ( noalyss_strlentrim($_GET['f_id']) != 0 )
143 {
144 // thanks the qcode we found the poste account
145 $fiche=new Fiche($cn);
146 $qcode=$fiche->get_by_qcode($http->get('f_id'));
147 $p=$fiche->strAttribut(ATTR_DEF_ACCOUNT);
148 if ( $p != NOTFOUND)
149 {
150 $go=2;
151 }
152 }
153
154 // A account is given
155 if ( $go == 1)
156 {
157 echo '<div class="content">';
158 if ( ! isset($_REQUEST['oper_detail']) )
159 {
161 echo '<div class="content">';
162 $Poste->load();
163 ob_start();
164 $result=$Poste->HtmlTable(null,$_GET['ople']);
165 $table=ob_get_clean();
166 if ( $result == 0) {
167 echo '<h2 class="">'.$Poste->id." ".h($Poste->label).'</h2>';
168 echo $table;
169 }
170 echo '</div>';
172 }
173 else
174 {
175 //----------------------------------------------------------------------
176 // Detail
177 //----------------------------------------------------------------------
179
180 $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']);
181 if ( empty($Poste->row)) return;
182 $Poste->load();
183
184 echo '<table class="result" >';
185 echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="info">'. $_GET['poste_id'].' '.h($Poste->label).'</h2></td></tr>';
186 /* avoid duplicates */
187 $old=array();
188 foreach ($Poste->row as $detail)
189 {
190 if ( in_array($detail['jr_id'],$old) == TRUE ) continue;
191 $old[]=$detail['jr_id'];
192 echo '<tr><td style="text-align:center;background-color:lightgrey" colspan="6">'.$detail['j_date'].' '.$detail['jr_internal'].h($detail['description']).'</td></tr>';
193
194 $op=new Acc_Operation($cn);
195 $op->jr_id=$detail['jr_id'];
196 $op->poste=$_GET['poste_id'];
197 echo $op->display_jrnx_detail(1);
198 }
199 echo '</table>';
200
202 }
203 echo "</div>";
204 exit;
205 }
206
207 // A QuickCode is given
208 if ( $go == 2)
209 {
210 if ( ! isset($_REQUEST['oper_detail']) )
211 {
212 echo '<div class="content">';
213 echo '<h2 class=""> ' .
214 '(' . $fiche->id . ')' .
215 $fiche->getName() . ' ' .
216 ' [ ' . $fiche->get_quick_code() . ' ] ' .
217 '</h2>';
218 $fiche->HtmlTableHeader();
219 $fiche->HtmlTable(null, $_GET['ople']);
220 $fiche->HtmlTableHeader();
221 echo "</div>";
222 }
223 else
224 {
225 // Detail //
226 echo '<div class="content">';
227 echo '<h2 class=""> ' .
228 '(' . $fiche->id . ')' .
229 $fiche->getName() . ' ' .
230 ' [ ' . $fiche->get_quick_code() . ' ] ' .
231 '<h2>';
232
233 $fiche->HtmlTableHeader();
234 $fiche->HtmlTableDetail();
235 $fiche->HtmlTableHeader();
236 echo "</div>";
237 }
238 exit;
239 }
240
241 // All the children account
242 if ( $go == 3 )
243 {
244
245 if ( sizeof($a_poste) == 0 )
246 exit;
247 echo '<div class="content">';
248
249
250 if ( ! isset ($_REQUEST['oper_detail']))
251 {
252 $Poste=new Acc_Account_Ledger($cn,$_GET['poste_id']);
254
255 foreach ($a_poste as $poste_id )
256 {
257 $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
258 $Poste->load();
259 ob_start();
260 $result=$Poste->HtmlTable(null,$_GET['ople']);
261 $table=ob_get_clean();
262 if ( $result == 0) {
263 echo '<h2 class="">'.$Poste->id." ".h($Poste->label).'</h2>';
264 echo $table;
265 }
266
267 }
269 echo "</div>";
270 }
271 else
272 {
273 //----------------------------------------------------------------------
274 // Detail
275 //----------------------------------------------------------------------
277 echo '<table style="width:100%;margin-left:0%">';
278 foreach ($a_poste as $poste_id )
279 {
280 $Poste=new Acc_Account_Ledger ($cn,$poste_id['pcm_val']);
281 $Poste->load();
282 $Poste->get_row_date( $_GET['from_periode'], $_GET['to_periode'],$_GET['ople']);
283 if ( empty($Poste->row)) continue;
284 echo '<tr><td class="mtitle" style="width:auto" colspan="6"><h2 class="title">'. $poste_id['pcm_val'].' '.h($Poste->label).'</h2></td></tr>';
285
286 $detail=$Poste->row[0];
287
288 $old=array();
289
290 foreach ($Poste->row as $detail)
291 {
292 /* avoid duplicates */
293 if ( in_array($detail['jr_id'],$old) == TRUE ) continue;
294 $old[]=$detail['jr_id'];
295 echo tr(td("Journal :".$detail['jrn_def_name'],''),'style="width:auto" colspan="6"');
296 echo '<tr><td class="mtitle" style="width:auto;color:whitesmoke" colspan="6">'. $detail['j_date'].' '.$detail['jr_internal'].' '.hb($detail['description']).' '.hi($detail['jr_pj_number']).'</td></tr>';
297
298 $op=new Acc_Operation($cn);
299 $op->poste=$poste_id['pcm_val'];
300
301 $op->jr_id=$detail['jr_id'];
302 echo $op->display_jrnx_detail(1);
303 }
304 }
305 echo '</table>';
307 }
308
309 exit;
310 }
311}
312?>
hi($p_string)
Definition: ac_common.php:48
hb($p_string)
Definition: ac_common.php:53
isDate($p_date)
Definition: ac_common.php:236
noalyss_strlentrim($p_string)
Definition: ac_common.php:1549
tr($p_string, $p_extra='')
Definition: ac_common.php:88
sql_string($p_string)
Fix the problem with the quote char for the database.
Definition: ac_common.php:511
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
h( $row[ 'oa_description'])
$_REQUEST['ac']
for($i=0; $i< count($plan); $i++)( $j==0) $a_poste
$p
Definition: array.php:34
$input_from id
Definition: balance.inc.php:63
$_GET['qcode']
Manage the account from the table jrn, jrnx or tmp_pcmn.
static HtmlTableHeader($actiontarget="poste")
Display HTML Table Header (button)
this file match the tables jrn & jrnx the purpose is to remove or save accountant writing to these ta...
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
Definition: fiche.class.php:38
static hidden($p_name, $p_value, $p_id="")
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
Input HTML for the card show buttons, in the file, you have to add card.js How to use :
Html Input.
Html Input : Input a date format dd.mm.yyyy The property title should be set to indicate what it is e...
Definition: idate.class.php:34
show a button, for selecting a account and a input text for manually inserting an account the differe...
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
Html Input.
Definition: ispan.class.php:32
const NOTFOUND(!defined("SYSINFO_DISPLAY"))
Definition: constant.php:131
const ATTR_DEF_ACCOUNT
Definition: constant.php:215
for($e=0; $e< count($afiche); $e++) exit
global $g_user
if( $delta< 0) elseif( $delta==0)
$table
Definition: menu.inc.php:103