Plugins  LAST
 All Data Structures Files Functions Variables Pages
Public Member Functions
Impacc_Csv_Bank Class Reference

Filter for the Financial format. More...

Collaboration diagram for Impacc_Csv_Bank:
Collaboration graph

Public Member Functions

 record (Impacc_Csv $p_csv, Impacc_File $p_file)
 insert file into the table import_detail More...
 
 adapt ($p_row)
 Transform a group of rows to an array and set $jr_date_paid. More...
 
 insert ($a_group, Acc_Ledger_Fin $p_ledger)
 Transfer operation with the status correct to the accountancy . More...
 

Detailed Description

Filter for the Financial format.

Definition at line 29 of file class_impacc_csv_bank.php.

Member Function Documentation

Impacc_Csv_Bank::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 68 of file class_impacc_csv_bank.php.

References $array, $cn, and $g_parameter.

Referenced by insert().

69  {
70  bcscale(4);
71  $cn=Dossier::connect();
72 
73  // Get the code_group
74  $code_group=$p_row;
75 
76  // get all rows from this group
78  $all_row=$t->collect_objects("where import_id=$1 and id_code_group=$2",
79  array($p_row['import_id'],$p_row['id_code_group']));
80 
81  // No block due to analytic
82  global $g_parameter;
83  $g_parameter->MY_ANALYTIC="N";
84 
85  // Initialise the array
86  $array=array();
87  // The first row gives all the information , the others of the group
88  // add services
89  $array['nb_item']=count($all_row); // must == 1
90  $array['chdate']=2; // must == 1
91  $array['e_other0']=$all_row[0]->id_acc;
92  $array['e_concerned0']="";
93  $array['e_other0_comment']=$all_row[0]->id_label;
94  // Must be transformed into DD.MM.YYYY
95  $array['dateop0']=$all_row[0]->id_date_conv;
96  $array['e_pj']=$all_row[0]->id_pj;
97 
98  $array['mt']=microtime();
99  $array['jrn_type']='FIN';
100  $array["e_other0_amount"]=$all_row[0]->id_amount_novat;
101  return $array;
102  }
global $g_parameter
Definition: ajax.php:27
if(isset($_POST['remove'])) $array
global $cn
Impacc_Csv_Bank::insert (   $a_group,
Acc_Ledger_Fin  $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 106 of file class_impacc_csv_bank.php.

References $array, $cn, and adapt().

107  {
108  $cn=Dossier::connect();
109  $nb_group=count($a_group);
110  for ( $i=0;$i< $nb_group;$i++)
111  {
112  $array=$this->adapt($a_group[$i]);
113 
114  //Complete the array
115  $array["p_jrn"]=$p_ledger->id;
116 
117  //Receipt
118  if (trim($array['e_pj'])=="") $array["e_pj"]=$p_ledger->guess_pj();
119  $array['e_pj_suggest']=$p_ledger->guess_pj();
120 
121  // Because of a bug in Acc_Ledger_Fin we have to unset this
122  // global variable
123  unset($_FILES);
124 
125  // Insert
126  $p_ledger->insert($array);
127 
128  // Update this group , status = 2 , jr_id
129  // and date_payment
130  $cn->exec_sql("update impacc.import_detail set id_status=2 where id_code_group=$1",
131  array($a_group[$i]['id_code_group']));
132 
133  }
134 
135  }
adapt($p_row)
Transform a group of rows to an array and set $jr_date_paid.
if(isset($_POST['remove'])) $array
global $cn
Impacc_Csv_Bank::record ( Impacc_Csv  $p_csv,
Impacc_File  $p_file 
)

insert file into the table import_detail

Definition at line 34 of file class_impacc_csv_bank.php.

References $aseparator, $cn, $nb_row, $row, and while.

35  {
36  global $aseparator;
37  // Open the CSV file
38  $hFile=fopen($p_file->import_file->i_tmpname, "r");
39  $cn=Dossier::connect();
40  $delimiter=$aseparator[$p_csv->detail->s_delimiter-1]['label'];
41  $surrount=($p_csv->detail->s_surround=="")?'"':$p_csv->detail->s_surround;
42  //---- For each row ---
43  while ($row=fgetcsv($hFile, 0,$delimiter ,$surrount ))
44  {
45  $insert=new Impacc_Import_detail_SQL($cn);
46  $insert->import_id=$p_file->import_file->id;
47  $nb_row=count($row);
48  if ($nb_row<5)
49  {
50  $insert->id_status=-1;
51  $insert->id_message=join($row,$delimiter );
52  }
53  else
54  {
55  $insert->id_date=$row[0];
56  $insert->id_code_group=$row[1];
57  $insert->id_acc=$row[2];
58  $insert->id_pj=$row[3];
59  $insert->id_label=$row[4];
60  $insert->id_amount_novat=$row[5];
61  }
62  $insert->insert();
63  }
64 
65  }
while(($row=fgetcsv($fbank, 0, $sp))!==false)
for($i=0;$i< Database::num_row($ret);$i++) $row
global $aseparator
$nb_row
Definition: search_view.php:6
global $cn

The documentation for this class was generated from the following file: