Proposal summary
SSK would like to automate the Invoice creation process by a customization program to have the screen to select sale orders to convert as Invoices.
Requirement
The ultimate aim is to generate invoices for sales orders from a customized page. The user should be able to filter out the sales orders after specifying some criteria. Users should have the flexibility to mark and unmark the order lines. For the selected sales orders, we have to create invoice records.
Our Solution
This requirement can be achieved by Implementing a suitelet page in the Netsuite account where the user can generate an invoice record by selecting the sales orders.
The navigation to the custom page can be added from the classic center. The user can navigate to Automation > Generate Invoice. Then upon clicking the “Generate Invoice”, the user will be redirected to a page as follows
Generate Invoice Page
Generate Invoice page will contain the following elements:
Generate Invoice Button
A button will appear at the top of the page and when the user clicks on the button, the user will be navigated to the home dashboard after initiating the invoice creation for the selected sales orders in the background. After completion of the process, invoice details will be emailed to the processed initiated user as a process completion notification
Cancel Button
Upon clicking the cancel button, the user will be navigated to the home dashboard.
Search Button
When the user enters the selection criteria and presses the search button, the script will run a search of sales orders where the orders have to meet the mentioned criteria. After filtering out the results, the results will be displayed in the list tab of the custom page.
Selection Criteria Fields
The user will be able to enter the following fields for the filtering out of search results of the sales orders:
| Generate Invoice page fields | Internal ID of the Sales Order Fields |
| Customer | customer (will source customer list, it will include both ID and Name) |
| SO No. From | tranid |
| SO No. To | tranid |
| SO Date From | trandate |
| SO Date To | trandate |
| Brand | cseg_brand |
| Model | custbody_model |
| ทะเบียนรถ | custbody_licence_plate |
Invoice record Input fields
Upon clicking the generate invoice button, the invoice will be created for selected orders.
- Date: The date field values entered in the form will be used for invoice Date (trandate) and it is mandatory for the user to enter the date field value. By default, the value will be set to the current date. We will be validating the date field in the format as in the sales order (DD/MM/YYYY).
- Invoice Type: This will be a custom list “Invoice Type” field. This mandatory field will default to the value “ใบกำกับภาษี (Vat)” on that list. Users can change its value and this will be populated on the Invoice Type field on the Invoice
Sales Orders List
This section will display Sales Orders by Selection Criteria entered by use in the “Selection criteria Fields” section. The orders will be sorted by the order transaction number (tranid) and by the order line. We will display only lines with Pending Billing quantity on the orders with Pending Billing or Pending Billing/Partially Fulfilled status.
Note: We will be using filters at the top of this subtab. The filters available will be for the page index range. Users can choose the page range to filter the results and display them in this subtab.
Mark All Button
Mark All button can be used to select all the Sales Order lines on the corresponding page
Unmark All Button
Unmark All button can be used to unselect all the Sales Order lines on the corresponding page
The fields displayed in the list has illustrated in the following table
| List fields | Internal ID of the Fields in Sales Order |
| Select (Checkbox) | |
| Customer | SO Header: Entity (it will include both customer ID and Name) |
| SO No. | SO Header: Tranid |
| SO Date | SO Header: Trandate (DD/MM/YYYY) |
| Item | SO Line Items: Item |
| Description | SO Line Items: Description |
| Units | SO Line Items: Units |
| SO Qty | SO Line Items: Quantity |
| Location | SO Line Items: LocationThe default value will be the location in the sales order. User can change this value if required |
| Remaining Invoice Qty | If Item Type is Inventory / Assembly thenDisplay pending invoice quantity = Fulfilled Qty – Invoiced Qty If Item Type is Non-Inventory / Service thenDisplay pending invoice quantity = Qty – Invoiced Qty |
| Invoice Qty | For user-specified invoice quantity, default and check as followingIf Item Type is Inventory / Assembly thenDefault Value = Fulfilled Qty – Invoiced QtyIf the entered quantity is greater than (Fulfilled Qty – Invoiced Qty), the display error message “Invoice Qty does not allow greater than Fulfilled Qty” and revert back to Default Quantity If Item Type is Non-Inventory / Service thenDefault Value = Qty – Invoiced QtyIf the entered quantity is greater than (Qty – Invoiced Qty), the display error message “Invoice Qty does not allow greater than Qty” and revert back to Default Quantity |
| Fulfilled Qty | SO Line Items: Fulfilled |
| Invoiced Qty | SO Line Items: Invoiced |
| Ship To | SO Header: Shipping (Tab): Ship To Address: Label |
| ทะเบียนรถ | SO Header: custbody_license_plate |
| Brand | SO Header: cseg_brand |
| Model | SO Header: custbody_model |
| เลขที่เคลม | SO Header: custbody_claim_no |
| เลขตัวถัง | SO Header: custbody_vin |
Page format design will be similar to the image displayed below.
Generate Invoice page validations
Restrict the generation of the invoice record if the following conditions are not satisfied
- If the entered quantity for Invoice Quantity is greater than (Fulfilled Qty – Invoiced Qty), the display error message “Invoice Qty does not allow greater than Fulfilled Qty”
- The user has to enter the Mandatory fields
- User entry to the date field will be validated to check the date format and a popup alert will be displayed
Invoice creation
Custom record set up
The user needs to mark the checkbox corresponding to the sales orders item line. When the user clicks the “Generate Invoice” records, a Custom record entry will be created in the Netsuite with the data from the suitelet page(sales orders and item details). We will be implementing a customized field “Generate Invoice status”, in the custom record to indicate whether all invoices have been created for the custom record or not. The scheduled script will be creating invoice records for the sales order lines selected in the “Generate Invoice page”. In each custom record, the sales order number will be grouped together and saved in one object in the post-action of the suitelet.
Note: Even if the Invoice from a Sales Order is failed, the process will continue to create Invoice for other Sales Orders in the selected list
Email notification
We will be creating a custom field, “Error for Invoice creation”, in the custom record. If there is any error generated while running the script on the custom record, the field will be updated by the error message. Then it will be notified to the user who submits the “Generate Invoice” button on the custom page via email. For email notification, we will be implementing a saved search in the error field of the custom record.
Invoice Record details
Following are the points we will be considering while creating the Invoice record:
- Location and Invoice quantity field values should be taken from the suitelet custom form page for invoice record creation
- Document number will be auto-generated by Netsuite
- Invoice Type and Date field value will be the value entered in the “Generate Invoice” page
- Every other field should be the same as that in the sales order record
- The status field will not be set on the invoice through the invoice creation script. So it defaulted to the Account setup/Approval Flow
| Invoice Field | Data From |
| Header | |
| Invoice Type | Invoice Type from Custom Page |
| Invoice # | Auto Generate by NetSuite |
| Customer | SO Header: Customer |
| Date | Date from Custom Page |
| Posting Period | Auto populated based on Trandate |
| Terms | SO Header: Term |
| Due Date | Date + Days Till Net Due of the corresponding TermIf Days is not defined for any Term, then Date will be set directly |
| Created From | SO Header: Order # |
| Sales Rep | SO Header: Sales Rep |
| Memo | SO Header: Memo |
| Department | SO Header: Department |
| Sale Type | SO Header: Sale Type |
| Location | SO Header: Location |
| Main Category | SO Header: Main Category |
| Brand | SO Header: Brand |
| Model | SO Header: Model |
| Subsidiary Branch | SO Header: cseg_branch |
| ทะเบียนรถ | SO Header: custbody_license_plate |
| เลขที่เคลม | SO Header: custbody_claim_no |
| เลขตัวถัง | SO Header: custbody_vin |
| Order Type | SO Header: Order Type |
| Bill To | SO Header: Billing (Tab): Bill To |
| Ship To | SO Header: Shipping (Tab): Ship To |
| Currency | SO Header: Accounting (Tab): Currency |
| Exchange Rate | SO Header: Accounting (Tab): Exchange Rate |
| Billing Note Applied (CBN) | SO Header: Billing Note Applied (CBN) |
| Line | |
| Item | SO Line Items: Item |
| Description | SO Line Items: Description |
| Location | SO Line Items: Location |
| Quantity | Invoice Qty from Custom Page |
| Units | SO Line Items: Units |
| Unit Price | SO Line Items: Unit Price |
| Disc% | SO Line Items: Disc% |
| Disc Amount | SO Line Items: Unit Price * SO Line Items: Disc% * Invoice Line Items: Invoice Quantity |
| Rate | SO Line Items: Rate |
| Amount | Invoice Quantity * Rate |
| Tax Code | SO Line Items: Tax Code |
| Tax Amt | Amount * Tax Rate |
| Main Category | SO Line Items: Main Category |
| Brand | SO Line Items: Brand |
Assumptions
- The Sales Order can be created in UI or CSV uploaded.
- Applicable only to the sales order record with terms
- Applicable only to inventory items, assembly items, Non-Inventory, and Serviceitems, not applicable to item groups, kit items, discount items, and gift certificates
- No restrictions related to Subsidiaries or locations or even roles
- The date format set in the account is DD/MM/YYYY
- There is no restriction to the user roles who have access to the “Generate Invoice” page
- We assume that the standard functionality to create the bulk Invoice has been considered and that functionality cannot meet the Line wise invoicing requirements
- The “Invoice In Advance of Fulfillment” accounting preference is disabled
Risks
- The NetSuite will enforce concurrency limits on Suitelet.
- The failure during the Invoice creation process is notified to the user via email. So users have to review the same and reprocess the failed one again.
- The submitted sales order will be stored in the custom record after the “Generate Invoice” button is clicked. If the user immediately opens the suitelet page and applies the criteria to display the order list, previously selected sales orders will be listed (since the Invoice is created via a scheduled process). It is the responsibility of the user to select the orders accordingly and make sure that the previously selected sales orders will not be repeatedly selected. Previously chosen Sales Order Item lines will be removed from the list when Invoice is created for the same.