Content Definition: Purchase Request Content
This document elaborates on the "Content Definition" section of specification.md.
Basic Information
| Item | Value |
|---|---|
| Content Name | Purchase Request Content |
| Content ID | purchase_request_content |
Screen Definitions
Screen Definition List
| Screen Type | Screen ID | Path Type | Script Path | Initial Use | Notes |
|---|---|---|---|---|---|
| Application Screen | SCR-001 | Scripting Development | purchase/apply/apply | ○ | imwUserDataId is assigned a number by the function container |
| Resubmission Screen | SCR-001 | Scripting Development | purchase/apply/apply | ○ | Same as the application screen. Additionally displays the send-back comment |
| Processing Screen | SCR-002 | Scripting Development | purchase/approve/approve | ○ | Displays the request details as read-only |
| Processing Detail Screen | SCR-003 | Scripting Development | purchase/detail/detail | ○ | Reference only |
| Reference Detail Screen | SCR-004 | Scripting Development | purchase/detail/detail | ○ | Uses the same screen as the Processing Detail Screen |
Screen Field Definitions
For details on the screen fields, see specification.md - Screen Field Definitions.
User Program Definitions
Development Model
| Item | Value |
|---|---|
| Development Model | Scripting development model (SSJS) |
| Screen Technology | JSSP (HTML templates + function containers) |
| User Programs | Server-side JavaScript (action processing / matter end process) |
Action Process List
| Program Name | Deployment Path | Target Node | Processing Content |
|---|---|---|---|
| ActionProcess1 | purchase/action/ActionProcess1.js | Application Node | Data saving, validation, and matter property setting on application and resubmission |
| ActionProcess2 | purchase/action/ActionProcess2.js | Purchasing Department Approval Node | Records the order data when the approval is completed |
ActionProcess1 (For the Application Node) Processing Details
| Process Type | Step | Processing Content | Applicable Rule |
|---|---|---|---|
| apply (Application) | 1 | Retrieve the screen input values (header and line items) from the user parameters | - |
| 2 | Validation: Number of line items is 1 to 20 | BR-001 | |
| 3 | Validation: Each line item's quantity ≧ 1, unit price ≧ 1 | BR-002 | |
| 4 | Validation: Desired delivery date ≧ Application date + 1 day | BR-004 | |
| 5 | Validation: The vendor ID exists in the vendor master | BR-005 | |
| 6 | Recalculate the subtotal and total amount for each line item on the server side | BR-006 | |
| 7 | On a validation error, return resultFlag = false plus an error message | - | |
| 8 | INSERT into purchase_request (key: userDataId) | - | |
| 9 | Bulk INSERT the line items into purchase_request_item | - | |
| 10 | Set the total amount in the matter property purchase_amount | BR-003 | |
| 11 | Set the vendor name in the matter property vendor_name | - | |
| 12 | Return resultFlag = true | - | |
| reapply (Resubmission) | 1 | Retrieve the screen input values from the user parameters | - |
| 2-7 | Run the validations and recalculate the total amount (same as on application) | BR-001, 002, 004, 005, 006 | |
| 8 | UPDATE purchase_request; delete all rows in purchase_request_item and re-INSERT | - | |
| 9 | Reset the matter properties purchase_amount and vendor_name | BR-003 | |
| 10 | Return resultFlag = true | - |
ActionProcess2 (For the Purchasing Department Approval Node) Processing Details
| Process Type | Step | Processing Content | Applicable Rule |
|---|---|---|---|
| approveEnd (Complete Approval) | 1 | Retrieve the header data from purchase_request using userDataId as the key | - |
| 2 | INSERT the order data into purchase_orders (the orderer is the processing user ID) | BR-007 | |
| 3 | Return resultFlag = true | - | |
| Other (approve / deny / sendBack, etc.) | - | No business data operation needed. Return resultFlag = true | BR-008 |
Matter End Process
| Program Name | Deployment Path | Processing Content |
|---|---|---|
| MatterEndProcess | purchase/action/MatterEndProcess.js | Returns whether to send an email (send if data = true) |
Notification Definitions
Notification Method
| Item | Value |
|---|---|
| Notification Method | Email notification |
| Definition Method | Message definition (recommended method) |
| IMBox Notification | Not used |
Email List
| Send Timing | Notification Type | Recipient | Example Subject |
|---|---|---|---|
| On application | Processing request | Department Manager | "A purchase request has arrived" |
| On department manager approval | Processing request | Accounting Department / Purchasing Department | "A purchase request needs your approval" |
| On accounting department approval | Processing request | Purchasing Department | "A purchase request needs order processing" |
| On approval | Processing result notification | Applicant | "Your purchase request has been approved" |
| On approval completion | Processing result notification | Applicant | "The order for your purchase request has been placed" |
| On send-back | Processing result notification | Applicant | "Your purchase request has been sent back" |
| On denial | Processing result notification | Applicant | "Your purchase request has been denied" |
Replacement Strings
The following replacement strings can be used in the email body.
| Replacement String | Description |
|---|---|
| Matter property value | purchase_amount (total amount), vendor_name (vendor name) |
| intra-mart URL | Link to the processing screen or reference screen |
Matter Properties
| Property Key | Set At | Purpose |
|---|---|---|
| purchase_amount | On application | Total amount. Used for branch route determination and email replacement |
| vendor_name | On application | Vendor name. Used for matter name generation and email replacement |
Rule Definitions
A rule definition is configured, since the route branches to (or skips) the accounting department approval node depending on the total amount.
Rule List
| Rule ID | Determination Key (Matter Property) | Comparison Condition | Condition Value | Branch Destination |
|---|---|---|---|---|
| RULE-AMOUNT-LOW | purchase_amount | Less than | 500000 | Skip the accounting department approval |
| RULE-AMOUNT-HIGH | purchase_amount | Greater than or equal to | 500000 | Proceed to the accounting department approval node |
- See the route configuration diagram in route_definition.md for the branch structure
- The rule is evaluated at the branch start node
Related Documents
- specification.md - Main specification
- flow_definition.md - Flow definition
- route_definition.md - Route definition