Introduction
A Sales Order represents the movement of product out of the ownership of your organization. This could be a beneficiary distribution or a customer sale, both of which would be come from an inventory in a source warehouse.
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-confirmed 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 Information (Regular Section) | ||
| Q1 | Source Location ID** | Text |
| Q2 | Pricebook ID** | Text |
| Q3 | Order Type** | Single Select (Sales Order) |
| Q4 | Source Warehouse ID** | Text |
| Q5 | Customer ID** | Text |
| Q6 | Customer Name | Text |
| Q7 | Date of Order* | Date |
| Q8 | Expected Delivery Date* | Date |
| Q9 | Direct Order** | Single Select (Yes) |
| Q10 | Status | Single Select (Confirmed) |
| Question | Question Type | |
| Section Name: Order Line Items - Repeat/Table Section | ||
| Q11 | Product ID** | Text |
| Q12 | Product Name | Text |
| Q13 | Price | Number |
| Q14 | Min Qty for Bulk Price | Number |
| Q15 | Bulk Price | Number |
| Q16 | Qty* | Number |
| Question | Question Type | |
| Section Name: Line Item Totals - Repeat/Table Section | ||
| Q17 | Product ID** | Text |
| Q18 | Product Name | Text |
| Q19 | Price | Number |
| Q20 | Qty Ordered | Number |
| Q21 | Line Item Total | Number |
| Question | Question Type | |
| Section Name: Order Summary - Regular Section | ||
| Q22 | Total Amount Due | Number |
* Mark Question as Required
** Mark Question as Required & 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 Sales order.
Operation : Calculation
Javascript : tw.order_information.order_type.value="Sales Order";Q9 Direct Order: Sets the Direct Order to "Yes"
Operation : Calculation
Javascript : tw.order_information.direct_order.value = "Yes";
Q10 Status: Sets Status to "Confirmed" if Direct order above is Yes and set to "Draft" if Direct order above is No.
Operation : Calculation
Javascript : tw.order_information.status_1.value = "Confirmed";
Q19 Price: Checks if quantity is above bulk price to set bulk price, if less than bulk price unit price remains.
Operation : Calculation
Javascript : var i = tw.line_item_totals.currentIndex; if(tw.order_line_items[i].qty.value < tw.order_line_items[i].min_qty_for_bulk_price.value) { tw.line_item_totals.current.price_1.value=tw.order_line_items[i].price.value; } else {tw.line_item_totals.current.price_1.value=tw.order_line_items[i].bulk_price.value; }
Q21 Line Item Total: Calculates the total cost of each Line Item
Operation : Calculation
Javascript : var i = tw.line_item_totals.currentIndex;var price = 0;if(tw.order_line_items[i].qty.value < tw.order_line_items[i].min_qty_for_bulk_price.value) { price=tw.order_line_items[i].price.value; } else { price=tw.order_line_items[i].bulk_price.value; }tw.line_item_totals.current.line_item_total.value = tw.order_line_items[i].qty.value*price;
Q22 Total Amount Due: Sum price of all product ordered.
Operation : Calculation
Javascript : var total = 0;for (var i=0; i < tw.line_item_totals.length; i ++){total = total + tw.line_item_totals[i].line_item_total.value;}tw.order_summary.total_amount_due.value = total;
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 second DDH (Drill Down Hierarchy).
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.