For Ledger of style SALE.
More...
|
| adapt ($p_row) |
| Transform a group of rows to an array and set $jr_date_paid useable by Acc_Ledger_Sold::insert. More...
|
|
| insert ($a_group, Acc_Ledger_Purchase $p_ledger) |
| Transfer operation with the status correct to the accountancy . More...
|
|
| transform ($ledger_id, $import_id) |
| Works by id_group_code : all the rows with the same id_code_group belong to the same operation The operation will be written in the right ledger Only operation with a id_status = 0 can be transferred , -1 is in error and 1 means that it has already been transferred. More...
|
|
| check_nb_column () |
|
| record (Impacc_Csv $p_csv, Impacc_File $p_file) |
| insert file into the table import_detail More...
|
|
For Ledger of style SALE.
Definition at line 23 of file class_impacc_csv_purchase.php.
Impacc_Csv_Purchase::adapt |
( |
|
$p_row | ) |
|
Transform a group of rows to an array and set $jr_date_paid useable by Acc_Ledger_Sold::insert.
Definition at line 30 of file class_impacc_csv_purchase.php.
References $array, $cn, $g_parameter, $nb_row, and Impacc_Tool\convert_tva().
Referenced by insert().
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;
if(isset($_POST['remove'])) $array
Check if Data are valid for one row.
- Parameters
-
$row | is an Impacc_Import_detail_SQL object |
$p_format_date | check for date_limit and date_payment |
$p_thousand | separator for thousands |
$p_decimal | separator for decimal |
- Check VAT CODE
- Check Date payment
- Check Date limit
- Check Amount VAT
- Check Quantity
Definition at line 50 of file class_impacc_csv_sale_purchase.php.
References $date, Impacc_Verify\check_date(), Impacc_Verify\check_tva(), and Impacc_Tool\convert_amount().
Referenced by Impacc_CSV\check().
53 $and=($row->id_message==
"")?
"":
",";
59 $row->id_message=$and.
"CK_TVA_INVALID";
65 if ($row->id_date_payment!=
"")
70 $row->id_message=$and.
"CK_FORMAT_DATE";
73 $row->id_date_payment_conv=
$date;
79 if ($row->id_date_limit!=
"")
84 $row->id_message=$and.
"CK_FORMAT_DATE";
87 $row->id_date_limit_conv=
$date;
95 $p_thousand, $p_decimal);
96 if (isNumber($row->id_amount_vat_conv)==0)
98 $and=($row->id_message==
"")?
"":
",";
99 $row->id_message.=$and.
"CK_INVALID_AMOUNT";
105 $p_thousand, $p_decimal);
106 if (isNumber($row->id_quant_conv)==0)
108 $row->id_message.=$and.
"CK_INVALID_AMOUNT";
static check_date($p_date, $p_format_date)
Check that the date payment has valid format . Return false or.
static check_tva($p_tva_code)
Check that TVA_CODE does exist , return true if exists otherwise false.
Impacc_Csv_Sale_Purchase::check_nb_column |
( |
| ) |
|
|
inherited |
Impacc_Csv_Purchase::insert |
( |
|
$a_group, |
|
|
Acc_Ledger_Purchase |
$p_ledger |
|
) |
| |
Transfer operation with the status correct to the accountancy .
Change the status of the row (id_status to 1) after because it can transferred several rows in one operation
Definition at line 83 of file class_impacc_csv_purchase.php.
References $array, $cn, and adapt().
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.
if(isset($_POST['remove'])) $array
Impacc_Csv_Sale_Purchase::record |
( |
Impacc_Csv |
$p_csv, |
|
|
Impacc_File |
$p_file |
|
) |
| |
|
inherited |
insert file into the table import_detail
Definition at line 121 of file class_impacc_csv_sale_purchase.php.
References $aseparator, $cn, $error, $nb_row, and $row.
125 $hFile=fopen($p_file->import_file->i_tmpname,
"r");
127 $cn=Dossier::connect();
128 $delimiter=$aseparator[$p_csv->detail->s_delimiter-1][
'label'];
129 if ($p_csv->detail->s_surround==
""){
130 $p_csv->detail->s_surround=
'"';
133 while (
$row=fgetcsv($hFile, 0, $delimiter, $p_csv->detail->s_surround))
137 $insert->import_id=$p_file->import_file->id;
140 $insert->id_status=-1;
141 $insert->id_message=join(
$row, $delimiter);
146 $insert->id_date=
$row[0];
147 $insert->id_code_group=
$row[1];
148 $insert->id_acc=
$row[2];
149 $insert->id_pj=
$row[3];
150 $insert->id_label=
$row[4];
151 $insert->id_acc_second=
$row[5];
152 $insert->id_quant=
$row[6];
153 $insert->id_amount_novat=
$row[7];
154 $insert->tva_code=
$row[8];
155 $insert->id_amount_vat=
$row[9];
156 $date_limit=(isset(
$row[10]))?
$row[10]:
"";
157 $insert->id_date_limit=$date_limit;
158 $date_payment=(isset(
$row[11]))?
$row[11]:
"";
159 $insert->id_date_payment=$date_payment;
160 $insert->id_nb_row=0;
for($i=0;$i< Database::num_row($ret);$i++) $row
Impacc_Csv_Sale_Purchase::transform |
( |
|
$ledger_id, |
|
|
|
$import_id |
|
) |
| |
|
inherited |
Works by id_group_code : all the rows with the same id_code_group belong to the same operation The operation will be written in the right ledger Only operation with a id_status = 0 can be transferred , -1 is in error and 1 means that it has already been transferred.
Definition at line 38 of file class_impacc_csv_sale_purchase.php.
40 throw new Exception(
"Not Yet Implemented");
Impacc_Csv_Purchase::$jr_date_paid |
|
private |
The documentation for this class was generated from the following file: