diff --git a/include/class_customer.php b/include/class_customer.php index 3f5bb3691..d6a8674c6 100644 --- a/include/class_customer.php +++ b/include/class_customer.php @@ -20,6 +20,7 @@ // Copyright Author Dany De Bontridder ddebontridder@yahoo.fr require_once("constant.php"); require_once("postgres.php"); +require_once("class_parm_code.php"); // Use the view vw_customer // class Customer { @@ -71,12 +72,17 @@ class Customer { // BASE ACCOUNT // for belgium - // TODO : those values should be in a table because - // they are _national_ parameters - //----- - $SOLD="70"; - $CUSTOMER="400"; - $TVA="451"; + $s=new parm_code($this->db,'VENTE'); + $s->Get() + $SOLD=$s->p_value; + + $c=new parm_code($this->db,'CUSTOMER'); + $c->Get(); + $CUSTOMER=$c->p_value; + + $t=new parm_code($this->db,'COMPTE_TVA'); + $t->Get(); + $TVA=$t->p_value; // Get all the sell operation //---- $sql="select j_grpt @@ -150,11 +156,12 @@ where //if not submitted to VAT, remove from list: //STAN: currently commented out because I don't know if it is really what we need. - //if (!isset($a_Res[$customer]['vat_number']) || strcmp($a_Res[$customer]['vat_number'], "") == 0) - //{ - // unset($a_Res[$customer]); - //} - + //Dany : yes we need it because the decla. concerns only the registered customer at the VAT + if (!isset($a_Res[$customer]['vat_number']) || strcmp($a_Res[$customer]['vat_number'], "") == 0) + { + unset($a_Res[$customer]); + } + }// foreach $a } diff --git a/include/class_fiche_def.php b/include/class_fiche_def.php index d45a49dde..c896f942f 100644 --- a/include/class_fiche_def.php +++ b/include/class_fiche_def.php @@ -123,6 +123,27 @@ class fiche_def_ref " where frd_id=".$this->frd_id; $Res=ExecSql($this->db,$sql); } +/* function Get + ************************************************** + * Purpose : Get the data with the p_code and complete + * the current object + * + * parm : + * - none + * gen : + * - + * return: none + */ + function Get() + { + $sql="select * from fiche_def_ref ". + " where frd_id=".$this->frd_id; + $Res=ExecSql($this->db,$sql); + if ( pg_NumRows($Res) == 0 ) return null; + $r=pg_fetch_array($Res,0); + $this->frd_text=$r['frd_text']; + $this->frd_class_base=$r['frd_class_base']; + } } ?> \ No newline at end of file diff --git a/include/fiche_def.inc.php b/include/fiche_def.inc.php index 96c0fcb64..05aa51610 100644 --- a/include/fiche_def.inc.php +++ b/include/fiche_def.inc.php @@ -53,8 +53,9 @@ echo ""; if ( isset ($_POST['mod']) ) { extract ($_POST); - echo '