Back to ER Diagram
Accounts Payable

Accounts Payable Logic

AP invoice processing, payment voucher generation, vendor ageing, payment scheduling, bank reconciliation, and TDS deduction management.

PostgreSQL
7 Tables
Schema: accounts_payable
Payment Processing

Overview

Accounts Payable manages vendor invoice processing through to payment. Invoices are booked after three-way match approval (PO-GRN-Invoice). Payment vouchers are generated based on payment terms and schedule. TDS is auto-calculated and deducted per applicable sections. Bank reconciliation matches payment vouchers with bank statement entries. Vendor ageing report tracks outstanding payables.


Book Invoice

3-Way Match

Approve

Generate PV

Pay & Reconcile
7
AP Tables
Auto
TDS Calculation
3-Way
Match Required
Bank
Reconciliation

Status States

StatusDescriptionAllowed ActionsNext States
DraftInvoice entered but not yet verifiedEdit, VerifyVerified
VerifiedThree-way match passedSubmit for ApprovalPending Approval
Pending ApprovalAwaiting finance manager approvalApprove, ReturnApproved
ApprovedInvoice approved for paymentGenerate PV, SchedulePV Generated
PV GeneratedPayment voucher createdExecute PaymentPaid
PaidPayment executed via bank transferReconcileReconciled
ReconciledBank statement matched

Database Schema

accounts_payable.ap_invoice

  • invoice_id — PK, vendor invoice header
  • vendor_id — FK → vendor.vendor_master
  • po_id — FK → procurement.purchase_order
  • invoice_number, invoice_date, due_date — Document details
  • gross_amount, tds_amount, net_amount — Financial breakdown
  • gst_amount, igst, cgst, sgst — Tax components
  • status — Lifecycle state

accounts_payable.payment_voucher

  • pv_id — PK, payment voucher header
  • vendor_id — FK → vendor.vendor_master
  • pv_number, pv_date — Document tracking
  • total_amount, payment_mode — bank_transfer | cheque | rtgs | neft
  • bank_account_id — FK → treasury.bank_account
  • reference_number — UTR/cheque number
  • status — Draft → Approved → Paid

accounts_payable.pv_allocation

  • allocation_id — PK
  • pv_id — FK → accounts_payable.payment_voucher
  • invoice_id — FK → accounts_payable.ap_invoice
  • allocated_amount — Amount applied to this invoice
  • tds_amount — TDS deducted for this allocation

accounts_payable.bank_reconciliation

  • recon_id — PK
  • bank_account_id — FK → treasury.bank_account
  • statement_date, bank_balance, book_balance — Reconciliation figures
  • unreconciled_credits, unreconciled_debits — Outstanding items
  • status — Draft → Completed

accounts_payable.vendor_ageing

  • ageing_id — PK
  • vendor_id — FK → vendor.vendor_master
  • current_due, days_30, days_60, days_90, over_90 — Ageing buckets
  • total_outstanding — Sum of all buckets
  • snapshot_date — As-of date for ageing

AP Process Steps

1

Invoice Booking

Accounts team books vendor invoice with reference to PO. System auto-populates line items from PO. GST components (IGST/CGST/SGST) calculated based on vendor and project state.

2

Three-Way Match

System matches PO ordered qty, GRN received qty, and invoice billed qty. Variances within tolerance auto-approved. Exceeding tolerance flagged for manual review.

3

TDS Deduction

Based on vendor PAN and payment nature, applicable TDS section (194C/194J/194I etc.) auto-detected. TDS rate applied to invoice amount. TDS amount deducted from payment.

4

Payment Voucher

Finance team generates PV selecting invoices for payment based on due date and cash availability. Multiple invoices can be combined in one PV. Approval workflow based on amount.

5

Payment Execution

Approved PV executed via bank transfer (RTGS/NEFT). UTR number recorded. Bank account balance updated. Vendor ledger credited.

6

Bank Reconciliation

Monthly bank reconciliation matches PV payments with bank statement entries. Unreconciled items investigated. BRS (Bank Reconciliation Statement) prepared.

AP Queries

Vendor Ageing Report

-- Vendor-wise outstanding ageing
SELECT vm.vendor_name,
  SUM(CASE WHEN ai.due_date >= CURRENT_DATE THEN ai.net_amount ELSE 0 END) AS current_due,
  SUM(CASE WHEN CURRENT_DATE - ai.due_date BETWEEN 1 AND 30 THEN ai.net_amount ELSE 0 END) AS days_30,
  SUM(CASE WHEN CURRENT_DATE - ai.due_date BETWEEN 31 AND 60 THEN ai.net_amount ELSE 0 END) AS days_60,
  SUM(CASE WHEN CURRENT_DATE - ai.due_date > 60 THEN ai.net_amount ELSE 0 END) AS over_60
FROM accounts_payable.ap_invoice ai
JOIN vendor.vendor_master vm ON vm.vendor_id = ai.vendor_id
WHERE ai.status IN ('Approved', 'PV Generated')
GROUP BY vm.vendor_id
ORDER BY over_60 DESC;

Validation Rules

Business Rules

  • 3-Way Match: Invoice cannot be approved without passing three-way match
  • TDS Threshold: TDS not applicable for payments below section-wise threshold (e.g., ₹30,000 for 194C)
  • Payment Terms: Payment date must respect vendor payment terms (30/45/60 days)
  • Duplicate Invoice: System checks vendor + invoice number + date combination to prevent duplicates

Integration Points

Connected Modules

  • Receiving: Three-way match uses GRN data
  • Procurement: Invoice linked to PO for amount validation
  • Finance: Invoice posting creates GL journal entries; TDS entries in tax module
  • Treasury: Payment execution debits bank account; feeds cash flow actual

Best Practices

Recommended

  • Process invoices within 7 days of receipt to avoid late payment penalties
  • Run vendor ageing weekly and prioritize overdue payments
  • Automate TDS calculation to avoid manual errors
  • Reconcile bank accounts monthly before period close