E-INVOICE: check data before generating

E-INVOICE: add missing for Belgium : BuyerReference and Due_Date
This commit is contained in:
sparkyx 2025-09-13 13:16:14 +02:00
parent d776c7bf98
commit 9ebb89b38a
8 changed files with 520 additions and 117 deletions

View file

@ -30,7 +30,9 @@
"label"=>"tva_label",
"rate"=>"tva_rate",
"comment"=>"tva_comment",
"account"=>"tva_poste");
"account"=>"tva_poste"
tva_peppol_code
* );
*/
class Acc_Tva
@ -42,7 +44,9 @@ class Acc_Tva
"account"=>"tva_poste",
"both_side"=>'tva_both_side',
'tva_reverse_account'=>'tva_reverse_account',
'tva_code'=>'tva_code');
'tva_code'=>'tva_code',
"tva_peppol_code"=>"tva_peppol_code"
);
public $tva_id,
$tva_label,
$tva_rate,
@ -50,16 +54,18 @@ class Acc_Tva
$tva_poste,
$tva_both_side,
$tva_code,
$tva_reverse_account;
$tva_reverse_account,
$tva_peppol_code
;
private $cn; //!< Database connection
private Tva_Rate_SQL $tva_rate_sql;
function __construct ($p_init,$p_tva_id=-1)
function __construct (Database $cn,$p_tva_id=-1)
{
$this->cn=$p_init;
$this->tva_rate_sql=new Tva_Rate_SQL($p_init,$p_tva_id);
$this->cn=$cn;
$this->tva_rate_sql=new Tva_Rate_SQL($cn,$p_tva_id);
$this->tva_id=$p_tva_id;
$this->tva_label=&$this->tva_rate_sql->tva_label;
$this->tva_rate=&$this->tva_rate_sql->tva_rate;
@ -68,6 +74,7 @@ class Acc_Tva
$this->tva_both_side=&$this->tva_rate_sql->tva_both_side;
$this->tva_code=&$this->tva_rate_sql->tva_code;
$this->tva_reverse_account=&$this->tva_rate_sql->tva_reverse_account;
$this->tva_peppol_code=&$this->tva_rate_sql->tva_peppol_code;
}
/**

View file

@ -329,7 +329,7 @@ class Fiche
* @param int $p_ad_id AD_ID from attr_def.ad_id
* @param int $p_return 1 return NOTFOUND otherwise an empty string
* @see constant.php
* @return string
* @return string
* @note reread data from database and so it reset previous unsaved change
*/
function get_attribute($p_ad_id,$p_return=1)
@ -1966,12 +1966,12 @@ class Fiche
}
/**
* @brief create a card from a qcode and returns a card
* @param string $p_qcode qcode of the card
* @param $cn Database cnx
* @param $p_qcode (string) qcode of the card
*/
static function from_qcode($p_qcode)
static function from_qcode(Database $cn,string $p_qcode)
{
$cn=Dossier::connect();
$card=new Card($cn);
$card=new Fiche($cn);
$card->get_by_qcode($p_qcode);
return $card;
}