Skip to content

List of Use Cases Implemented by the Program Suite

The call stack (AR200.ocl36.txt, AR200P.rpgle.txt, AR200.rpg36.txt, AR210.rpg36.txt, AR211.rpg36.txt, AR2011.ocl36.txt, AR2011.rpg36.txt) implements a single primary use case in the accounts receivable (AR) cash receipts posting process. This use case is executed as a batch process, taking input files and producing outputs without direct screen interaction, aligning with the requirement for a large function that processes inputs to complete the process.

Use Case: Post Cash Receipts and Generate General Ledger (GL) Journal Entries with Product-Level Discount Allocation

  • Description: This use case processes cash receipt transactions to update AR files, generate GL journal entries, produce sales and cash receipts journal reports, and allocate discounts by product for invoices. It handles invoices, adjustments, payments, miscellaneous cash, and inter-company transactions, ensuring accurate financial updates and reporting.
  • Scope: Encompasses transaction validation, AR updates, GL entry creation, journal reporting, and product-specific discount allocation.
  • Inputs: Transaction register (CRTRGG), customer master (ARCUST), AR detail (ARDETL), control (ARCONT), sales finder (SA5FIND), and general table (GSTABL) files.
  • Outputs: Updated AR files (ARDETL, ARCUST), GL entries (TEMGEN), daily summaries (ARDALY), discount details (SA5DSC), and journal reports (REPORT, REPORTP).
  • Components:
  • AR200P: Initializes and validates input data, sets journal date.
  • AR200: Updates AR files, generates distribution entries, and prints the transaction posting register.
  • AR210: Creates GL journal entries from distribution records.
  • AR211: Summarizes GL entries, updates GL master, and prints sales/cash receipts journals.
  • AR2011: Allocates discounts by product for invoices.
  • OCL scripts (AR200.ocl36.txt, AR2011.ocl36.txt): Orchestrate file sorting, program execution, and cleanup.

This is a single cohesive use case, as all programs work together to process cash receipts end-to-end, with AR2011 providing specialized discount analysis.


Cash Receipts Posting Function Requirements

Overview

The Cash Receipts Posting function processes cash receipt transactions to update accounts receivable (AR) balances, generate general ledger (GL) journal entries, produce journal reports, and allocate discounts by product for invoices. It operates as a batch process, taking input files and producing file and report outputs without user interaction.

Inputs

  • Transaction Register (CRTRGG): Contains cash receipt transactions (company, customer, invoice, amount, discount, type, date, GL accounts, description, inter-company code).
  • Customer Master (ARCUST): Customer details (name, balances, payment dates).
  • AR Detail (ARDETL): Open invoice items (amount, aging code, payments).
  • AR Control (ARCONT): Company settings (GL accounts, journal numbers).
  • Sales Finder (SA5FIND): Invoice line items (product, quantity, price).
  • General Table (GSTABL): Product/discount code mappings.
  • Journal Date (JRNLDT): Supplied via user data structure (UDS).

Outputs

  • Updated Files:
  • ARDETL: Updated invoice amounts, payments, and aging.
  • ARCUST: Updated customer balances and payment dates.
  • TEMGEN: GL journal entries (debit/credit, account, amount).
  • ARDALY: Daily AR summaries (company, account, amount).
  • SA5DSC: Product-level discount details (invoice, product, discount amount, percentage).
  • Reports:
  • Transaction Posting Register (REPORT, REPORTP): Details invoices, adjustments, payments, and totals.
  • Sales/Cash Receipts Journals (REPORT, REPORTP): Summarized GL entries by account.

Process Steps

  1. Validate Input and Initialize:
  2. Validate CRTRGG existence and journal date format (CCYYMMDD).
  3. Initialize accumulators, journal numbers, and Y2K century settings.
  4. Sort Transactions:
  5. Sort CRTRGG by company, customer, and invoice for processing.
  6. Process Transactions:
  7. Read CRTRGG records (invoices, adjustments, payments, misc cash).
  8. Match to ARDETL, ARCUST, ARCONT for validation and updates.
  9. Update ARDETL (invoice amounts, payments), ARCUST (balances, payment dates), and write to ARHIST (audit trail) unless inter-company.
  10. Generate GL distribution entries (ARDIST) with debit/credit accounts.
  11. Generate GL Journal Entries:
  12. Process ARDIST to create TEMGEN entries (debit/credit, account, amount, description).
  13. Handle inter-company transactions with separate GL accounts (ACTRGL).
  14. Create discount entries using discount GL account (ADGLDI).
  15. Summarize and Post to GL:
  16. Summarize TEMGEN entries by account for sales (SJ) or cash receipts (CR) journals.
  17. Update GLMAST descriptions and write daily summaries to ARDALY.
  18. Produce journal reports with headers (company, date, user) and totals.
  19. Allocate Discounts by Product:
  20. Match CRTRGG discounts to SA5FIND invoice lines by company, customer, invoice.
  21. Calculate total invoice price (quantity * price per line).
  22. Allocate discount percentage (line price / total price) and amount per product.
  23. Adjust final line to match total discount.
  24. Write discount details to SA5DSC (product, amount, percentage, journal data).
  25. Clean Up:
  26. Delete temporary files (CRTRGG, CRDIGG, CRTGGG, AR211S).

Business Rules

  1. Transaction Types:
  2. Invoices: Add to ARDETL, ARCUST balances, and aging; generate GL entries.
  3. Adjustments: Modify ARDETL, ARCUST (e.g., credit memos); generate GL entries.
  4. Payments: Reduce ARDETL amounts, update ARCUST payment dates, apply discounts; generate GL entries.
  5. Miscellaneous Cash: Generate GL entries without AR updates.
  6. Inter-Company Transactions:
  7. Skip ARDETL, ARCUST, ARHIST updates; generate GL entries using inter-company account (ACTRGL).
  8. Discount Allocation:
  9. Calculate discount percentage per invoice line: (quantity * price) / total invoice price.
  10. Multiply percentage by total discount (ATDISC) to get line discount.
  11. Adjust final line to ensure sum equals ATDISC.
  12. Handle credit/rebill cases: Set percentage to 1 (positive price) or -1 (negative price) if total price is zero.
  13. GL Entries:
  14. Positive amounts: Debit AR (ADGLDR), credit GL (ADGLCR).
  15. Negative amounts: Reverse accounts (debit ADGLCR, credit ADGLDR).
  16. Discounts: Separate debit/credit entry to ADGLDI.
  17. Inter-company: Use ACTRGL for AR side, flip debit/credit based on amount sign.
  18. Y2K Compliance:
  19. Convert dates to CCYYMMDD using century (Y2KCEN, e.g., 19/20) and comparison year (Y2KCMP, e.g., 80).
  20. Reporting:
  21. Transaction register: Lists invoices, adjustments, payments, totals, with audit fields (user, workstation, date).
  22. Journals: Summarize by account, include debits/credits, support paperless output.
  23. Error Handling:
  24. Validate file existence and matches (company, customer, invoice).
  25. Ensure GL entries balance (debits = credits).
  26. Adjust discounts to prevent rounding discrepancies.

Calculations

  • Discount Percentage: PCT = (SAQTY * SAPRCE) / TOTPRC, where TOTPRC = Σ(SAQTY * SAPRCE) across invoice lines. If TOTPRC = 0, set PCT = 1 (positive) or -1 (negative).
  • Discount Amount: AMT = PCT * ATDISC.
  • Final Adjustment: If ΣAMT ≠ ATDISC, adjust last line’s AMT by difference (ATDISC - ΣAMT).
  • GL Amounts: For payments, debit = ADAMT ± ADDISC (subtract if positive, add if negative); credit = ADAMT. For negative amounts, reverse accounts and adjust signs.

Constraints

  • Requires sorted CRTRGG from prior steps.
  • Assumes valid SA5FIND data for invoice-product mappings.
  • No direct user interaction; relies on pre-populated files.
  • No updates to ARCONT journal numbers (per 8/06/14 change).

Call stack Summary

Program Main Purpose Tables Used Outputs (Files or Side Effects)
AR200.ocl36.txt Orchestrates the cash receipts posting process by sorting transactions, calling RPG programs, and cleaning up temporary files. Input: CRIEGG, CRPSGG, ARCUST, ARCONT
Output: CRTRGG, CRDIGG, CRTGGG, AR211S
CRTRGG (sorted transactions), CRDIGG (distributions), CRTGGG (GL entries), AR211S (sorted GL entries); deletes temporary files; routes reports to ARPOST/TESTOUTQ.
AR200P.rpgle.txt Validates and initializes the cash receipts process by setting journal date and checking input file existence. Input: CRIEGG, CRPSGG, ARCONT Sets journal date in UDS; sets U1 switch for cancellation; no file outputs.
AR200.rpg36.txt Processes cash receipt transactions, updates AR files, generates GL distribution entries, and prints the transaction posting register. Input: ARTRAN (?9?CRTRGG), ARDETL, ARCUST, ARCONT
Output: ARHIST, ARDIST (?9?CRDIGG), REPORT, REPORTP
Updates ARDETL (invoice amounts), ARCUST (balances, payment dates); writes ARHIST (audit trail), ARDIST (GL distributions); prints transaction register (REPORT, REPORTP).
AR210.rpg36.txt Generates GL journal entries from AR distribution records for invoices, adjustments, payments, and discounts. Input: ARDIST (?9?CRDIGG), ARCONT
Output: ARTEMG (?9?CRTGGG)
Writes ARTEMG (GL journal entries); no reports or side effects.
AR211.rpg36.txt Summarizes GL journal entries, updates GL master, generates daily AR summaries, and prints sales/cash receipts journals. Input: ARTEMG (?9?CRTGGG), AR211S (?9?AR211S), GLMAST, ARCONT
Output: TEMGEN, ARDALY, REPORT, REPORTP
Writes TEMGEN (GL postings), ARDALY (daily summaries); prints sales/cash receipts journals (REPORT, REPORTP); no ARCONT updates (per 8/06/14).
AR2011.ocl36.txt Calls AR2011 RPG to process product-level discount allocations, ensuring transaction file existence. Input: ARTRAN (?9?CRTRGG), SA5FIND, GSTABL, ARCUST, SA5DSC No direct outputs; invokes AR2011 RPG; no file creation/deletion.
AR2011.rpg36.txt Allocates cash receipt discounts across invoice line items by product, writing detailed discount records. Input: ARTRAN (?9?CRTRGG), SA5FIND, GSTABL, ARCUST
Output: SA5DSC
Writes SA5DSC (product-level discount details); no reports or side effects.