Vendor Payments, Deductions, Prepayments, Overtime

Business perspective: Vendor Payments, Deductions, Prepayments, Overtime

1. Business Summary

Pays vendors with one of three methods (cheque/bank/e-cash); applies deductions, bank fees, prepayments; tracks overtime and minimum payment thresholds.

2. Business Value

Accurate vendor cash-out; compliance with tax/fees.

3. Users / Stakeholders

Finance, vendor managers, vendors.

4. Workflows

  • Cron + manual flows generate VendorPayment with VendorPaymentDetails per invoice.
  • Deductions (VendorPaymentDeduction) and prepayments (VendorPrepayment) applied.
  • Overtime (OvertimePayment + Tasks/Details) tracks extra effort.
  • SAP-driven inbound: addVendorPayment REST endpoint.

5. Sub-Features

  • Three payment methods: 1=Cheque (chequeNo required), 2=Bank Transfer (resources_banks.sap_id), 3=E-cash (resources_ecashes.sap_id).
  • Bank fees, deductions, prepayments.

6. Business Rules

  • Active payment method selection enforced.
  • Allocation cannot exceed remaining invoice balance.
  • Minimum payment thresholds at vendor configs.

7. Data Entities

VendorPayment, VendorPaymentDetail, VendorPaymentDeduction, VendorPrepayment, OvertimePayment, OvertimePaymentsTask, OvertimePaymentsDetail, BankFeesType, DeductionType.

8. Entry Points

  • finance/vendorPayments, finance/vendorPaymentDetails, finance/vendorPaymentDeductions, finance/vendorPrepayments, finance/overtimePayments, etc.
  • sap/addVendorPayment.

9. Inputs & Outputs

  • Inputs: vendor, method, invoices, fees, deductions.
  • Outputs: AP payment records, SAP IDs, audit logs.

10. Integrations

  • SAP.

11. Calculations / Logic

  • Remaining balance per invoice; deduction reasons captured.

12. Status Lifecycle

  • created → submitted → scheduled → paid → reconciled.

13. Permissions

  • Finance, brand-scoped.

14. Reports & KPIs

  • AP aging, deduction trends, overtime.

15. Risks & Observations

  • Hard-coded auth headers.
  • sapSetLog(entity_id=311) audit logs may grow unbounded.

16. Source Code Evidence

  • app/Plugin/finance/Model/VendorPayment.php, VendorPaymentDetail.php, VendorPaymentDeduction.php, VendorPrepayment.php, OvertimePayment.php, OvertimePaymentsTask.php, OvertimePaymentsDetail.php.
  • app/Plugin/finance/Controller/VendorPaymentsController.php, VendorPaymentDetailsController.php, VendorPaymentDeductionsController.php, VendorPrepaymentsController.php, OvertimePaymentsController.php.
  • app/Controller/SapController.php :: addVendorPayment (~line 3722).

← Deep dives index