View source | View content page | Page history | Printable version   


This document contains the functional specification of the mass invoicing module.


General Description

The mass invoicing function allows a user to create multiple sales invoices in one step for multiple business partners. The generated invoices are based on an invoice template. The invoice template defines default and pre-set information which is to be used in the generation of the invoices.

This module will use the prefix: MINV.

The menu options for the mass invoicing functions can be found in the following locations

Relation to other modules

This module is related to (but not dependent on) the inter-company invoicing module. The invoices generated by mass invoicing can be used as input for the inter company invoicing process.

This module makes use of and is dependent on the multi-business-partner selector module. The business partner delivered by that module is used in the generation wizard.

MassInvoicing Wizard

To generate invoices the user will go through a multi-step wizard:

  1. select business partners, organization, invoice template and select which products will be in each invoice and their default price and quantity
  2. set a price quantity per business partner-invoice line combination and generate the invoices
  3. show the result of the generation step (invoices created)

Step 1: Select Organization, business partner and products

This step allows the user to:

A first version of the user interface is shown below.

Mass w1.png

The invoice template listbox will only show invoice templates which are active and which have at least one active line.

The product list in the bottom is refreshed when the user selects another invoice template.

When the user selects an invoice template then all product lines are initially selected.

The product list will only show active lines. The user can (de-)select all invoice template lines by checking the 'global' checkbox in the product list.

The price and quantity fields are only enabled if their corresponding line-checkbox is checked.

The price field is not mandatory, if it not set then the system will automatically use the price from the price list. This price is shown in step 2 of the wizard.

The business partner selector is implemented by the business partner selector module. It allows filtering business partners and to select one or more business partners.

Bp selector.png

The following validations should be done in step 1 of the wizard:

The validations marked with client-side are performed on the client-side (in the browser). The remaining validations are done when the user presses next. If a validation fails the same window is displayed with all the information as entered and a message box explaining the validation failure. The validation message should show enough detail (list specific business partners for which the above check fails).

When the user is satisfied the user can select the next button to go to step 2. The information entered in step 1 is stored and the user can return back from step 2 to change the information.

Step 2: Set price/quantity per business partner/invoice line

The second step uses the information from the first step to show a product list by business partner. All the lines of the selected invoice template are shown. Only the ones which have been selected in the first step are also selected in step 2 of the wizard. Also the price and quantity from step 1 are used, for the non-selected lines the price and quantity from the invoice template line is used.

When for a line in the first step no price was set, then the price is read from the price list and shown in this step 2. The price list is either taken from the invoice template or if not set there from the business partner.

Step 2 allows the user to change price/quantity on a business partner-invoice line level. If the price field is cleared/not set then the price from the price list is used in the invoice generation.

Mass w2.png

When the user presses generate the system validates the inputs and asks for confirmation. If the user confirms then system generates invoices (see later section for a description of the generate process).

The validation, validates that each selected line has a valid quantity and price.

If the generation fails then the step 2 window is re-shown with a detailed error message in a red message box.

Step 3: The result

In step 3 the result for of the generation step is shown. The proposal is to show the following information: a table with a list of invoices with for each invoice:

The invoice identifier is a link to the invoice itself.

Minv page3.png

In addition the sum of the total amount and grand total are displayed.

Invoice Templates

In the first step of the invoice generation wizard the user can select the invoice template. The invoice template defines which products are used as the basis for the generated invoice.

In addition it allows the definition of the following information which is used in each generated invoice:

On invoice header level:

On invoice line level:

If the non-mandatory information is not set then it is computed when the invoice generation takes place.

Generating Invoices

This section of the functional spec describes in some detail how the invoices are created and which information is used to set which invoice header and line column.

When the user presses the generate button the following actions are performed:

The information on the invoice header (c_invoice) is set as follows:

Column Value
ad_client_id the current user client
ad_org_id the organization selected in step 1
isactive Y
created, createdby, updated, updatedby current user, current date
issotrx Y
documentno will be computed
docstatus DR
docaction CO
processing N
processed N
posted N
c_doctype_id initially set to 0
c_doctypetarget_id set to the c_doctype_id from the template
c_order_id null
description set from the invoice template
salesrep_id copied from the business partner
dateinvoiced set to invoice date set in step 1 of the wizard
dateprinted null
dateacct set to invoice date set in step 1 of the wizard
c_bpartner_id the business partner for which the invoice is generated
c_businesspartner_location the first business partner location in c_bpartner_location which has billto='Y'
poreference null
isdiscountprinted taken from the business partner
dateordered null
c_currency_id taken from the invoice template price list, or from the price list of the invoice
paymentrule taken from the invoice template, or from the business partner
c_paymentterm_id taken from the invoice template, or from the business partner
c_charge_id null
chargeamt null
totallines, grandtotal computed by triggers
m_pricelist-id taken from the invoice template, or from the business partner (the po price list)
tax_included N
c_campaign_id, c_project_id, c_activity_id all null
createfrom, generateto, copyfrom null
isselfservice null
ad_orgtrx_id null
user1_id, user2_id null
witholdingamount null
taxdate invoice date entered in step 1
c_withholding_id null

The invoice line (c_invoice_line) is set as follows:

Column Value
ad_client_id the current user client
ad_org_id the organization selected in step 1
isactive Y
created, createdby, updated, updatedby current user, current date
c_invoice_id the id of the invoice header
c_orderline_id, c_inoutline_id null
line from the invoice template line
description from the invoice template line
m_product_id from the invoice template line
qtyinvoiced entered quantity on page 2 of the wizard
pricelist computed using the PriceListVersion and ProductPrice
priceactual price entered on page 2 of the wizard
pricelimit computed using the PriceListVersion and ProductPrice
linenetamt pricestd * quantity entered by the user in step 2
c_charge_id null
chargeamt null
c_uom_id taken from the product: c_product.c_uom_id
c_tax_id from the invoice template line, or computed
s_resourceassignment_id null
taxamt null
m_attributesetinstance_id null
isdescription N
quantityorder null
m_product_uom_id same as c_uom_id
c_invoice_discount_id, c_projectline_id, c_offer_id null
pricestd computed from pricelist using the SLOrderProductData.getOffersStdPriceInvoice method
excludeforwithholding null

The following related tables are handled by triggers:

A created invoice is stored in the database and directly posted using the C_INVOICE_POST stored procedure.

Other considerations

Maintaining Invoice Templates: table definitions and windows/tabs

Table: Invoice Template and Invoice Template Line

To maintain and store invoice templates two new tables are created:

Window/Tabs for maintaining Invoice Templates

The following screenshots show examples of the maintenance windows for the invoice templates.

It header list.png

It header edit.png

It line list.png

It line edit.png

Server-Side Implementation

The server-side logic to create invoices will be using the DAL.

The idea is to implement the creation of invoices in two steps:

This pattern can be the basis for future more generic solutions as it is a common requirement that it should be easy to create business objects and set computable information automatically.

The posting of the invoice is done through a stored procedure. The implementation of this module will try to create a generic api for passing parameters to stored procedures and running stored procedures from java.

Retrieved from ""

This page has been accessed 2,955 times. This page was last modified on 8 June 2012, at 05:32. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.