noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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 * \brief display history of accountant , and let search into
26 *
27 */
28echo js_include("operation_payment.js");
29if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
32$ledger_type=$http->get("ledger_type","string", 'ALL');
33
34switch($ledger_type)
35{
36 case 'ACH':
37 $ask_pay=1;
38 $p_array['ledger_type']='ACH';
39 break;
40 case 'ODS':
41 $ask_pay=0;
42 $p_array['ledger_type']='ODS';
43 break;
44 case 'ALL':
45 $ask_pay=0;
46 $p_array['ledger_type']='ALL';
47 break;
48 case 'VEN':
49 $ask_pay=1;
50 $p_array['ledger_type']='VEN';
51 break;
52 case 'FIN':
53 $ask_pay=0;
54 $p_array['ledger_type']='FIN';
55 break;
56 default:
57 throw new \Exception("HO58 : ledger_type unknown");
58
59}
60$Ledger=new Acc_Ledger_Search($p_array['ledger_type'],0,'search_op');
61echo '<div class="content">';
62// Check privilege
63$p_jrn=$http->request("p_jrn", "string",-1);
64if (isset($_REQUEST['p_jrn']) &&
65 $g_user->check_jrn($p_jrn) == 'X')
66{
67
68 NoAccess();
69 exit - 1;
70}
71
73
75/* by default we should use the default period */
76if (!isset($p_array['date_start']))
77{
78 $period = $g_user->get_periode();
79 $per = new Periode($cn, $period);
80 list($date_start, $date_end) = $per->get_date_limit();
81 $p_array['date_start'] = $date_start;
82 $p_array['date_end'] = $date_end;
83 $msg='<h2 class="h-section" class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end).'</h2>';
84}
85else
86{
87 $date_start=$http->get("date_start","string","");
88 $date_end=$http->get("date_end","string","");
89 $msg='<h2 class="h-section" class="">'.sprintf(_("Période %s au %s "),$date_start,$date_end) .'</h2>';
90
91}
92/* compute the sql stmt */
93list($sql, $where) = $Ledger->build_search_sql($p_array);
94$max_line = $cn->count_sql($sql);
95
96$step = $_SESSION[SESSION_KEY.'g_pagesize'];
97try
98{
99 $page = $http->get('page','string',1);
100 $offset =$http->get('offset','string',0);
101} catch (\Exception $e)
102{
103 $page=1;$offset=0;
104}
105
106
108
109echo $msg;
110echo $Ledger->button_propose_filter();
111echo HtmlInput::filter_table('history_operation_t', '0,1,2,3,4,5,6,7', 1);
112echo $Ledger->display_search_form();
113echo $bar;
114echo '<form method="GET" id="fpaida" class="print">';
115echo HtmlInput::hidden("ac", $http->request('ac'));
116echo HtmlInput::hidden('ledger_type',$ledger_type);
117echo dossier::hidden();
118
119list($count, $html) = $Ledger->list_operation($sql, $offset, $ask_pay);
120
121
122echo $html;
123echo $bar;
124$r = HtmlInput::get_to_hidden(array('search_opnb_jrn',
125 'operation_filter',
126 'search_opqcode',
127 'l',
128 'date_start',
129 'date_end',
130 'date_paid_start',
131 'date_paid_end',
132 'desc',
133 'amount_min',
134 'amount_max',
135 'qcode',
136 'accounting',
137 'unpaid',
138 'gDossier',
139 'ledger_type',
140 'p_action',
141 'search_opr_jrn'));
142if (isset($_GET['r_jrn']))
143{
144 $a_rjn=$http->get('r_jrn','array');
145 foreach ($a_rjn as $k => $v) {
146 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
147 }
148}
149if (isset($_GET['search_opr_jrn']))
150{
151 $a_search_opr_jrn=$http->get('search_opr_jrn');
152 foreach ($a_search_opr_jrn as $k => $v)
153 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
154}
155echo $r;
156
157echo '</form>';
158/*
159 * Export to csv
160 */
161$r = HtmlInput::get_to_hidden(array('l', 'date_paid_start','date_paid_end',
162 'date_start', 'date_end', 'desc', 'amount_min', 'amount_max', 'qcode','operation_filter',
163 'accounting', 'unpaid', 'gDossier', 'ledger_type',
164 'p_action','search_optag_option','p_currency_code','tva_id_search'));
165if (isset($_GET['search_opr_jrn']))
166{
167 foreach ($a_search_opr_jrn as $k => $v)
168 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
169}
170$r.=HtmlInput::hidden("tag_option",$http->request("search_optag_option","string",0));
171if (isset($_GET['r_jrn']))
172{
173 foreach ($a_rjn as $k => $v)
174 if (isNumber($v)) $r.=HtmlInput::hidden('r_jrn[' . $k . ']', $v);
175}
176if (isset($_GET['search_optag'])) {
177 $http=new HttpInput();
178 $aTag=$http->get("search_optag","array");
179 foreach ($aTag as $k=>$v) {
180 // Protect : check that $k and $v are numeric
181 if (isNumber($k)&&isNumber($v)) {
182 $r.=HtmlInput::hidden('tag[]',$v);
183 }
184 }
185}
186echo '<form action="export.php" method="get">';
187echo $r;
188echo HtmlInput::hidden('act', 'CSV:histo');
189echo HtmlInput::submit('viewsearch', _('Export vers CSV'));
190$qcode=$http->get("search_opqcode","string","");
191echo HtmlInput::hidden('qcode',trim($qcode));
192echo '</form>';
193
194echo '</div>';
195if ( $ask_pay){
196?>
197<script>
198 var operation_payment=new Operation_Payment("paid_operation_ck",'<?=Dossier::id()?>','<?=$http->request("ac")?>');
199 operation_payment.activate_checkbox_range()
200</script>
201<?php
202}
isNumber($p_int)
NoAccess($js=1)
Echo no access and stop.
global $g_user
if no group available , then stop
if(headers_sent() &&DEBUGNOALYSS > 0) $html
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
foreach(array( 'l', 'gDossier') as $a) if(is_numeric($l)==false) $Ledger
$_REQUEST['ac']
_("actif, passif,charge,...")
$date_start
$_GET['qcode']
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
$count
for($e=0; $e< count($afiche); $e++) exit
js_include($p_string)
create the HTML for including of a javascript file if a file is included twice, the second time it wi...
catch(\Exception $e) $bar
navigation_bar($p_offset, $p_line, $p_size=0, $p_page=1, $p_javascript="")
Create a navigation_bar (pagesize)