noalyss Version-9
NOALYSS : serveur de comptabilité et ERP (2002)
Loading...
Searching...
No Matches
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 var $has_data; /*!< array of data */
41 var $pa_id; /*!< axis for analytic : plan */
42
43 function __construct($p_cn)
44 {
45 global $g_user;
46 list($from,$to)=$g_user->get_limit_current_exercice();
47 $this->db=$p_cn;
48 $this->from=$from;
49 $this->to=$to;
50 $this->from_poste="";
51 $this->to_poste="";
52 $this->has_data=0;
53
54 }
55 /*!
56 * \brief complete the object with the data in $_REQUEST
57 */
58 function get_request()
59 {
60 $http=new HttpInput();
61 if ( isset($_REQUEST['from']))
62 $this->from=$http->request('from');
63
64 if ( isset($_REQUEST['to']))
65 $this->to=$http->request('to');
66
67 if ( isset($_REQUEST['from_poste']))
68 $this->from_poste=$http->request('from_poste');
69
70 if ( isset($_REQUEST['to_poste']))
71 $this->to_poste=$http->request('to_poste');
72 if ( isset($_REQUEST['pa_id']))
73 $this->pa_id=$http->request('pa_id');
74 else
75 $this->pa_id="";
76
77 }
78 /*!
79 * \brief Compute the form to display
80 * \param $p_hidden hidden tag to be included (gDossier,...)
81 *
82 *
83 * \return string containing the data
84 */
85 function display_form($p_hidden="")
86 {
87 /* if there is no analytic plan return */
88 $pa=new Anc_Plan($this->db);
89 if ( $pa->count() == 0 )
90 {
91 echo '<div class="content">';
92 echo '<h2 class="error">'._('Aucun plan défini').'</h2>';
93 echo '</div>';
94 return;
95 }
96
97 $from=new IDate('from','from');
98 $from->size=10;
99 $from->value=$this->from;
100
101 $to=new IDate('to','to');
102 $to->value=$this->to;
103 $to->size=10;
104
105 $from_poste=new IAncCard('from_poste','from_poste');
106 $from_poste->size=10;
107 $from_poste->plan_ctl='pa_id';
109
110 $to_poste=new IAncCard('to_poste','to_poste');
112 $to_poste->size=10;
113
114 $hidden=new IHidden();
115 $r=dossier::hidden();
116 $r.=$hidden->input("result","1");
117
118 $r.=HtmlInput::request_to_hidden(array('ac'));
119 $r.=$p_hidden;
120 $plan=new Anc_Plan($this->db);
121 $plan_id=new ISelect("pa_id");
122 $plan_id->value=$this->db->make_array("select pa_id, pa_name from plan_analytique order by pa_name");
123 $plan_id->selected=$this->pa_id;
124
125 $javascript="search_ca(".dossier::id().",'from_poste','pa_id')";
126 $choose_from=Icon_Action::icon_magnifier(uniqid(), $javascript);
127 $javascript="search_ca(".dossier::id().",'to_poste','pa_id')";
128 $choose_to=Icon_Action::icon_magnifier(uniqid(), $javascript);
129
130
131 $r.=HtmlInput::request_to_hidden(array('ac'));
132 ob_start();
133 ?>
134<table>
135 <tr>
136 <td>
137 <?php
138 echo _('Depuis') ;
139 echo Icon_Action::infobulle(37);
140 ?>
141 </td>
142 <td>
143 <?php
144 echo $from->input();
145 ?>
146 </td>
147 <td>
148 <?php
149 echo _('Jusque') ;
150 echo Icon_Action::infobulle(37);
151 ?>
152 </td>
153 <td>
154 <?php
155 echo $to->input();
156 ?>
157 </td>
158 <td>
159 <?php echo _( "Plan Analytique ")?>
160 </td>
161 <td>
162 <?php
163 echo $plan_id->input();
164 echo Icon_Action::infobulle(42);
165 ?>
166 </td>
167
168 </tr>
169
170</table>
171<span style="padding:5px;margin:5px;display:block;">
172
173</span>
174
175<?php
176 $r.=ob_get_clean();
177 $r.=_("Entre l'activité ").$from_poste->input();
178 $r.=$choose_from;
179 $r.=_(" et l'activité ").$to_poste->input();
180 $r.=$choose_to;
181
182 $r.='</span>';
183 return $r;
184 }
185 /*!
186 * \brief Set the filter (account_date)
187 *
188 * \return return the string to add to load
189 */
190
191 function set_sql_filter()
192 {
193 $sql="";
194 $and=" and ";
195 if ( $this->from != "" )
196 {
197 $sql.="$and a.oa_date >= to_date('".$this->from."','DD.MM.YYYY')";
198 }
199 if ( $this->to != "" )
200 {
201 $sql.=" $and a.oa_date <= to_date('".$this->to."','DD.MM.YYYY')";
202 }
203
204 return $sql;
205
206 }
207 function check()
208 {
209
210 /*
211 * check date
212 */
213 if (($this->from != '' && isDate ($this->from) == 0)
214 ||
215 ($this->to != '' && isDate ($this->to) == 0))
216 return -1;
217
218 return 0;
219 }
220
221
222}
span($p_string, $p_extra='')
Definition ac_common.php:43
isDate($p_date)
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
_("actif, passif,charge,...")
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)
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...
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