Adempiere--Print Format

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.

1. Requirements

The print format of the invoice in adempiere is like this:

Invoice Vendor.jpg

Now, I want to change the referring invoice include:

  • Name
  • UOM
  • Tax Base Amount
  • Tax Rate
  • Tax Amount
  • Total

The purpose is: show total equals price plus tax when the price includes tax in transactions.

2. About my train of think

In Adempiere, there is "Price Includes Tax" field in "Price List" window. If the field is marked, it can control the price includes tax. For example: If you mark the field, switch to "Invoice(Customer)"->"Invoice Line" tab, insert some mandatory:

  • Price=116
  • Tax=VAT 16%
  • Line Net Amount=116

Then switch to "Invoice Tax" tab, it can be created automatically.

  • Tax Amount=100 (Tax Amount=116/(1+0.16)=100)
  • Tax Base Amount=16(Tax Base Amount=100*0.16=16)

3. The field match along with column in database

|=Field|=Table|=Column

|Machine Name|C_InvoiceLine|C_Product_ID

|UOM|C_InvoiceLine|UOMSymbol

|Tax Base Amount|C_InvoiceTax|TaxBaseAmt

|Tax Rate|C_Tax_ID|Rate

|Tax Amount|C_InvoiceTax|TaxAmt

|Total|C_InvoiceLine|LineNetAmt

4. Process

If we create new columns, we should modify the view referred in database. Here, the view named "c_invoice_linetax_v". So, we should modify it.

1.According to requirement, add the new columns into the right place, and modify the logic.

Note: There will be showed many problems, and view the tips from database, modify and test it again and again. Such as:

1) number should be matched. 2) datatype should be matched. 3) check the result you select is right or not. 4) etc...

Method: We should divide the whole view into some parts, and debug each part, then debug the whole view.

2.After test it successful, drop the view and create new one named as original name.

3.Log in system with administrator role, open "Table and Column" window, find the record named "c_invoice_linetax_v", then go to "Column" field to add the new fields we defined.

4.Log out and re-login system with clientadmin role, open "Print Format" window, find the record you want to modify the print format. Here, the print format named "Invoice_LineTax ** 1000000 ** &Copy Record 28223709". Then switch to "Format Item" tab, add new columns same as you created with administrator role.

5.Switch to "Display Order" tab, order the display field.

6.Open the invoice, and check the print format.

5. Result

The view modified by me is here: c_invoice_linetax_v

Now, the invoice of print formatis done. The results are:

1) pl.istaxincluded = 'N'

Result-without-tax.jpg

2) pl.istaxincluded = 'Y'

Result-with-tax.jpg