Introduction
A Purchase Order represents the movement of product into the ownership of your organization. This could be a sourcing of inventory from suppliers or donors which will result in increase in the Qty on-hand at the destination inventory.
Direct orders enable you to create orders in a status other than Draft. This article will outline how to configure a TaroWorks Job that creates a direct-completed Purchase Order upon sync.
Before you begin:
- This article assumes you know how to build TaroWorks Jobs
A. Configuring the Form
1. In the Question Builder Tab, create the following sections and questions.
| Question | Question Type | |
| Section Name: Order Info (Regular Section) | ||
| Q1 | Destination Location ID** | Text |
| Q2 | Destination Warehouse ID** | Text |
| Q3 | Order Type** | Single Select (Purchase Order) |
| Q4 | Direct Orders** | Single Select (Yes) |
| Q5 | Date of Order* | Date |
| Q6 | Status** | Single Select (Completed) |
| Q7 | Expected Date of Delivery* | Date |
| Q8 | Supplier Contact ID** | Text |
| Q9 | Transportation Cost* | Text |
| Question | Question Type | |
| Section Name: Order Line Items (Repeat/Table Section) | ||
| Q10 | Product* | Text |
| Q11 | Quantity* | Number (Min 0) |
| Q12 | Unit Cost* | Number |
| Question | Question Type | |
| Section Name: Order Summary (Repeat/Table Section) | ||
| Q13 | Product ID** | Text |
| Q14 | Product* | Text |
| Q15 | Quantity* | Number (Min 0) |
| Q16 | Quantity Delivered** | Number |
| Q17 | Unit Cost* | Number |
| Q18 | Line Item Total | Number |
| Question | Question Type | |
| Section Name: Total (Regular Section) | ||
| Q19 | Total Amount Due* | Number |
* Required
** Required and Hidden
2. Add the following dynamic operations to calculate and validate answers to the questions below :
Note: please replace any section names, question names, or picklist values that may be different in your org. If you are new to Dynamic Ops, kindly refer to this article for better understanding and examples.
Q3 Order Type: Sets the Order Type to Purchase Order.
Operation : Calculation
Javascript : tw.order_info.order_type.value="Purchase Order";
Q4: Direct Orders: Sets the Direct Order to "Yes"
Operation : Calculation
Javascript : tw.order_info.direct_orders.value="Yes"
Q6: Status: Sets Status to "Completed"
Operation : Calculation
Javascript : tw.order_info.status.value="Completed";
Q7: Expected Date of Delivery: Sets this to "Today's" date
Operation : Calculation Javascript : tw.order_info_expected_date_of_delivery.value = new Date();
Q16: Quantity Delivered: Sets to the Qty ordered
Operation : Calculation Javascript : var i = tw.order_summary.currentIndex; tw.order_summary.current.quantity_delivered.value = tw.order_line_items[i].quantity.value;
Q17 Unit Cost: Sets to Unit Cost
Operation : Calculation
Javascript : var i = tw.order_summary.currentIndex; tw.order_summary.current.unit_cost_1.value = tw.order_line_items[i].unit_cost.value;
Q18 Line Item Total: Calculates the total for each product
Operation : Calculation Javascript : var i = tw.order_summary.currentIndex; tw.order_summary.current.line_item_total.value = tw.order_line_items[i].quantity.value*tw.order_line_items[i].unit_cost.value;
Q17: Total Amount Due: Sum all Total Line Items Totals.
Operation : Calculation
Javascript : var sum =0; for(var i=0; i<tw.order_summary.length; i++) {sum = sum + tw.order_summary[i].line_item_total.value; }tw.total.total_amount_due.value=sum + tw.order_info.transportation_cost.value;
3. In the Field Mapping tab, configure the following mapping.
| Question | Question Type | Location | Warehouse | Taro Order | Taro Order Line Item | Product | Contact | |
| Section Name: Total (Order Info) | ||||||||
| Q1 | Destination Location ID** | Text | Taro Location ID | |||||
| Q2 | Destination Warehouse ID** | Text | Taro Warehouse ID | |||||
| Q3 | Order Type** | Single Select (Purchase Order) | Record Type ID | Record Type ID | ||||
| Q4 | Direct Orders** | Single Select (Yes) | Direct Orders | |||||
| Q5 | Date of Order* | Date | Date of Order | |||||
| Q6 | Status** | Single Select (Completed) | Status | Status | ||||
| Q7 | Expected Date of Delivery* | Date | Expected Delivery Date | Last Delivery Date | ||||
| Q8 | Supplier Contact ID** | Text | Contact AN ID | |||||
| Q9 | Transportation Cost* | Number | Transportation Cost | |||||
| Question | Question Type | Location | Warehouse | Taro Order | Taro Order Line Item | Product | Contact | |
| Section Name: Order Line Items (Repeat/Table Section) | ||||||||
| Q10 | Product | Text | ||||||
| Q11 | Quantity | Number | ||||||
| Q12 | Unit Cost | Number | ||||||
| Question | Question Type | Location | Warehouse | Taro Order | Taro Order Line Item | Product | Contact | |
| Section Name: Order Summary (Repeat/Table Section) | ||||||||
| Q13 | Product ID | Text | Product AN ID | |||||
| Q14 | Product | Text | ||||||
| Q15 | Quantity | Number | Qty Ordered | |||||
| Q16 | Quantity Delivered* | Number | Last Qty Delivered | |||||
| Q17 | Unit Cost* | Number | Number | |||||
| Q18 | Line Item Total | |||||||
| Question | Question Type | Location | Warehouse | Taro Order | Taro Order Line Item | Product | Contact | |
| Section Name: Total (Regular Section) | ||||||||
| Q19 | Total Amount Due* | Number | ||||||
B. Configuring the Job
1. Configure the following drill-down hierarchies (DDH).
2. Check "Allow Mobile User to select multiple records in the last level" for the DDH listing inventories.
3. Configure the following Task.

4. Click Save, Save the job again and Publish.
NOTE: Always perform extensive testing on any jobs that you create before assigning them to your field staff.
Comments
0 comments
Article is closed for comments.