noalyss Version-9
history_operation.inc.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of NOALYSS.
5 *
6 * NOALYSS is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * NOALYSS is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with NOALYSS; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21// Copyright Author Dany De Bontridder danydb@aevalys.eu
22
23/**
24 * \file
25 *
26 *
27 * \brief
28 *
29 */
30if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
33$ledger_type=$http->get("ledger_type","string", 'ALL');
34
35switch($ledger_type)
36{
37 case 'ACH':
38 $ask_pay=1;
39 $p_array['ledger_type']='ACH';
40 break;
41 case 'ODS':
42 $ask_pay=0;
43 $p_array['ledger_type']='ODS';
44 break;
45 case 'ALL':
46 $ask_pay=0;
47 $p_array['ledger_type']='ALL';
48 break;
49 case 'VEN':
50 $ask_pay=1;
51 $p_array['ledger_type']='VEN';
52 break;
53 case 'FIN':
54 $ask_pay=0;
55 $p_array['ledger_type']='FIN';
56 break;
57 default:
58 throw new \Exception("HO58 : ledger_type unknown");
59
60}
61$Ledger=new Acc_Ledger_Search($p_array['ledger_type'],0,'search_op');
62echo '<div class="content">';
63// Check privilege
64$p_jrn=$http->request("p_jrn", "string",-1);
65if (isset($_REQUEST['p_jrn']) &&
66 $g_user->check_jrn($p_jrn) == 'X')
67{
68
69 NoAccess();
70 exit - 1;
71}
72
74
75//------------------------------
76// UPdate the payment
77//------------------------------
78if (isset($_GET ['paid']))
79{
80 $ledger_paid=new Acc_Ledger($cn,$p_jrn);
81 $ledger_paid->update_paid($_GET);
82}
83
84
86/* by default we should use the default period */
87if (!isset($p_array['date_start']))
88{
89 $period = $g_user->get_periode();
90 $per = new Periode($cn, $period);
91 list($date_start, $date_end) = $per->get_date_limit();
92 $p_array['date_start'] = $date_start;
93 $p_array['date_end'] = $date_end;
94 $msg='<h2 class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end).'</h2>';
95}
96else
97{
98 $date_start=$http->get("date_start","string","");
99 $date_end=$http->get("date_end","string","");
100 $msg='<h2 class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end) .'</h2>';
101
102}
103/* compute the sql stmt */
104list($sql, $where) = $Ledger->build_search_sql($p_array);
105$max_line = $cn->count_sql($sql);
106
107$step = $_SESSION[SESSION_KEY.'g_pagesize'];
108$page = (isset($_GET['offset'])) ? $http->get('page') : 1;
109$offset = (isset($_GET['offset'])) ? $http->get('offset') : 0;
110
111// check if number
112$page=(isNumber($page)==0)?1:$page;
114
116
117echo $msg;
118echo $Ledger->button_propose_filter();
119echo HtmlInput::filter_table('history_operation_t', '0,1,2,3,4,5,6,7', 1);
120echo $Ledger->display_search_form();
121echo $bar;
122echo '<form method="GET" id="fpaida" class="print">';
123echo HtmlInput::hidden("ac", $http->request('ac'));
124echo HtmlInput::hidden('ledger_type',$ledger_type);
125echo dossier::hidden();
126
127list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay);
128
129
130echo $html;
131echo $bar;
132$r = HtmlInput::get_to_hidden(array('search_opnb_jrn',
133 'operation_filter',
134 'search_opqcode',
135 'l',
136 'date_start',
137 'date_end',
138 'date_paid_start',
139 'date_paid_end',
140 'desc',
141 'amount_min',
142 'amount_max',
143 'qcode',
144 'accounting',
145 'unpaid',
146 'gDossier',
147 'ledger_type',
148 'p_action',
149 'search_opr_jrn'));
150if (isset($_GET['r_jrn']))
151{
152 $a_rjn=$http->get('r_jrn','array');
153 foreach ($a_rjn as $k => $v) {
154 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
155 }
156}
157if (isset($_GET['search_opr_jrn']))
158{
159 $a_search_opr_jrn=$http->get('search_opr_jrn');
160 foreach ($a_search_opr_jrn as $k => $v)
161 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
162}
163echo $r;
164
165if ($ask_pay) {
166 echo '<p>' . HtmlInput::submit('paid', _('Mise à jour paiement')) . IButton::select_checkbox('fpaida') . IButton::unselect_checkbox('fpaida') . '</p>';
167 echo ICheckBox::javascript_set_range("paid_operation_ck");
168}
169
170echo '</form>';
171/*
172 * Export to csv
173 */
174$r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end',
175 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode','operation_filter',
176 'accounting', 'unpaid', 'gDossier', 'ledger_type',
177 'p_action','search_optag_option','p_currency_code','tva_id_search'));
178if (isset($_GET['search_opr_jrn']))
179{
180 foreach ($a_search_opr_jrn as $k => $v)
181 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
182}
183$r.=HtmlInput::hidden("tag_option",$http->request("search_optag_option","string",0));
184if (isset($_GET['r_jrn']))
185{
186 foreach ($a_rjn as $k => $v)
187 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
188}
189if (isset($_GET['search_optag'])) {
190 $http=new HttpInput();
191 $aTag=$http->get("search_optag","array");
192 foreach ($aTag as $k=>$v) {
193 // Protect : check that $k and $v are numeric
194 if (isNumber($k)&&isNumber($v)) {
195 $r.=HtmlInput::hidden('tag[]',$v);
196 }
197 }
198}
199echo '<form action="export.php" method="get">';
200echo $r;
201echo HtmlInput::hidden('act', 'CSV:histo');
202echo HtmlInput::submit('viewsearch', _('Export vers CSV'));
203$qcode=$http->get("search_opqcode","string","");
204echo HtmlInput::hidden('qcode',trim($qcode));
205echo '</form>';
206
207echo '</div>';
208return;
209?>
isNumber($p_int)
Definition: ac_common.php:215
NoAccess($js=1)
Echo no access and stop.
Definition: ac_common.php:480
if(headers_sent() &&DEBUGNOALYSS > 0) $html
$_REQUEST['ac']
$date_start
$_GET['qcode']
static filter_table($p_table_id, $p_col, $start_row)
filter the rows in a table and keep the colored row in alternance
static hidden($p_name, $p_value, $p_id="")
static get_to_hidden($array)
transform $_GET data to hidden
static submit($p_name, $p_value, $p_javascript="", $p_class="smallbutton")
manage the http input (get , post, request) and extract from an array
static select_checkbox($p_form)
static unselect_checkbox($p_form)
static javascript_set_range($p_name)
Before calling this function , you must set a range with the function set_range.
For the periode tables parm_periode and jrn_periode.
$count
for($e=0; $e< count($afiche); $e++) exit
switch($ledger_type) $Ledger
global $http
global $g_user
global $cn
if(isset($_GET['paid'])) $msg
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)
Definition: user_common.php:76