19 require_once
'class_impacc_csv_sale_purchase.php';
32 $cn=Dossier::connect();
39 $all_row=$t->collect_objects(
"where import_id=$1 and id_code_group=$2",
40 array($p_row[
'import_id'],$p_row[
'id_code_group']));
44 $g_parameter->MY_ANALYTIC=
"N";
46 $this->jr_date_paid=$all_row[0]->id_date_payment_conv;
54 $array[
'e_client']=$all_row[0]->id_acc;
55 $array[
'nb_item']=count($all_row);
56 $array[
'e_comm']=$all_row[0]->id_label;
58 $array[
'e_date']=$all_row[0]->id_date_conv;
59 $array[
'e_ech']=$all_row[0]->id_date_limit_conv;
60 $array[
'e_pj']=$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_Sold $p_ledger)
85 $cn=Dossier::connect();
86 $nb_group=count($a_group);
87 for ( $i=0;$i< $nb_group;$i++)
92 $array[
"p_jrn"]=$p_ledger->id;
95 if (trim(
$array[
'e_pj'])==
"")
$array[
"e_pj"]=$p_ledger->guess_pj();
96 $array[
'e_pj_suggest']=$p_ledger->guess_pj();
103 $cn->exec_sql(
"update impacc.import_detail set jr_id=$1 , id_status=2 where id_code_group=$2",
104 array($p_ledger->jr_id,$a_group[$i][
'id_code_group']));
105 $cn->exec_sql(
" update public.jrn set jr_date_paid=to_date($1,'DD.MM.YYYY') where jr_id=$2",
106 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_Sold $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.