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

Different tools used directly by the objects , some parts of this code should Move to the right class in a later development. More...

Collaboration diagram for Impacc_Tool:
Collaboration graph

Static Public Member Functions

static ledger_factory ($p_jrn_def_id)
 Factory pattern to get a ledger of the right type based on $p_jrn_def_id which is the id of the table jrn_def This code should be moved to Acc_Ledger. More...
 
static mark_group_transferred ($p_code_group, $p_import_id)
 Mark a group of rows transferred as a single operation. More...
 
static convert_amount ($p_amount, $p_thousand, $p_decimal)
 convert_amount($array[$i]->id_amount_novat,$this->detail->s_thousand,$this->s_decimal); More...
 
static convert_tva ($p_code)
 Find the correct TVA from the table impacc.parameter_tva. More...
 

Detailed Description

Different tools used directly by the objects , some parts of this code should Move to the right class in a later development.

Definition at line 30 of file class_impacc_tool.php.

Member Function Documentation

static Impacc_Tool::convert_amount (   $p_amount,
  $p_thousand,
  $p_decimal 
)
static

convert_amount($array[$i]->id_amount_novat,$this->detail->s_thousand,$this->s_decimal);

Definition at line 75 of file class_impacc_tool.php.

References $p_amount.

Referenced by Impacc_Csv_Sale_Purchase\check(), Impacc_CSV\check(), Impacc_Verify\check_amount_vat(), and Impacc_Verify\check_quantity().

76  {
77  if ( $p_thousand == 1) $p_amount=str_replace(',', '', $p_amount);
78  if ( $p_thousand == 2) $p_amount=str_replace('.', '', $p_amount);
79  if ($p_decimal == 1) $p_amount=str_replace(',', '.', $p_amount);
80  return $p_amount;
81  }
static Impacc_Tool::convert_tva (   $p_code)
static

Find the correct TVA from the table impacc.parameter_tva.

Parameters
$p_codeis the tva code from the file

Definition at line 85 of file class_impacc_tool.php.

References $cn, and $tva_id.

Referenced by Impacc_Csv_Sale\adapt(), and Impacc_Csv_Purchase\adapt().

86  {
87  $cn=Dossier::connect();
88  $tva_id=$cn->get_value("select tva_id from impacc.parameter_tva where tva_code=$1",array($p_code));
89  return $tva_id;
90  }
global $cn
static Impacc_Tool::ledger_factory (   $p_jrn_def_id)
static

Factory pattern to get a ledger of the right type based on $p_jrn_def_id which is the id of the table jrn_def This code should be moved to Acc_Ledger.

Parameters
$p_jrn_def_idis the id of the ledger
Returns
Acc_Ledger , Acc_Ledger_Purchase , Acc_Ledger_Fin or Acc_Ledger_Sold
Exceptions
Exceptionif no ledger is found

Definition at line 39 of file class_impacc_tool.php.

References $cn, and $ledger.

Referenced by Impacc_CSV\transfer().

40  {
41  $cn=Dossier::connect();
42  $tmp=new Acc_Ledger($cn, $p_jrn_def_id);
43  $ledger=null;
44  switch ($tmp->get_type())
45  {
46  case "ACH":
47  $ledger=new Acc_Ledger_Purchase($cn, $p_jrn_def_id);
48  break;
49  case "ODS":
50  $ledger=new Acc_Ledger($cn, $p_jrn_def_id);
51  break;
52  case "VEN":
53  $ledger=new Acc_Ledger_Sold($cn, $p_jrn_def_id);
54  break;
55  case "FIN":
56  $ledger=new Acc_Ledger_Fin($cn, $p_jrn_def_id);
57  break;
58 
59  default:
60  throw new Exception(_("journal inconnu"), 1);
61  break;
62  }
63  return $ledger;
64  }
global $cn
static Impacc_Tool::mark_group_transferred (   $p_code_group,
  $p_import_id 
)
static

Mark a group of rows transferred as a single operation.

Parameters
$p_code_groupis import_detail::id_code_group
$p_import_idimport id (import_file.id = import_detail.import_id)

Definition at line 68 of file class_impacc_tool.php.

References $cn, and $sql.

69  {
70  $cn=Dossier::connect();
71  $sql=" update impacc.import_detail set id_status=2 where id_code_group=$1 and import_id=$2 ";
72  $cn->exec_sql($sql, array($p_code_group,$p_import_id));
73  }
$sql
global $cn

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