pipekit/config/modules/vchr.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

276 lines
6.7 KiB
JSON

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