Plugins  LAST
 All Data Structures Files Functions Variables Pages
ajax_save_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 sauve la nouvelle ligne de détail (paramètre) et renvoie un xml
27  * avec code = ok ou nok, p_id pk de formulaire_param et html le code html à afficher : soit une ligne à ajouter à la table
28  * soit le message d'erreur à ajouter dans le div
29  *
30  *
31  */
32 require_once NOALYSS_INCLUDE.'/lib/class_impress.php';
33 require_once 'include/class_formulaire_param_detail.php';
34 $fp_id = HtmlInput::default_value_request('fp_id', '-1');
35 switch ($tab)
36 {
37  case 'account_tva':
38  $acc_tva = new RAPAV_Account_Tva($fp_id);
39  $acc_tva->tva_id = $code_tva;
40  $acc_tva->tmp_val = $formtva;
41  $acc_tva->jrn_def_type = $code_jrn;
42  $acc_tva->p_id = $p_id;
43  $acc_tva->type_detail = 2;
44  $acc_tva->tt_id = $code_base;
45  $acc_tva->jrn_def_id = $p_ledger;
46  $acc_tva->date_paid=$p_paid;
47  if ($acc_tva->verify() == 1)
48  {
49  $code = 'nok';
50  $html = "Erreur dans la formule " . $acc_tva->errcode;
51  } else
52  {
53  $acc_tva->save();
54  $code = 'ok';
55  $fp_id = $acc_tva->fp_id;
56  $html = '<td>';
57  ob_start();
58  $acc_tva->display_row();
59  $html.=ob_get_contents();
60  ob_end_clean();
61  $html.= '</td>';
62  $html.=$acc_tva->button_delete();
63  $html.=$acc_tva->button_modify();
64  }
65  break;
66  case 'formula':
67  $acc_formula = new RAPAV_Formula($fp_id);
68  $acc_formula->fp_formula = $formula_new;
69  $acc_formula->p_id = $p_id;
70  $acc_formula->type_detail = 1;
71  $acc_formula->jrn_def_id = $p_ledger;
72  $acc_formula->date_paid=$p_paid;
73  if ($acc_formula->verify() == 1)
74  {
75  $code = 'nok';
76  $html = $acc_formula->errcode;
77  } else
78  {
79  $acc_formula->save();
80  $fp_id = $acc_formula->fp_id;
81  $code = 'ok';
82  $html = '<td>';
83  ob_start();
84  $acc_formula->display_row();
85  $html.=ob_get_contents();
86  ob_end_clean();
87  $html.= '</td>';
88  $html.=$acc_formula->button_delete();
89  $html.=$acc_formula->button_modify();
90  }
91  break;
92  case 'compute_id':
93  $acc_compute = new RAPAV_Compute($fp_id);
94  $acc_compute->fp_formula = $form_compute;
95  $acc_compute->p_id = $p_id;
96  $acc_compute->type_detail = 3;
97  $acc_compute->jrn_def_id = null;
98  if ($acc_compute->verify() == 1)
99  {
100  $code = 'nok';
101  $html = $acc_compute->errcode;
102  } else
103  {
104  $acc_compute->save();
105  $fp_id = $acc_compute->fp_id;
106  $code = 'ok';
107  $html = '<td>';
108  ob_start();
109  $acc_compute->display_row();
110  $html.=ob_get_contents();
111  ob_end_clean();
112  $html.= '</td>';
113  $html.=$acc_compute->button_delete();
114  $html.=$acc_compute->button_modify();
115  }
116  break;
117  case 'new_account_id':
118  $acc_account = new RAPAV_Account($fp_id);
119  $acc_account->tmp_val = $account_first;
120  $acc_account->with_tmp_val = $account_second;
121  $acc_account->p_id = $p_id;
122  $acc_account->type_detail = 4;
123  $acc_account->type_sum_account = $account_sum_type;
124  $acc_account->jrn_def_id = $p_ledger;
125  $acc_account->date_paid=$p_paid;
126  if ($acc_account->verify() == 1)
127  {
128  $code = 'nok';
129  $html = $acc_account->errcode;
130  } else
131  {
132  $code = 'ok';
133  $html = '<td>';
134  $child=HtmlInput::default_value_get("child", 0);
135  if ( $child == 0 )
136  {
137  // Normal : without child
138  $acc_account->save();
139  $fp_id = $acc_account->fp_id;
140  ob_start();
141  $acc_account->display_row();
142  $html.=ob_get_contents();
143  ob_end_clean();
144  $html.= '</td>';
145  $html.=$acc_account->button_delete();
146  $html.=$acc_account->button_modify();
147  } else {
148  // with all children
149  $acc_account->type_detail = 6;
150  $acc_account->save();
151  $fp_id = $acc_account->fp_id;
152  ob_start();
153  $acc_account->display_row();
154  $html.=ob_get_contents();
155  ob_end_clean();
156  $html.= '</td>';
157  $html.=$acc_account->button_delete();
158  $html.=$acc_account->button_modify();
159  }
160  }
161  break;
162 
163  case 'new_reconcile_id':
164  $acc_account = new RAPAV_Reconcile($fp_id);
165  $acc_account->tmp_val = $acrec_first;
166  $acc_account->with_tmp_val = $acrec_second;
167  $acc_account->operation_pcm_val = $acrec_third;
168  $acc_account->p_id = $p_id;
169  $acc_account->type_detail = 5;
170  $acc_account->type_sum_account = $account_sum_type;
171  $acc_account->jrn_def_id = $p_ledger;
172  if ($acc_account->verify() == 1)
173  {
174  $code = 'nok';
175  $html = $acc_account->errcode;
176  } else
177  {
178  $acc_account->save();
179  $fp_id = $acc_account->fp_id;
180  $code = 'ok';
181  $html = '<td>';
182  ob_start();
183  $acc_account->display_row();
184  $html.=ob_get_contents();
185  ob_end_clean();
186  $html.= '</td>';
187  $html.=$acc_account->button_delete();
188  $html.=$acc_account->button_modify();
189  }
190  break;
191 }
192 //echo $html;exit();
193 $html = escape_xml($html);
194 
195 header('Content-type: text/xml; charset=UTF-8');
196 echo <<<EOF
197 <?xml version="1.0" encoding="UTF-8"?>
198 <data>
199 <code>$code</code>
200 <html>$html</html>
201 <p_id>$p_id</p_id>
202 <fp_id>$fp_id</fp_id>
203 </data>
204 EOF;
205 ?>
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
poste comptable utilisé avec le poste comptable, choix entre diff crédit - debit, diff débit-crédit...
switch($tab) $html
$oPeriode p_id