Sales Order Module Manual
Official Documentation for Sales Quotations and Order Management System.
Module Overview
The Sales Order Module (Quotation) is designed to manage the preliminary stage of a sales transaction. It allows users to record customer requirements, specify items, quantities, and pricing before a final invoice is generated. This module serves as a bridge between customer inquiries and finalized sales.
Step-by-Step Workflow
View Existng Orders
Navigate to 'Sales Order/Quotation'. The index page displays a paginated list of all orders. You can search by Order ID, Reference, Date, Branch, or Customer Ledger.
Initiate New Order
Click the 'Add New' button. The system redirects you to the creation form
where header information like Date, Branch, and
Ledger (Customer) must be selected.
Configure Items & Pricing
Use the dynamic item grid to search for products. Specify the Quantity and
Rate. The system will automatically calculate the Value and
Sub-total.
Save & Commit
Click 'Save'. The transaction is wrapped in a database commit to ensure data
integrity across both the sales_orders (Master) and
sales_order_details tables.
Generate Print/PDf
Upon success, use the Print icon to generate a professional Quotation/Order
document. Options for Master Print and Detail Print are available.
Configuration Settings
The form behavior can be customized via SalesFormSetting. This allows toggling specific
fields like VAT, Discounts, or Store selections based on business requirements.
| Setting Name | Description |
|---|---|
_form_name |
Internal identifier for the specific sales form configuration. |
Default Ledger |
Commonly used ledger for quick entry (e.g., Cash or General Sales). |
Inventory Accounts |
Defines which ledger heads are used for inventory tracking in this module. |
Database Schema
Relational structure to maintain order history and line-item details:
| Table Name | Primary Columns | Purpose |
|---|---|---|
sales_orders |
id, _date, _ledger_id, _total
|
Master table storing order header information. |
sales_order_details |
_no, _item_id, _qty, _rate |
Detail table linked via _no (Foreign Key to
sales_orders.id).
|
sales_form_settings |
id, _form_name, _show_vat |
Stores UI preferences and default logic toggles. |
account_ledgers |
id, _name |
Referenced for customer/party selection. |
Model Relationships
Eloquent models defined in app/Models/:
- SalesOrder:
_master_details(): HasManySalesOrderDetail(Links via_no)._ledger(): HasOneAccountLedger._master_branch(): HasOneBranch.
- SalesOrderDetail:
_items(): HasOneInventory(Product details)._trans_unit(): HasOneUnits._store(): HasOneStoreHouse.
View File Mapping
Templates located in resources/views/backend/sales-order/:
| Blade View | Component Purpose |
|---|---|
index.blade.php |
Listing page with search, filters, and action buttons. |
create.blade.php |
Primary entry interface for new orders. |
edit.blade.php |
Interface for modifying existing order records. |
print.blade.php |
Standard print template for the order document. |
master_print.blade.php |
Batch summary print for filtered results. |
details_print.blade.php |
Detailed batch print including line items. |
Controller Function Details
Logical breakdown of SalesOrderController.php:
| Method | Action | Technical Logic |
|---|---|---|
| index | List Data | Retrieves orders with eager loading (_ledger,
_master_branch) and applies multi-column filtering.
|
| store | Save Order | Uses DB::beginTransaction(). Creates SalesOrder, then
loops through requested items to create SalesOrderDetail entries. |
| update | Modify Order | Updates master record and refreshes details by setting _status=0 for
old items and inserting new/updated ones. |
| SalesOrderDetails | Fetch Details | AJAX endpoint that returns JSON encoded line items for a specific order ID. |
| orderSearch | Live Search | AJAX endpoint for searching active orders based on date or ID strings. |
| destroy | Delete Order | Removes records from both sales_orders and
sales_order_details to maintain cleanup.
|
| SalesOrderPrint | Print View | Fetches a single order with all relations to be rendered by the print
template. |