25 require_once NOALYSS_INCLUDE.
'/class/class_pre_operation.php';
37 $this->operation->od_direct=
'f';
43 $this->operation->od_direct=
'f';
44 $this->e_client=
$_POST[
'e_client'];
45 for ($i=0;$i<$this->operation->nb_item;$i++)
48 $this->$march=
$_POST[
'e_march'.$i];
49 $this->{
"e_march".$i.
"_price"}=(isset (
$_POST[
'e_march'.$i.
"_price"]))?
$_POST[
'e_march'.$i.
"_price"]:0;
50 $this->{
"e_march".$i.
"_price"}=(
trim(
$_POST[
'e_march'.$i.
"_price"])==
"")?0:
$_POST[
'e_march'.$i.
"_price"];
51 $this->{
"e_march".$i.
"_tva_id"}=(isset (
$_POST[
'e_march'.$i.
"_tva_id"]))?
$_POST[
'e_march'.$i.
"_tva_id"]:0;
52 $this->{
"e_march".$i.
"_tva_amount"}=(isset(
$_POST[
'e_march'.$i.
"_tva_amount"]))?
$_POST[
'e_march'.$i.
"_tva_amount"]:0;
53 $this->{
"e_march".$i.
"_label"}=(isset(
$_POST[
'e_march'.$i.
"_label"]))?
$_POST[
'e_march'.$i.
"_label"]:null;
54 $this->{
"e_quant".$i}=
$_POST[
'e_quant'.$i];
68 if ($this->operation->save() ==
false )
71 $sql=sprintf(
'insert into op_predef_detail (od_id,opd_poste,opd_debit)'.
74 $this->operation->od_id,
79 for ($i=0;$i<$this->operation->nb_item;$i++)
81 if ( strlen(
trim($this->{
"e_march".$i}))==
"")
continue;
82 $sql=
'insert into op_predef_detail (opd_poste,'
91 ' values ($1,$2,$3,$4,$5,$6,$7,$8)';
93 array($this->{
"e_march".$i},
94 $this->{
"e_march".$i.
"_price"},
95 $this->{
"e_march".$i.
"_tva_id"},
96 $this->{
"e_quant".$i},
98 $this->operation->od_id,
99 $this->{
"e_march".$i.
"_tva_amount"},
100 $this->{
"e_march".$i.
"_label"},
106 echo ($e->getMessage());
107 $this->
db->rollback();
117 $a_op=$this->operation->load();
118 $array=$this->operation->compute_array($a_op);
120 if ( empty (
$p_array))
return array();
123 if ( $row[
'opd_debit']==
'f')
125 $array+=array(
'e_client'=>$row[
'opd_poste']);
129 if (
trim($row[
'opd_poste']) !=
"" )
132 "e_march".
$count.
"_price"=>$row[
'opd_amount'],
133 "e_march".$count.
"_tva_id"=>$row[
'opd_tva_id'],
134 "e_march".$count.
"_tva_amount"=>$row[
'opd_tva_amount'],
135 "e_quant".$count=>$row[
'opd_quantity']
151 $sql=
"select opd_id,opd_poste,opd_amount,opd_tva_id,opd_debit,".
152 " opd_quantity,opd_tva_amount from op_predef_detail where od_id=".$this->operation->od_id.
160 $this->operation->od_id=
$p_id;
164 require_once NOALYSS_INCLUDE.
'/class/class_acc_ledger_purchase.php';
170 $flag_tva=$g_parameter->MY_TVA_USE;
172 $f_add_button=
new IButton(
'add_card');
173 $f_add_button->label=_(
'Créer une nouvelle fiche');
174 $f_add_button->tabindex=-1;
175 $f_add_button->set_attribute(
'ipopup',
'ipop_newcard');
176 $f_add_button->set_attribute(
'jrn',$this->jrn_def_id);
177 $f_add_button->javascript=
" this.jrn=\$('p_jrn').value;select_card_type(this);";
179 $f_add_button2=
new IButton(
'add_card2');
180 $f_add_button2->tabindex=-1;
181 $f_add_button2->label=_(
'Créer une nouvelle fiche');
182 $f_add_button2->set_attribute(
'ipopup',
'ipop_newcard');
183 $f_add_button2->set_attribute(
'filter',
$ledger->get_all_fiche_def ());
185 $f_add_button2->javascript=
" this.jrn=\$('p_jrn').value;select_card_type(this);";
188 if ($g_user->check_action(
FICADD)==1)
190 $str_add_button=$f_add_button->input();
191 $str_add_button2=$f_add_button2->input();
195 $r.=dossier::hidden();
196 $f_legend=_(
"En-tête facture fournisseur");
197 $f_legend_detail=_(
"Détail articles acheté");
210 $e_client=( isset ($e_client) )?$e_client:
"";
211 $e_client_label=
" ";
217 if ( strlen(
trim($e_client)) != 0)
220 $fClient->get_by_qcode($e_client);
230 $W1->label=_(
"Fournisseur ").HtmlInput::infobulle(0) ;
231 $W1->name=
"e_client";
233 $W1->value=$e_client;
235 $W1->set_dblclick(
"fill_ipopcard(this);");
236 $W1->set_attribute(
'ipopup',
'ipopcard');
239 $W1->set_attribute(
'label',
'e_client_label');
241 $W1->set_attribute(
'typecard',
'cred');
244 $W1->set_callback(
'filter_card');
245 $W1->set_function(
'fill_data');
246 $W1->javascript=sprintf(
' onchange="fill_data_onchange(\'%s\');" ',
248 $f_client_qcode=$W1->input();
249 $client_label=
new ISpan();
250 $client_label->table=0;
251 $f_client=$client_label->input(
"e_client_label",$e_client_label);
252 $f_client_bt=$W1->search();
257 $p_article= ( isset ($nb_item))?$nb_item:
$min;
260 $e_comment=(isset($e_comment))?$e_comment:
"";
262 $r.=$Hid->input(
"nb_item",$p_article);
265 for ($i=0;$i<
$max ;$i++)
269 $march=(isset(${
"e_march$i"}))?${
"e_march$i"}:
"" ;
270 $march_price=(isset(${
"e_march".$i.
"_price"}))?${
"e_march".$i.
"_price"}:
""
273 if ( $g_parameter->MY_TVA_USE==
'Y')
275 $march_tva_id=(isset(${
"e_march$i".
"_tva_id"}))?${
"e_march$i".
"_tva_id"}:
"";
276 $march_tva_amount=(isset(${
"e_march$i".
"_tva_amount"}))?${
"e_march$i".
"_tva_amount"}:
"";
281 $march_label=(isset(${
"e_march".$i.
"_label"}))?${
"e_march".$i.
"_label"}:
"";
284 if ( strlen(
trim($march))!=0 && strlen(
trim($march_label))==0 )
287 $fMarch->get_by_qcode($march);
290 if ( ! isset($march_tva_id) && $g_parameter->MY_TVA_USE==
'Y' )
297 $W1->name=
"e_march".$i;
300 $W1->set_dblclick(
"fill_ipopcard(this);");
301 $W1->set_attribute(
'ipopup',
'ipopcard');
303 $W1->set_attribute(
'typecard',
'deb');
306 $W1->set_attribute(
'label',
'e_march'.$i.
'_label');
308 $W1->set_attribute(
'purchase',
'e_march'.$i.
'_price');
309 $W1->set_attribute(
'price',
'e_march'.$i.
'_price');
312 $W1->set_attribute(
'tvaid',
'e_march'.$i.
'_tva_id');
314 $W1->set_callback(
'filter_card');
315 $W1->set_function(
'fill_data');
316 $W1->javascript=sprintf(
' onchange="fill_data_onchange(\'%s\');" ',
319 $array[$i][
'quick_code']=$W1->input();
320 $array[$i][
'bt']=$W1->search();
324 if ( $g_parameter->MY_TVA_USE==
'Y')
329 if ( $g_parameter->MY_TVA_USE==
'Y')
330 $tvac=
new INum(
'tvac_march'.$i);
332 $tvac=
new IHidden(
'tvac_march'.$i);
336 $array[$i][
'tvac']=$tvac->input();
338 $htva=
new INum(
'htva_march'.$i);
342 $array[$i][
'htva']=$htva->input();
344 if ( $g_parameter->MY_UPDLAB ==
'Y')
346 $Span=
new IText(
"e_march".$i.
"_label");
347 $Span->css_size=
"100%";
350 $Span=
new ISpan(
"e_march".$i.
"_label");
352 $Span->value=$march_label;
353 $Span->setReadOnly(
false);
356 $array[$i][
'denom']=$Span->input(
"e_march".$i.
"_label",$march_label);
360 $Price->setReadOnly(
false);
362 $Price->javascript=
"onBlur='format_number(this);clean_tva($i);compute_ledger($i)'";
363 $array[$i][
'pu']=$Price->input(
"e_march".$i.
"_price",$march_price);
364 if ( $g_parameter->MY_TVA_USE==
'Y')
370 $Tva->js=
"onblur=\"format_number(this);onChange=clean_tva($i);compute_ledger($i)\"";
372 $Tva->set_attribute(
'compute',$i);
373 $Tva->value=$march_tva_id;
374 $array[$i][
'tva']=$Tva->input(
"e_march$i".
"_tva_id");
379 $Tva_amount=
new INum();
380 $Tva_amount->setReadOnly(
false);
382 $Tva_amount->javascript=
"onBlur='format_number(this);compute_ledger($i)'";
383 $array[$i][
'amount_tva']=$Tva_amount->input(
"e_march".$i.
"_tva_amount",$march_tva_amount);
387 $quant=(isset(${
"e_quant$i"}))?${
"e_quant$i"}:
"1"
389 $Quantity=
new INum();
390 $Quantity->setReadOnly(
false);
392 $Quantity->javascript=
"onChange=format_number(this);clean_tva($i);compute_ledger($i)";
393 $array[$i][
'quantity']=$Quantity->input(
"e_quant".$i,$quant);
396 $f_type=_(
'Fournisseur');
399 require_once NOALYSS_TEMPLATE.
'/predf_ledger_detail.php';
400 $r.=ob_get_contents();
static fetch_all($ret)
wrapper for the function pg_fetch_all
Handle the ledger of purchase,.
compute_array()
compute an array accordingly with the FormVenView function
if(!isset($_REQUEST['act'])||!isset($_REQUEST['jr_id'])||!isset($_REQUEST['div'])) global $g_parameter
define Class fiche and fiche def, those class are using class attribut. When adding or modifing new c...
concerns the predefined operation for ACH ledger
global $g_user
Find the default module or the first one.
function trim(s)
remove trailing and heading space
mother of the pre_op_XXX, it contains only one data : an object Pre_Operation. The child class contai...
load()
load the data from the database and return an array
save()
save the detail and op in the database
Input HTML for the card show buttons, in the file, you have to add card.js How to use : ...
__construct($cn, $p_id=0)
This class handles only the numeric input, the input will call a javascript to change comma to period...