pipekit/config/modules/open.json
Paul Trowbridge d0e72e270f 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) <noreply@anthropic.com>
2026-09-04 01:05:34 -04:00

486 lines
12 KiB
JSON

{
"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": []
}