Purchase Order Business Rules¶
This document outlines the business rules for purchase orders in the PRS system.
Purchase Order Entity¶
A purchase order (PO) is an official document issued to suppliers to order goods or services.
Purchase Order Status Flow¶
| Text Only | |
|---|---|
- PO can be REJECTED during FOR_PO_APPROVAL status
- PO can be CANCELLED if PO items are NOT yet FULLY DELIVERED
- PO status will be CLOSED_PO if all PO items delivered (based on DR) and fully paid (based on PR)
Purchase Order Fields¶
| Field | Description | Validation Rules |
|---|---|---|
| poNumber | Purchase Order Number | Auto-generated |
| poLetter | Purchase Order Letter | Auto-generated |
| requisitionId | Associated Requisition ID | Required |
| supplierId | Supplier ID | Required |
| supplierName | Supplier Name | Required |
| status | Current status | Must be one of the defined statuses |
| createdBy | User ID of creator | Required |
| warranty | Warranty information | Optional |
| deliveryAddress | Delivery address | Required |
| totalAmount | Total amount | Calculated from items |
Business Rules¶
1. Purchase Order Creation¶
- Purchase orders are created automatically after canvass approval
- Purchase orders are grouped by supplier and terms
- PO Number is auto-generated
- PO Letter is auto-generated
- Status is set to FOR_PO_REVIEW
- Includes all selected items from the canvass for each supplier
2. Purchase Order Review¶
- Purchase order details can be updated during review
- Warranty and delivery address can be specified
- Discount, fixed or percentage, can be added
- Status changes to FOR_PO_APPROVAL when submitted for approval
3. Purchase Order Approval¶
- Only FOR_PO_APPROVAL purchase orders can be approved
- User must be an assigned approver for the purchase order
- Approvers are processed in order by level
- Status will remain as FOR APPROVAL until fully approved
- Additional approvers can be added during the approval process
- Approvers can input a note during approval
- Approvers can edit item quantity or delete an item from the table
- If all approvers approve, status changes to FOR_SENDING
4. Purchase Order Sending¶
- Purchasing Staff will send the PO to supplier manually (outside of the system)
- After sending, assigned Purchasing Staff can change status from FOR_SENDING to FOR_DELIVERY
5. Purchase Order Rejection¶
- Only FOR_PO_APPROVAL purchase orders can be rejected
- User must be an assigned approver for the purchase order
- Rejection requires a reason/comment
- Upon rejection, status changes to PO_REJECTED
- Assigned Purchasing Staff should be able to edit rejected PO
- Can resubmit and will undergo approval process again with status FOR_PO_APPROVAL
6. Purchase Order Cancellation¶
- Purchase orders can be CANCELLED if PO items are NOT yet FULLY DELIVERED or
- Purchase orders can be cancelled if the supplier is suspended
- Upon cancellation, status changes to CANCELLED_PO
- Should allow cancelled PO items to be canvassed again (add undelivered PO Qty to Remaining Qty to be canvassed)
7. Purchase Order Items¶
- Items are created from the selected suppliers in the canvass
- Each item includes price, quantity, unit, and description
- Total amount is calculated from all items
Validation Rules¶
Detailed validation rules are defined in the Zod schema: