Plugins  LAST
 All Data Structures Files Functions Variables Pages
class_formulaire_param_detail.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 /* $Revision$ */
21 
22 // Copyright (c) 2002 Author Dany De Bontridder dany@alchimerys.be
23 
24 /**
25  * @file
26  * @brief
27  *
28  */
29 require_once 'class_rapport_avance_sql.php';
30 require_once 'class_rapav_formulaire.php';
31 require_once 'class_rapav.php';
32 
34 {
35 
36  function input_new($p_id)
37  {
38  global $cn;
39  $parent = new Formulaire_Param($p_id);
40  echo HtmlInput::title_box('Formule', 'param_detail_div');
41  echo '<h2>' . $parent->p_code . " " . $parent->p_libelle . '</h2>';
42 
43  require_once 'template/param_detail_new.php';
44  }
45  function input_new_child($p_id){
46  global $cn;
47  $parent = new Formulaire_Param($p_id);
48  echo HtmlInput::title_box('Formule', 'param_detail_div');
49  echo '<h2>' . $parent->p_code . " " . $parent->p_libelle . '</h2>';
50 
51  require_once 'template/param_detail_new_child.php';
52  }
53  function button_delete()
54  {
55  $html='<td id="del_' . $this->fp_id . '">';
56  $html.=HtmlInput::anchor("Effacer", "", sprintf("onclick=\"delete_param_detail('%s','%s','%s','%s','%s','%s')\""
57  , $_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'], $this->fp_id,$this->p_id,$this->type_detail));
58  $html.= '</td>';
59  return $html;
60  }
61  function button_modify()
62  {
63  $html='<td id="mod_' . $this->fp_id . '">';
64  $html.=HtmlInput::anchor("Modifier", "", sprintf("onclick=\"modify_param_detail('%s','%s','%s','%s')\""
65  , $_REQUEST['plugin_code'], $_REQUEST['ac'], $_REQUEST['gDossier'], $this->fp_id));
66  $html.= '</td>';
67  return $html;
68  }
69  /**
70  * display a choice of ledger
71  * @global cn
72  */
73  function input_ledger()
74  {
75  global $cn;
76  $select = new ISelect('p_ledger');
77  $a_ledger = $cn->make_array('select jrn_def_id,jrn_def_name from jrn_def order by 2', 1);
78  $a_ledger[0]['label'] = '-- Tous les journaux -- ';
79  $select->value = $a_ledger;
80  if ( $this->fp_id != -1)
81  {
82  $select->selected=$this->jrn_def_id;
83  }
84 
85  echo '<p> Filtrage par journal ' . $select->input() . '</p>';
86  }
87 
88  /**
89  * Display a select for the date
90  */
92  {
93  $s_date = new ISelect('p_paid');
94  $s_date->value = array();
95  $s_date->value[] = array("value" => 0, "label" => 'Date d\'opération');
96  $s_date->value[] = array("value" => 1, "label" => 'Date de paiement');
97  $s_date->value[] = array("value" => 2, "label" => 'Date d\'échéance');
98  echo '<p> Si la date donnée concerne la date de paiement ou d\'écheance, cela limitera la recherche aux journaux VEN et ACH ';
99  echo HtmlInput::infobulle(36);
100  if ( $this->fp_id != -1)
101  {
102  $s_date->selected=$this->date_paid;
103  }
104  echo $s_date->input();
105  echo '</p>';
106  }
107 
108 }
109 
111 {
112 
113  function display_row()
114  {
115  $ledger = RAPAV::get_ledger_name($this->jrn_def_id);
116  $paid = RAPAV::str_date_type($this->date_paid);
117  printf("Résultat de la formule %s utilisant $ledger %s", $this->fp_formula, $paid);
118  }
119 
120  function input()
121  {
122  $account = new IPoste("formula_new", "", "form_id");
123  if ($this->fp_id != -1)
124  {
125  $account->value=$this->fp_formula;
126  }
127  $account->size = 50;
128  $account->label = _("Recherche poste");
129  $account->set_attribute('gDossier', dossier::id());
130  $account->set_attribute('bracket', 1);
131  $account->set_attribute('no_overwrite', 1);
132  $account->set_attribute('noquery', 1);
133  $account->set_attribute('account', $account->id);
134  echo $account->input();
135  $this->input_date_paiement();
136  $this->input_ledger();
137  }
138  static function new_row()
139  {
140  $obj=new RAPAV_Formula();
141  $obj->input();
142  }
143  function verify()
144  {
145  global $errcode;
146  $ret = RAPAV::verify_compute($this->fp_formula);
147  $this->errcode = $errcode;
148  return $ret;
149  }
150 
151 }
152 
154 {
155 
156  function display_row()
157  {
158  global $cn;
159  $ledger = RAPAV::get_ledger_name($this->jrn_def_id);
160  $type_total = $cn->get_value("select tt_label from rapport_advanced.total_type where tt_id=$1", array($this->tt_id));
161  $paid = RAPAV::str_date_type($this->date_paid);
162  printf("Poste comptable %s avec le code tva %s (%s) dans le journal de type %s [ %s ] $ledger %s", $this->tmp_val, $this->tva_id, $this->tva_id, $this->jrn_def_type, $type_total, $paid);
163  }
164 
165  function input()
166  {
167  global $cn;
168  $account = new IPoste("formtva", "", "formtva_id");
169  $account->size = 20;
170  $account->label = _("Recherche poste");
171  $account->set_attribute('gDossier', dossier::id());
172  $account->set_attribute('noquery', 1);
173  $account->set_attribute('account', $account->id);
174  $account->value=$this->tmp_val;
175 
176  $tva = new ITva_Popup("code_tva");
177  $tva->id = HtmlInput::generate_id("code_tva");
178  $tva->set_attribute('gDossier', dossier::id());
179  $tva->value=$this->tva_id;
180  // Jrn type
181  $select = new ISelect('code_jrn');
182  $select->value = array(
183  array('value' => 'VEN', 'label' => 'journaux Vente'),
184  array('value' => 'ACH', 'label' => 'journaux Achat')
185  );
186  $select->selected=$this->jrn_def_type;
187  echo '<table>';
188  echo '<tr><td>Poste comptable</td>';
189  echo td($account->input());
190  echo '</tr>';
191  echo td('TVA') . td($tva->input());
192  echo '</tr>';
193  echo td(_('Choix du type de journal ')) . td($select->input());
194  // Base or VAT
195  echo '</tr>';
196  $code_base = new ISelect('code_base');
197  $code_base->value = $cn->make_array("select tt_id,tt_label from rapport_advanced.total_type order by 2");
198  $code_base->selected=$this->tt_id;
199  echo td("Type de total");
200  echo td($code_base->input());
201  echo '</tr>';
202  echo '</table>';
203  $this->input_date_paiement();
204  $this->input_ledger();
205  }
206  static function new_row()
207  {
208  $obj=new RAPAV_Account_Tva();
209  $obj->input();
210  }
211  function verify()
212  {
213  global $cn;
214  if (trim($this->tmp_val) == "")
215  {
216  $this->errcode = 'Poste comptable est vide';
217  return 1;
218  }
219  $count = $cn->get_value("select count(*) from tva_rate where tva_id=$1", array($this->tva_id));
220  if ($count == 0)
221  {
222  $this->errcode = 'Code TVA inexistant';
223  return 1;
224  }
225  }
226 
227 }
228 
230 {
231 
232  function display_row()
233  {
234  printf("Total des codes du formulaire %s", $this->fp_formula);
235  }
236 
237  function input()
238  {
239  global $cn;
240  $f_id = $cn->get_value("select f_id from rapport_advanced.formulaire_param where p_id=$1", array($this->p_id));
241  $account = new IText("form_compute");
242  $account->size = 50;
243  $account->value=$this->fp_formula;
244  echo $account->input();
245  echo HtmlInput::button('rapav_search_code_bt', 'Cherche codes', sprintf(" onclick=\"rapav_search_code('%s','%s','%s','%s')\"", $_REQUEST['ac'], $_REQUEST['plugin_code'], $_REQUEST['gDossier'], $f_id));
246  }
247  static function new_row($p_id)
248  {
249  $obj=new RAPAV_Compute();
250  $obj->p_id=$p_id;
251  $obj->input();
252  }
253  function verify()
254  {
255  global $errcode;
256  $ret = RAPAV::verify_compute($this->fp_formula);
257  $this->errcode = $errcode;
258  return $ret;
259  }
260 
261 }
262 
263 /**
264  * @brief poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit, crédit, débit
265  */
267 {
268 
269  function display_row()
270  {
271  global $cn;
272  $ledger = RAPAV::get_ledger_name($this->jrn_def_id);
273  $paid = RAPAV::str_date_type($this->date_paid);
274  $total_type_account = $cn->get_value('select tt_label from rapport_advanced.total_type_account where tt_id=$1', array($this->type_sum_account));
275  printf("Total %s poste comptable %s utilisé avec le poste comptable %s utilisant $ledger %s", $total_type_account, $this->tmp_val, $this->with_tmp_val, $paid);
276  }
277 
278  function input()
279  {
280  global $cn;
281  $sum_type = new ISelect('account_sum_type');
282  $sum_type->value = $cn->make_array("select tt_id, tt_label from rapport_advanced.total_type_account ");
283  $sum_type->selected=$this->type_sum_account;
284  $account = new IPoste("account_first", "", "account_first_id");
285  $account->size = 10;
286  $account->label = _("Recherche poste");
287  $account->value=$this->tmp_val;
288  $account->set_attribute('gDossier', dossier::id());
289  $account->set_attribute('account', $account->id);
290 
291  $account_second = new IPoste("account_second", "", "account_second_id");
292  $account_second->size = 10;
293  $account_second->label = _("Recherche poste");
294  $account_second->set_attribute('gDossier', dossier::id());
295  $account_second->set_attribute('account', $account_second->id);
296  $account_second->value=$this->with_tmp_val;
297  echo '<p>';
298  echo 'Calculer ';
299  echo $sum_type->input();
300  echo '</p>';
301  echo '<p>';
302  echo _('du poste comptable') . '(1)'." ". HtmlInput::infobulle(203);
303  echo $account->input();
304  echo '</p>';
305  echo '<p>';
306  echo _(' utilisé avec le poste comptable'). " " . HtmlInput::infobulle(203);
307  echo $account_second->input();
308  echo '</p>';
309  $this->input_date_paiement();
310  $this->input_ledger();
311  }
312  static function new_row()
313  {
314  $obj=new RAPAV_Account();
315  $obj->input();
316  }
317  function verify()
318  {
319 
320  if (trim($this->tmp_val) == "" || trim($this->with_tmp_val) == "")
321  {
322  $this->errcode = _(" Un poste comptable est manquant");
323  return 1;
324  }
325  return 0;
326  }
327 
328 }
329 
330 /**
331  * @brief poste comptable utilisé avec le poste comptable,
332  * choix entre diff crédit - debit, diff débit-crédit, crédit, débit
333  */
335 {
336 
337  function display_row()
338  {
339  global $cn;
340  $total_type_account = $cn->get_value('select tt_label from rapport_advanced.total_type_account where tt_id=$1', array($this->type_sum_account));
341  $ledger = RAPAV::get_ledger_name($this->jrn_def_id);
342  printf("Total %s poste comptable %s utilisé avec le poste comptable %s rapprochée dans la période donnée
343  avec une opération utilisant le poste comptable %s utilisant $ledger", $total_type_account, $this->tmp_val, $this->with_tmp_val, $this->operation_pcm_val);
344  }
345 
346  function input()
347  {
348  global $cn;
349  $sum_type = new ISelect('account_sum_type');
350  $sum_type->value = $cn->make_array("select tt_id, tt_label from rapport_advanced.total_type_account ");
351  $sum_type->selected=$this->type_sum_account;
352  $account = new IPoste("acrec_first", "", "acrec_first_id");
353  $account->size = 10;
354  $account->label = _("Recherche poste");
355  $account->set_attribute('gDossier', dossier::id());
356  $account->set_attribute('account', $account->id);
357  $account->value=$this->tmp_val;
358 
359  $account_second = new IPoste("acrec_second", "", "acrec_second_id");
360  $account_second->size = 10;
361  $account_second->label = _("Recherche poste");
362  $account_second->set_attribute('gDossier', dossier::id());
363  $account_second->set_attribute('account', $account_second->id);
364  $account_second->value=$this->with_tmp_val;
365 
366  $account_third = new IPoste("acrec_third", "", "acrec_third_id");
367  $account_third->size = 10;
368  $account_third->label = _("Recherche poste");
369  $account_third->set_attribute('gDossier', dossier::id());
370  $account_third->set_attribute('account', $account_third->id);
371  $account_third->value=$this->operation_pcm_val;
372 
373  echo '<p>';
374  echo 'Calculer ';
375  echo $sum_type->input();
376  echo '</p>';
377  echo '<p>';
378  echo 'du poste comptable ' . HtmlInput::infobulle(203);
379  echo $account->input();
380  echo '</p>';
381  echo '<p>';
382  echo ' utilisé avec le poste comptable ' . HtmlInput::infobulle(203);
383  echo $account_second->input();
384  echo '</p>';
385  echo '<p>';
386  echo ' rapproché avec une opération dans la période donnée utilisant le poste comptable ' . HtmlInput::infobulle(203);
387  echo $account_third->input();
388 
389  echo '</p>';
390  $this->input_ledger();
391  }
392  static function new_row()
393  {
394  $obj=new RAPAV_Reconcile();
395  $obj->input();
396  }
397  function verify()
398  {
399 
400  if (trim($this->tmp_val) == "" || trim($this->with_tmp_val) == "" || trim($this->operation_pcm_val) == '')
401  {
402  $this->errcode = " Un poste comptable est manquant";
403  return 1;
404  }
405  return 0;
406  }
407 
408 }
409 
410 ?>
$select_type id
$ret
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
$html
Definition: ajax.php:32
input_date_paiement()
Display a select for the date.
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
static verify_compute($p_formula)
check if the formula is valid, return 1 for an error and set errcode to the error msg errcode is glob...
static str_date_type($p_type)
Compute the string to display for date.
Definition: class_rapav.php:58
manage the table rapport_avance.formulaire_param
input_ledger()
display a choice of ledger cn
$oPeriode p_id
if(isset($_POST['save'])) $tva
static get_ledger_name($p_jrn)
Return the ledger's name of p_jrn.
Definition: class_rapav.php:35
$_REQUEST['sb']
Definition: am_print.php:39
global $cn