Massinvoicing/Functional Specifications
(→Step 3: the result) |
(→Invoice Templates) |
||
| Line 104: | Line 104: | ||
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 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 | + | In addition it allows the definition of the following information which is used in each generated invoice: |
| + | |||
On invoice header level: | On invoice header level: | ||
* description | * description | ||
| Line 118: | Line 119: | ||
* price (can be overridden in the wizard) | * price (can be overridden in the wizard) | ||
* tax | * tax | ||
| - | |||
== Generating Invoices == | == Generating Invoices == | ||
Revision as of 21:22, 16 July 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 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.
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:
- select business partners, organization, invoice template and select which products will be in each invoice and their default price and quantity
- set a price quantity per business partner-invoice line combination and generate the invoices
- show the result of the generation step (invoices created)
Step 1: Select Organization, business partner and products
This step allows the user to:
- select an organization
- select one or more business partners
- set the invoice date
- select which invoice template to use
- set for the chosen invoice template which lines should be used and the price/quantity per line
A first version of the user interface is shown below.
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 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 following validations should be done in step 1 of the wizard:
- at least one business partner should be selected (client-side)
- the business partners should belong to the accessible organizations for the selected organization in the window.
- the business partners should have access to the price-list defined in the selected invoice template.
- the business partners should all have an invoicing address (at least active c_bpartner_location with billto=='Y').
- invoice date should be set and have the right format (client-side)
- an invoice template 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 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.
Step 2 allows the user to change price/quantity on a business partner-invoice line level.
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
- total amount
- grand total (incl. taxes)
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
- 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
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:
- description
- pricelist
- payment rule
- payment term
On invoice line level:
- line
- description
- product
- quantity (can be overridden in the wizard)
- price (can be overridden in the wizard)
- tax
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:
- For each business partner which has at least one selected product an invoice header is created.
- For each checked line an invoice line is created which is linked to its invoice header.
- The created invoice is posted.
- The resulting id, identifier and documentno are displayed on the result page.
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 | ARI (value to be confirmed by Gorka Ion) |
| c_doctypetarget_id | same as c_doctype_id |
| c_order_id | null |
| description | set from the invoice template |
| isprinted | N |
| salesrep_id | null |
| 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 | N |
| dateordered | null |
| c_currency_id | taken from the price list of the invoice template |
| paymentrule | taken from the invoice template |
| c_paymentterm_id | taken from the invoice template |
| c_charge_id | null |
| chargeamt | null |
| totallines, grandtotal | computed by triggers |
| m_pricelist-id | taken from the invoice template |
| tax_included | N |
| c_campaign_id, c_project_id, c_activity_id | all null |
| createfrom, generateto, copyfrom | null |
| isselfservice | null |
| ad_orgtrx_id | same as the ad_org_id |
| 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 | from the invoice template header |
| priceactual | price entered on page 2 of the wizard |
| pricelimit | null |
| 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 |
| 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:
- c_invoice_discount
- c_invoiceline_offer
- c_invoicetax
- c_invoice_acctdimenstion
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
- The invoice template name is not translated.
- Labels and messages should be translatable.
- The date and numeric formats used by the rest of the application should also be used here.
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:
- minv_invoice_template: with the following fields:
- standard columns: minv_invoice_template_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby
- 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)
- m_pricelist_id (required): foreign key to the m_pricelist table
- paymentrule (required): a free format string field
- c_paymentterm_id (required): foreign key to the c_paymentterm table
- minv_invoice_template_line: with the following fields:
- standard columns: minv_invoice_template_line_id, ad_client_id, ad_org_id, isactive, created, createdby, updated, updatedby
- minv_invoice_template_id: the reference to the invoice template header
- line (required): a line number to identify the order of the lines, will be used to create the line number on the invoice line
- description (required): the description, is used to set the description on the invoice line
- m_product_id (required): foreign key reference to the m_product table
- 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)
Window/Tabs for maintaining Invoice Templates
The following screenshots show examples of the maintenance windows for the invoice templates.