Generate Invoice in Bulk

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 fieldsInternal ID of the Sales Order Fields
Customercustomer  (will source customer list, it will include both ID and Name)
SO No. Fromtranid
SO No. Totranid
SO Date From trandate
SO Date Totrandate
Brandcseg_brand
Modelcustbody_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 fieldsInternal ID of the Fields in Sales Order
Select (Checkbox)
CustomerSO Header: Entity (it will include both customer ID and Name)
SO No.SO Header: Tranid
SO DateSO Header: Trandate  (DD/MM/YYYY)  
ItemSO Line Items: Item
DescriptionSO Line Items: Description
UnitsSO Line Items: Units
SO QtySO Line Items: Quantity
LocationSO Line Items: LocationThe default value will be the location in the sales order. User can change this value if required
Remaining Invoice QtyIf 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 QtyFor 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 QtySO Line Items: Fulfilled
Invoiced QtySO Line Items: Invoiced
Ship ToSO Header: Shipping (Tab):  Ship To Address: Label
ทะเบียนรถSO Header: custbody_license_plate
BrandSO Header: cseg_brand
ModelSO 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 FieldData From
Header
Invoice TypeInvoice Type from Custom Page
Invoice #Auto Generate by NetSuite
CustomerSO Header: Customer
DateDate from Custom Page
Posting PeriodAuto populated based on Trandate
TermsSO Header: Term
Due DateDate + Days Till Net Due of the corresponding TermIf Days is not defined for any Term, then Date will be set directly
Created FromSO Header: Order #
Sales RepSO Header: Sales Rep
MemoSO Header: Memo
DepartmentSO Header: Department
Sale TypeSO Header: Sale Type
LocationSO Header: Location
Main CategorySO Header: Main Category
BrandSO Header: Brand
ModelSO Header: Model
Subsidiary BranchSO Header: cseg_branch
ทะเบียนรถSO Header: custbody_license_plate
เลขที่เคลมSO Header: custbody_claim_no
เลขตัวถังSO Header: custbody_vin
Order TypeSO Header: Order Type
Bill ToSO Header: Billing (Tab):  Bill To
Ship ToSO Header: Shipping (Tab):  Ship To
CurrencySO Header: Accounting (Tab): Currency
Exchange RateSO Header: Accounting (Tab): Exchange Rate
Billing Note Applied (CBN)SO Header: Billing Note Applied (CBN)
Line
ItemSO Line Items: Item
DescriptionSO Line Items: Description
LocationSO Line Items: Location
QuantityInvoice Qty from Custom Page
UnitsSO Line Items: Units
Unit PriceSO Line Items: Unit Price
Disc%SO Line Items: Disc%
Disc AmountSO Line Items: Unit Price * SO Line Items: Disc% * Invoice Line Items: Invoice Quantity
RateSO Line Items: Rate
AmountInvoice Quantity * Rate
Tax CodeSO Line Items: Tax Code
Tax AmtAmount * Tax Rate
Main CategorySO Line Items: Main Category
BrandSO 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.

Leave a comment

Your email address will not be published. Required fields are marked *