From d0e72e270f5aa344d637d250c54715fe714be83d Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 4 Sep 2026 01:05:34 -0400 Subject: [PATCH] Add the CMS AP subledger modules (avtx, vchr, open) Completes the AP source layer: GP was covered by the pm* modules, but the CMS side had only cms.vend. These three are what SQL/fiscal/analysis/open_ap_aging.db2.sql actually joins. avtx 966,553 A/P voucher transaction events incremental on AVTSTM vchr 792,348 vouchers entered, period to date full open 538,544 open payables; FHCBAL is live full AVTX is the artrn analog -- the per-event apply detail. It matters because the AR aging in /opt/clean reconstructs balances from application events rather than a single settle_date, so AP needs an applications fact too, not just documents. Grains verified exactly unique before drafting: AVTX (avtco#,avtvh#,avttx#) 966,553/966,553; VCHR (idcom#,idvch#,idbnk#,idfisy,idfisp) 792,348/792,348; OPEN (fhcom#,fhvch#,fhpyy,fhpper) 538,544/538,544. All three reconcile IN SYNC. vchr and open stay full: no change signal, only business dates, and FHCBAL is a live mutable balance. Two things worth knowing for the next DB2 module: - pipekit maps DB2 TIMESTMP to Postgres text, so a watermark resolver doing COALESCE(MAX(ts), TIMESTAMP '...') fails on mismatched types. Cast explicitly. cms.gtran was already the precedent. - Watermarks resolve at engine step 2 but --create-dest builds the table at step 3b, so a watermark reading its own dest table fails on the first run. Pre-create the table or seed with a constant. Note LGDAT.AP* is a dead end -- APVH has 14 rows, APVD has 22. CMS AP does not live in AP-prefixed files. Co-Authored-By: Claude Opus 5 (1M context) --- config/groups.json | 12 + config/modules/avtx.json | 268 +++++++++++++++++++++ config/modules/avtx.sql | 38 +++ config/modules/open.json | 485 +++++++++++++++++++++++++++++++++++++++ config/modules/open.sql | 69 ++++++ config/modules/vchr.json | 275 ++++++++++++++++++++++ config/modules/vchr.sql | 39 ++++ 7 files changed, 1186 insertions(+) create mode 100644 config/modules/avtx.json create mode 100644 config/modules/avtx.sql create mode 100644 config/modules/open.json create mode 100644 config/modules/open.sql create mode 100644 config/modules/vchr.json create mode 100644 config/modules/vchr.sql diff --git a/config/groups.json b/config/groups.json index 46cb934..49b7de3 100644 --- a/config/groups.json +++ b/config/groups.json @@ -41,6 +41,18 @@ { "module": "pm30700", "run_order": 10 + }, + { + "module": "avtx", + "run_order": 11 + }, + { + "module": "vchr", + "run_order": 12 + }, + { + "module": "open", + "run_order": 13 } ], "schedules": [ diff --git a/config/modules/avtx.json b/config/modules/avtx.json new file mode 100644 index 0000000..d157435 --- /dev/null +++ b/config/modules/avtx.json @@ -0,0 +1,268 @@ +{ + "name": "avtx", + "source_connection": "S78030956", + "dest_connection": "usmidsap02", + "dest_table": "cms.avtx", + "staging_table": "pipekit_staging.avtx", + "merge_strategy": "incremental", + "merge_key": "avtco#, avtvh#, avttx#", + "enabled": 1, + "dest_description": "CMS A/P voucher transaction events (payments, discounts, adjustments)", + "description": "CMS A/P voucher transaction events (payments, discounts, adjustments)", + "columns": [ + { + "source_name": "AVTCO#", + "source_type": "NUMERIC(2,0)", + "dest_name": "avtco#", + "dest_type": "numeric(2,0)", + "description": "Company Number" + }, + { + "source_name": "AVTVH#", + "source_type": "NUMERIC(6,0)", + "dest_name": "avtvh#", + "dest_type": "numeric(6,0)", + "description": "Voucher'Number" + }, + { + "source_name": "AVTTX#", + "source_type": "NUMERIC(9,0)", + "dest_name": "avttx#", + "dest_type": "numeric(9,0)", + "description": "Transaction'Number" + }, + { + "source_name": "AVTTDT", + "source_type": "DATE", + "dest_name": "avttdt", + "dest_type": "date", + "description": "Transaction Date" + }, + { + "source_name": "AVTTYP", + "source_type": "CHAR(2)", + "dest_name": "avttyp", + "dest_type": "text", + "description": "Transaction Type" + }, + { + "source_name": "AVT1099", + "source_type": "CHAR(1)", + "dest_name": "avt1099", + "dest_type": "text", + "description": "1099 Applicable" + }, + { + "source_name": "AVTSTM", + "source_type": "TIMESTMP", + "dest_name": "avtstm", + "dest_type": "text", + "description": "Actual Time Stamp" + }, + { + "source_name": "AVTFIS", + "source_type": "NUMERIC(6,0)", + "dest_name": "avtfis", + "dest_type": "numeric(6,0)", + "description": "Fiscal Period" + }, + { + "source_name": "AVTAMT", + "source_type": "NUMERIC(11,2)", + "dest_name": "avtamt", + "dest_type": "numeric(11,2)", + "description": "Cheque Paid Amount" + }, + { + "source_name": "AVTCCD", + "source_type": "CHAR(3)", + "dest_name": "avtccd", + "dest_type": "text", + "description": "Currency Code" + }, + { + "source_name": "AVTVAM", + "source_type": "NUMERIC(11,2)", + "dest_name": "avtvam", + "dest_type": "numeric(11,2)", + "description": "Amount in Voucher Curr" + }, + { + "source_name": "AVTVCC", + "source_type": "CHAR(3)", + "dest_name": "avtvcc", + "dest_type": "text", + "description": "Voucher Currency" + }, + { + "source_name": "AVTDIS", + "source_type": "NUMERIC(11,2)", + "dest_name": "avtdis", + "dest_type": "numeric(11,2)", + "description": "Discount Taken" + }, + { + "source_name": "AVTEXC", + "source_type": "NUMERIC(11,6)", + "dest_name": "avtexc", + "dest_type": "numeric(11,6)", + "description": "Exchange Rate Voucher Currency" + }, + { + "source_name": "AVTCHC", + "source_type": "NUMERIC(2,0)", + "dest_name": "avtchc", + "dest_type": "numeric(2,0)", + "description": "Cheque Company" + }, + { + "source_name": "AVTCHB", + "source_type": "CHAR(3)", + "dest_name": "avtchb", + "dest_type": "text", + "description": "Cheque Bank Code" + }, + { + "source_name": "AVTCHQ", + "source_type": "NUMERIC(8,0)", + "dest_name": "avtchq", + "dest_type": "numeric(8,0)", + "description": "Cheque Number" + }, + { + "source_name": "AVTEFT", + "source_type": "CHAR(20)", + "dest_name": "avteft", + "dest_type": "text", + "description": "EFT #" + }, + { + "source_name": "AVTOBL", + "source_type": "NUMERIC(11,2)", + "dest_name": "avtobl", + "dest_type": "numeric(11,2)", + "description": "New Balance" + }, + { + "source_name": "AVTUSR", + "source_type": "CHAR(10)", + "dest_name": "avtusr", + "dest_type": "text", + "description": "User ID" + }, + { + "source_name": "AVTEXCP", + "source_type": "NUMERIC(11,6)", + "dest_name": "avtexcp", + "dest_type": "numeric(11,6)", + "description": "Exchange Rate Cheque Currency" + }, + { + "source_name": "AVTHQEXCP", + "source_type": "NUMERIC(11,6)", + "dest_name": "avthqexcp", + "dest_type": "numeric(11,6)", + "description": "HQ Exchange Rate Cheque Currency" + }, + { + "source_name": "AVTEXCM", + "source_type": "NUMERIC(11,6)", + "dest_name": "avtexcm", + "dest_type": "numeric(11,6)", + "description": "Man. Cheq. Exc. Rate Entered" + }, + { + "source_name": "AVTOEX", + "source_type": "NUMERIC(11,6)", + "dest_name": "avtoex", + "dest_type": "numeric(11,6)", + "description": "Overridden Exchange Rate" + }, + { + "source_name": "AVTIRDT", + "source_type": "DATE", + "dest_name": "avtirdt", + "dest_type": "date", + "description": "Invoice Received Date" + }, + { + "source_name": "AVTDSNT", + "source_type": "NUMERIC(9,2)", + "dest_name": "avtdsnt", + "dest_type": "numeric(9,2)", + "description": "Net Discount Amount" + }, + { + "source_name": "AVTGSTD", + "source_type": "NUMERIC(9,2)", + "dest_name": "avtgstd", + "dest_type": "numeric(9,2)", + "description": "Recoverable Discount Amount" + }, + { + "source_name": "AVTFUT1", + "source_type": "CHAR(1)", + "dest_name": "avtfut1", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "AVTFUT2", + "source_type": "CHAR(1)", + "dest_name": "avtfut2", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "AVTFUT3", + "source_type": "NUMERIC(15,5)", + "dest_name": "avtfut3", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "AVTFUT4", + "source_type": "NUMERIC(15,5)", + "dest_name": "avtfut4", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "AVTFUT5", + "source_type": "CHAR(10)", + "dest_name": "avtfut5", + "dest_type": "text", + "description": "User-Defined Date" + }, + { + "source_name": "AVTFUT6", + "source_type": "CHAR(10)", + "dest_name": "avtfut6", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "AVTFUT7", + "source_type": "CHAR(20)", + "dest_name": "avtfut7", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "AVTFUT8", + "source_type": "CHAR(20)", + "dest_name": "avtfut8", + "dest_type": "text", + "description": "Future Use" + } + ], + "watermarks": [ + { + "name": "avtx_wm", + "connection": "usmidsap02", + "resolver_sql": "SELECT COALESCE(MAX(avtstm)::timestamp - INTERVAL '7 days', TIMESTAMP '1900-01-01')::text FROM cms.avtx", + "default_value": "1900-01-01 00:00:00.000000" + } + ], + "hooks": [] +} diff --git a/config/modules/avtx.sql b/config/modules/avtx.sql new file mode 100644 index 0000000..c0015c0 --- /dev/null +++ b/config/modules/avtx.sql @@ -0,0 +1,38 @@ +SELECT + "AVTCO#" AS avtco#, + "AVTVH#" AS avtvh#, + "AVTTX#" AS avttx#, + CASE WHEN AVTTDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVTTDT END AS avttdt, + RTRIM(AVTTYP) AS avttyp, + RTRIM(AVT1099) AS avt1099, + AVTSTM AS avtstm, + AVTFIS AS avtfis, + AVTAMT AS avtamt, + RTRIM(AVTCCD) AS avtccd, + AVTVAM AS avtvam, + RTRIM(AVTVCC) AS avtvcc, + AVTDIS AS avtdis, + AVTEXC AS avtexc, + AVTCHC AS avtchc, + RTRIM(AVTCHB) AS avtchb, + AVTCHQ AS avtchq, + RTRIM(AVTEFT) AS avteft, + AVTOBL AS avtobl, + RTRIM(AVTUSR) AS avtusr, + AVTEXCP AS avtexcp, + AVTHQEXCP AS avthqexcp, + AVTEXCM AS avtexcm, + AVTOEX AS avtoex, + CASE WHEN AVTIRDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE AVTIRDT END AS avtirdt, + AVTDSNT AS avtdsnt, + AVTGSTD AS avtgstd, + RTRIM(AVTFUT1) AS avtfut1, + RTRIM(AVTFUT2) AS avtfut2, + AVTFUT3 AS avtfut3, + AVTFUT4 AS avtfut4, + RTRIM(AVTFUT5) AS avtfut5, + RTRIM(AVTFUT6) AS avtfut6, + RTRIM(AVTFUT7) AS avtfut7, + RTRIM(AVTFUT8) AS avtfut8 +FROM LGDAT.AVTX +WHERE AVTSTM > '{avtx_wm}' diff --git a/config/modules/open.json b/config/modules/open.json new file mode 100644 index 0000000..fc4f323 --- /dev/null +++ b/config/modules/open.json @@ -0,0 +1,485 @@ +{ + "name": "open", + "source_connection": "S78030956", + "dest_connection": "usmidsap02", + "dest_table": "cms.open", + "staging_table": "pipekit_staging.open", + "merge_strategy": "full", + "merge_key": null, + "enabled": 1, + "dest_description": "CMS A/P open payables; FHCBAL is the live voucher balance", + "description": "CMS A/P open payables; FHCBAL is the live voucher balance", + "columns": [ + { + "source_name": "FHCOM#", + "source_type": "NUMERIC(2,0)", + "dest_name": "fhcom#", + "dest_type": "numeric(2,0)", + "description": "Company Number" + }, + { + "source_name": "FHBANK", + "source_type": "CHAR(3)", + "dest_name": "fhbank", + "dest_type": "text", + "description": "Pay. Bank Code" + }, + { + "source_name": "FHVCH#", + "source_type": "NUMERIC(6,0)", + "dest_name": "fhvch#", + "dest_type": "numeric(6,0)", + "description": "Voucher Number" + }, + { + "source_name": "FHPYY", + "source_type": "NUMERIC(2,0)", + "dest_name": "fhpyy", + "dest_type": "numeric(2,0)", + "description": "Fiscal Year" + }, + { + "source_name": "FHPPER", + "source_type": "NUMERIC(2,0)", + "dest_name": "fhpper", + "dest_type": "numeric(2,0)", + "description": "Fiscal Period" + }, + { + "source_name": "FHHSTS", + "source_type": "CHAR(1)", + "dest_name": "fhhsts", + "dest_type": "text", + "description": "Old Hold" + }, + { + "source_name": "FHINV#", + "source_type": "CHAR(20)", + "dest_name": "fhinv#", + "dest_type": "text", + "description": "Invoice Number" + }, + { + "source_name": "FHIDTE", + "source_type": "CHAR(6)", + "dest_name": "fhidte", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHDDTE", + "source_type": "CHAR(6)", + "dest_name": "fhddte", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHCHQ#", + "source_type": "NUMERIC(8,0)", + "dest_name": "fhchq#", + "dest_type": "numeric(8,0)", + "description": "Manual Cheque #" + }, + { + "source_name": "FHMDTE", + "source_type": "CHAR(6)", + "dest_name": "fhmdte", + "dest_type": "text", + "description": "Closing Period" + }, + { + "source_name": "FHA1", + "source_type": "CHAR(1)", + "dest_name": "fha1", + "dest_type": "text", + "description": "Work Field DO NOT USE" + }, + { + "source_name": "FHANU", + "source_type": "CHAR(4)", + "dest_name": "fhanu", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHGRS", + "source_type": "DECIMAL(11,2)", + "dest_name": "fhgrs", + "dest_type": "numeric(11,2)", + "description": "Gross Amount" + }, + { + "source_name": "FHDIS", + "source_type": "DECIMAL(9,2)", + "dest_name": "fhdis", + "dest_type": "numeric(9,2)", + "description": "Discount Amount" + }, + { + "source_name": "FHPCOD", + "source_type": "CHAR(1)", + "dest_name": "fhpcod", + "dest_type": "text", + "description": "Pay Code" + }, + { + "source_name": "FHVCLS", + "source_type": "CHAR(1)", + "dest_name": "fhvcls", + "dest_type": "text", + "description": "Vendor Class" + }, + { + "source_name": "FHDSDT", + "source_type": "CHAR(6)", + "dest_name": "fhdsdt", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHA4", + "source_type": "CHAR(4)", + "dest_name": "fha4", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHPTD", + "source_type": "DECIMAL(11,2)", + "dest_name": "fhptd", + "dest_type": "numeric(11,2)", + "description": "Paid to Date" + }, + { + "source_name": "FHPTD2", + "source_type": "DECIMAL(11,2)", + "dest_name": "fhptd2", + "dest_type": "numeric(11,2)", + "description": "Not Used" + }, + { + "source_name": "FHPIND", + "source_type": "CHAR(1)", + "dest_name": "fhpind", + "dest_type": "text", + "description": "Not Used" + }, + { + "source_name": "FHDSCD", + "source_type": "CHAR(1)", + "dest_name": "fhdscd", + "dest_type": "text", + "description": "Take Discount Flag" + }, + { + "source_name": "FHA3", + "source_type": "CHAR(3)", + "dest_name": "fha3", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "FHVDES", + "source_type": "CHAR(20)", + "dest_name": "fhvdes", + "dest_type": "text", + "description": "Voucher Description" + }, + { + "source_name": "FHPAY", + "source_type": "DECIMAL(11,2)", + "dest_name": "fhpay", + "dest_type": "numeric(11,2)", + "description": "Pay Amount" + }, + { + "source_name": "FHVEN#", + "source_type": "CHAR(10)", + "dest_name": "fhven#", + "dest_type": "text", + "description": "Vendor Code" + }, + { + "source_name": "FHGSTA", + "source_type": "NUMERIC(11,2)", + "dest_name": "fhgsta", + "dest_type": "numeric(11,2)", + "description": "GST Amount" + }, + { + "source_name": "FHGSTX", + "source_type": "NUMERIC(11,2)", + "dest_name": "fhgstx", + "dest_type": "numeric(11,2)", + "description": "GST Exempt Amount" + }, + { + "source_name": "FHADR#", + "source_type": "NUMERIC(8,0)", + "dest_name": "fhadr#", + "dest_type": "numeric(8,0)", + "description": "OneTime Vendor#" + }, + { + "source_name": "FHIDAT", + "source_type": "DATE", + "dest_name": "fhidat", + "dest_type": "date", + "description": "Invoice Date" + }, + { + "source_name": "FHDDAT", + "source_type": "DATE", + "dest_name": "fhddat", + "dest_type": "date", + "description": "Due Date" + }, + { + "source_name": "FHMDAT", + "source_type": "DATE", + "dest_name": "fhmdat", + "dest_type": "date", + "description": "Manual Cheque Date" + }, + { + "source_name": "FHSDAT", + "source_type": "DATE", + "dest_name": "fhsdat", + "dest_type": "date", + "description": "Discount Date" + }, + { + "source_name": "FHPRJ#", + "source_type": "CHAR(20)", + "dest_name": "fhprj#", + "dest_type": "text", + "description": "Project Number" + }, + { + "source_name": "FHCURR", + "source_type": "CHAR(2)", + "dest_name": "fhcurr", + "dest_type": "text", + "description": "Pay. Curr Code" + }, + { + "source_name": "FHAMTP", + "source_type": "NUMERIC(11,2)", + "dest_name": "fhamtp", + "dest_type": "numeric(11,2)", + "description": "Amt in Payment Currency" + }, + { + "source_name": "FHVBKC", + "source_type": "CHAR(3)", + "dest_name": "fhvbkc", + "dest_type": "text", + "description": "Vendor Bank Code" + }, + { + "source_name": "FHHQCN", + "source_type": "NUMERIC(2,0)", + "dest_name": "fhhqcn", + "dest_type": "numeric(2,0)", + "description": "HQ Company Number" + }, + { + "source_name": "FHHQBC", + "source_type": "CHAR(3)", + "dest_name": "fhhqbc", + "dest_type": "text", + "description": "HQ Bank Code" + }, + { + "source_name": "FHCBAL", + "source_type": "NUMERIC(11,2)", + "dest_name": "fhcbal", + "dest_type": "numeric(11,2)", + "description": "Current Balance" + }, + { + "source_name": "FHSTSC", + "source_type": "CHAR(1)", + "dest_name": "fhstsc", + "dest_type": "text", + "description": "Status of Voucher" + }, + { + "source_name": "FHSTSK", + "source_type": "CHAR(1)", + "dest_name": "fhstsk", + "dest_type": "text", + "description": "Status Key" + }, + { + "source_name": "FHFUT1", + "source_type": "CHAR(1)", + "dest_name": "fhfut1", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT2", + "source_type": "CHAR(1)", + "dest_name": "fhfut2", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT3", + "source_type": "CHAR(1)", + "dest_name": "fhfut3", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT4", + "source_type": "CHAR(1)", + "dest_name": "fhfut4", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT5", + "source_type": "CHAR(10)", + "dest_name": "fhfut5", + "dest_type": "text", + "description": "User-Defined Date" + }, + { + "source_name": "FHFUT6", + "source_type": "CHAR(10)", + "dest_name": "fhfut6", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT7", + "source_type": "CHAR(20)", + "dest_name": "fhfut7", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUT8", + "source_type": "NUMERIC(15,5)", + "dest_name": "fhfut8", + "dest_type": "numeric(15,5)", + "description": "Fiscal Century+Year" + }, + { + "source_name": "FHFUT9", + "source_type": "NUMERIC(15,5)", + "dest_name": "fhfut9", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "FHFUTA", + "source_type": "CHAR(3)", + "dest_name": "fhfuta", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHWTYC", + "source_type": "NUMERIC(9,0)", + "dest_name": "fhwtyc", + "dest_type": "numeric(9,0)", + "description": "Warranty Claim Number" + }, + { + "source_name": "FHCDAT", + "source_type": "DATE", + "dest_name": "fhcdat", + "dest_type": "date", + "description": "Closing Date" + }, + { + "source_name": "FHOEXT", + "source_type": "NUMERIC(11,6)", + "dest_name": "fhoext", + "dest_type": "numeric(11,6)", + "description": "Overridden Exchange Rate" + }, + { + "source_name": "FHIRDT", + "source_type": "DATE", + "dest_name": "fhirdt", + "dest_type": "date", + "description": "Invoice Received Date" + }, + { + "source_name": "FHDSNT", + "source_type": "NUMERIC(9,2)", + "dest_name": "fhdsnt", + "dest_type": "numeric(9,2)", + "description": "Net Discount Amount" + }, + { + "source_name": "FHGSTD", + "source_type": "NUMERIC(9,2)", + "dest_name": "fhgstd", + "dest_type": "numeric(9,2)", + "description": "Recoverable Discount Amount" + }, + { + "source_name": "FHFUTB", + "source_type": "NUMERIC(15,5)", + "dest_name": "fhfutb", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "FHFUTC", + "source_type": "NUMERIC(15,5)", + "dest_name": "fhfutc", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "FHFUTD", + "source_type": "CHAR(10)", + "dest_name": "fhfutd", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUTE", + "source_type": "CHAR(20)", + "dest_name": "fhfute", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHFUTF", + "source_type": "CHAR(20)", + "dest_name": "fhfutf", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "FHMCRF", + "source_type": "CHAR(30)", + "dest_name": "fhmcrf", + "dest_type": "text", + "description": "Manual Cheque Reference Text" + }, + { + "source_name": "FHEHCD", + "source_type": "CHAR(3)", + "dest_name": "fhehcd", + "dest_type": "text", + "description": "EDI Handling Code" + }, + { + "source_name": "FHMISA", + "source_type": "NUMERIC(15,5)", + "dest_name": "fhmisa", + "dest_type": "numeric(15,5)", + "description": "Misc. Charge Amount" + } + ], + "watermarks": [], + "hooks": [] +} diff --git a/config/modules/open.sql b/config/modules/open.sql new file mode 100644 index 0000000..e3d63d8 --- /dev/null +++ b/config/modules/open.sql @@ -0,0 +1,69 @@ +SELECT + "FHCOM#" AS fhcom#, + RTRIM(FHBANK) AS fhbank, + "FHVCH#" AS fhvch#, + FHPYY AS fhpyy, + FHPPER AS fhpper, + RTRIM(FHHSTS) AS fhhsts, + RTRIM("FHINV#") AS fhinv#, + RTRIM(FHIDTE) AS fhidte, + RTRIM(FHDDTE) AS fhddte, + "FHCHQ#" AS fhchq#, + RTRIM(FHMDTE) AS fhmdte, + RTRIM(FHA1) AS fha1, + RTRIM(FHANU) AS fhanu, + FHGRS AS fhgrs, + FHDIS AS fhdis, + RTRIM(FHPCOD) AS fhpcod, + RTRIM(FHVCLS) AS fhvcls, + RTRIM(FHDSDT) AS fhdsdt, + RTRIM(FHA4) AS fha4, + FHPTD AS fhptd, + FHPTD2 AS fhptd2, + RTRIM(FHPIND) AS fhpind, + RTRIM(FHDSCD) AS fhdscd, + RTRIM(FHA3) AS fha3, + RTRIM(FHVDES) AS fhvdes, + FHPAY AS fhpay, + RTRIM("FHVEN#") AS fhven#, + FHGSTA AS fhgsta, + FHGSTX AS fhgstx, + "FHADR#" AS fhadr#, + CASE WHEN FHIDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHIDAT END AS fhidat, + CASE WHEN FHDDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHDDAT END AS fhddat, + CASE WHEN FHMDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHMDAT END AS fhmdat, + CASE WHEN FHSDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHSDAT END AS fhsdat, + RTRIM("FHPRJ#") AS fhprj#, + RTRIM(FHCURR) AS fhcurr, + FHAMTP AS fhamtp, + RTRIM(FHVBKC) AS fhvbkc, + FHHQCN AS fhhqcn, + RTRIM(FHHQBC) AS fhhqbc, + FHCBAL AS fhcbal, + RTRIM(FHSTSC) AS fhstsc, + RTRIM(FHSTSK) AS fhstsk, + RTRIM(FHFUT1) AS fhfut1, + RTRIM(FHFUT2) AS fhfut2, + RTRIM(FHFUT3) AS fhfut3, + RTRIM(FHFUT4) AS fhfut4, + RTRIM(FHFUT5) AS fhfut5, + RTRIM(FHFUT6) AS fhfut6, + RTRIM(FHFUT7) AS fhfut7, + FHFUT8 AS fhfut8, + FHFUT9 AS fhfut9, + RTRIM(FHFUTA) AS fhfuta, + FHWTYC AS fhwtyc, + CASE WHEN FHCDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHCDAT END AS fhcdat, + FHOEXT AS fhoext, + CASE WHEN FHIRDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE FHIRDT END AS fhirdt, + FHDSNT AS fhdsnt, + FHGSTD AS fhgstd, + FHFUTB AS fhfutb, + FHFUTC AS fhfutc, + RTRIM(FHFUTD) AS fhfutd, + RTRIM(FHFUTE) AS fhfute, + RTRIM(FHFUTF) AS fhfutf, + RTRIM(FHMCRF) AS fhmcrf, + RTRIM(FHEHCD) AS fhehcd, + FHMISA AS fhmisa +FROM LGDAT.OPEN diff --git a/config/modules/vchr.json b/config/modules/vchr.json new file mode 100644 index 0000000..9c6aa60 --- /dev/null +++ b/config/modules/vchr.json @@ -0,0 +1,275 @@ +{ + "name": "vchr", + "source_connection": "S78030956", + "dest_connection": "usmidsap02", + "dest_table": "cms.vchr", + "staging_table": "pipekit_staging.vchr", + "merge_strategy": "full", + "merge_key": null, + "enabled": 1, + "dest_description": "CMS A/P vouchers entered (period to date)", + "description": "CMS A/P vouchers entered (period to date)", + "columns": [ + { + "source_name": "IDBNK#", + "source_type": "CHAR(3)", + "dest_name": "idbnk#", + "dest_type": "text", + "description": "A/P Bank Code" + }, + { + "source_name": "IDA5", + "source_type": "CHAR(5)", + "dest_name": "ida5", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "IDCOM#", + "source_type": "NUMERIC(2,0)", + "dest_name": "idcom#", + "dest_type": "numeric(2,0)", + "description": "Company Number" + }, + { + "source_name": "IDVCH#", + "source_type": "NUMERIC(6,0)", + "dest_name": "idvch#", + "dest_type": "numeric(6,0)", + "description": "Voucher Number" + }, + { + "source_name": "IDMCH#", + "source_type": "NUMERIC(8,0)", + "dest_name": "idmch#", + "dest_type": "numeric(8,0)", + "description": "Manual Cheque Number" + }, + { + "source_name": "IDIDAT", + "source_type": "CHAR(6)", + "dest_name": "ididat", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "IDGROS", + "source_type": "DECIMAL(11,2)", + "dest_name": "idgros", + "dest_type": "numeric(11,2)", + "description": "Gross Amount" + }, + { + "source_name": "IDDISC", + "source_type": "DECIMAL(9,2)", + "dest_name": "iddisc", + "dest_type": "numeric(9,2)", + "description": "Discount Amount" + }, + { + "source_name": "IDDISP", + "source_type": "NUMERIC(3,1)", + "dest_name": "iddisp", + "dest_type": "numeric(3,1)", + "description": "NOT USED" + }, + { + "source_name": "IDDSDT", + "source_type": "CHAR(6)", + "dest_name": "iddsdt", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "IDA1", + "source_type": "CHAR(1)", + "dest_name": "ida1", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "IDVEN#", + "source_type": "CHAR(10)", + "dest_name": "idven#", + "dest_type": "text", + "description": "Vendor Code" + }, + { + "source_name": "IDVDES", + "source_type": "CHAR(20)", + "dest_name": "idvdes", + "dest_type": "text", + "description": "Voucher Description" + }, + { + "source_name": "IDINV#", + "source_type": "CHAR(20)", + "dest_name": "idinv#", + "dest_type": "text", + "description": "Invoice Number" + }, + { + "source_name": "IDA8", + "source_type": "CHAR(8)", + "dest_name": "ida8", + "dest_type": "text", + "description": "NOT USED" + }, + { + "source_name": "IDFISP", + "source_type": "NUMERIC(2,0)", + "dest_name": "idfisp", + "dest_type": "numeric(2,0)", + "description": "Fiscal Period" + }, + { + "source_name": "IDGSTA", + "source_type": "NUMERIC(11,2)", + "dest_name": "idgsta", + "dest_type": "numeric(11,2)", + "description": "GST Amount" + }, + { + "source_name": "IDGSTX", + "source_type": "NUMERIC(11,2)", + "dest_name": "idgstx", + "dest_type": "numeric(11,2)", + "description": "GST Exempt Amount" + }, + { + "source_name": "IDFISY", + "source_type": "NUMERIC(2,0)", + "dest_name": "idfisy", + "dest_type": "numeric(2,0)", + "description": "Fiscal Year" + }, + { + "source_name": "IDADR#", + "source_type": "NUMERIC(8,0)", + "dest_name": "idadr#", + "dest_type": "numeric(8,0)", + "description": "One Time Vendor#" + }, + { + "source_name": "IDDATE", + "source_type": "DATE", + "dest_name": "iddate", + "dest_type": "date", + "description": "Invoice Date" + }, + { + "source_name": "IDDDAT", + "source_type": "DATE", + "dest_name": "idddat", + "dest_type": "date", + "description": "Discount Date" + }, + { + "source_name": "IDIRDT", + "source_type": "DATE", + "dest_name": "idirdt", + "dest_type": "date", + "description": "Invoice Received Date" + }, + { + "source_name": "IDCVRS", + "source_type": "CHAR(5)", + "dest_name": "idcvrs", + "dest_type": "text", + "description": "Credit-Voucher Reason Code" + }, + { + "source_name": "IDCMT1", + "source_type": "CHAR(30)", + "dest_name": "idcmt1", + "dest_type": "text", + "description": "Credit-Voucher Comment 1" + }, + { + "source_name": "IDCMT2", + "source_type": "CHAR(30)", + "dest_name": "idcmt2", + "dest_type": "text", + "description": "Credit-Voucher Comment 2" + }, + { + "source_name": "IDCMT3", + "source_type": "CHAR(30)", + "dest_name": "idcmt3", + "dest_type": "text", + "description": "Credit-Voucher Comment 3" + }, + { + "source_name": "IDMISA", + "source_type": "NUMERIC(15,5)", + "dest_name": "idmisa", + "dest_type": "numeric(15,5)", + "description": "Misc. Charge Amount" + }, + { + "source_name": "IDUDDT", + "source_type": "DATE", + "dest_name": "iduddt", + "dest_type": "date", + "description": "User-Defined Date" + }, + { + "source_name": "IDFUT1", + "source_type": "CHAR(1)", + "dest_name": "idfut1", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "IDFUT2", + "source_type": "CHAR(1)", + "dest_name": "idfut2", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "IDFUT3", + "source_type": "NUMERIC(15,5)", + "dest_name": "idfut3", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "IDFUT4", + "source_type": "NUMERIC(15,5)", + "dest_name": "idfut4", + "dest_type": "numeric(15,5)", + "description": "Future Use" + }, + { + "source_name": "IDFUT5", + "source_type": "CHAR(10)", + "dest_name": "idfut5", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "IDFUT6", + "source_type": "CHAR(10)", + "dest_name": "idfut6", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "IDFUT7", + "source_type": "CHAR(20)", + "dest_name": "idfut7", + "dest_type": "text", + "description": "Future Use" + }, + { + "source_name": "IDFUT8", + "source_type": "CHAR(20)", + "dest_name": "idfut8", + "dest_type": "text", + "description": "Future Use" + } + ], + "watermarks": [], + "hooks": [] +} diff --git a/config/modules/vchr.sql b/config/modules/vchr.sql new file mode 100644 index 0000000..f97e731 --- /dev/null +++ b/config/modules/vchr.sql @@ -0,0 +1,39 @@ +SELECT + RTRIM("IDBNK#") AS idbnk#, + RTRIM(IDA5) AS ida5, + "IDCOM#" AS idcom#, + "IDVCH#" AS idvch#, + "IDMCH#" AS idmch#, + RTRIM(IDIDAT) AS ididat, + IDGROS AS idgros, + IDDISC AS iddisc, + IDDISP AS iddisp, + RTRIM(IDDSDT) AS iddsdt, + RTRIM(IDA1) AS ida1, + RTRIM("IDVEN#") AS idven#, + RTRIM(IDVDES) AS idvdes, + RTRIM("IDINV#") AS idinv#, + RTRIM(IDA8) AS ida8, + IDFISP AS idfisp, + IDGSTA AS idgsta, + IDGSTX AS idgstx, + IDFISY AS idfisy, + "IDADR#" AS idadr#, + CASE WHEN IDDATE IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE IDDATE END AS iddate, + CASE WHEN IDDDAT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE IDDDAT END AS idddat, + CASE WHEN IDIRDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE IDIRDT END AS idirdt, + RTRIM(IDCVRS) AS idcvrs, + RTRIM(IDCMT1) AS idcmt1, + RTRIM(IDCMT2) AS idcmt2, + RTRIM(IDCMT3) AS idcmt3, + IDMISA AS idmisa, + CASE WHEN IDUDDT IN (DATE('0001-01-01'), DATE('9999-12-31')) THEN NULL ELSE IDUDDT END AS iduddt, + RTRIM(IDFUT1) AS idfut1, + RTRIM(IDFUT2) AS idfut2, + IDFUT3 AS idfut3, + IDFUT4 AS idfut4, + RTRIM(IDFUT5) AS idfut5, + RTRIM(IDFUT6) AS idfut6, + RTRIM(IDFUT7) AS idfut7, + RTRIM(IDFUT8) AS idfut8 +FROM LGDAT.VCHR