WZUV#63962: WZUV ongebruikte imports

svn path=/Customer/trunk/; revision=48193
This commit is contained in:
Suzan Wiegerinck
2020-09-17 11:09:45 +00:00
parent 0e88964a12
commit f41ba97254

View File

@@ -890,130 +890,6 @@ AS
OR aog.alg_ruimte_key = ar.alg_ruimte_key)
AND kpl_cat.alg_onrgoed_key(+) = aog.alg_gebouw_key;
CREATE OR REPLACE PROCEDURE wzuv_import_fin_fact_liander (
p_import_key IN NUMBER)
AS
v_seq_of_columns VARCHAR (50);
BEGIN
-- In de xsl factuurnr(1);factuurdatum(2);omschrijving(3);bedrag(4);btwperc(5);btwbedrag(6);periode_van(7);EAN nummer(8)
--hulp voor pos : '1;2;3;4;5;6;7;8;9;0;1;2;3;14;15;16;7;8;9;0'
v_seq_of_columns := '0;1;2;0;0;0;3;0;4;6;5;0;0;0;0;7;8;0;0;0';
-- Variabelelijst
-- v_leveranciernr: 1
-- v_factuurnr: 2 (VERPLICHT, anders zet Facilitor '-' in factuurnr, en is status van factuur "Incompleet")
-- v_factuurdatum: 3
-- v_ordernr: 4 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_locatie: 5
-- v_afleverdatum: 6
-- v_omschrijving: 7
-- v_aantal: 8
-- v_kostprijs: 9 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_btw_bedrag: 10 (VERPLICHT, of anders veld 11, anders is status van factuur "Incompleet")
-- v_btw: 11 (VERPLICHT, of anders veld 10, anders is status van factuur "Incompleet")
-- v_docid: 12
-- v_debiteur_nr: 13
-- v_opmerking: 14
-- v_btw_verlegd: 15 (VERPLICHT, Ja/Nee/<leeg> waarbij leeg gelijk is aan Nee. Andere waarden leidt tot "Incompleet")
-- v_kenmerk1: 16
-- v_kenmerk1: 17
-- v_kenmerk1: 18
-- v_kenmerk1: 19
-- v_kenmerk1: 20
-- v_boekmaand: 21
fac_import_factuur_body (p_import_key, v_seq_of_columns);
-- Voeg prefix C toe aan het contractnummer van het actieve contract van Liander
-- het juiste contract kan bepaald worden op basis van het EAN nummer dat in kenmerkveldje 2 staat
UPDATE fac_imp_factuur f
SET f.ordernr =
(SELECT DECODE (
cnt_contract_versie,
NULL,
'C' || c.cnt_contract_nummer_intern,
'C'
|| c.cnt_contract_nummer_intern
|| '.'
|| cnt_contract_versie)
AS orderid
FROM cnt_kenmerkcontract kc,
cnt_kenmerk k,
cnt_srtkenmerk sk,
cnt_contract c,
prs_bedrijf b
WHERE kc.cnt_kenmerk_key = k.cnt_kenmerk_key
AND k.cnt_srtkenmerk_key = sk.cnt_srtkenmerk_key
AND kc.cnt_contract_key = c.cnt_contract_key
AND c.cnt_prs_bedrijf_key = b.prs_bedrijf_key
AND b.prs_bedrijf_naam_upper LIKE '%LIANDER%'
AND UPPER (sk.cnt_srtkenmerk_omschrijving) LIKE '%EAN%'
AND cnt_kenmerkcontract_waarde = f.kenmerk2);
-- de boekmaand is de maand waarover de factuur betrekking heeft
-- het kenmerk veld bevat de begindatum van deze maand dus daar extraheren we het jaar en de maand uit
UPDATE fac_imp_factuur f
SET f.boekmaand = SUBSTR (kenmerk1, 1, 7)
WHERE kenmerk1 IS NOT NULL;
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_update_fin_fact_liander (
p_import_key IN NUMBER)
AS
BEGIN
-- Standaard FCLT verwerk import facturen
fac_update_factuur (p_import_key);
END;
/
CREATE OR REPLACE PROCEDURE wzuv_import_fin_fact_tu (p_import_key IN NUMBER)
AS
v_seq_of_columns VARCHAR (50);
BEGIN
-- In de xsl bestelnr(1);factuurnr(2);factuurdatum(3);omschrijving(4);bedrag(5);btwperc(6);aantal(7)
--hulp voor pos : '1;2;3;4;5;6;7;8;9;0;1;2;3;14;15;16;7;8;9;0'
v_seq_of_columns := '0;2;3;1;0;0;4;7;5;0;6;0;0;0;0;0;0;0;0;0';
-- Variabelelijst
-- v_leveranciernr: 1
-- v_factuurnr: 2 (VERPLICHT, anders zet Facilitor '-' in factuurnr, en is status van factuur "Incompleet")
-- v_factuurdatum: 3
-- v_ordernr: 4 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_locatie: 5
-- v_afleverdatum: 6
-- v_omschrijving: 7
-- v_aantal: 8
-- v_kostprijs: 9 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_btw_bedrag: 10 (VERPLICHT, of anders veld 11, anders is status van factuur "Incompleet")
-- v_btw: 11 (VERPLICHT, of anders veld 10, anders is status van factuur "Incompleet")
-- v_docid: 12
-- v_debiteur_nr: 13
-- v_opmerking: 14
-- v_btw_verlegd: 15 (VERPLICHT, Ja/Nee/<leeg> waarbij leeg gelijk is aan Nee. Andere waarden leidt tot "Incompleet")
-- v_kenmerk1: 16
-- v_kenmerk1: 17
-- v_kenmerk1: 18
-- v_kenmerk1: 19
-- v_kenmerk1: 20
-- v_boekmaand: 21
fac_import_factuur_body (p_import_key, v_seq_of_columns);
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_update_fin_fact_tu (p_import_key IN NUMBER)
AS
BEGIN
-- Standaard FCLT verwerk import facturen
fac_update_factuur (p_import_key);
END;
/
-- ==========================================
@@ -2199,118 +2075,6 @@ AS
WHERE UPPER (fac_notificatie_job_view) =
'WZUV_V_NOTI_VRIJKOMEN_APP3');
-- Factuur import Nuts facturen Kenter
CREATE OR REPLACE PROCEDURE wzuv_import_fin_fact_kenter (
p_import_key IN NUMBER)
AS
v_seq_of_columns VARCHAR (50);
BEGIN
-- In de csv:
-- Verzamelspecificatie nr. (1) ;Geadresseerde (2) ;Adres (3) ;PC Plaats (4) ;EAN code (5) ;Product (6) ;Aansluitadres: straat (7) ;Aansluitadres: huisnummer(8) ;Aansluitadres: huisnummertoevoeging (9);Aansluitadres: postcode (10);
-- Aansluitadres: plaats (11) ;Locatiedetails (12) ;Kostenplaats (13) ;Kostendrager (14) ;Kostendrager2 (15) ;Factuurgroepering (16) ;Factuurdatum (17) ;Factuurnummer (18) ;Gestorneerde factuur (19) ;Factuurtype (20);
-- Bedrag excl. BTW (21) ;Bedrag excl. BTW 21% (22);Bedrag excl. BTW 19% (23) ;Bedrag excl. BTW 6% (24) ;Bedrag excl. BTW 0% (25) ;Afrekentijdvak: start (26) ;Afrekentijdvak: einde (27) ;Blok 1 (28) ;Blok aantal 1 (29) ;Blok prijs 1 (30) ;
-- Blok bedrag (excl. BTW) 1 (31) ;Blok BTW% 1 (32) ;Blok 2 (33) ;Blok aantal 2 (34) ;Blok prijs 2 (35) ;Blok bedrag (excl. BTW) 2 (36) ;Blok BTW% 2 (37);Blok 3 (38) ;Blok aantal 3 (39) ;Blok prijs 3 (40) ;
-- Blok bedrag (excl. BTW) 3 (41);Blok BTW% 3 (42) ;Blok 4 (43) ;Blok aantal 4 (44) ;Blok prijs 4 (45) ;Blok bedrag (excl. BTW) 4 (46) ;Blok BTW% 4 (47) ;Blok 5 (48) ;Blok aantal 5 (49) ;Blok prijs 5 (50);
-- Blok bedrag (excl. BTW) 5;Blok BTW% 5;Blok 6;Blok aantal 6;Blok prijs 6;Blok bedrag (excl. BTW) 6;Blok BTW% 6;Blok 7;Blok aantal 7;Blok prijs 7;Blok bedrag (excl. BTW) 7;Blok BTW% 7;Blok 8;Blok aantal 8;Blok prijs 8;Blok bedrag (excl. BTW) 8;Blok BTW% 8;Blok 9;Blok aantal 9;Blok prijs 9;Blok bedrag (excl. BTW) 9;Blok BTW% 9;Blok 10;Blok aantal 10;Blok prijs 10;Blok bedrag (excl. BTW) 10;Blok BTW% 10;Blok 11;Blok aantal 11;Blok prijs 11;Blok bedrag (excl. BTW) 11;Blok BTW% 11;Blok 12;Blok aantal 12;Blok prijs 12;Blok bedrag (excl. BTW) 12;Blok BTW% 12;Blok 13;Blok aantal 13;Blok prijs 13;Blok bedrag (excl. BTW) 13;Blok BTW% 13;Blok 14;Blok aantal 14;Blok prijs 14;Blok bedrag (excl. BTW) 14;Blok BTW% 14;Blok 15;Blok aantal 15;Blok prijs 15;Blok bedrag (excl. BTW) 15;Blok BTW% 15;Blok 16;Blok aantal 16;Blok prijs 16;Blok bedrag (excl. BTW) 16;Blok BTW% 16;Blok 17;Blok aantal 17;Blok prijs 17;Blok bedrag (excl. BTW) 17;Blok BTW% 17;Blok 18;Blok aantal 18;Blok prijs 18;Blok bedrag (excl. BTW) 18;Blok BTW% 18;Blok 19;Blok aantal 19;Blok prijs 19;Blok bedrag (excl. BTW) 19;Blok BTW% 19;Blok 20;Blok aantal 20;Blok prijs 20;Blok bedrag (excl. BTW) 20;Blok BTW% 20;Blok 21;Blok aantal 21;Blok prijs 21;Blok bedrag (excl. BTW) 21;Blok BTW% 21;Blok 22;Blok aantal 22;Blok prijs 22;Blok bedrag (excl. BTW) 22;Blok BTW% 22;Blok 23;Blok aantal 23;Blok prijs 23;Blok bedrag (excl. BTW) 23;Blok BTW% 23;Blok 24;Blok aantal 24;Blok prijs 24;Blok bedrag (excl. BTW) 24;Blok BTW% 24;Blok 25;Blok aantal 25;Blok prijs 25;Blok bedrag (excl. BTW) 25;Blok BTW% 25;Blok 26;Blok aantal 26;Blok prijs 26;Blok bedrag (excl. BTW) 26;Blok BTW% 26;Blok 27;Blok aantal 27;Blok prijs 27;Blok bedrag (excl. BTW) 27;Blok BTW% 27;Blok 28;Blok aantal 28;Blok prijs 28;Blok bedrag (excl. BTW) 28;Blok BTW% 28;Blok 29;Blok aantal 29;Blok prijs 29;Blok bedrag (excl. BTW) 29;Blok BTW% 29;Blok 30;Blok aantal 30;Blok prijs 30;Blok bedrag (excl. BTW) 30;Blok BTW% 30;Factuuraanbieder;BTW Bedrijfsnaam;BTW Nummer;KVK nummer
--hulp voor pos : '1;2;3;4;5;6;7;8;9;0;1;2;3;4;5;6;7;8;9;0'
v_seq_of_columns := '0;18;17;5;0;0;6;0;21;0;32;0;0;0;0;26;5;0;0;0';
-- Variabelelijst
-- v_leveranciernr: 1
-- v_factuurnr: 2 (VERPLICHT, anders zet Facilitor '-' in factuurnr, en is status van factuur "Incompleet")
-- v_factuurdatum: 3
-- v_ordernr: 4 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_locatie: 5
-- v_afleverdatum: 6
-- v_omschrijving: 7
-- v_aantal: 8
-- v_kostprijs: 9 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_btw_bedrag: 10 (VERPLICHT, of anders veld 11, anders is status van factuur "Incompleet")
-- v_btw: 11 (VERPLICHT, of anders veld 10, anders is status van factuur "Incompleet")
-- v_docid: 12
-- v_debiteur_nr: 13
-- v_opmerking: 14
-- v_btw_verlegd: 15 (VERPLICHT, Ja/Nee/<leeg> waarbij leeg gelijk is aan Nee. Andere waarden leidt tot "Incompleet")
-- v_kenmerk1: 16
-- v_kenmerk1: 17
-- v_kenmerk1: 18
-- v_kenmerk1: 19
-- v_kenmerk1: 20
-- v_boekmaand: 21
fac_import_factuur_body (p_import_key, v_seq_of_columns);
-- De header regel kan verwijderd worden
DELETE fac_imp_factuur f
WHERE f.factuurnr = 'Factuurnummer';
-- Het EAN nummer bevat nog een ' deze moet verwijderd worden
UPDATE fac_imp_factuur
SET kenmerk2 = SUBSTR (kenmerk2, 2, 18);
-- Voeg prefix C toe aan het contractnummer van het actieve contract van Liander
-- het juiste contract kan bepaald worden op basis van het EAN nummer dat in kenmerkveldje 2 staat
UPDATE fac_imp_factuur f
SET f.ordernr =
(SELECT DECODE (
cnt_contract_versie,
NULL,
'C' || c.cnt_contract_nummer_intern,
'C'
|| c.cnt_contract_nummer_intern
|| '.'
|| cnt_contract_versie)
AS orderid
FROM cnt_kenmerkcontract kc,
cnt_kenmerk k,
cnt_srtkenmerk sk,
cnt_contract c,
prs_bedrijf b
WHERE kc.cnt_kenmerk_key = k.cnt_kenmerk_key
AND k.cnt_srtkenmerk_key = sk.cnt_srtkenmerk_key
AND kc.cnt_contract_key = c.cnt_contract_key
AND c.cnt_prs_bedrijf_key = b.prs_bedrijf_key
AND b.prs_bedrijf_naam_upper LIKE '%KENTER%'
AND UPPER (sk.cnt_srtkenmerk_omschrijving) LIKE '%EAN%'
AND cnt_kenmerkcontract_waarde = f.kenmerk2);
-- de boekmaand is de maand waarover de factuur betrekking heeft
-- het kenmerk veld bevat de begindatum van deze maand dus daar extraheren we het jaar en de maand uit
UPDATE fac_imp_factuur f
SET f.boekmaand = SUBSTR (kenmerk1, 7, 4) || SUBSTR (kenmerk1, 3, 3)
WHERE kenmerk1 IS NOT NULL;
-- per boekmaand moet een factuur geboekt worden
-- dus die plakken we voor nu maar even achter het factuurnummer
UPDATE fac_imp_factuur f
SET F.FACTUURNR = F.FACTUURNR || '/' || F.BOEKMAAND
WHERE kenmerk1 IS NOT NULL;
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_update_fin_fact_kenter (
p_import_key IN NUMBER)
AS
BEGIN
-- Standaard FCLT verwerk import facturen
fac_update_factuur (p_import_key);
-- Bij de import hebben we de facturen gesplits naar periode
-- Deze splitsing maken we nu weer ongedaan
UPDATE fin_factuur f
SET f.fin_factuur_nr =
SUBSTR (f.fin_factuur_nr, 1, INSTR (f.fin_factuur_nr, '/') - 1)
WHERE f.fin_factuur_key IN (SELECT i.fin_factuur_key
FROM fac_imp_factuur i
WHERE i.fac_import_key = p_import_key);
END;
/
--View voor Notificatie bij Rapeldatum contract bereikt
CREATE OR REPLACE VIEW WZUV_V_NOTI_CNTREMINDER
(
@@ -2570,350 +2334,6 @@ BEGIN
END;
/
CREATE OR REPLACE PROCEDURE wzuv_import_fin_fact_care4flex (
p_import_key IN NUMBER)
AS
v_seq_of_columns VARCHAR (50);
BEGIN
-- eerst de kopregel maar even weggooien
DELETE FAC_IMP_FILE
WHERE fac_import_key = p_import_key
AND UPPER (fac_imp_file_line) LIKE
'INVOICE_ID;INVOICE_NUMBER;INVOICE_PLACE;INVOICE_DATE;%';
-- In de csv factuurnr;
-- 1 INVOICE_ID;2 INVOICE_NUMBER;3 INVOICE_PLACE;4 INVOICE_DATE;5 INVOICE_TYPE;6 INVOICE_DEBTOR_REFERENCE;7 INVOICE_PROJECT_NUMBER;8 INVOICE_JOB_DESCRIPTION;9 INVOICE_DEBTOR_NAME;10 INVOICE_DEBTOR_FINANCIAL_CONTACT;
-- 11 INVOICE_DEBTOR_ADDRESS;12 INVOICE_DEBTOR_POSTCODE;13 INVOICE_DEBTOR_PLACE;14 INVOICE_SUBTOTAL;15 INVOICE_VAT;16 INVOICE_DISCOUNT;17 INVOICE_TOTAL;18 INVOICE_G_ACCOUNT_YN;19 INVOICE_G_ACCOUNT_PCT;20 INVOICE_PAYMENT_TERM;
-- 21 INVOICE_NOTES;22 INVOICE_VAT_NUMBER;23 INVOICE_DETAIL_WORKSHEET_WEEK;24 INVOICE_DETAIL_QUANTITY;25 INVOICE_DETAIL_PERCENTAGE;26 INVOICE_DETAIL_DESCRIPTION;27 INVOICE_DETAIL_TARIFF;28 INVOICE_DETAIL_DISCOUNT;29 INVOICE_DETAIL_VAT_PERCENTAGE;30 INVOICE_DETAIL_SUB_TOTAL;
-- 31 WORKER_INITIALS;32 WORKER_FIRSTNAMES;33 WORKER_MIDDLENAME;34 WORKER_SURNAME;35 WORKER_MAIDEN_NAME;36 ADMINISTRATION_ID;37 ADMINISTRATION_NAME;38 ADMINISTRATION_ADDRESS;39 ADMINISTRATION_POSTCODE;40 ADMINISTRATION_PLACE;
-- 41 ADMINISTRATION_PHONE;42 ADMINISTRATION_FAX;43 ADMINISTRATION_WEBSITE;44 ADMINISTRATION_KVK_NUMBER;45 ADMINISTRATION_VAT_NUMBER;46 ADMINISTRATION_IBAN;47 ADMINISTRATION_IBAN_G_ACCOUNT
--hulp voor pos : '1;2;3;4;5;6;7;8;9;0;1;2;3;14;15;16;7;8;9;0'
v_seq_of_columns := '0;2;4;0;0;0;23;24;30;0;29;0;0;26;0;7;31;32;33;34';
-- Variabelelijst
-- v_leveranciernr: 1
-- v_factuurnr: 2 (VERPLICHT, anders zet Facilitor '-' in factuurnr, en is status van factuur "Incompleet")
-- v_factuurdatum: 3
-- v_ordernr: 4 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_locatie: 5
-- v_afleverdatum: 6
-- v_omschrijving: 7
-- v_aantal: 8
-- v_kostprijs: 9 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_btw_bedrag: 10 (VERPLICHT, of anders veld 11, anders is status van factuur "Incompleet")
-- v_btw: 11 (VERPLICHT, of anders veld 10, anders is status van factuur "Incompleet")
-- v_docid: 12
-- v_debiteur_nr: 13
-- v_opmerking: 14
-- v_btw_verlegd: 15 (VERPLICHT, Ja/Nee/<leeg> waarbij leeg gelijk is aan Nee. Andere waarden leidt tot "Incompleet")
-- v_kenmerk1: 16
-- v_kenmerk1: 17
-- v_kenmerk1: 18
-- v_kenmerk1: 19
-- v_kenmerk1: 20
-- v_boekmaand: 21
fac_import_factuur_body (p_import_key, v_seq_of_columns);
-- Dan de achternaam samenstellen
UPDATE fac_imp_factuur f
SET f.kenmerk6 =
CASE
WHEN f.kenmerk4 IS NOT NULL
THEN
f.kenmerk4 || ' ' || f.kenmerk5
ELSE
f.kenmerk5
END;
-- Dan de omschrijving van de factuurregel volledig samenstellen
UPDATE fac_imp_factuur f
SET f.omschrijving =
CASE
WHEN UPPER (opmerking) = 'UREN'
THEN
'Week '
|| f.omschrijving
|| ' - '
|| f.kenmerk2
|| ' '
|| f.kenmerk6
|| ' - '
|| f.aantal
|| ' '
|| f.opmerking
ELSE
'Week '
|| f.omschrijving
|| ' - '
|| f.kenmerk2
|| ' '
|| f.kenmerk6
|| ' - '
|| f.opmerking
END;
-- De factuur koppelen aan het juiste contract
UPDATE fac_imp_factuur f
SET f.ordernr =
(SELECT DECODE (
cnt_contract_versie,
NULL,
'C' || c.cnt_contract_nummer_intern,
'C'
|| c.cnt_contract_nummer_intern
|| '.'
|| cnt_contract_versie)
AS orderid
FROM cnt_kenmerkcontract kc,
cnt_kenmerk k,
cnt_srtkenmerk sk,
cnt_contract c,
prs_bedrijf b
WHERE kc.cnt_kenmerk_key = k.cnt_kenmerk_key
AND k.cnt_srtkenmerk_key = sk.cnt_srtkenmerk_key
AND kc.cnt_contract_key = c.cnt_contract_key
AND c.cnt_prs_bedrijf_key = b.prs_bedrijf_key
AND c.cnt_contract_verwijder IS NULL
AND b.prs_bedrijf_naam_upper LIKE '%CARE4FLEX%');
-- De kostenplaats wordt meegegeven met de factuur, vast de kpl key erbij zoeken
UPDATE fac_imp_factuur
SET kenmerk12 =
(SELECT kp.prs_kostenplaats_key
FROM prs_kostenplaats kp
WHERE SUBSTR (kenmerk1, -4) = kp.prs_kostenplaats_nr);
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_update_fin_fact_care4flex (
p_import_key IN NUMBER)
AS
CURSOR c_factuur
IS
SELECT fin_factuur_key, 22, kenmerk12
FROM fac_imp_factuur
WHERE fin_factuur_key IS NOT NULL;
BEGIN
-- Standaard FCLT verwerk import facturen
fac_update_factuur (p_import_key);
-- het goedkeuren van deze facturen moet altijd door het flexbureau gedaan worde
UPDATE fin_factuur f
SET f.prs_perslid_key_goedkeur =
(SELECT p.prs_perslid_key
FROM prs_perslid p
WHERE p.prs_perslid_upper = 'FLEXBUREAU')
WHERE f.fin_factuur_key IN (SELECT i.fin_factuur_key
FROM fac_imp_factuur i
WHERE i.fac_import_key = p_import_key);
-- de kostenplaats is niet de kostenplaats van het contract, maar de kostenplaats die op de factuur wordt meegegeven
-- de key was al in kenmerk12 gezet
-- daarnaast moet er een notificatie voor het goedkeuren van de factuur aangemaakt worden
FOR rec IN c_factuur
LOOP
BEGIN
wzuv_fin_upsertkenmerk (22, rec.fin_factuur_key, rec.kenmerk12);
END;
fac.trackaction ('FIN2GO',
rec.fin_factuur_key,
NULL,
NULL,
'Goedkeuring voor factuur Care4Flex vereist');
END LOOP;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_import_fin_fact_randstad (
p_import_key IN NUMBER)
AS
v_seq_of_columns VARCHAR (50);
BEGIN
-- In de xsl factuurnr(1);factuurdatum(2);omschrijving(3);bedrag(4);btwperc(5);btwbedrag(6);omschr(7);weeknummer(8);Kostenplaats(9);pdf(10);aantal(11);naam(12)
--hulp voor pos : '1;2;3;4;5;6;7;8;9;0;1;2;3;14;15;16;7;8;9;0'
v_seq_of_columns := '12;1;2;0;0;0;3;0;4;6;0;10;0;0;0;7;8;9;11;0';
-- Variabelelijst
-- v_leveranciernr: 1
-- v_factuurnr: 2 (VERPLICHT, anders zet Facilitor '-' in factuurnr, en is status van factuur "Incompleet")
-- v_factuurdatum: 3
-- v_ordernr: 4 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_locatie: 5
-- v_afleverdatum: 6
-- v_omschrijving: 7
-- v_aantal: 8
-- v_kostprijs: 9 (VERPLICHT, anders is status van factuur "Incompleet")
-- v_btw_bedrag: 10 (VERPLICHT, of anders veld 11, anders is status van factuur "Incompleet")
-- v_btw: 11 (VERPLICHT, of anders veld 10, anders is status van factuur "Incompleet")
-- v_docid: 12
-- v_debiteur_nr: 13
-- v_opmerking: 14
-- v_btw_verlegd: 15 (VERPLICHT, Ja/Nee/<leeg> waarbij leeg gelijk is aan Nee. Andere waarden leidt tot "Incompleet")
-- v_kenmerk1: 16
-- v_kenmerk1: 17
-- v_kenmerk1: 18
-- v_kenmerk1: 19
-- v_kenmerk1: 20
-- v_boekmaand: 21
fac_import_factuur_body (p_import_key, v_seq_of_columns);
-- De factuur koppelen aan het juiste contract
UPDATE fac_imp_factuur f
SET f.ordernr =
(SELECT DECODE (
cnt_contract_versie,
NULL,
'C' || c.cnt_contract_nummer_intern,
'C' || c.cnt_contract_nummer_intern || '.' || cnt_contract_versie)
AS orderid
FROM cnt_contract c, prs_bedrijf b
WHERE c.cnt_prs_bedrijf_key = b.prs_bedrijf_key
AND c.cnt_contract_verwijder IS NULL
AND b.prs_bedrijf_naam_upper LIKE '%RANDSTAD%');
-- De kostenplaats wordt meegegeven met de factuur, vast de kpl key erbij zoeken
UPDATE fac_imp_factuur
SET kenmerk12 =
(SELECT kp.prs_kostenplaats_key
FROM prs_kostenplaats kp
WHERE SUBSTR (kenmerk3, 1, INSTR (kenmerk3, ' ') - 1) =
kp.prs_kostenplaats_nr);
-- De omschrijving aanvullen met de informatie rondom het weeknummer
UPDATE fac_imp_factuur
SET omschrijving =
REPLACE (omschrijving, 'Regular', 'Gewerkte uren')
|| ', aantal: '
|| kenmerk4
|| ', '
|| kenmerk1
|| ' '
|| kenmerk2
|| ', naam medewerker: '
|| leveranciernr;
--- Daarna kan het veld leveranciernt opgeruimd worden
UPDATE fac_imp_factuur
SET leveranciernr = '';
COMMIT;
END;
/
CREATE OR REPLACE PROCEDURE wzuv_update_fin_fact_randstad (
p_import_key IN NUMBER)
AS
CURSOR c_factuur
IS
SELECT fin_factuur_key, 22, kenmerk12
FROM fac_imp_factuur
WHERE fin_factuur_key IS NOT NULL;
-- pdf extraheren uit xml
-- Volgens JGL kunnen we niet meerdere imports tegelijk aan bij fac_result, zie hieronder.
-- Vandaar de conditie met max(fin_factuur_key), die levert maximaal 1 record op.
CURSOR cfactuur_docid
IS
SELECT fin_factuur_key,
docid,
factuurnr,
fac_imp_file_index
FROM fac_imp_factuur
WHERE fin_factuur_key IS NOT NULL
AND fac_import_key = p_import_key
AND docid IS NOT NULL
AND fin_factuur_key =
(SELECT MAX (fin_factuur_key)
FROM fac_imp_factuur
WHERE fin_factuur_key IS NOT NULL
AND fac_import_key = p_import_key
AND docid IS NOT NULL);
-- Key van het kenmerk 'Factuurbijlage'
c_kenmerk_key_bijlage NUMBER (10) := 21;
BEGIN
-- Standaard FCLT verwerk import facturen
fac_update_factuur (p_import_key);
-- het goedkeuren van deze facturen moet altijd door het flexbureau gedaan worden
UPDATE fin_factuur f
SET f.prs_perslid_key_goedkeur =
(SELECT p.prs_perslid_key
FROM prs_perslid p
WHERE p.prs_perslid_upper = 'FLEXBUREAU')
WHERE f.fin_factuur_key IN (SELECT i.fin_factuur_key
FROM fac_imp_factuur i
WHERE i.fac_import_key = p_import_key);
-- de kostenplaats is niet de kostenplaats van het contract, maar de kostenplaats die op de factuur wordt meegegeven
-- de key was al in kenmerk12 gezet
-- dan regelen we direct ook maar even de notificatie voor het goedkeuren
FOR rec IN c_factuur
LOOP
BEGIN
wzuv_fin_upsertkenmerk (22, rec.fin_factuur_key, rec.kenmerk12);
END;
fac.trackaction ('FIN2GO',
rec.fin_factuur_key,
NULL,
NULL,
'Goedkeuring voor factuur Randstad vereist');
END LOOP;
FOR rc IN cfactuur_docid
LOOP
BEGIN
INSERT INTO fac_result (fac_result_sessionid,
fac_result_naam,
fac_result_waarde)
VALUES ('IMPORT:' || TO_CHAR (p_import_key),
'flexcode',
'FIN:'
|| TO_CHAR (rc.fin_factuur_key) -- We kunnen niet meerdere imports tegelijk aan!
|| ':'
|| c_kenmerk_key_bijlage
|| ':' -- De kenmerk key
|| 'F');
-- FSN#33363: Zelf de insert in fin_kenmerkfactuur doen van het bestandskenmerk (FSN#33105 verzorgt dit niet namelijk)
INSERT INTO fin_kenmerkfactuur (fin_factuur_key,
fin_kenmerk_key,
fin_kenmerkfactuur_waarde)
VALUES (rc.fin_factuur_key, c_kenmerk_key_bijlage, rc.docid);
EXCEPTION
WHEN OTHERS
THEN
fac.imp_writelog (
p_import_key,
'W',
'Van factuur met key '
|| rc.fin_factuur_key
|| ' is de bestandsnaam niet bewaard (regel '
|| rc.fac_imp_file_index
|| ')',
'Factuurnr:'
|| rc.factuurnr
|| ' / Bestandsnaam: '
|| rc.docid);
END;
END LOOP;
END;
/
CREATE OR REPLACE VIEW WZUV_V_INS_QRC_OBJECT
(
HIDE_F_SORT,
@@ -2958,7 +2378,6 @@ BEGIN
END;
/
------ payload end ------
SET DEFINE OFF