noalyss Version-9
anc_print.class.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 * \brief this class is the mother class for the CA printing
24 */
25
26/*!
27 * \class Anc_Print
28 * \brief this class is the mother class for the CA printing
29 *
30 *
31 */
32require_once NOALYSS_INCLUDE.'/constant.php';
34{
35 var $db; /*!< $db database connection */
36 var $to; /*!< $to start date */
37 var $from; /*!< $from end date */
38 var $from_poste; /*!< $from_poste from poste */
39 var $to_poste; /*!< $to_poste to the poste */
40
41 function __construct($p_cn)
42 {
43 global $g_user;
44 list($from,$to)=$g_user->get_limit_current_exercice();
45 $this->db=$p_cn;
46 $this->from=$from;
47 $this->to=$to;
48 $this->from_poste="";
49 $this->to_poste="";
50 $this->has_data=0;
51
52 }
53 /*!
54 * \brief complete the object with the data in $_REQUEST
55 */
56 function get_request()
57 {
58 $http=new HttpInput();
59 if ( isset($_REQUEST['from']))
60 $this->from=$http->request('from');
61
62 if ( isset($_REQUEST['to']))
63 $this->to=$http->request('to');
64
65 if ( isset($_REQUEST['from_poste']))
66 $this->from_poste=$http->request('from_poste');
67
68 if ( isset($_REQUEST['to_poste']))
69 $this->to_poste=$http->request('to_poste');
70 if ( isset($_REQUEST['pa_id']))
71 $this->pa_id=$http->request('pa_id');
72 else
73 $this->pa_id="";
74
75 }
76 /*!
77 * \brief Compute the form to display
78 * \param $p_hidden hidden tag to be included (gDossier,...)
79 *
80 *
81 * \return string containing the data
82 */
83 function display_form($p_hidden="")
84 {
85 /* if there is no analytic plan return */
86 $pa=new Anc_Plan($this->db);
87 if ( $pa->count() == 0 )
88 {
89 echo '<div class="content">';
90 echo '<h2 class="error">'._('Aucun plan défini').'</h2>';
91 echo '</div>';
92 return;
93 }
94
95 $from=new IDate('from','from');
96 $from->size=10;
97 $from->value=$this->from;
98
99 $to=new IDate('to','to');
100 $to->value=$this->to;
101 $to->size=10;
102
103 $from_poste=new IAncCard('from_poste','from_poste');
104 $from_poste->size=10;
105 $from_poste->plan_ctl='pa_id';
107
108 $to_poste=new IAncCard('to_poste','to_poste');
110 $to_poste->size=10;
111
112 $hidden=new IHidden();
113 $r=dossier::hidden();
114 $r.=$hidden->input("result","1");
115
116 $r.=HtmlInput::request_to_hidden(array('ac'));
117 $r.=$p_hidden;
118 $plan=new Anc_Plan($this->db);
119 $plan_id=new ISelect("pa_id");
120 $plan_id->value=$this->db->make_array("select pa_id, pa_name from plan_analytique order by pa_name");
121 $plan_id->selected=$this->pa_id;
122
123 $javascript="search_ca(".dossier::id().",'from_poste','pa_id')";
124 $choose_from=Icon_Action::icon_magnifier(uniqid(), $javascript);
125 $javascript="search_ca(".dossier::id().",'to_poste','pa_id')";
126 $choose_to=Icon_Action::icon_magnifier(uniqid(), $javascript);
127
128
129 $r.=HtmlInput::request_to_hidden(array('ac'));
130 ob_start();
131 ?>
132<table>
133 <tr>
134 <td>
135 <?php
136 echo _('Depuis') ;
137 echo Icon_Action::infobulle(37);
138 ?>
139 </td>
140 <td>
141 <?php
142 echo $from->input();
143 ?>
144 </td>
145 <td>
146 <?php
147 echo _('Jusque') ;
148 echo Icon_Action::infobulle(37);
149 ?>
150 </td>
151 <td>
152 <?php
153 echo $to->input();
154 ?>
155 </td>
156 <td>
157 <?php echo _( "Plan Analytique ")?>
158 </td>
159 <td>
160 <?php
161 echo $plan_id->input();
162 echo Icon_Action::infobulle(42);
163 ?>
164 </td>
165
166 </tr>
167
168</table>
169<span style="padding:5px;margin:5px;display:block;">
170
171</span>
172
173<?php
174 $r.=ob_get_clean();
175 $r.=_("Entre l'activité ").$from_poste->input();
176 $r.=$choose_from;
177 $r.=_(" et l'activité ").$to_poste->input();
178 $r.=$choose_to;
179
180 $r.='</span>';
181 return $r;
182 }
183 /*!
184 * \brief Set the filter (account_date)
185 *
186 * \return return the string to add to load
187 */
188
189 function set_sql_filter()
190 {
191 $sql="";
192 $and=" and ";
193 if ( $this->from != "" )
194 {
195 $sql.="$and a.oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
196 }
197 if ( $this->to != "" )
198 {
199 $sql.=" $and a.oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
200 }
201
202 return $sql;
203
204 }
205 function check()
206 {
207
208 /*
209 * check date
210 */
211 if (($this->from != '' && isDate ($this->from) == 0)
212 ||
213 ($this->to != '' && isDate ($this->to) == 0))
214 return -1;
215
216 return 0;
217 }
218
219
220}
span($p_string, $p_extra='')
Definition: ac_common.php:43
isDate($p_date)
Definition: ac_common.php:236
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
global $g_user
if no group available , then stop
catch(Exception $exc) if(! $g_user->can_write_action($ag_id)) $r
$anc pa_id
$anc_grandlivre from_poste
$anc_grandlivre to
$anc_grandlivre to_poste
$anc_grandlivre from
$opd_description style
$_REQUEST['ac']
$pa
Definition: anc_od.inc.php:34
Concerns the Analytic plan (table plan_analytique)
this class is the mother class for the CA printing
get_request()
complete the object with the data in $_REQUEST
set_sql_filter()
Set the filter (account_date)
display_form($p_hidden="")
Compute the form to display.
__construct($p_cn)
static request_to_hidden(array $array)
transform $_REQUEST data to hidden
manage the http input (get , post, request) and extract from an array
HtmlInput for card of analytic accountancy.
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
Html Input.
Html Input , create a tag <SELECT> ... </SELECT> if readonly == true then display the label correspon...
static icon_magnifier($id, $p_javascript, $p_style="")
Display a icon with a magnify glass.
static infobulle($p_comment)
Display a info in a bubble, text is in message_javascript.
$all table
$SecUser db