List of Use Cases Implemented by the AP100, AP110, and AP115 Programs¶
The RPG programs AP100, AP110, and AP115 form a call stack for processing Accounts Payable (A/P) voucher transactions on IBM midrange systems (e.g., AS/400 or iSeries). Together, they implement a single cohesive use case:
- Use Case: Process and Validate A/P Voucher Transactions
- Description: This use case involves the entry, validation, editing, and reporting of A/P voucher transactions, including header and detail records, for various payment types (e.g., prepaid checks, ACH, wire transfers, employee expenses, utility auto-payments). The process ensures data integrity, validates against vendor, company, G/L, and inventory data, and generates reports for errors and totals.
- Components:
- AP100: Handles interactive entry and validation of voucher transactions via screen formats (
AP100S1,AP100S2,AP100S3,AP100S5), updating transaction files (APTRAN,APCONT) and callingAP1011for freight calculations. - AP110: Validates voucher transactions from
APTRAN, checks for errors (e.g., duplicate invoices, invalid G/Ls), updates prepaid check records (APCHKT), and produces an edit report (APLIST). - AP115: Validates prepaid checks, ensuring non-void checks are not already open and void checks match the full amount, generating an error report (
APLIST).
- AP100: Handles interactive entry and validation of voucher transactions via screen formats (
This single use case encompasses the entire workflow of entering, validating, and reporting A/P voucher transactions, with each program handling a specific aspect of the process.
Function Requirement Document: Process and Validate A/P Voucher Transactions¶
Function Requirement Document: Process and Validate A/P Voucher Transactions¶
Overview¶
This function processes and validates Accounts Payable (A/P) voucher transactions, including header and detail records, for various payment types (prepaid checks, ACH, wire transfers, employee expenses, utility auto-payments). It ensures data integrity by validating inputs against company, vendor, G/L, and inventory data, calculates due dates and discounts, updates transaction and check files, and generates reports for errors and totals.
Inputs¶
- Company Number (
CONO): 2-digit identifier for the company. - Vendor Number (
VEND): 5-digit identifier for the vendor. - Entry Number (
ENT#): 5-digit transaction identifier (auto-generated or user-provided). - Invoice Number (
INV#): 20-character vendor invoice number. - Invoice Amount (
IAMT): 11.2-digit total invoice amount. - Invoice Date (
INDT): 6-digit vendor invoice date (MMDDYY). - Due Date (
DUDT): 6-digit due date (MMDDYY, calculated or user-provided). - Discount Due Date (
DSDT): 6-digit discount due date (MMDDYY, calculated or user-provided). - Hold Code (
HOLD): 1-character code (H=hold,A=ACH,W=wire transfer,E=employee expense,U=utility auto-payment). - Prepay Code (
PAID): 1-character code (P=prepaid,A=ACH,E=employee expense,U=utility auto-payment). - Prepaid Check Number (
PPCK): 6-digit check number for prepaid transactions. - Single Check Flag (
SNGL): 1-character flag (S=single check). - Canceled Voucher (
CNVO): 5-digit canceled voucher number. - Purchase Order Number (
PONO): 30-character purchase order number. - Sales Order Number (
SORN): 6-digit sales order number. - Carrier ID (
CAID): 6-character carrier identifier. - Process Type (
PTYP): 6-character process type (NORMAL,PAPER,ARGLMS). - Freight Total (
FRTL): 7.2-digit total freight amount to allocate. - Detail Lines:
- Sequence Number (
ENSQ): 3-digit line sequence. - Expense G/L (
EXGL): 8-digit expense general ledger account. - Amount (
AMT): 8.2-digit line amount. - Discount Amount (
DISC): 8.2-digit discount amount. - Discount Percentage (
DSPC): 3.2-digit discount percentage. - Gallons (
GALN): 4.2-digit gallons quantity. - Receipt Number (
RCPT): 7-digit receipt number. - Receipt Code (
CLCD): 1-character code (O=open,C=closed). - Freight Amount (
FRAM): 4.2-digit freight amount per line. - Product Amount (
PRAM): 6.2-digit product amount per line.
Outputs¶
- Updated Files:
APTRAN: Transaction header and detail records.APCHKT: Prepaid check records.APCONT: Updated with next entry number.APSTAT: Error status (Yfor errors,Notherwise).- Report (
APLIST): Printed report listing transaction details, errors, warnings, and totals (invoices, prepaid amounts, vendor hash).
Process Steps¶
- Initialize:
- Retrieve system date and time.
- Validate company number (
CONO) againstAPCONT. If invalid or deleted, return error. - Initialize accumulators for invoice counts, amounts, discounts, and prepaid totals.
-
Set process type (
PTYP) toNORMALif blank. -
Validate Header:
- Ensure
CONOexists inAPCONT, not deleted (ACDEL ≠ 'D'). - Validate
VENDagainstAPVEND, ensuring not deleted (VNDEL ≠ 'D'), not inactive (VNDEL ≠ 'I'), and name not blank. - Verify
INV#is non-blank and unique (checkAPTRNX,APINVH,APOPNHCfor non-prepaid, non-canceled, non-wire-transfer transactions). - Ensure
INDTis non-zero and not older than one year (warning only). - Ensure
IAMTis non-zero and matches sum of detail amounts (AMT+FRAM). - Validate
HOLD(H,A,W,E,U) andPAID(P,A,E,U). - If
PAIDis set, ensurePPCKis provided. - Calculate
DUDTandDSDTusing terms (VNTERM) fromGSTABL(net days, discount days). - Validate
ATAPGLandATBKGLagainstGLMAST, ensuring not deleted or inactive. - If
SORN ≠ 0, prohibitRCPTandGALN. -
For freight invoices (
FRTL ≠ 0), allocate amounts to detail lines (callAP1011). -
Validate Detail Lines:
- Validate
EXGLagainstGLMAST, ensuring not deleted or inactive. - If
GLPOCD = 'Y', ensurePONOis non-blank. - Validate gallons/receipts:
- If
VNGRRQ = 'Y', requireGALNandRCPT. - If
VNGRRQ = 'N', prohibitGALNandRCPT. - If
GLAPCD = 'Y'andAMT > 0, requireGALN. - If
GALN > 0, ensureGLAPCD = 'Y'. - If
RCPT ≠ 0, validate againstINFIL1orINTZH1for sufficient quantity (GALN ≤ IHNQTY + IHNQTF - IHAPTQ - IHAPTF) and no prior A/P postings. - Ensure
CLCDis'O'or'C'.
- If
- Validate discounts:
- Ensure
DISCandDSPCare not both non-zero. - If
DISCorDSPCis non-zero, requireACDSGL ≠ 0. - If
TBDISC = 0, prohibitDISCandDSPC. - If
TBDISC ≠ 0, ensureDSPC = TBDISCor bothDISCandDSPCare non-zero. - If
DSDT ≠ 0andDSDT ≤ system date, issue warning. - Calculate
DISC = AMT * (DSPC / 100)ifDSPC ≠ 0.
- Ensure
-
Calculate net amount:
NETAMT = AMT - DISC. -
Validate Prepaid Checks:
- For
PAIDtransactions, updateAPCHKTwith check amount (ACCKAM = AMT - DISC). - Ensure non-void checks are not already open (
AMCODE ≠ 'O'). -
Ensure void checks are open (
AMCODE = 'O') and match full amount (L1CKAM = AMCKAM). -
Update Files:
- Write/update
APTRANwith header and detail records. - Update
APCONTwith next entry number (ACNXTE). - Write/update
APCHKTwith prepaid check records. -
Write
APSTATwith error status (YorN). -
Generate Report:
- Produce
APLISTreport with:- Headers: Company, date, time, workstation, process type.
- Details: Entry, vendor, invoice number, description, amounts, G/L, status.
- Errors/Warnings: List entry numbers with issues (e.g., invalid vendor, duplicate invoice).
- Totals: Invoice count, amounts, discounts, prepaid totals, vendor hash.
Business Rules¶
- Company and Vendor:
CONOmust exist inAPCONT, not deleted.-
VENDmust exist inAPVEND, not deleted or inactive, with non-blank name. -
Invoice:
INV#must be non-blank and unique (unless prepaid, canceled, or wire transfer).IAMTmust be non-zero and match detail totals.-
INDTmust be non-zero; warn if older than one year. -
Payment Types:
HOLD:'H','A','W','E','U'.PAID:'P','A','E','U', withPPCKrequired if set.-
SNGL = 'S'for single check processing. -
Gallons and Receipts:
- If
VNGRRQ = 'Y', requireGALNandRCPT. - If
VNGRRQ = 'N', prohibitGALNandRCPT. - If
GLAPCD = 'Y'andAMT > 0, requireGALN. - If
GALN > 0, requireGLAPCD = 'Y'. RCPTmust exist inINFIL1orINTZH1with sufficient quantity.-
CLCDmust be'O'or'C'. -
Purchase Orders:
-
If
GLPOCD = 'Y', requirePONO. -
Discounts:
DISCandDSPCcannot both be non-zero.- Require
ACDSGLifDISCorDSPCis non-zero. - If
TBDISC = 0, prohibitDISCandDSPC. - If
TBDISC ≠ 0, ensureDSPC = TBDISCor bothDISCandDSPCare non-zero. -
Warn if
DSDT ≤ system date. -
Prepaid Checks:
- Non-void checks must not be open.
- Void checks must be open and match full amount.
-
Update
ACCKAM = AMT - DISC. -
Freight:
- If
FRTL ≠ 0, allocate amounts to detail lines viaAP1011.
Calculations¶
- Due Date (
DUDT): Calculated fromINDT+TBNETD(net days fromGSTABL), adjusted for holidays/weekends. - Discount Due Date (
DSDT): Calculated fromINDT+TBDISD(discount days fromGSTABL). - Discount Amount (
DISC): IfDSPC ≠ 0,DISC = AMT * (DSPC / 100). - Net Amount (
NETAMT):NETAMT = AMT - DISC. - Check Amount (
ACCKAM):ACCKAM = AMT - DISCfor prepaid checks. - Receipt Quantity:
RNQTY = IHNQTY + IHNQTF - IHAPTQ - IHAPTF(fromINFIL1orINTZH1). - Totals:
L1AMT = Σ(AMT),L1PAMT = Σ(PRAM),L1FAMT = Σ(FRAM),L1DISC = Σ(DISC),L1NET = L1AMT - L1DISC(per entry).L2AMT,L2PAMT,L2FAMT,L2DISC,L2NET,L2PPD,L2PPA,L2PPW,L2PPEaccumulateL1totals.
External Dependencies¶
- Program Called:
AP1011(for freight amount allocation to detail lines whenFRTL ≠ 0). - Files:
- Input:
APCONT,APVEND,GLMAST,GSTABL,INFIL1,INTZH1,APTRNX,APOPNHC,APINVH. - Update:
APTRAN,APCHKT,APSTAT. - Output:
APLIST(report).