Difference between revisions of "Adempiere--Print Format"

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.
m (wikify)
 
(8 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{H:h|editor toc}}
 
 
 
==1. Requirements==
 
==1. Requirements==
  
 
The print format of the invoice in adempiere is like this:
 
The print format of the invoice in adempiere is like this:
  
image:Invoice-Vendor.jpg
+
[[Image:Invoice_Vendor.jpg]]
  
Now, I want to change the referring invoice like this:
+
Now, I want to change the referring invoice include:
  
|=Machine Name|=UOM|=Tax Base Amount|=Tax Rate|=Tax Amount|=Total
+
* Name
| | | | | | |
+
* UOM
| | | | | | |
+
* Tax Base Amount
 +
* Tax Rate
 +
* Tax Amount
 +
* Total
  
For example:
+
The purpose is: show total equals price plus tax when the price includes tax in transactions.
 
+
|=Machine Name|=UOM|=Tax Base Amount|=Tax Rate|=Tax Amount|=Total
+
|Machine 1|Unit|100|0.16|16|116|
+
|Machine 2|Unit|360|0.16|57.6|417.6
+
 
+
Because the price for transaction includes tax, total equals price plus tax.
+
  
 
==2. About my train of think==
 
==2. About my train of think==
  
In Adempiere, there is "Price Includes Tax" field in **//"Invoice(Vendor)" window->"Invoice" tab//**. If the field is marked, it can control the price includes tax. For example: If you mark the field, switch to "Invoice Line" tab, insert some mandatory:
+
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
 
* Price=116
Line 37: Line 32:
  
 
|=Field|=Table|=Column
 
|=Field|=Table|=Column
 +
 
|Machine Name|C_InvoiceLine|C_Product_ID
 
|Machine Name|C_InvoiceLine|C_Product_ID
 +
 
|UOM|C_InvoiceLine|UOMSymbol
 
|UOM|C_InvoiceLine|UOMSymbol
 +
 
|Tax Base Amount|C_InvoiceTax|TaxBaseAmt
 
|Tax Base Amount|C_InvoiceTax|TaxBaseAmt
 +
 
|Tax Rate|C_Tax_ID|Rate
 
|Tax Rate|C_Tax_ID|Rate
 +
 
|Tax Amount|C_InvoiceTax|TaxAmt
 
|Tax Amount|C_InvoiceTax|TaxAmt
 +
 
|Total|C_InvoiceLine|LineNetAmt
 
|Total|C_InvoiceLine|LineNetAmt
  
Line 82: Line 83:
  
 
[[image:result-with-tax.jpg]]
 
[[image:result-with-tax.jpg]]
 +
 +
[[Category:Localisation]]

Latest revision as of 08:39, 6 November 2009

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