diff --git a/include/class/acc_ledger_history_generic.class.php b/include/class/acc_ledger_history_generic.class.php index 3b7a90c23..284cbb548 100644 --- a/include/class/acc_ledger_history_generic.class.php +++ b/include/class/acc_ledger_history_generic.class.php @@ -325,10 +325,10 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History /* if ND */ if ($p_array['jrn_def_type']=='ACH') { - $purchase=new Gestion_Purchase($this->db); - $purchase->search_by_jid($code['j_id']); - $purchase->load(); - $dep_priv+=$purchase->qp_dep_priv; + $qp_id=$this->get_value("select qp_id from quant_purchase where j_id=$1",[$code['j_id']]); + $purchase=new Quant_Purchase_SQL($this->db,$qp_id); + + $dep_priv=bcadd ($dep_priv,$purchase->qp_dep_priv); $p_array['dep_priv']=$dep_priv; $p_array['dna']=bcadd($p_array['dna'], $purchase->qp_nd_amount); $p_array['tva_dna']=bcadd($p_array['tva_dna'], @@ -338,9 +338,8 @@ class Acc_Ledger_History_Generic extends Acc_Ledger_History } if ($p_array['jrn_def_type']=='VEN') { - $sold=new gestion_sold($this->db); - $sold->search_by_jid($code['j_id']); - $sold->load(); + $qs_id=$this->db->get_value("select qs_id from quant_sold where j_id=$1",array($code['j_id'])); + $sold=new Quant_Sold_SQL($this->db,$qs_id); $p_array['tva_np']=bcadd($sold->qs_vat_sided, $p_array['tva_np']); } } diff --git a/include/class/gestion_purchase.class.php b/include/class/gestion_purchase.class.php deleted file mode 100644 index 152e65142..000000000 --- a/include/class/gestion_purchase.class.php +++ /dev/null @@ -1,127 +0,0 @@ -qp_internal=="") - throw new Exception(__FILE__.__LINE__." qs_internal est vide"); - $sql="select qp_id, - qp_internal, - qp_fiche, - qp_quantite, - qp_price, - qp_vat, - qp_vat_code, - tva_rate, - tva_label, - qp_nd_amount, - qp_nd_tva, - qp_nd_tva_recup, - qp_supplier, - j_id, - qp_dep_priv, - qp_vat_sided - from quant_purchase left join tva_rate on (qp_vat_code=tva_id) - where qp_internal='".$this->qp_internal."'"; - $ret=$this->db->exec_sql($sql); - // $res contains all the line - $res=Database::fetch_all($ret); - - if ( sizeof($res)==0) return null; - $count=0; - foreach ($res as $row) - { - $t_gestion_purchase=new gestion_purchase($this->db); - foreach ($row as $idx=>$value) - $t_gestion_purchase->$idx=$value; - $array[$count]=clone $t_gestion_purchase; - $count++; - } - return $array; - } - function search_by_jid($p_jid) - { - $res=$this->db->exec_sql("select qp_id from quant_purchase where j_id=".$p_jid); - - if ( Database::num_row($res) == 1) - $this->qp_id=Database::fetch_result($res,0,0); - else - $this->qp_id=0; - } - function load() - { - $sql="select qp_id, - qp_internal, - qp_fiche, - qp_quantite, - qp_price, - qp_vat, - qp_vat_code, - qp_nd_amount, - qp_nd_tva, - qp_nd_tva_recup, - qp_supplier, - j_id, - qp_dep_priv, - qp_vat_sided - from quant_purchase - where qp_id=".$this->qp_id; - $ret=$this->db->exec_sql($sql); - // $res contains all the line - $res=Database::fetch_all($ret); - - if ( empty($res) ) return null; - foreach ($res[0] as $idx=>$value) - $this->$idx=$value; - - } - -} diff --git a/include/class/gestion_sold.class.php b/include/class/gestion_sold.class.php deleted file mode 100644 index 5127ffd30..000000000 --- a/include/class/gestion_sold.class.php +++ /dev/null @@ -1,114 +0,0 @@ -qs_internal=="") - throw new Exception(__FILE__.__LINE__." qs_internal est vide"); - $sql="select qs_id, - qs_internal, - qs_fiche, - qs_quantite, - qs_price, - qs_vat, - tva_label, - tva_rate, - qs_vat_code, - qs_client, - j_id, - qs_vat_sided - from quant_sold left join tva_rate on (qs_vat_code=tva_id) - where qs_internal='".$this->qs_internal."'"; - $ret=$this->db->exec_sql($sql); - // $res contains all the line - $res=Database::fetch_all($ret); - - if ( $res == FALSE || sizeof($res)==0) return null; - $count=0; - - foreach ($res as $row) - { - $t_gestion_sold=new gestion_sold($this->db); - foreach ($row as $idx=>$value) - $t_gestion_sold->$idx=$value; - $array[$count]=clone $t_gestion_sold; - $count++; - } - return $array; - } - function search_by_jid($p_jid) - { - $res=$this->db->exec_sql("select qs_id from quant_sold where j_id=".$p_jid); - - if ( Database::num_row($res) == 1) - $this->qs_id=Database::fetch_result($res,0,0); - else - $this->qs_id=0; - } - function load() - { - $sql=" select qs_id, - qs_internal, - qs_fiche, - qs_quantite, - qs_price, - qs_vat, - qs_vat_code, - qs_client, - j_id, - qs_vat_sided - from quant_sold - where qs_id=$1"; - $ret=$this->db->exec_sql($sql,array($this->qs_id)); - // $res contains all the line - $res=Database::fetch_all($ret); - - if ( $res==FALSE || empty($res) ) return null; - foreach ($res[0] as $idx=>$value) - $this->$idx=$value; - } -} diff --git a/include/class/gestion_table.class.php b/include/class/gestion_table.class.php deleted file mode 100644 index d5e0a8160..000000000 --- a/include/class/gestion_table.class.php +++ /dev/null @@ -1,37 +0,0 @@ -db=$p_cn; - } -} diff --git a/include/constant.php b/include/constant.php index bda9ea591..884f5f72f 100644 --- a/include/constant.php +++ b/include/constant.php @@ -450,10 +450,6 @@ function noalyss_class_autoloader($class) { "forecast_category_mtable" => "class/forecast_category_mtable.class.php", "forecast" => "class/forecast.class.php", "forecast_item_mtable" => "class/forecast_item_mtable.class.php", - "gestion_purchase" => "class/gestion_purchase.class.php", - "gestion_sold" => "class/gestion_sold.class.php", - "gestion_table" => "class/gestion_table.class.php", - "html_input_noalyss" => "class/html_input_noalyss.class.php", "lettering" => "class/lettering.class.php", "lettering_card" => "class/lettering.class.php", "lettering_account" => "class/lettering.class.php", @@ -599,7 +595,8 @@ function noalyss_class_autoloader($class) { "document_state_mtable"=>"class/document_state_mtable.class.php", "noalyss\mobile"=>"class/mobile.class.php", "profile_mobile_sql"=>"database/profile_mobile_sql.class.php", - "mobile_device_mtable"=>"class/mobile_device_mtable.class.php" + "mobile_device_mtable"=>"class/mobile_device_mtable.class.php", + "html_input_noalyss"=>"class/html_input_noalyss.class.php" ); if ( isset ($aClass[$class]) ) { require_once NOALYSS_INCLUDE."/".$aClass[$class]; diff --git a/include/database/quant_fin_sql.class.php b/include/database/quant_fin_sql.class.php new file mode 100644 index 000000000..34f88acb0 --- /dev/null +++ b/include/database/quant_fin_sql.class.php @@ -0,0 +1,78 @@ +table = "public.quant_fin"; + $this->primary_key = "qf_id"; + /* + * List of columns + */ + $this->name = array( + "qf_id" => "qf_id" + , "qf_bank" => "qf_bank" + , "jr_id" => "jr_id" + , "qf_other" => "qf_other" + , "qf_amount" => "qf_amount" + , "j_id" => "j_id" + ); + /* + * Type of columns + */ + $this->type = array( + "qf_id" => "numeric" + , "qf_bank" => "numeric" + , "jr_id" => "numeric" + , "qf_other" => "numeric" + , "qf_amount" => "numeric" + , "j_id" => "numeric" + ); + + + $this->default = array( + "qf_id" => "auto" + ); + + $this->date_format = "DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + + +} \ No newline at end of file diff --git a/include/database/quant_purchase_sql.class.php b/include/database/quant_purchase_sql.class.php new file mode 100644 index 000000000..27325f6b5 --- /dev/null +++ b/include/database/quant_purchase_sql.class.php @@ -0,0 +1,97 @@ +table = "public.quant_purchase"; + $this->primary_key = "qp_id"; + /* + * List of columns + */ + $this->name = array( + "qp_id" => "qp_id" + , "qp_internal" => "qp_internal" + , "j_id" => "j_id" + , "qp_fiche" => "qp_fiche" + , "qp_quantite" => "qp_quantite" + , "qp_price" => "qp_price" + , "qp_vat" => "qp_vat" + , "qp_vat_code" => "qp_vat_code" + , "qp_nd_amount" => "qp_nd_amount" + , "qp_nd_tva" => "qp_nd_tva" + , "qp_nd_tva_recup" => "qp_nd_tva_recup" + , "qp_supplier" => "qp_supplier" + , "qp_valid" => "qp_valid" + , "qp_dep_priv" => "qp_dep_priv" + , "qp_vat_sided" => "qp_vat_sided" + , "qp_unit" => "qp_unit" + ); + /* + * Type of columns + */ + $this->type = array( + "qp_id" => "numeric" + , "qp_internal" => "text" + , "j_id" => "numeric" + , "qp_fiche" => "numeric" + , "qp_quantite" => "numeric" + , "qp_price" => "numeric" + , "qp_vat" => "numeric" + , "qp_vat_code" => "numeric" + , "qp_nd_amount" => "numeric" + , "qp_nd_tva" => "numeric" + , "qp_nd_tva_recup" => "numeric" + , "qp_supplier" => "numeric" + , "qp_valid" => "text" + , "qp_dep_priv" => "numeric" + , "qp_vat_sided" => "numeric" + , "qp_unit" => "numeric" + ); + + + $this->default = array( + "qp_id" => "auto" + ); + + $this->date_format = "DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + + +} \ No newline at end of file diff --git a/include/database/quant_sold.class.php b/include/database/quant_sold.class.php new file mode 100644 index 000000000..5eb1b78a1 --- /dev/null +++ b/include/database/quant_sold.class.php @@ -0,0 +1,88 @@ +table = "public.quant_sold"; + $this->primary_key = "qs_id"; + /* + * List of columns + */ + $this->name = array( + "qs_id" => "qs_id" + , "qs_internal" => "qs_internal" + , "qs_fiche" => "qs_fiche" + , "qs_quantite" => "qs_quantite" + , "qs_price" => "qs_price" + , "qs_vat" => "qs_vat" + , "qs_vat_code" => "qs_vat_code" + , "qs_client" => "qs_client" + , "qs_valid" => "qs_valid" + , "j_id" => "j_id" + , "qs_vat_sided" => "qs_vat_sided" + , "qs_unit" => "qs_unit" + ); + /* + * Type of columns + */ + $this->type = array( + "qs_id" => "numeric" + , "qs_internal" => "text" + , "qs_fiche" => "numeric" + , "qs_quantite" => "numeric" + , "qs_price" => "numeric" + , "qs_vat" => "numeric" + , "qs_vat_code" => "numeric" + , "qs_client" => "numeric" + , "qs_valid" => "text" + , "j_id" => "numeric" + , "qs_vat_sided" => "numeric" + , "qs_unit" => "numeric" + ); + + + $this->default = array( + "qs_id" => "auto" + ); + + $this->date_format = "DD.MM.YYYY"; + parent::__construct($p_cn, $p_id); + } + + +} \ No newline at end of file