Vendor Invoices

Business perspective: Vendor Invoices

1. Business Summary

Generated from completed/verified tasks; line items represent tasks with rates, units, taxes, distribution rules; SAP-synced AP documents.

2. Business Value

Pays vendors; ensures cost matching to revenue.

3. Users / Stakeholders

Finance, vendor managers, vendors.

4. Workflows

  • Tasks closed/verified → eligible.
  • VendorInvoice created with VendorInvoiceDetail per task.
  • submitVendorInvoice (CommonController) marks submitted.
  • sapVendorInvoiceSync posts to SAP if due_date >= '2018-01-01' and not yet sap_posted.

5. Sub-Features

  • Distribution rules (DistributionRule3=language_group_id, DistributionRule5=language_region.sap_id).
  • Resource type/SAP employee ID mapping.
  • Tax group mapping (tax.sap_id or default X1).

6. Business Rules

  • Only verified tasks eligible.
  • Brand-specific behaviors.
  • Submitted+sap_posted gating.

7. Data Entities

VendorInvoice, VendorInvoiceDetail.

8. Entry Points

  • finance/vendorInvoices, finance/vendorInvoiceDetails.
  • Common: submitVendorInvoice.
  • SAP: sapVendorInvoiceSync.

9. Inputs & Outputs

  • Inputs: tasks, vendor, rates.
  • Outputs: AP records, SAP postings.

10. Integrations

  • SAP.

11. Calculations / Logic

  • total_price = cost × amount; if apply_minimum_charge and total_price < minimum_chargeminimum_charge.
  • discount_amount = total_price × (discount / 100).
  • deduction_amount = (total_price - discount) × (deduction / 100).
  • final_price = (total_price - discount) + extra_fees_amount (Observed flow).
  • DiscountPercent = total_discount / final_price × 100.
  • Calculated_Price = final_price / amount.

12. Status Lifecycle

  • draft → submitted → sap_posted → paid; cancel via SAP if posted, else delete.

13. Permissions

  • Finance, brand-scoped.

14. Reports & KPIs

  • Vendor cost, tax exposure, productivity vs cost.

15. Risks & Observations

  • Calculation precedence subtle (min charge before discount/deduction).
  • SAP date cutoff hard-coded.

16. Source Code Evidence

  • app/Plugin/finance/Model/VendorInvoice.php, VendorInvoiceDetail.php.
  • app/Plugin/finance/Controller/VendorInvoicesController.php, VendorInvoiceDetailsController.php.
  • app/Controller/SapController.php :: sapVendorInvoiceSync (~line 2015).

← Deep dives index