Purchase Management — Overview & module guide

Module: Purchase Management v1.1.0

Enterprise purchase and procurement management for BIXCRM

Screen-by-screen guides (each tab explained)

Click a menu item below for step-by-step instructions on that Purchase Management screen:

How to use in BIXCRM (daily operations)

  1. Sign in to the admin area with a role that includes Purchase Management permissions.
  2. Open Purchase Management (sidebar) or search for Purchase Management in the admin menu.
  3. Start on the Dashboard (if available) to see open tasks, pending approvals, and KPIs.
  4. Review Settings after upgrades — new options may need defaults for your company.
  5. Create or import master data first; most modules block transactions until masters exist.
  6. Run the main business flow (create → submit → approve → post/complete) using the screens listed in Admin menu below.
  7. Use Reports / Analytics screens to reconcile stock, finance, compliance, or SLA metrics.
  8. For integrations (API, EDI, gateways, tax), confirm credentials in Settings and monitor logs or webhook delivery screens.
  9. Train staff with role-based access — give approvers approve permissions only, operators create/edit on their area.
  10. If something fails overnight, check BIXCRM cron ran and open the module log / failed queue screen if present.

Admin menu — where to work

Open the Purchase Management section in the admin sidebar. Screens your staff may use (depending on role):

  • Approvals
  • Dashboard
  • Goods Receipt
  • Payments
  • Purchase Orders
  • Purchase Requests
  • Purchasing
  • Reports
  • Returns
  • RFQ / Quotations
  • Settings
  • Supplier Bills
  • Suppliers

Detailed guide — features, workflows, API & FAQ

Status

AreaStatus
--------------
Core procurement workflow (PR → RFQ → PO → GRN → Bill → Payment → Return)Complete
Approvals, dashboard, reports, settingsComplete
Security hardening (POST/CSRF, upload validation, rate limits, webhook URL validation)Complete
Unit tests (helper, payment, extension logic)Complete — 57 tests
CodeCanyon packaging (LICENSE, CHANGELOG, HTML docs, demo data)Complete

Production-ready for standard procurement use. See [docs/ROADMAP.md](docs/ROADMAP.md) for migration history and future ideas.

---

Features

Suppliers

  • Supplier master with contacts, attachments, ledger, and statement PDF
  • CSV and Excel export
  • Opening balance and credit tracking

Purchase requests (PR)

  • Draft → submit → approval workflow
  • Line items (catalog or manual when enabled)
  • Attachments and convert-to-PO

RFQ & quotations

  • RFQ creation from PR or standalone
  • Supplier quotation entry, comparison, and award
  • Email invitation to suppliers
  • RFQ PDF download

Purchase orders (PO)

  • Tax, discount, shipping, terms
  • Email with PDF attachment
  • Receipt tracking (partial / full)
  • Billing status — PO marked billed only when all lines are fully billed

Goods receipt (GRN)

  • Warehouse integration modes: auto, required, disabled
  • Stock movement hooks for Inventory Management module
  • PDF export

Supplier bills

  • Three-way match (PO qty/price vs GRN received qty)
  • Partial billing support
  • Approve / reject / cancel workflow

Payments

  • Multi-bill split allocations (on-account supported)
  • Void reverses all allocations and bill balances
  • Payment receipt PDF

Returns

  • Purchase return documents with approval workflow
  • PDF export

Approvals

  • Multi-level approval (configurable staff per level)
  • Delegation sync across PR, PO, Bill, Return
  • Dedicated approvals inbox

Dashboard & reports

  • KPI dashboard and top suppliers widget
  • 13 report types with CSV, Excel, and PDF export
  • Supplier statement and aging

Security

  • Destructive actions require POST (+ CSRF for module URLs)
  • Upload MIME and rel_type validation
  • Export rate limiting
  • No generic admin bypass on assigned approval steps

---

Requirements

RequirementNotes
--------------------
BIXCRM2.3.x or later
PHP7.4+ (8.x supported)
MySQL / MariaDBInnoDB
TCPDFBundled with BIXCRM (application/vendor/tecnickcom/tcpdf)
BIXCRM cronRecommended — overdue bill checks
Inventory ManagementOptional — GRN warehouse stock sync

---

Permissions

Feature keyCapabilities
---------------------------
purchase_dashboardview
purchase_suppliersview, create, edit, delete
purchase_requestview, create, edit, delete, approve
purchase_rfqview, create, edit, delete
purchase_orderview, create, edit, delete, approve
purchase_grnview, create, edit, delete
purchase_billview, create, edit, delete, approve
purchase_paymentview, create, edit, delete
purchase_returnview, create, edit, delete, approve
purchase_reportsview, export
purchase_settingsview, edit, manage

Approvals inbox: staff with purchase_dashboard view or document approve permissions (pm_can_access_approvals()).

---

Typical workflow

PR (optional) → RFQ (optional) → PO → GRN → Supplier Bill → Payment
                                      ↘ Return (optional)

Each document type supports draft, approval (when enabled), and status-specific actions. See [docs/DOCUMENTATION.md](docs/DOCUMENTATION.md) for step-by-step usage.

---

Documentation

DocumentDescription
-----------------------
[docs/DOCUMENTATION.md](docs/DOCUMENTATION.md)User guide, admin settings, reports, PDFs, integrations, security
[docs/ROADMAP.md](docs/ROADMAP.md)Optional enhancements and known limitations

---

Extended module documentation

Table of contents

  1. [Overview](#overview)
  2. [Menu & navigation](#menu--navigation)
  3. [Document workflow](#document-workflow)
  4. [Module settings](#module-settings)
  5. [Approvals](#approvals)
  6. [Payments & allocations](#payments--allocations)
  7. [Reports & exports](#reports--exports)
  8. [PDF documents](#pdf-documents)
  9. [Integrations](#integrations)
  10. [Security](#security)
  11. [Cron & automation](#cron--automation)
  12. [Database schema](#database-schema)
  13. [Developer reference](#developer-reference)

---

Overview

Purchase Management covers the full procure-to-pay cycle inside BIXCRM admin:

PhaseDocumentPurpose
--------------------------
1SuppliersVendor master data
2Purchase Request (PR)Internal requisition
3RFQRequest quotations from suppliers
4Purchase Order (PO)Commitment to supplier
5GRNGoods received note
6Supplier BillAccounts payable invoice
7PaymentPay supplier (multi-bill split)
8ReturnReturn goods to supplier

All 17 implementation phases (foundation through testing) are complete. Post-phase polish (RFQ PDF, partial PO billing, supplier Excel export, deactivation logging) is also complete.

---

Menu & navigation

Admin path: Purchase Management (sidebar)

Menu itemURL segmentPermission
------------------------------------
Dashboardpurchase_managementpurchase_dashboard → view
Suppliers.../supplierspurchase_suppliers
Purchase Requests.../requestspurchase_request
RFQ & Quotations.../rfqspurchase_rfq
Purchase Orders.../orderspurchase_order
Goods Receipt.../grnpurchase_grn
Supplier Bills.../billspurchase_bill
Payments.../paymentspurchase_payment
Returns.../returnspurchase_return
Approvals.../approvalsdashboard view or approve caps
Reports.../reportspurchase_reports
Settings.../settingspurchase_settings

Routes are defined in config/routes.php.

---

Document workflow

Purchase request (PR)

Statuses: draft → submitted → pending_approval → approved / rejected → converted / cancelled

  1. Create PR with line items (catalog items or manual lines if pm_allow_manual_items is enabled).
  2. Upload attachments on the PR view page.
  3. Submit for approval (when pm_require_approval is on and amount exceeds limit).
  4. Approved PR can be converted to PO or used as source for RFQ.

Actions on view: Edit (draft/rejected), Submit, Approve/Reject (inbox), Cancel, Convert to PO.

RFQ

Statuses: draft → sent → closed / cancelled

  1. Create RFQ manually or link from an approved PR.
  2. Add invited suppliers and line items (qty, UOM, specifications).
  3. Send — emails suppliers with quotation link (no PDF attachment; see [ROADMAP.md](ROADMAP.md)).
  4. Enter supplier quotations; use Compare to evaluate; Award winning quotation.
  5. Download PDF from list or view page.

Feature toggle: pm_enable_rfq in settings.

Purchase order (PO)

Statuses: draft → pending_approval → approved → sent → partially_received / fully_received → billed → closed / cancelled

  1. Create from PR, RFQ award, or directly (if pm_allow_po_without_pr).
  2. Set supplier, lines, tax, shipping, payment terms.
  3. Approve and Send — email includes PO PDF attachment.
  4. Create GRN against PO as goods arrive.
  5. PO billing status:

- Partial bill: PO stays at partially_received or fully_received.

- Full bill: All line billed_qty ≥ line quantity → status becomes billed.

GRN (Goods receipt)

Statuses: draft → posted / cancelled

  1. Select PO and received quantities per line.
  2. Warehouse field behaviour depends on pm_warehouse_integration:

- auto — optional warehouse

- required — warehouse mandatory

- disabled — no warehouse validation; no stock sync

  1. Posting updates PO received quantities and may sync inventory (Inventory Management module).

Supplier bill

Statuses: draft → pending_approval → approved → partially_paid / paid / overdue / cancelled

  1. Create from PO (pulls unbilled quantities) or manually.
  2. Three-way match checks PO price/qty vs GRN received qty (unless pm_allow_bill_without_grn).
  3. On approval, PO line billed_qty increases; PO billing status refreshes automatically.
  4. Download bill PDF from list or document view.

Payment

  1. Record payment against one or more approved bills (allocation UI).
  2. On-account payments (no bill allocation) supported.
  3. Void reverses all allocations and restores bill balances/status.
  4. Payment receipt PDF available.

Database: allocations stored in pm_supplier_payment_allocations (migration 101).

Return

Statuses: draft → pending_approval → approved → posted / cancelled

Create return against GRN/bill context. Approval workflow and PDF export supported.

Feature toggle: pm_enable_returns.

---

Module settings

Path: Purchase Management → Settings

Prefix & numbering

SettingDefaultPurpose
---------------------------
pm_supplier_code_prefixSUP-Supplier code
pm_pr_prefixPR-Purchase request
pm_rfq_prefixRFQ-RFQ
pm_po_prefixPO-Purchase order
pm_grn_prefixGRN-Goods receipt
pm_bill_prefixBILL-Supplier bill
pm_payment_prefixPAY-Payment
pm_return_prefixPRN-Return
pm_number_padding6Numeric padding

General

SettingDescription
----------------------
pm_default_currencyDefault document currency
pm_default_payment_termse.g. Net 30
pm_default_taxDefault tax name for lines
pm_required_supplier_fieldsComma-separated required fields
pm_warehouse_integrationauto / required / disabled
pm_terms_conditionsDefault PO terms
pm_pdf_footerFooter text on all module PDFs

Approval

SettingDescription
----------------------
pm_require_approvalEnable approval workflows
pm_approval_amount_limitAmount threshold
pm_approval_level1_staffLevel 1 approver (staff ID)
pm_approval_level2_staffLevel 2 approver
pm_approval_level3_staffLevel 3 approver
pm_approval_routing_modestaff or role
pm_approval_level1_roleLevel 1 BIXCRM role (when mode = role)
pm_approval_level2_roleLevel 2 BIXCRM role
pm_approval_level3_roleLevel 3 BIXCRM role

When role mode is selected, any active staff member with the configured BIXCRM role can approve that step from the inbox.

API & webhooks

SettingDescription
----------------------
pm_api_enabledEnable REST API
pm_api_keyAPI authentication key
pm_webhook_urlWebhook receiver URL
pm_webhook_secretHMAC signing secret

Feature toggles

SettingDefaultDescription
-------------------------------
pm_enable_purchase_requests1PR module
pm_enable_rfq1RFQ module
pm_enable_returns1Returns module
pm_allow_manual_items1Free-text line items
pm_allow_po_without_pr1Direct PO creation
pm_allow_bill_without_grn0Skip GRN qty check on bills

---

Approvals

Supported document types

  • Purchase request (purchase_request)
  • Purchase order (purchase_order)
  • Supplier bill (purchase_bill)
  • Purchase return (purchase_return)

Inbox

Purchase Management → Approvals lists pending steps assigned to the current user.

Rules

  • Assigned approver must hold the document's approve permission.
  • Generic admin bypass is disabled — only assigned approver or settings manager (purchase_settings → manage) on unassigned steps may act.
  • Delegation: pm_delegate_approval_action() keeps document status in sync with Approval_model.

`approver_role` column

The pm_purchase_approval_steps.approver_role field stores role hints (manager, admin, staff) when fallback approvers are used. Settings UI assigns staff IDs, not roles. Role-based routing is partially implemented — see [ROADMAP.md](ROADMAP.md).

---

Payments & allocations

Recording a payment

  1. Open Payments → New payment.
  2. Select supplier and payment amount/method/date.
  3. Allocate amounts to one or more open bills (AJAX loads bill balances).
  4. Save — allocations inserted into pm_supplier_payment_allocations; bill paid_amount and status updated.

Void

Voiding a payment:

  • Deletes all allocation rows for that payment
  • Reverses paid_amount on each affected bill
  • Restores bill status (unpaid, partially_paid, or overdue if past due)

On-account

Payment with zero allocations is stored as supplier on-account credit (no bill linkage).

---

Reports & exports

Path: Purchase Management → Reports

Report keyName
------------------
supplier_statementSupplier statement
supplier_ledgerSupplier ledger
poPurchase orders
grnGoods receipts
pending_receivingPending receiving
billsSupplier bills
paymentsPayments
returnsReturns
by_itemPurchases by item
by_supplierPurchases by supplier
taxTax summary
agingAP aging
approval_historyApproval history

Export formats: CSV, Excel (.xls), PDF — via Pm_export library.

Suppliers list: CSV and Excel export from Suppliers → Export buttons.

Export endpoints use pm_export_rate_limit() to reduce abuse.

---

PDF documents

Generated via libraries/Pm_pdf.php (TCPDF + module view templates).

DocumentTemplateController action
---------------------------------------
Purchase orderviews/orders/pdf.phporders/pdf/{id}
GRNviews/grn/pdf.phpgrn/pdf/{id}
Supplier billviews/bills/pdf.phpbills/pdf/{id}
Payment receiptviews/payments/pdf.phppayments/pdf/{id}
Returnviews/returns/pdf.phpreturns/pdf/{id}
Purchase requestviews/requests/pdf.phprequests/pdf/{id}
RFQviews/rfqs/pdf.phprfqs/pdf/{id}
Supplier statementviews/suppliers/statement_pdf.phpvia supplier view

PO email send attaches PDF via Pm_pdf::save_purchase_order_file().

Optional query: ?output_type=I (inline) or D (download, default).

---

Integrations

Inventory Management

When pm_warehouse_integration is not disabled and the Inventory Management module is active:

  • GRN post creates stock movements
  • GRN cancel reverses movements

Setting: Settings → Warehouse integration.

BIXCRM items & taxes

Line items can reference BIXCRM catalog items (pm_get_items()). Tax rates resolve via pm_resolve_line_tax_rate() and BIXCRM tax settings.

Email

RFQ send and PO send use pm_send_email(). Both include PDF attachments when sending.

---

REST API & webhooks

Configure under Settings → API & Webhooks.

SettingPurpose
------------------
pm_api_enabledEnable read-only REST API
pm_api_keySend as header X-PM-API-Key
pm_webhook_urlOutbound webhook endpoint
pm_webhook_secretHMAC SHA256 signature in X-PM-Signature

API endpoints

MethodURLDescription
--------------------------
GET/purchase_management/apiAPI info
GET/purchase_management/api/suppliersSupplier list
GET/purchase_management/api/purchase_orders/{id}PO + lines
GET/purchase_management/api/supplier_bills/{id}Bill + lines
GET/purchase_management/api/payments/{id}Payment + allocations

Webhook events

EventWhen
-------------
rfq.sentRFQ emailed to suppliers
supplier_bill.approvedBill approved
supplier_bill.cancelledApproved bill cancelled
supplier_payment.recordedPayment saved
supplier_payment.voidedPayment voided

---

Security

Implemented in Phase 15:

ControlImplementation
-------------------------
POST-only destructive actionspm_require_post(), pm_require_post_or_ajax() on delete/void/approve/reject/cancel/submit/send/post
CSRF on delete linksassets/js/purchase_management.js converts _delete links to POST with token
Upload validationMIME check + pm_get_allowed_attachment_rel_types() whitelist
Approval integritypm_can_act_on_approval_step() — no admin bypass
Export throttlingpm_export_rate_limit() on reports and supplier export

---

Cron & automation

Hook: after_cron_run → purchase_management_cron_tasks()

  • Overdue bills: Supplier_bill_model::check_overdue_bills() marks approved unpaid bills past due date as overdue.

Ensure BIXCRM cron is configured and running.

---

Database schema

Prefix: {db_prefix}pm_*

DB version option: pm_db_version = 103

Tables (22)

TablePurpose
----------------
pm_suppliersSupplier master
pm_supplier_contactsSupplier contacts
pm_supplier_attachmentsSupplier files
pm_purchase_requestsPR header
pm_purchase_request_itemsPR lines
pm_rfqsRFQ header
pm_rfq_itemsRFQ lines
pm_supplier_quotationsQuotation header
pm_supplier_quotation_itemsQuotation lines
pm_purchase_ordersPO header
pm_purchase_order_itemsPO lines
pm_goods_receiptsGRN header
pm_goods_receipt_itemsGRN lines
pm_supplier_billsBill header
pm_supplier_bill_itemsBill lines
pm_supplier_paymentsPayment header
pm_supplier_payment_allocationsPayment-to-bill splits (v101)
pm_purchase_returnsReturn header
pm_purchase_return_itemsReturn lines
pm_purchase_approvalsApproval header
pm_purchase_approval_stepsApproval steps
pm_purchase_logsAudit log
pm_purchase_settingsModule settings key/value
pm_stock_movementsGRN stock movement log

Foreign keys

Applied on install and migration 102 via pm_install_foreign_keys() for core parent/child tables. Failures are logged and skipped on restrictive hosts.

---

Developer reference

Key helpers (`helpers/purchase_management_helper.php`)

FunctionPurpose
-------------------
pm_can() / pm_require_permission()Permission checks
pm_generate_number()Document numbering
pm_calculate_line_total()Line math
pm_resolve_po_billing_status()PO billed vs partial logic
pm_validate_catalog_item()Manual item enforcement
pm_validate_grn_warehouse()Warehouse rules
pm_get_configured_approvers()Approval chain
pm_can_act_on_approval_step()Approval authorization
pm_handle_upload()Secure uploads
pm_log()Audit trail + activity log

Libraries

  • Pm_pdf — TCPDF document generation
  • Pm_export — CSV/Excel/PDF report export

Migrations

Add new file migrations/XXX_version_XXX.php with function pm_run_migration_XXX($CI), register in pm_maybe_upgrade_database().

Tests

tests/
├── bootstrap.php       # CI stubs, loads helper
├── LogicTest.php       # 26 helper/security tests
├── PaymentLogicTest.php # 14 payment/billing tests
├── ExtensionTest.php   # 12 API/role/cancel tests
├── IntegrationTest.php # Optional live DB verification
└── run_all.php

Hooks (module file)

HookFunction
----------------
admin_initMenu + permissions + DB upgrade
get_dashboard_widgetsDashboard widget
app_admin_head / app_admin_footerAssets
after_cron_runOverdue bills

---

Manual QA checklist (recommended)

Before go-live, verify:

  • [ ] Activate module; confirm pm_db_version = 101
  • [ ] Role permissions assigned for each team
  • [ ] Settings: prefixes, approvers, feature toggles
  • [ ] Full cycle: PR → PO → GRN → Bill → Payment (partial + full bill)
  • [ ] Multi-bill payment allocation and void
  • [ ] Approval approve/reject on PR, PO, Bill
  • [ ] Report CSV/Excel/PDF export
  • [ ] RFQ send email + PDF download
  • [ ] Supplier CSV/Excel export
  • [ ] Cron marks overdue bills
  • [ ] Run php modules/purchase_management/tests/run_all.php

---

Nasbix Technologies — Purchase Management v1.1.0

Extended module documentation

Table of contents

  1. [Overview](#overview)
  2. [Menu & navigation](#menu--navigation)
  3. [Document workflow](#document-workflow)
  4. [Module settings](#module-settings)
  5. [Approvals](#approvals)
  6. [Payments & allocations](#payments--allocations)
  7. [Reports & exports](#reports--exports)
  8. [PDF documents](#pdf-documents)
  9. [Integrations](#integrations)
  10. [Security](#security)
  11. [Cron & automation](#cron--automation)
  12. [Database schema](#database-schema)
  13. [Developer reference](#developer-reference)

---

Overview

Purchase Management covers the full procure-to-pay cycle inside BIXCRM admin:

PhaseDocumentPurpose
--------------------------
1SuppliersVendor master data
2Purchase Request (PR)Internal requisition
3RFQRequest quotations from suppliers
4Purchase Order (PO)Commitment to supplier
5GRNGoods received note
6Supplier BillAccounts payable invoice
7PaymentPay supplier (multi-bill split)
8ReturnReturn goods to supplier

All 17 implementation phases (foundation through testing) are complete. Post-phase polish (RFQ PDF, partial PO billing, supplier Excel export, deactivation logging) is also complete.

---

Menu & navigation

Admin path: Purchase Management (sidebar)

Menu itemURL segmentPermission
------------------------------------
Dashboardpurchase_managementpurchase_dashboard → view
Suppliers.../supplierspurchase_suppliers
Purchase Requests.../requestspurchase_request
RFQ & Quotations.../rfqspurchase_rfq
Purchase Orders.../orderspurchase_order
Goods Receipt.../grnpurchase_grn
Supplier Bills.../billspurchase_bill
Payments.../paymentspurchase_payment
Returns.../returnspurchase_return
Approvals.../approvalsdashboard view or approve caps
Reports.../reportspurchase_reports
Settings.../settingspurchase_settings

Routes are defined in config/routes.php.

---

Document workflow

Purchase request (PR)

Statuses: draft → submitted → pending_approval → approved / rejected → converted / cancelled

  1. Create PR with line items (catalog items or manual lines if pm_allow_manual_items is enabled).
  2. Upload attachments on the PR view page.
  3. Submit for approval (when pm_require_approval is on and amount exceeds limit).
  4. Approved PR can be converted to PO or used as source for RFQ.

Actions on view: Edit (draft/rejected), Submit, Approve/Reject (inbox), Cancel, Convert to PO.

RFQ

Statuses: draft → sent → closed / cancelled

  1. Create RFQ manually or link from an approved PR.
  2. Add invited suppliers and line items (qty, UOM, specifications).
  3. Send — emails suppliers with quotation link (no PDF attachment; see [ROADMAP.md](ROADMAP.md)).
  4. Enter supplier quotations; use Compare to evaluate; Award winning quotation.
  5. Download PDF from list or view page.

Feature toggle: pm_enable_rfq in settings.

Purchase order (PO)

Statuses: draft → pending_approval → approved → sent → partially_received / fully_received → billed → closed / cancelled

  1. Create from PR, RFQ award, or directly (if pm_allow_po_without_pr).
  2. Set supplier, lines, tax, shipping, payment terms.
  3. Approve and Send — email includes PO PDF attachment.
  4. Create GRN against PO as goods arrive.
  5. PO billing status:

- Partial bill: PO stays at partially_received or fully_received.

- Full bill: All line billed_qty ≥ line quantity → status becomes billed.

GRN (Goods receipt)

Statuses: draft → posted / cancelled

  1. Select PO and received quantities per line.
  2. Warehouse field behaviour depends on pm_warehouse_integration:

- auto — optional warehouse

- required — warehouse mandatory

- disabled — no warehouse validation; no stock sync

  1. Posting updates PO received quantities and may sync inventory (Inventory Management module).

Supplier bill

Statuses: draft → pending_approval → approved → partially_paid / paid / overdue / cancelled

  1. Create from PO (pulls unbilled quantities) or manually.
  2. Three-way match checks PO price/qty vs GRN received qty (unless pm_allow_bill_without_grn).
  3. On approval, PO line billed_qty increases; PO billing status refreshes automatically.
  4. Download bill PDF from list or document view.

Payment

  1. Record payment against one or more approved bills (allocation UI).
  2. On-account payments (no bill allocation) supported.
  3. Void reverses all allocations and restores bill balances/status.
  4. Payment receipt PDF available.

Database: allocations stored in pm_supplier_payment_allocations (migration 101).

Return

Statuses: draft → pending_approval → approved → posted / cancelled

Create return against GRN/bill context. Approval workflow and PDF export supported.

Feature toggle: pm_enable_returns.

---

Module settings

Path: Purchase Management → Settings

Prefix & numbering

SettingDefaultPurpose
---------------------------
pm_supplier_code_prefixSUP-Supplier code
pm_pr_prefixPR-Purchase request
pm_rfq_prefixRFQ-RFQ
pm_po_prefixPO-Purchase order
pm_grn_prefixGRN-Goods receipt
pm_bill_prefixBILL-Supplier bill
pm_payment_prefixPAY-Payment
pm_return_prefixPRN-Return
pm_number_padding6Numeric padding

General

SettingDescription
----------------------
pm_default_currencyDefault document currency
pm_default_payment_termse.g. Net 30
pm_default_taxDefault tax name for lines
pm_required_supplier_fieldsComma-separated required fields
pm_warehouse_integrationauto / required / disabled
pm_terms_conditionsDefault PO terms
pm_pdf_footerFooter text on all module PDFs

Approval

SettingDescription
----------------------
pm_require_approvalEnable approval workflows
pm_approval_amount_limitAmount threshold
pm_approval_level1_staffLevel 1 approver (staff ID)
pm_approval_level2_staffLevel 2 approver
pm_approval_level3_staffLevel 3 approver
pm_approval_routing_modestaff or role
pm_approval_level1_roleLevel 1 BIXCRM role (when mode = role)
pm_approval_level2_roleLevel 2 BIXCRM role
pm_approval_level3_roleLevel 3 BIXCRM role

When role mode is selected, any active staff member with the configured BIXCRM role can approve that step from the inbox.

API & webhooks

SettingDescription
----------------------
pm_api_enabledEnable REST API
pm_api_keyAPI authentication key
pm_webhook_urlWebhook receiver URL
pm_webhook_secretHMAC signing secret

Feature toggles

SettingDefaultDescription
-------------------------------
pm_enable_purchase_requests1PR module
pm_enable_rfq1RFQ module
pm_enable_returns1Returns module
pm_allow_manual_items1Free-text line items
pm_allow_po_without_pr1Direct PO creation
pm_allow_bill_without_grn0Skip GRN qty check on bills

---

Approvals

Supported document types

  • Purchase request (purchase_request)
  • Purchase order (purchase_order)
  • Supplier bill (purchase_bill)
  • Purchase return (purchase_return)

Inbox

Purchase Management → Approvals lists pending steps assigned to the current user.

Rules

  • Assigned approver must hold the document's approve permission.
  • Generic admin bypass is disabled — only assigned approver or settings manager (purchase_settings → manage) on unassigned steps may act.
  • Delegation: pm_delegate_approval_action() keeps document status in sync with Approval_model.

`approver_role` column

The pm_purchase_approval_steps.approver_role field stores role hints (manager, admin, staff) when fallback approvers are used. Settings UI assigns staff IDs, not roles. Role-based routing is partially implemented — see [ROADMAP.md](ROADMAP.md).

---

Payments & allocations

Recording a payment

  1. Open Payments → New payment.
  2. Select supplier and payment amount/method/date.
  3. Allocate amounts to one or more open bills (AJAX loads bill balances).
  4. Save — allocations inserted into pm_supplier_payment_allocations; bill paid_amount and status updated.

Void

Voiding a payment:

  • Deletes all allocation rows for that payment
  • Reverses paid_amount on each affected bill
  • Restores bill status (unpaid, partially_paid, or overdue if past due)

On-account

Payment with zero allocations is stored as supplier on-account credit (no bill linkage).

---

Reports & exports

Path: Purchase Management → Reports

Report keyName
------------------
supplier_statementSupplier statement
supplier_ledgerSupplier ledger
poPurchase orders
grnGoods receipts
pending_receivingPending receiving
billsSupplier bills
paymentsPayments
returnsReturns
by_itemPurchases by item
by_supplierPurchases by supplier
taxTax summary
agingAP aging
approval_historyApproval history

Export formats: CSV, Excel (.xls), PDF — via Pm_export library.

Suppliers list: CSV and Excel export from Suppliers → Export buttons.

Export endpoints use pm_export_rate_limit() to reduce abuse.

---

PDF documents

Generated via libraries/Pm_pdf.php (TCPDF + module view templates).

DocumentTemplateController action
---------------------------------------
Purchase orderviews/orders/pdf.phporders/pdf/{id}
GRNviews/grn/pdf.phpgrn/pdf/{id}
Supplier billviews/bills/pdf.phpbills/pdf/{id}
Payment receiptviews/payments/pdf.phppayments/pdf/{id}
Returnviews/returns/pdf.phpreturns/pdf/{id}
Purchase requestviews/requests/pdf.phprequests/pdf/{id}
RFQviews/rfqs/pdf.phprfqs/pdf/{id}
Supplier statementviews/suppliers/statement_pdf.phpvia supplier view

PO email send attaches PDF via Pm_pdf::save_purchase_order_file().

Optional query: ?output_type=I (inline) or D (download, default).

---

Integrations

Inventory Management

When pm_warehouse_integration is not disabled and the Inventory Management module is active:

  • GRN post creates stock movements
  • GRN cancel reverses movements

Setting: Settings → Warehouse integration.

BIXCRM items & taxes

Line items can reference BIXCRM catalog items (pm_get_items()). Tax rates resolve via pm_resolve_line_tax_rate() and BIXCRM tax settings.

Email

RFQ send and PO send use pm_send_email(). Both include PDF attachments when sending.

---

REST API & webhooks

Configure under Settings → API & Webhooks.

SettingPurpose
------------------
pm_api_enabledEnable read-only REST API
pm_api_keySend as header X-PM-API-Key
pm_webhook_urlOutbound webhook endpoint
pm_webhook_secretHMAC SHA256 signature in X-PM-Signature

API endpoints

MethodURLDescription
--------------------------
GET/purchase_management/apiAPI info
GET/purchase_management/api/suppliersSupplier list
GET/purchase_management/api/purchase_orders/{id}PO + lines
GET/purchase_management/api/supplier_bills/{id}Bill + lines
GET/purchase_management/api/payments/{id}Payment + allocations

Webhook events

EventWhen
-------------
rfq.sentRFQ emailed to suppliers
supplier_bill.approvedBill approved
supplier_bill.cancelledApproved bill cancelled
supplier_payment.recordedPayment saved
supplier_payment.voidedPayment voided

---

Security

Implemented in Phase 15:

ControlImplementation
-------------------------
POST-only destructive actionspm_require_post(), pm_require_post_or_ajax() on delete/void/approve/reject/cancel/submit/send/post
CSRF on delete linksassets/js/purchase_management.js converts _delete links to POST with token
Upload validationMIME check + pm_get_allowed_attachment_rel_types() whitelist
Approval integritypm_can_act_on_approval_step() — no admin bypass
Export throttlingpm_export_rate_limit() on reports and supplier export

---

Cron & automation

Hook: after_cron_run → purchase_management_cron_tasks()

  • Overdue bills: Supplier_bill_model::check_overdue_bills() marks approved unpaid bills past due date as overdue.

Ensure BIXCRM cron is configured and running.

---

Database schema

Prefix: {db_prefix}pm_*

DB version option: pm_db_version = 103

Tables (22)

TablePurpose
----------------
pm_suppliersSupplier master
pm_supplier_contactsSupplier contacts
pm_supplier_attachmentsSupplier files
pm_purchase_requestsPR header
pm_purchase_request_itemsPR lines
pm_rfqsRFQ header
pm_rfq_itemsRFQ lines
pm_supplier_quotationsQuotation header
pm_supplier_quotation_itemsQuotation lines
pm_purchase_ordersPO header
pm_purchase_order_itemsPO lines
pm_goods_receiptsGRN header
pm_goods_receipt_itemsGRN lines
pm_supplier_billsBill header
pm_supplier_bill_itemsBill lines
pm_supplier_paymentsPayment header
pm_supplier_payment_allocationsPayment-to-bill splits (v101)
pm_purchase_returnsReturn header
pm_purchase_return_itemsReturn lines
pm_purchase_approvalsApproval header
pm_purchase_approval_stepsApproval steps
pm_purchase_logsAudit log
pm_purchase_settingsModule settings key/value
pm_stock_movementsGRN stock movement log

Foreign keys

Applied on install and migration 102 via pm_install_foreign_keys() for core parent/child tables. Failures are logged and skipped on restrictive hosts.

---

Developer reference

Key helpers (`helpers/purchase_management_helper.php`)

FunctionPurpose
-------------------
pm_can() / pm_require_permission()Permission checks
pm_generate_number()Document numbering
pm_calculate_line_total()Line math
pm_resolve_po_billing_status()PO billed vs partial logic
pm_validate_catalog_item()Manual item enforcement
pm_validate_grn_warehouse()Warehouse rules
pm_get_configured_approvers()Approval chain
pm_can_act_on_approval_step()Approval authorization
pm_handle_upload()Secure uploads
pm_log()Audit trail + activity log

Libraries

  • Pm_pdf — TCPDF document generation
  • Pm_export — CSV/Excel/PDF report export

Migrations

Add new file migrations/XXX_version_XXX.php with function pm_run_migration_XXX($CI), register in pm_maybe_upgrade_database().

Tests

tests/
├── bootstrap.php       # CI stubs, loads helper
├── LogicTest.php       # 26 helper/security tests
├── PaymentLogicTest.php # 14 payment/billing tests
├── ExtensionTest.php   # 12 API/role/cancel tests
├── IntegrationTest.php # Optional live DB verification
└── run_all.php

Hooks (module file)

HookFunction
----------------
admin_initMenu + permissions + DB upgrade
get_dashboard_widgetsDashboard widget
app_admin_head / app_admin_footerAssets
after_cron_runOverdue bills

---

Manual QA checklist (recommended)

Before go-live, verify:

  • [ ] Activate module; confirm pm_db_version = 101
  • [ ] Role permissions assigned for each team
  • [ ] Settings: prefixes, approvers, feature toggles
  • [ ] Full cycle: PR → PO → GRN → Bill → Payment (partial + full bill)
  • [ ] Multi-bill payment allocation and void
  • [ ] Approval approve/reject on PR, PO, Bill
  • [ ] Report CSV/Excel/PDF export
  • [ ] RFQ send email + PDF download
  • [ ] Supplier CSV/Excel export
  • [ ] Cron marks overdue bills
  • [ ] Run php modules/purchase_management/tests/run_all.php

---

Nasbix Technologies — Purchase Management v1.1.0

Requirements

ComponentMinimum
BIXCRM2.3.0+ (tested on 3.x)
PHP7.4+ (recommended 8.1+)
MySQL / MariaDB5.7+ / 10.3+
PHP extensionsmysqli, json, mbstring, curl
BIXCRM cronRequired for overdue bill checks

Optional modules: Inventory Management (GRN stock sync), Accounting Pro (AP/GL sync), Supplier Portal (supplier linking).

Zero core modifications

Procure-to-Pay Workflow

PR (optional) → RFQ (optional) → PO → GRN → Supplier Bill → Payment
                                      ↘ Return (optional)

Document statuses

  • PR / PO / Bill / Return: draft → pending approval → approved → (completed/cancelled)
  • RFQ: draft → sent → quotations_received → awarded / cancelled
  • GRN: draft → posted / cancelled

On create/edit forms, use Save Draft or the primary action button (Submit for Approval, Send, Post GRN) to save and trigger the workflow in one step.

Permissions

11 permission groups under Setup → Staff → Permissions → Purchase Management. Admins bypass all checks.

FeatureCapabilities
Dashboardview
Suppliersview, create, edit, delete
Purchase Requestsview, create, edit, delete, approve
RFQview, create, edit, delete
Purchase Ordersview, create, edit, delete, approve
GRNview, create, edit, delete
Supplier Billsview, create, edit, delete, approve
Paymentsview, create, edit, delete
Returnsview, create, edit, delete, approve
Reportsview, export
Settingsview, edit, manage

Key Settings

SettingDescription
Feature togglesEnable/disable PR, RFQ, returns
Approval routingStaff-based or role-based multi-level approvers
Warehouse integrationauto / required / disabled for GRN
REST APIEnable + API key (read-only endpoints)
WebhooksIndependent toggle + HTTPS endpoint URL + HMAC secret

REST API

Read-only API. Enable in Settings, then send header X-PM-API-Key: your-key.

GET /purchase_management/api/suppliers
GET /purchase_management/api/purchase_orders/{id}
GET /purchase_management/api/supplier_bills/{id}
GET /purchase_management/api/payments/{id}

Rate limited (default 60 requests/minute). Returns JSON.

Outbound Webhooks

Enable webhooks separately from the API. Configure a public HTTPS endpoint URL and optional HMAC secret.

Events: rfq.sent, supplier_bill.approved, supplier_bill.cancelled, supplier_payment.recorded, supplier_payment.voided

Payload includes event, timestamp, and payload. Signature in X-PM-Signature header when secret is set.

Module Integrations

  • Inventory Management — GRN posting increases stock; cancellation reverses
  • Accounting Pro — Approved bills and payments sync to accounts payable
  • Supplier Portal — Link PM suppliers to portal accounts (admin-side)

FAQ

Do I need to edit BIXCRM core files?

No. The module is fully self-contained under /modules/purchase_management/.

How do RFQ supplier invitations work?

Select invited suppliers when creating an RFQ. On send, only invited suppliers receive the email (with PDF). If none selected, all active suppliers with email addresses are notified. Quotations are entered by staff in the admin panel.

Can suppliers submit quotations online?

Staff enter quotations in admin. External supplier self-service is planned for the optional Supplier Portal module.

After activation — configuration checklist

  1. Go to Setup → Modules and click Activate.
  2. Open any Purchase menu — migrations run automatically (DB v103).
  3. Configure Purchase Management → Settings.
  4. Optional: click Load Demo Data in Settings to seed sample records.
  5. Assign permissions under Setup → Staff → Permissions.

Staff permissions (from module)

Assign under Setup → Staff → Roles. Each feature can expose different actions:

FeatureActions
Dashboard
purchase_dashboard
view
Suppliers
purchase_suppliers
view, create, edit, delete
Purchase Requests
purchase_request
view, create, edit, delete, approve
RFQ / Quotations
purchase_rfq
view, create, edit, delete
Purchase Orders
purchase_order
view, create, edit, delete, approve
Goods Receipt
purchase_grn
view, create, edit, delete
Supplier Bills
purchase_bill
view, create, edit, delete, approve
Payments
purchase_payment
view, create, edit, delete
Returns
purchase_return
view, create, edit, delete, approve
Reports
purchase_reports
view, export
Settings
purchase_settings
view, edit, manage

One-time setup (first time only)

  1. Setup → Modules → activate Purchase Management.
  2. Setup → Staff → Roles → assign Purchase Management permissions (view, create, edit, delete, approve, export, settings as needed).
  3. Open Purchase Management → Settings and complete company defaults, prefixes, integrations, and notification options.
  4. Create master data (warehouses, products, templates, accounts, routes, etc.) before processing live transactions.
  5. Enable BIXCRM cron (php /path/to/bixcrm/index.php cron/index) for sync, retries, alerts, and scheduled jobs.
  6. Optionally enable REST API / webhooks in module settings if you integrate external systems.

BIXCRM Knowledge Base — usage guide generated from module README and documentation.

Did you find this article useful?