E-INVOICE extract all documents from XML and store in DB

This commit is contained in:
sparkyx 2025-11-07 18:22:35 +01:00
parent 9db299594d
commit 35d73582b0
7 changed files with 288 additions and 96 deletions

View file

@ -233,7 +233,7 @@ insert into parameter_extra(pe_code,pe_label) values ('COMPANY_LEGAL_REGISTRATIO
insert into parameter_extra(pe_code,pe_label) values ('COMPANY_LEGAL_ENTITY','Forme légal de la société (SRL,ASBL,AISBL,...') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('COMPANY_BANK_IBAN','Compte en banque (IBAN)') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('COMPANY_BANK_BIC','BIC Bank Identification Code') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('COMPANY_UBL_ID','ID PEPPOL') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('COMPANY_UBL_ID','Identifiant PEPPOL') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('SIREN','n° SIREN') on conflict do nothing;
insert into parameter_extra(pe_code,pe_label) values ('SIRET','n° SIRET') on conflict do nothing;
@ -438,24 +438,14 @@ insert into jnt_fic_attr (fd_id,ad_id,jnt_order)
--
CREATE OR REPLACE FUNCTION comptaproc.update_peppol ()
RETURNS int2
/*- SETOF menu_tree : (TABLE FUNCTION) menu_tree is a type of a rowtype create type menu_tree as (code text,description text);
- int2, text,varchar...
- trigger : if called from a trigger
- void : nothing
- boolean
*/ AS
AS
$BODY$
declare
/*
* Section for variables
*/
n_card_id int;
vat_number text;
record_card RECORD;
result_fct int;
country_code text;
n_card_id int;
vat_number text;
record_card RECORD;
result_fct int;
begin
select pi_value into country_code from parameter_internal where pi_id ='COUNTRY_CODE';
result_fct := 0;
@ -478,4 +468,27 @@ end;
$BODY$
LANGUAGE plpgsql;
select comptaproc.update_peppol();
select comptaproc.update_peppol();
CREATE TABLE public.jrn_sup_document (
js_id int8 GENERATED BY DEFAULT AS IDENTITY( INCREMENT BY 1 MINVALUE 1 MAXVALUE 9223372036854775807 START 1 CACHE 1 NO CYCLE) NOT NULL, -- PK
js_mimetype text NOT NULL, -- Mimetype
js_lob oid NOT NULL, -- OID
jr_id int8 NOT NULL, -- FK to jrn
js_filename text not null,
js_description text ,
js_cbc_id text,
CONSTRAINT jrn_sup_document_pkey PRIMARY KEY (js_id),
CONSTRAINT jrn_sup_document_jrn_fk FOREIGN KEY (jr_id) REFERENCES public.jrn(jr_id) ON DELETE SET NULL ON UPDATE CASCADE
);
COMMENT ON TABLE public.jrn_sup_document IS 'Supplement document for operation';
-- Column comments
COMMENT ON COLUMN public.jrn_sup_document.js_id IS 'PK';
COMMENT ON COLUMN public.jrn_sup_document.js_mimetype IS 'Mimetype';
COMMENT ON COLUMN public.jrn_sup_document.js_lob IS 'OID';
COMMENT ON COLUMN public.jrn_sup_document.jr_id IS 'FK to jrn';
COMMENT ON COLUMN public.jrn_sup_document.js_description IS 'Description of document';
COMMENT ON COLUMN public.jrn_sup_document.js_cbc_id IS 'ID in XML';