20 require_once
'class_impacc_csv_sale_purchase.php';
33 $cn=Dossier::connect();
40 $all_row=$t->collect_objects(
"where import_id=$1 and id_code_group=$2",
41 array($p_row[
'import_id'],$p_row[
'id_code_group']));
45 $g_parameter->MY_ANALYTIC=
"N";
47 $this->jr_date_paid=$all_row[0]->id_date_payment_conv;
55 $array[
'e_client']=$all_row[0]->id_acc;
56 $array[
'nb_item']=count($all_row);
57 $array[
'e_comm']=$all_row[0]->id_label;
59 $array[
'e_date']=$all_row[0]->id_date_conv;
60 $array[
'e_ech']=$all_row[0]->id_date_limit_conv;
61 $array[
'e_pj']=trim($all_row[0]->id_pj);
67 $array[
"e_march".$i]=$all_row[$i]->id_acc_second;
68 $price=$all_row[$i]->id_amount_novat_conv;
69 $quant=($all_row[$i]->id_quant_conv<>0)?$all_row[$i]->id_quant_conv:1;
70 $pricetax=$all_row[$i]->id_amount_vat_conv;
71 $price_unit=bcdiv($price,$quant);
72 $array[
"e_march".$i.
"_price"]=$price_unit;
73 $array[
"e_march".$i.
"_label"]=$all_row[$i]->id_label;
75 $array[
"e_march".$i.
"_tva_amount"]=bcsub($pricetax,$price);
76 $array[
"e_quant".$i]=$quant;
83 function insert($a_group, Acc_Ledger_Purchase $p_ledger)
85 $cn=Dossier::connect();
86 $nb_group=count($a_group);
87 for ( $i=0;$i< $nb_group;$i++)
93 $array[
"p_jrn"]=$p_ledger->id;
96 if (trim(
$array[
'e_pj'])==
"")
$array[
"e_pj"]=$p_ledger->guess_pj();
97 $array[
'e_pj_suggest']=$p_ledger->guess_pj();
102 $cn->exec_sql(
"update impacc.import_detail set jr_id=$1 , id_status=2 where id_code_group=$2",
103 array($p_ledger->jr_id,$a_group[$i][
'id_code_group']));
104 $cn->exec_sql(
" update public.jrn set jr_date_paid=to_date($1,'DD.MM.YYYY') where jr_id=$2",
105 array($this->jr_date_paid,$p_ledger->jr_id));
adapt($p_row)
Transform a group of rows to an array and set $jr_date_paid useable by Acc_Ledger_Sold::insert.
insert($a_group, Acc_Ledger_Purchase $p_ledger)
Transfer operation with the status correct to the accountancy .
if(isset($_POST['remove'])) $array
$jr_date_paid
< date_paid will introduced after insert
Manage one row of operation of Sale / Purchase for importing them.
For Ledger of style SALE.