View source | Discuss this page | Page history | Printable version    | Latest revision

Massinvoicing/Functional Specifications

(Invoice Templates)
(Step 2: Set price/quantity per business partner/invoice line)
 
(16 intermediate revisions not shown)
Line 4: Line 4:
== General Description ==
== General Description ==
-
The mass invoicing function allows a user to create multiple 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.
+
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.
This module will use the prefix: MINV.
 +
 +
The menu options for the mass invoicing functions can be found in the following locations
 +
* Sales Management > Transactions menu: contains Mass Invoicing
 +
* Sales Management > Setup: contains the Invoice Template maintenance function
== Relation to other modules ==
== Relation to other modules ==
Line 46: Line 50:
The price and quantity fields are only enabled if their corresponding line-checkbox is checked.
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.
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.
Line 61: Line 67:
* an invoice template should be selected (client-side)
* an invoice template should be selected (client-side)
* at least one line should be selected (client-side)
* at least one line should be selected (client-side)
-
* the quantity and price of the selected lines should be set and have the correct format (client-side)
+
* the quantity of the selected lines should be set and have the correct format (client-side)
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).
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).
Line 71: Line 77:
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.  
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.  
-
Step 2 allows the user to change price/quantity on a business partner-invoice line level.
+
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.
Line 83: Line 91:
If the generation fails then the step 2 window is re-shown with a detailed error message in a red message box.
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 ===
+
=== 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:
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:
Line 92: Line 100:
The invoice identifier is a link to the invoice itself.  
The invoice identifier is a link to the invoice itself.  
-
In addition the sum of the total amount and grand total are displayed.
 
-
=== Open Topics ===
+
[[Image:minv_page3.png|center|750px]]
-
* Should the user be asked for confirmation (through a popup) that he/she really wants to generate invoices?
 
-
* Should more or other information be shown on the result page
 
 +
In addition the sum of the total amount and grand total are displayed.
== Invoice Templates ==
== Invoice Templates ==
Line 121: Line 127:
If the non-mandatory information is not set then it is computed when the invoice generation takes place.
If the non-mandatory information is not set then it is computed when the invoice generation takes place.
 +
== Generating Invoices ==
== Generating Invoices ==
Line 130: Line 137:
* For each checked line an invoice line is created which is linked to its invoice header.
* For each checked line an invoice line is created which is linked to its invoice header.
* The created invoice is posted.
* The created invoice is posted.
-
* The resulting id, identifier and documentno are displayed on the result page.
+
* The resulting identifier and totals are displayed on the result page.
Line 185: Line 192:
|-
|-
|c_doctype_id
|c_doctype_id
-
|ARI (value to be confirmed by Gorka Ion)
+
|initially set to 0
|-
|-
|c_doctypetarget_id
|c_doctypetarget_id
-
|same as c_doctype_id
+
|set to the c_doctype_id from the template
|-
|-
Line 198: Line 205:
|description
|description
|set from the invoice template
|set from the invoice template
-
 
-
|-
 
-
|isprinted
 
-
|N
 
|-
|-
|salesrep_id
|salesrep_id
-
|null
+
|copied from the business partner
|-
|-
Line 233: Line 236:
|-
|-
|isdiscountprinted
|isdiscountprinted
-
|N
+
|taken from the business partner
|-
|-
Line 241: Line 244:
|-
|-
|c_currency_id
|c_currency_id
-
|taken from the price list of the invoice template
+
|taken from the invoice template price list, or from the price list of the invoice
|-
|-
|paymentrule
|paymentrule
-
|taken from the invoice template
+
|taken from the invoice template, or from the business partner
|-
|-
|c_paymentterm_id
|c_paymentterm_id
-
|taken from the invoice template
+
|taken from the invoice template, or from the business partner
|-
|-
Line 265: Line 268:
|-
|-
|m_pricelist-id
|m_pricelist-id
-
|taken from the invoice template
+
|taken from the invoice template, or from the business partner (the po price list)
|-
|-
Line 285: Line 288:
|-
|-
|ad_orgtrx_id
|ad_orgtrx_id
-
|same as the ad_org_id
+
|null
|-
|-
Line 354: Line 357:
|-
|-
|pricelist
|pricelist
-
|from the invoice template header
+
|computed using the PriceListVersion and ProductPrice
|-
|-
Line 362: Line 365:
|-
|-
|pricelimit
|pricelimit
-
|null
+
|computed using the PriceListVersion and ProductPrice
|-
|-
Line 382: Line 385:
|-
|-
|c_tax_id
|c_tax_id
-
|from the invoice template line
+
|from the invoice template line, or computed
|-
|-
Line 429: Line 432:
A created invoice is stored in the database and directly posted using the C_INVOICE_POST stored procedure.
A created invoice is stored in the database and directly posted using the C_INVOICE_POST stored procedure.
-
 
-
The server-side logic to create invoices will be using the DAL.
 
== Other considerations ==
== Other considerations ==
Line 449: Line 450:
** name: the name of the invoice template, is displayed to the user generating the invoices
** name: the name of the invoice template, is displayed to the user generating the invoices
** description: is used to create the invoice description (c_invoice.description)
** description: is used to create the invoice description (c_invoice.description)
-
** m_pricelist_id (required): foreign key to the m_pricelist table
+
** c_doctype_id (required): a required reference to he c_doctype table, only document types accessible from the organization of the template can be selected.
-
** paymentrule (required): a free format string field
+
** m_pricelist_id (not-required): foreign key to the m_pricelist table
-
** c_paymentterm_id (required): foreign key to the c_paymentterm table
+
** paymentrule (not-required): a free format string field
 +
** c_paymentterm_id (not-required): foreign key to the c_paymentterm table
* minv_invoice_template_line: with the following fields:
* minv_invoice_template_line: with the following fields:
Line 461: Line 463:
** qty (required): initial quantity (can be changed in the wizard)
** qty (required): initial quantity (can be changed in the wizard)
** price (required): initial price in the uom of the product (can be changed in the wizard)
** price (required): initial price in the uom of the product (can be changed in the wizard)
-
 
+
** c_tax_id (not required): foreign key to the c_tax table
=== Window/Tabs for maintaining Invoice Templates ===
=== Window/Tabs for maintaining Invoice Templates ===
Line 477: Line 479:
[[Image:it_line_edit.png|center|750px]]
[[Image:it_line_edit.png|center|750px]]
 +
 +
=== 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:
 +
* first create the invoice(line) object
 +
* then have a separate object/service set or compute the non-set properties of the invoice(line) object
 +
 +
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.

Latest revision as of 12:35, 1 September 2009

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


Contents

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.