CRMconnect Azuvio · Docs

Workflow: Full Commercial Cycle

Modules involved: Leads · Opportunities · Proposals · Sales Orders · Warehouse · Purchase · Invoices · Payments · Innoship
Who uses it: Sales · Warehouse · Purchasing · Finance
Typical duration: Days – weeks (from lead to delivery and payment)

Overview

The complete commercial cycle — from first contact with the prospect through to stock rotation after delivery. Covers the sale, stock verification, procurement for shortages (manual backorder), receipt from vendors, client delivery with delivery note and invoice, and residual stock management.

Important — known automation limitations:
CRMConnect partially automates this cycle. Three points require manual intervention: (1) creating the RFQ when stock is insufficient, (2) a direct link between sales order ↔ purchase order does not exist in the tables, (3) automatic replenishment at minimum stock is not implemented — the configured minimum is informational only.


Complete Flow Diagram

[LEAD]
  │ capture: form / email pipe / Facebook / manual
  │ ↓
[OPPORTUNITY]
  │ qualification, estimated value, probability
  │ ↓
[PROPOSAL]
  │ Draft → Sent → Accepted
  │ ↓ Convert
[SALES ORDER]
  │ status: Draft(1) → Sent(2) → Accepted(4) → Invoiced
  │ ↓ Convert to Invoice
[CLIENT INVOICE — Draft]
  │
  ├──────────────────────────────────────────────────────────────
  │  STOCK CHECK (when creating the delivery note)
  │
  │  inventory_manage.inventory_number ≥ quantity ordered?
  │
  ├─── YES → sufficient stock ─────────────────────────────────┐
  │                                                              │
  └─── NO → insufficient stock ─────────────────────────────────┤
              │                                                  │
              │ [BACKORDER — manual intervention]               │
              │  Agent identifies shortage →                    │
              │                                                  │
              │ [REQUEST FOR QUOTATION (RFQ)]                   │
              │  status: Draft(1) → Approved(2)                 │
              │  ↓                                              │
              │ [VENDOR QUOTATION]                              │
              │  status: Pending(1) → Accepted(2)              │
              │  ↓                                              │
              │ [PURCHASE ORDER]                                │
              │  sent to vendor                                 │
              │  ↓                                              │
              │ [GOODS RECEIPT NOTE]                            │
              │  goods arrived → stock updated                  │
              │  ↓                                              │
              │ [VENDOR INVOICE]                                │
              │  payment_status: unpaid → paid                  │
              │  ↓                                              │
              └──────────→ STOCK AVAILABLE ────────────────────┘
                                │
                                ↓
              [DELIVERY NOTE]
               created from client invoice
               approval: 0=Draft → 1=Approved
               stock −= quantity delivered
               ↓
              [PACKING LIST]
               parcel dimensions + weight
               ↓
              [AWB INNOSHIP]
               generated via courier API
               ↓
              [DELIVERY NOTE sent to client]
               PDF document with delivered products
               ↓
              [CLIENT INVOICE — Sent]
               status: Sent → Partially paid → Paid
               ↓
              [CLIENT PAYMENT RECEIVED ✓]
               ↓
              [STOCK ROTATION]
               balance updated in warehouse_history
               minimum stock check (inventory_commodity_min)
               if below minimum → agent creates new RFQ

Detailed Step by Step

Phase 1 — Sale: Lead → Sales Order

1.1 Lead

Where: /admin/leads

The prospect enters through any channel (form, Facebook Lead Ads, email pipe, import, manual). The SDR agent qualifies them and updates the status through the pipeline.

Essential fields for continuing the flow:

  • Company + contact person
  • Email (for sending the proposal)
  • Source (for ROI reporting)

1.2 Opportunity

Where: /admin/leads (Opportunities filter) or /admin/opportunities

From lead → Convert to Opportunity. Fill in:

  • Estimated transaction value
  • Estimated closing date
  • Conversion probability

The opportunity feeds the sales forecast and can be included in Goals as a tracked target.

1.3 Proposal

Where: /admin/proposals

From opportunity → Create Proposal. The cycle:

Status Code Trigger
Draft 6 At creation
Sent 4 Send button → email with portal link
Viewed 1 Client opens the link
Accepted 3 Client clicks Accept or agent changes manually
Declined 2 Client or agent

Upon acceptance → the Convert to Sales Order button becomes available.

1.4 Sales Order

Where: /admin/estimates

Created from the accepted proposal — all product/service lines are automatically copied.

Sales order statuses (tblestimates.status):

Code Status Description
1 Draft Unconfirmed draft
2 Sent Sent to client
3 Declined Declined
4 Accepted / Invoiced Accepted and converted to invoice
5 Expired Expiry date exceeded

Key fields:

  • invoiceid — automatically filled after conversion to invoice
  • invoiced_date — timestamp of conversion

Upon client acceptance:
If estimate_auto_convert_to_invoice_on_client_accept = 1 → the invoice is generated automatically.
Otherwise → manual Convert to Invoice button.


Phase 2 — Stock Verification

When: When creating the Delivery Note from the invoice

How it works:

The system calls get_inventory_by_commodity_and_warehouse(commodity_code, warehouse_id) and checks:

if inventory_manage.inventory_number < quantity_ordered:
    flag_export_warehouse = 0  → delivery note CANNOT be approved

Important — no automatic reservation:
Stock is NOT reserved when the sales order is created. It is checked and decremented only when the delivery note is approved. Between the sales order and delivery, stock may be consumed by other orders.

Configured minimum stock — informational reference:

The inventory_commodity_min table stores:

  • inventory_number_min — alert threshold
  • inventory_number_max — target level at replenishment

These values do not automatically trigger any action. The agent must check manually and create an RFQ when they find that stock has fallen below the minimum.

Where to check stock: /admin/warehouse/warehouse_history or from the product record (Commodities) → current balance per warehouse.


Phase 3 — Backorder: Procurement for Shortages (Manual)

This phase is only followed if stock is insufficient. If stock is available, proceed directly to Phase 4.

CRMConnect does not have an automatic backorder mechanism. The procurement flow is initiated manually by the purchasing agent.

3.1 Request for Quotation (RFQ)

Where: /admin/purchase/purchase_request

The agent creates an RFQ specifying the products and quantities missing relative to the sales order. The reference document (sales order) is noted in the description or internal notes field.

RFQ statuses:

Code Status
1 Draft
2 Approved — sent to vendors
3 Rejected
4 Canceled

Link to sales order: There is no direct FK field in the tables. Recommended convention: mention the sales order number in the RFQ title or description for manual traceability.

3.2 Vendor Quotations

Where: /admin/purchase/myquotations

Vendors respond through the portal or the agent enters the received quotes. Multiple quotes for the same RFQ can be compared before selection.

Code Status
1 Pending — received, not yet evaluated
2 Accepted — winning quote

3.3 Purchase Order

Where: /admin/purchase/purchase_order

Created from the accepted quotation. Sent to the vendor with PDF + portal link.

Purchase Order statuses:

Field Code Description
status 1 Draft
status 2 Approved — confirmed to vendor
status 3 Rejected
status 4 Canceled
order_status 1 Not Started
order_status 2 In Progress
order_status 3 Completed
delivery_status 0 Not Delivered
delivery_status 1 Delivered

3.4 Goods Receipt Note from Vendor

Where: /admin/warehouse/manage_purchase

Created automatically when the Purchase Order is approved (if auto_create_goods_received = 1) or manually.

Upon approval (approval = 1):

  • Stock increases: inventory_manage.inventory_number += quantity_received
  • Transaction recorded: goods_transaction_detail.status = 1 (Receipt)
  • Lot tracking: lot_number, date_manufacture, expiry_date

Critical fields for stock rotation:

Field Notes
lot_number Lot identifier — basis for FIFO
date_manufacture Manufacturing date
expiry_date Expiry date — perishable stock warning
warehouse_id Destination warehouse

3.5 Vendor Invoice

Where: /admin/purchase/myinvoices

Received from the vendor after receipt. payment_status: unpaidpartially_paidpaid.

Vendor payment is recorded in pur_invoice_payment.


Phase 4 — Delivery to Client

4.1 Client Invoice (before delivery)

Where: /admin/invoices

Converted from the Sales Order. Upon creation:

  • tblestimates.invoiceid = invoice_id
  • tblestimates.status = 4 (Invoiced)
  • If auto_create_goods_delivery = 1 → Delivery Note is created automatically

Invoice statuses:

Code Status
6 Draft
1 Unsent
3 Partially Paid
2 Paid
4 Overdue
5 Cancelled

4.2 Delivery Note

Where: /admin/warehouse/manage_delivery

Automatic creation from invoice (if option is active) via:
auto_create_goods_delivery_with_invoice(invoice_id)

Fields set automatically:

  • invoice_id = client invoice ID
  • Product lines copied from invoice items
  • warehouse_id = configurable warehouse

Stock check at creation:

  • If insufficient stock → flag_export_warehouse = 0delivery note blocked
  • Agent sees the warning and initiates Phase 3 (backorder)
  • Once stock is replenished → return to delivery note → approve

Delivery types:

  • type_of_delivery = 'total' — complete delivery
  • type_of_delivery = 'partial' — partial delivery (a second delivery note follows)

Upon approval (approval = 1):

  • Stock decreases: inventory_manage.inventory_number -= quantity
  • Transaction: goods_transaction_detail.status = 2 (Delivery)
  • FIFO: lots selected in the order they were received (ORDER BY id ASC)

4.3 Packing List + AWB Innoship

Where: /admin/warehouse/manage_packing_list + /admin/innoship/awb

From the approved delivery note:

  1. Packing List — select quantities, fill in dimensions (length, width, height, weight)
  2. AWB generated via Innoship API — returns tracking number
  3. Packing list status: wh_ready_to_deliverwh_in_transitwh_delivered

Delivery Note — the PDF document accompanying the physical goods, also sent to the client with:

  • List of delivered products + quantities
  • AWB number for tracking
  • Sender and recipient details

4.4 Client Invoice — Sending and Payment

Invoice sent to the client (email + PDF + portal link). The client can pay online (if gateway configured) or by bank transfer.

Upon full payment:

  • status = 2 (Paid)
  • Activity logged in the client's history
  • If cancelled_invoice_reverse_inventory = 1 and the invoice is later cancelled → stock is restored

Phase 5 — Stock Rotation

5.1 FIFO Principle

CRMConnect applies FIFO through lot tracking:

  • At receipt: each received lot has lot_number, date_manufacture, expiry_date
  • At delivery: lots are selected in the order they were recorded (ORDER BY id ASC on goods_receipt_detail)
  • Result: oldest goods / first lot received → first delivered

View: Product record → Inventory tab → balances per lot per warehouse.

5.2 Minimum Stock — Manual Monitoring

Where: /admin/warehouse/warehouse_history + Commodities → edit → min/max fields

The inventory_commodity_min table stores:

Field Description
inventory_number_min Minimum alert threshold
inventory_number_max Target level at replenishment

Recommended workflow for periodic replenishment:

  1. Set inventory_number_min on each active product
  2. Periodically run the Current Stock report filtered below minimum
  3. Purchasing agent creates RFQ for products below threshold
  4. Quantity ordered = inventory_number_max - current_inventory_number

There is no automatic trigger. The check is done manually or can be automated externally via webhook + Zapier (if stock is below minimum, Zapier creates a replenishment task).

5.3 Perishable Products — Expiry Alerts

Products with expiry_date filled in on the receipt note can be monitored:

  • Filter in the product list by expiry_date < current_date + N days
  • Delivery selects them in FIFO — those closest to expiry are dispatched first
  • Expired lots → Loss & Adjustments (/admin/warehouse/loss_adjustment) with type = 'loss'

5.4 Stock Adjustments

Discrepancies found during periodic physical inventory:

  1. Physical Inventory (/admin/warehouse/physical_inventory) — count and reconciliation
  2. Loss & Adjustments (/admin/warehouse/loss_adjustment) — point corrections
  3. Return from client (/admin/warehouse/manage_order_return_receipt) — returned goods re-entered into stock

Document and Status Map

SALES:
tblestimates.status:  1=Draft 2=Sent 3=Declined 4=Invoiced 5=Expired
tblinvoices.status:   6=Draft 1=Unpaid 3=Partial 2=Paid 4=Overdue 5=Cancelled
tblproposals.status:  6=Draft 4=Sent 1=Open 3=Accepted 2=Declined 5=Revised

WAREHOUSE (outbound):
goods_delivery.approval:       0=Draft → 1=Approved
goods_delivery.type_of_delivery: 'total' / 'partial'
goods_transaction_detail.status: 2=Delivery, 3=Issue

PURCHASING:
pur_request.status:    1=Draft 2=Approved 3=Rejected 4=Canceled
pur_estimates.status:  1=Pending 2=Accepted
pur_orders.status:     1=Draft 2=Approved 3=Rejected 4=Canceled
pur_orders.order_status: 1=NotStarted 2=InProgress 3=Completed
pur_invoices.payment_status: unpaid / partially_paid / paid

WAREHOUSE (inbound):
goods_receipt.approval:       0=Draft → 1=Approved
goods_transaction_detail.status: 1=Receipt

COURIER:
wh_packing_lists.delivery_status: wh_ready_to_deliver → wh_in_transit → wh_delivered

What Is Created Automatically vs. Manually

Step Automatic? Condition
Lead from web form ✅ Automatic Active embedded form
Proposal → Invoice ✅ Automatic (optional) estimate_auto_convert_to_invoice_on_client_accept = 1
Invoice → Delivery Note ✅ Automatic (optional) auto_create_goods_delivery = 1
Purchase Order → Goods Receipt ✅ Automatic (optional) auto_create_goods_received = 1
Backorder on insufficient stock Manual Agent creates RFQ
Purchase order from sales order Manual No direct FK exists
Replenishment at minimum stock Manual No automatic trigger
Delivery Note → AWB Innoship ✅ Automatic Packing list approved + API key configured
Stock decremented ✅ Automatic Upon delivery note approval
Stock incremented ✅ Automatic Upon goods receipt approval

Critical Points of Attention

Risk Impact Mitigation
Stock not reserved at sales order Stock consumed by another order before delivery Process deliveries in priority order; check availability daily
Backorder without FK link to sales order Lost traceability vendor ↔ client Manually note sales order number in RFQ title
FIFO correct only with lot_number filled in at receipt Expired products delivered if lots not registered Enforce completion of lot_number and expiry_date at all receipts
Minimum stock not monitored Undetected stock outages Weekly check: stock vs. minimum report
Delivery note blocked (stock = 0) Delayed delivery Alert visible in UI; escalation procedure to purchasing defined
Invoice cancelled after delivery Stock not restored if cancelled_invoice_reverse_inventory = 0 Enable the option OR create a manual stock adjustment

Complete Order Traceability

Starting from the sales order number, you can trace:

Sales Order #EST-001
  └── Invoice #INV-010  (tblestimates.invoiceid = 10)
        └── Delivery Note #XK-005  (goods_delivery.invoice_id = 10)
              └── Packing List #PL-003
                    └── AWB #FAN-123456  (wh_omni_shipments)
        └── Payment #PAY-007  (tblinvoices → tblinvoicepayments)

RFQ #RFQ-002  [created manually for shortages from EST-001]
  └── Quotation #Q-004  (pur_estimates)
        └── Purchase Order #PO-006  (pur_orders)
              └── Goods Receipt #NK-008  (goods_receipt, pr_order_id = PO-006)
                    └── Vendor Invoice #VI-009  (pur_invoices)

Key Reports for Monitoring

Report URL What you monitor
Pending sales orders /admin/estimates/list_estimates?status=2 Sent orders, not yet confirmed
Uncollected invoices /admin/invoices/list_invoices?status=1 Client cash flow
Overdue invoices /admin/invoices/list_invoices?status=4 Debt collection
Undelivered purchase orders /admin/purchase/purchase_order?delivery_status=0 Vendors in delay
Current stock vs. minimum Commodities + inventory_commodity_min Imminent stock outages
Stock transaction history /admin/warehouse/warehouse_history Movement audit
Pending delivery notes /admin/warehouse/manage_delivery Blocked deliveries
AWBs in transit /admin/innoship/awb Courier status

Modules Involved — Detailed Documentation

Sales: Leads · Opportunities · Proposals · Sales Orders · Invoices · Payments

Warehouse: Delivery Notes · Goods Receipt Note · Packing Lists · Inventory History · Loss & Adjustments · Physical Inventory

Purchasing: RFQ · Received Quotations · Purchase Orders · Vendor Invoices

Courier & Integrations: Innoship Couriers · WooCommerce · Webhooks

Related Workflows: Lead → Cash · Purchase to Pay · OmniSales Fulfillment · Warehouse Inbound → Outbound

← Back to Workflows

Tip

Every stage in the full commercial cycle auto-fills the next when converted correctly — use the Convert/Copy actions rather than creating new documents manually to preserve the complete traceable chain from lead to payment.

Note

The full cycle works only when each stage is completed in order. Issuing an invoice without a confirmed Sales Order, or creating a contract after invoicing, breaks the traceability chain that auditors and regulators expect to see.