Posts

A Step by Step Guide to Libero Manufacturing

Overview

This page is based on the attempt to make sense of ADempiere Libero Manufacturing module of the author. It will be illustrated as a step by step guide for the reader to have the FEEL of what Libero Manufacturing can do and how to do it. All the cases here, I am referring to the Libero Manufacturing Work Shop conducted by Victor Perez some time back in 2009.

As such, this is by no mean the as the reference manual of Manufacturing Management in ADempiere and you can always find more reference from the original source in LIBERO

Note: All cases are based on initial data in Adempiere360LTS database.

Briefing about Manufacturing Process

Libero Manufacturing Process is the mean of producing new Product based on specified Bill of Material (BOM & Formula), Manufacturing Resources, Workflows (how to produce) and Distribution (where to deliver).

1) First, we have to tell the system on how to produce products.
  • On how the product will be produced, Bill of Material tell us what material to use, Workflow Process tell us how to do with what Resources.
  • Product Planning Data is where the relationship between Product and all (BOM, Process, Resources) is defined together with Setup Data, i.e., Order Policy, Order Period, Minimum Order Quantity, etc.
2) After the relationship of How to produce a product is defined we can start producing things.
  • Without planning (pre-order), we can directly use Manufacturing Order to produce things (of course with the above information). We then use the Component Check Process to verify and use Print and Release Order process to print out checklist for user on the field. Once completed, store can use Order Receipt & Issue to accept the newly created products into warehouse (and of course, reduce the inventory of raw material).
  • With demand forecast or pre-order, we can then use MRP to help us determine what when where and how (much) to produce.

Business Case: Chemical Industry (Process Production)

The Management of Garden World evaluated the possibility of getting a profitable increase by manufacturing the fertilizer and took a decision to open a new manufacturing plant to produce the fertilizer which previously Garden World only purchased and sold.

So the engineering department designs two bills of materials to produce the Fertilizer in 50 and 70 kg packages and also a formula used for gross production of the fertilizer. The Lawn Fertilizer uses following raw materials:

  • Phosphorus 17%
  • Nitrogen 17%
  • Potassium 17%
  • Water 49%
OK, Let’s start with Libero Manufacturing!

Step 1: Define BOM

Bill of Materials & Formula

  • Prepare BOM for Fertilizer_Lawn Fertilizer, which has the formula in % as above
  • Prepare BOM for Fertilizer#50 and Fertilizer#70, of which components are Fertilizer and Bag
  • See the summary of prepared BOM in BOM & Formula Info

manu_1

Step 2: Define Manufacturing Workflow and Resources used in Production Process

Manufacturing Resource

  • Define Plant (with Manufacturing Resource Type = Plant) that govern the entire production process.
    • Fertilizer Plant with Planning Horizon = 120
  • Defines Resources’ (with Manufacturing Resource Type = Work Center) that will be used in Production Process (Manufacturing Workflow).
    • Mixed Area
    • Inspection Area
    • Packing Production Line

manu_2

Manufacturing Workflow

  • Define Manufacturing Workflow process to produce the fertilizer products
    1. Lawn Fertilizer
    2. Lawn Fertilizer Packing

manu_3 manu_4

  • Define Workflow Activities and Resources

manu_5 manu_6

Step 3: Generate Demand for Manufacturing

Theoretically there are 2 kinds of demand, Independent and Dependent Demand.

The MRP system takes in a number of parameters as inputs and performs some level of analysis and generates recommendations that can either be accepted or rejected by the planner. One of the inputs of MRP is the BOM, which is a list of all components (and in what quantity) needed to produce finished good(s). For example, the bill of material needed to produce a dinning set is 6 chairs and 1 table (supposedly). The demand for the dinning set here is independent while that for the chairs and table are dependent.

An independent demand is a demand that is not based on the demand for another item while a dependent demand is based on the demand for another item. Hence, it can be concluded that the demand for the 6 chairs and the table is based on the demand for dinning set. Thus, you can forecast an independent demand while dependent demands are calculated based on the independent demand item. The role of the MRP therefore is to perform this calculation.

And so, now, we will be creating 2 Independent Demands.

Sales Order

  • Create and complete 2 Sales Orders
    • Sales Order #1> Org: Fertilizer | DocType: Standard Order | Date Promised: <same date next month> | BPartner: Seed Farm | Delivery Rule: Available
      • Sales Order Line> Product: Fertilizer#70 | Quantity: 70 | Price: 33 | Tax: Standard
    • Sales Order #2> Org: Fertilizer | DocType: Standard Order | Date Promised: <same date next month> | BPartner: Seed Farm | Delivery Rule: Available
      • Sales Order Line> Product: Fertilizer#50 | Quantity: 60 | Price: 20 | Tax: Standard

Forecast

ADempiere do not provide sophisticated Forecasting module but rather providing Forecasting Data Input window. The calculation need to be done elsewhere using 3rd party software. I.e., Lokad business forecasting

  • Define Forecast Data for manufacturing of fertilizer
Sales Representative Warehouse Product Quantity Date Promised
SuperUser Fertilizer Fertilizer#70 10 12/03/10
GardenAdmin Fertilizer Fertilizer#50 22 12/03/10
SuperUser Fertilizer Fertilizer#70 11 12/10/10
GardenAdmin Fertilizer Fertilizer#50 21 12/10/10
SuperUser Fertilizer Fertilizer#70 11 12/17/09
GardenAdmin Fertilizer Fertilizer#50 21 12/17/10
SuperUser Fertilizer Fertilizer#70 11 12/24/10
GardenAdmin Fertilizer Fertilizer#50 20 12/24/10
SuperUser Fertilizer Fertilizer#70 10 12/31/10
GardenAdmin Fertilizer Fertilizer#50 20 12/31/10
  • View the total amount of Forecast by Forecast Report

manu_7

MRP Info

  • View Material Resource Planning by MRP Info
  • Note that we are focusing on Fertilizer only. The view will display both demand from Sales Orders (1) and from Forecast (2).
  • In this view you can look at both demands as gross requirement and an On-Hand project quantity that indicates the availability of material in the future. If this is negative then the system shall generate a production plan for us to know what materials to produce in our plant.

manu_8

Product Data Planning

  • And before we run the Calculate Material Plan, we will check out the Product Planning Data.
  • Product Planning Data is the master data that manages the relationships between Products and BOMs with their Manufacturing Resources, Manufacturing Processes (Workflow) and Distribution. It also stores the initial data about manufacturing process of each product, such as, Order Policy, Order Period, Batch Quantity, etc.

manu_9

Now that we have the independent Demand and Planning data, we shall calculate the Material Plan to issue the manufacturing orders.

Image:Note.gif Note:Use Create Product Planning process to create this data. Running this process helps to create or update data in batch or bulk.Following are the meaning of other parameters,

  • Is MPS: ???
  • Create Plan: If checked, indicates that MRP must create Planned orders for this Product-organization-warehouse. If not checked, then you need to use the Replenishment tab in the product window and control the inventory level using the Replenish Report.
  • Required Calculate MRP: This means it has been a change in some element which affect the MRP Calculation for this product, i.e BOM, Orders, Inventory, MPS, etc. and therefore you need to recalculate the MRP to adjust the Planned Orders to the new conditions and to get the updated action messages.
  • Time Fence: The number of days since you execute the MRP process inside of which the system must not change the planned orders.
  • Order Policy: ???
  • Order Period: ???
  • Batch Quantity: ???
  • Yield %: ???

Step 4: Calculate MRP

Calculate Material Plan

  • Supply parameters and run the process

manu_10 manu_11

Image:Note.gif Note:

  • What Calculate Material Plan process is doing can be found here at Calculate MRP logics
  • Following are the meaning of other parameters
    • Required calculated DRP ???

When this process ends it shows that Manufacturing Orders or Material Requisitions and Notice Messages that were generated. Repeating MRP Info we can see how MRP create the Planned Orders and material requisitions.

manu_12

  • MRP will summarize the demand from both Sales Order and Forecast and use the behavior of the Product (i.e., Is Sales or Is Purchase, etc.), Product Data Plan (i.e., Min Order Qty, Promised Delivery Time, Order Pack Qty, etc.), Bill of Material and Workflow Process, to determine the next action.
    • To produce packaged Fertilizer#70 & Fertilizer#50 the Fertilizer itself must be enough first, MRP generate Manufacturing Orders (1) for Fertilizer first.
      • And as the Minimum Order Qty of Fertilizer is 1000 and the Order Pack Qty is 200, MRP generate 2 Manufacturing Orders, 7,200 and 7,000 respectively.
    • For Fertilizer#70 (sales only)
      • Since this product must be manufactured, MRP generate Manufacturing Orders (1) for it.
      • And because the Minimum Order Qty is 100, MRP make it 100 for each order.
    • For Fertilizer#50 (purchase and sales)
      • Since this product is trading item, it won’t be produced in-house but rather purchase from vendor, MRP generate Material Requisition (2) for them.
    • Please make note also on the Date Start Scheduled of Orders, MRP will be based on Just-in-Time concept, making sure that required material / product is available just before it is needed.
  • Review our Master Production Schedule from Manufacturing Order Review
  • Review message generated by MRP from MRP Notice (all)

Step 5: Review and Confirm for Production

A planned manufacturing order is a manufacturing order suggested by the MRP process and contains its quantity and its release and promise dates. When you approve a planned manufacturing order, you convert it in a manufacturing order with the status of In Process.

When you approve a planned order you are telling the system that the manufacturing order is ready to start its process with the approval you change the order status from Draft to In Process.

We can run Calculate MRP as many times as we want until satisfied with the plan.

Image:Note.gif Note:

Document Status to Manufacturing Order (MO)
  • Draft: The MO with this status are Planning Order and are delete and generate again to Calculate material Plan. so this MO only are “Recommended Production Schedule”
  • In Process: The MO with this status are Firm Planned, so when I Calculate material plan, it MO do not delete because this order was approved, this case MRP only generate Notice Action.
  • Complete The MO with this status are ready to entry in shop.
    • Use Component Check here I can validate if MO have all components to release.
    • Use Printing and Release Order to Print the MO, if MO have all component then your status is change from in process to complete.
  • MO have complete doc status we can report receipt the finish good and issue component use Order Receipt and Issue
  • Close: The MO with this status do not allow receipt and issue component, but are ready to generate the variance cost to accounting

Component Check

  • Component Check is the report that tell us whether Manufacturing order can be completed (release to production shop). This report shows the material requirement vs availability in inventory. It is up to us to decide.

manu_13

Print & Release Order

  • With this option, we can get the Pick List , Pack & Tools List and workflow manufacturing as a preliminary, and if the information is right we can mark the complete check box to try to release order (Complete MO)

manu_14

Manufacturing Order

  • The Manufacturing Order is a document or schedule identity conveying authority for the manufacture of specified products in specified quantities.
  • User change the status of document to Complete to state that the Production Process (Workflow) can be stared on shop floor.
  • Note that, although the required material for production are not yet available, we can also still release the order. The real Finished Goods will be produced to stock on the next step.

manu_15

Order Receipt & Issue

  • Use this window to receive the finished goods to stock and/or components delivery to next production shop.
  • This is where, in ADempiere, the newly finished goods shall increase, and the raw materials used in production shall decreased the inventories. And as such, it will not process if the raw components are insufficient for production.
  • The Manufacturing Order will be set to Closed.

manu_16

Image:Note.gif Note:Here we can use multiple options to report the production:

  • Delivery Rule:
    • Back Flush: Allow receipt and component delivery based on the quantity to deliver
    • Only Issue: Allow delivery of components only to the production shop
    • Only receipt: Allow only receipt of finished goods.

In this case we will use Back flush for Manufacturing Order that has been released with following information:

  • Qty to Deliver: Which quantity you need to report
  • Qty Scrap: Which quantity you need to report
  • Movement Date: Which Date to Report
  • Locator: The Locator where we receive the materials.

Activity control

  • We can report the actual events that happen in the production shop.
  • Choose Manufacturing Order that you want to report choose the Manufacturing Order Activity that you need to report typed in the actual setup ,duration time and movement quantity.
  • The Activity Control report allows to register actual events that happened in the production shop and get the actual cost.

Misc (Temp)

  • The Resource Type is used to calculate the available time in a Manufacturing Resource. It allows input of starting time and end time for the slot according to the working days.
  • The Planning Horizon in Manufacturing resources is used for ???
  • If the workflow name is the same as the product name this Workflow will be the default Workflow for the product.
  • The time constraint (i.e., Queuing Time, Waiting Time) in Manufacturing WF and Manufacturing Resource is different in that = ????
  • Calculate Low Level = ???

Creating New Data Import Window

Overview

In ADempeire, the recommended way to import data is through Data Import Process. The data import process has two main steps. Data is read into the system and placed in a temporary table. From there it is processed and entered into the main database. The two step process helps prevent errors in the data from affecting the main database. The first step of importing the data requires a: definition of the data file that will be imported and information about where to put it in the temporary tables. This is performed by an Import File Loader and an Import Loader Format.

You can read about how the Data Import works from Data Import.

The only problem is that, the Data Import windows comes with standard version of ADempiere do not cover all kinds of data. What if we want to import other kind of data? Or may be to modify the existing one?

This page will give you steps by steps guide on how to create a new Data Import Window of your own.

Example Scenario

To be an easy example, let’s say we have a data list of Product’s Attribute Values to import into the system. Note also that each Attribute Values will be linked to the existing Attribute Name already exist in the system.

As ADempiere do not provide Import Attribute Value data import window out of the box, we will want to creating a new Import Attribute Value window to do the task.

For demonstration purposes, we will be creating an Import Attribute Value window that pretty much matching with the Attribute Value tab we want to import data into.

import_1

Note: In real life case, we might design a complex import window that validate data and import into different tables in one go.

Creating New Data Import Window

Create User Interface

You can look at how to create new window at NewWindow. In our case we are going to do the same thing, except we will use it to create Importing Window.

1) Create new Table
  • Login as System, go to window “Table and Column”
  • Create new DB Table = “I_AttributeValue”
import_2
  • Click on Copy Column from Table and select “M_AttributeValue”
  • New columns will be created as of M_AttributeValue, except that it will has Key Column I_AttributeValue_ID in stead of M_AttributeValue_ID
2) Create required columns for Data Import table
  • 5 Mandatory columns: I_ErrorMsg, I_IsImported,Processing, Processed, ID column of target table – in this case, M_AttributeValue_ID — (1)
    • Set all columns in this table not mandatory, except 2 columns –> Table’s ID column and I_IsImported
  • Optional lookup columns: AttributeName — (2)
Image:Note.gif Note:

  1. Additional ID field (i.e., M_AttributeValue_ID) is used to save back the ID of record inserted in target table, use for reference.
  2. The preferred function of using this Import Window is that, user will only supply the Name/Vlaue field, and let the system validate for matching ID field.
import_3
3) Create Import Table in Database
  • On any record in Column Tab, Click on Synchronize Column button.
  • On the first time, as table is not yet crated, it will create new table and all the columns.
  • Note that if the table created, this button will only alter the current column.
  • Drop of IsImported column in the database table, since it only allow ‘Y’ and ‘N’. (later, we will use ‘E’ as well)
ALTER TABLE adempiere.i_attributevalue
  DROP CONSTRAINT i_attributevalue_i_isimported_check;
4) Create Interface and Model Classes for new table
  • In your Eclipse project, run GenerateModel class to create Interface and Model for this table. These models will be useful when we refer to data in this table in Business Logic.
  • In our case, we are creating I_I_AttributeValue.java and X_I_AttributeValue.java. Note that our Entity Type is ‘RJC’, so the arguments are,
C:\<target folder>\
org.compiere.model
'RJC'
'I_AttributeValue'
  • Deploy this 2 files to org.compiere.model package.
5) Create new Window
  • Login as System, go to window “Window, Tab & Field”
  • Create new Window = “Import Attribute Value”
import_4
  • Create new Tab = “Attribute Value”. Note that, for ease of use, Data Import window will always have only 1 tab.
  • Refer this tab to table “I_AttributeValue”, created previously.
import_5
  • At the bottom of this tab, click on “Create Fields” button to create fields from columns in table I_AttributeValue
  • In Field Sequence tab, arrange the field order for layout. The recommended layout is,
    • Top part: Is Imported checkbox, reference ID from target table, Error Messages
    • Bottom part: Process Button, Is Processed CheckBox
    • Lookup Name fields same line as its ID fields. For example, in this case, Attribute Name (AttributeName) is next to Attribute (M_Attribute_ID).
import_6
6) Register new window to Menu
  • Login as System, got to window “Menu”
  • Create new Menu Item = “Import Attribute Value”
import_7

Now if you login again as admin user, you should be able to see the new window. You can test creating new records and save it.

Next step, we will look at how to create ImportAttributeValue Process, so that clicking at Process Now button will validate and import data into target table.

Create Business Logic

All Process Class for Data Import windows are in package org.compiere.process, all classes start with Import<XXX>. Now we want to create our own ImportAttributeValue.java Process.

1) Create JAVA process

You can see example from package org.compiere.process, or use the example provided here File:ImportAttributeValue.java. Although some Import Process as you can find from the package are relatively complex, they share the same pattern with our simple example. Here is what it does,

  1. protected void prepare()
    • Get the input parameter, in most cases are Client and/or Organization, Delete Old Imported?, Is Validate Only?
  2. protected String doIt()
    • If user select Delete Old Imported, then delete old imported records from previous time.
    • Reset importing records ready to start validation (set IsImported = ‘N’)
    • Data Validation and Data Lookup
      • Most of the logic goes here to ensure data integrity before the real import take place.
      • Data Validation can be as complex as we wanted, i.e., check whether the record exist, check duplication, etc. For invalid record, add Error Message (and set IsImported = ‘E’)
      • Data Lookup can be as automated as we want, i.e., getting ID of Attribute from Name, getting the default value, etc.
    • For valid data (IsImported = ‘E’), do the real import to target table(s)
      • Then set Is Imported = true, Processed = true
    • And finally, return the number of successful / unsuccessful import
2) Create new Process in ADempiere
  • Login as System, got to window “Report & Process”
  • Create new Process = “Import_AttributeValue”
  • Set Classname = “org.compiere.process.ImportAttributeValue”
import_8
  • In Parameter tab, set parameters based on what are required. In this case, Client , Delete Old Imported? and Is Validate Only?
  • Note that, we can use “Copy from Report and Process” button in the first tab, in case, the same already exists.
import_9
3) Register this new process to “Process Now” button.
  • Login as System, go to window “Table and Column”
  • Open the newly crated Table “I_AttributeValue”
  • On column “Processing”, set Process = “Import_AttributeValue”
import_10
That’s it!

Now the new Import Attribute Value window is ready to use along side with other Data Import Windows. And we can use it just like others.

Enjoy!
import_11
Image:Note.gif Note:

  • To package it to use in another system, use 2Pack to packout as Application and Module. It will pack everything except Java class that need to deploy separately.
  • It is recommended to use System Administrator to create Import Loader Format, and use Client’s user to do the data import.

Using Jasper Report Form in place of Standard Forms

Jasper Report is adopted as more flexible and easy way to create reports. Without it, we need to create Forms or Reports using ADempiere’s Print Format. In some case, it is ok, but many cases quite difficult to use.

Overview

There are many pages in this Wiki that talked in depth about Jasper Report, which are very informative to read.

In contrary, this page will highlight only on how to use Jasper Report as a Form, but with mores picture and easy steps to follow.

By default, clicking on Print Preview in document window menu give, Sales Order Form generated by standard Print Format technique. This page will address the need to use Jasper Report instead.

jasper_1

Understanding how ADempiere locate Forms for each document window

Wondering, how Print Preview button discover which Form to use? Here is the answer,

Before the integration with Jasper Report, Print Format is the only way to create Print Form in ADempiere. As such, in the window that do the Form & Document mapping is using the Print Format to tell what form to use for which document type. This give some confusion at first, but we will see how jasper report form will be used on top of it later.

  • For most Document Types, Print Form window will be used to store Print Format for each document forms by default (Some exception will be discussed later)
jasper_2
  • To overwrite it to be more specific for different Document Type, use window Document Type, field Print Format
  • You can note that, by default, the Print Format field is blank. But you are likely to set it as needed.
jasper_3
  • From there, you can right click on the Print Format field and Zoom to Print Format window to see them in detail.
  • You can also click on Format Item tab to see how this form is laid out.
  • Note that, by default, Jasper Report field is blank, which mean this Print Format (Form) is used directly as Printing Form
jasper_4
  • Summary on how Print Preview button on document window find Print Format to use
    • Purchase Order and Sales Order: “Document Type” overwrite “Print Form”
    • Shipment (Customer) and Material Receipt: “Document Type” overwrite “Print Form”
    • Invoice (Customer) and Invoice (Vendor): “Business Partner / Customer tab (Invoice Print Format)” overwrite “Document Type” overwrite “Print Form”
    • Payment: This type of document is a bit special, as it will be looking the Print Format from “Bank / Bank Account Document tab (Check Print Format)”. In Payment window, based on selected Bank Account, right Print Format will be used.
Image:Note.gif Note:In other windows, ADempiere will directly use Report specified in Process field located at “Tab” tab in “Window, Tab and Fields” window. And as such, only System level reports are available. See exactly how it works & org.compiere.print.RportCtl.java
Now we know, when Print Preview button is clicked, what Print Format Form will be called.

Although we can use Print Format to customize this form using its Format Item tab, but trust me, it is the most time consuming work to do with ADempiere. Let’s make our life easier with Jasper Report!

Creating new Jasper Report Form and use it in place of the Print Format

Assuming that we already know how to use Jasper Report to create a form, the only trick is to ensure your Jasper Report will use $P{RECORD_ID} parameter to get ID from the calling window.

jasper_5

Note:

  • In most window, RECORD_ID is the real current record of the calling window. I.e., Sales Order = C_Order_ID, but not always.
  • Some window, such as Payment, is passing C_PaySelectionCheck_ID not C_Payment_ID.

Once the Jasper Report is tested fine, you then deploy report and have this new jrxml file registered within ADempiere.

1) As System, create new record and tell where this report is located

jasper_5

Note:

  • It is important to select Report checkbox. Although, when Classname is not defined, it will be OK in some case. But for other case, i.e., we want to also run some process to validate something before Print and Java Classname is defined, AD will only execute the Java Class and ignore Jasper Report.

2) As Client, use this Jasper Report in the Print Format in question, i.e., following is for Sales Order Form

jasper_7

3) Now, test on Print Preview again, you should see the report in Jasper View as following.

jasper_8

Note: (as of 360LTS)

  • It is recommended to use jasper report to overwrite the default Print Format, rather than creating new print format just for it. Although you might notice that, the overwritten default print format configuration is not used at all.
  • The reason is, Jasper Report is just being used instead. Internally, the report engine still execute the overwritten Print Format although not used eventually. It can give non-fatal log message if, i.e., not found the Format Items records, or pass RECORD_ID that is unmatched with the Print Format’s Table.
  • Or if it is necessary, make sure you create with the right table and click on “Copy/Create” button to create some Format Item records (just to avoid error).

Amount to Text in Jasper Form (Thai Language)

As Jasper Report can call java class that convert from number to text, so this problem is resolved easily using Scriptlet Java Class. Just following these steps to use Thai Text in Jasper Report.

  1. Compile this File:Scriptlet.java into your project [1]
  2. In Jasper Report –> Tools / Options / Classpath –> Add Jar file that compiled with Scriptlet.java
  3. In Jasper Report, create a Text Field where you want the Amount Text to display.
  4. In Jasper Report, create a Variable field (Integer) and set value to 2. This value hold decimal point we want to use.
  5. Put this string function –> “(“+org.isec.report.utils.Scriptlet.getAmtInWords($F{payamt}.setScale($V{v_scale}).toString(),”THB”)+”)” on the Text Field to run the amount
  6. Enjoy!
jasper_9

Resolving Export to PDF Problem

With jasper report that use Thai Charactors, from the print preview it will work just fine. But if you try to export it the character will be missing. As well as using report in WebUI, as internally it will convert to PDF first, its Thai character will also be missing.

Here is the steps to solve the problem.

For iReport

  • Copy font, i.e., Angsana from windows and store it some where.
  • Install Font: on iReport, click Tool | Options | iReport -> Fonts -> Install Fonts, then select the desired font. (for Window 7, ensure that you have disable the UAC)
  • Select fonts, [PDF Encoding ]= Identity-H (Unicode with horizontal writing) and [Embeded this font to PDF document] = True
  • On the report design, ensure that for all Thai words, use the installed font and mark PDF Embeded = True
  • Now, from the Preview report, you should be able to save them in PDF without problem with Thai character

jasper_10

  • We will still need to define PDF Font in the designer, in order to see Thai Font options, on Fonts Tab | PDF fonts path, select the folder that contain Thai fonts (make sure to add folder in classpath first).
  • Restart iReport and continue design, make sure PDF font name and PDF encoding is selected.

jasper_11

Tips – Using Style: It is inconvenient to set PDF attributes one by one for each object. Now you can create styles to handle it.

  • Create a new style.
  • Specify Pdf Font name and Pdf Encoding for the new style.
  • Assign the style to each objects on your report. Don’t forget to do it for your subreport.
  • If your later want to change the font or the path, you simply do it in the style. That is easy!

More trick about Jasper Report see this excellent article –> ADempiere/Compiere JasperReports Integration HowTo

Deploying Jasper Report for Production (in regards to Thai fonts)

Following are some conditions to meet
  1. Reports have sub-reports or image
  2. Reports have new fonts that was not originally exists
  3. Server is Linux (and Windows)
  4. Client is both Swing and Webui, on both Linux and Windows (as such, fonts must work for both)
  5. Easy to deploy new reports

Playing around with your development is one thing. Deploy for production is another thing. After many tries and wiki readings, there are many ways to deploy it, but most ways works for some condition and not others.

Following are what I think work best (at least for me) in most condition.

Deploying new fonts
  1. Jar all new fonts into, i..e, Fonts.jar.
  2. Deploy as new package in Adempiere. I..e, %ADEMPIERE_HOME%/packages/Fonts/lib/Fonts.jar
  3. Execute RUN_silentsetup.bat (.sh), this will make sure it will be availabe through both WebUI and also when deploy as WebStart (swing)
Deploying Jasper Files
  1. Create a folder in Server (a folder not a file!) %ADEMPIERE_HOME%/jboss/server/adempiere/deploy/reports.war
  2. Copy all jasper files, related images into this folder “reports.war”. Without having to restart jboss, all these reports will be availabe in path http://<server>:8080/reports/<jasper files>.
  3. In Report & Process window of ADempiere, Jasper field, specify path to the report using the URL, i.e., http://<server>:8080/reports/MyReport.jasper. Make sure you use .jasper, not .jrxml.
  4. If you have new report, just copy the file into this folder and it should be available immediatelly.
Note when design jasper
  • Make sure that during design time, you can save to pdf and the font still display correctly. This is important, as it will make sure that new font will display correctly in boht WebUI and Swing client (when export to PDF). Read more about PDF here, http://www.adempiere.com/ADempiere/Compiere_JasperReports_Integration_HowTo#Problems_exporting_to_PDF
  • If the report has sub report or link to images, do use the URL to link the image, i.e., http://<server>:8080/reports/Logo.gif. Jasper will look up only for Logo.gif during design time. (if you don’t specify as URL, Linux Server will not be able to find the correct image path).

Start the Application Server. Now report should be available in both WebUI and Swing, in any OS.

Some note on why other approach don’t work

  • Deploy as attachment –> Case report with image link, Work in Windows, not work in Linux
  • Deploy at %ADEMPIERE_HOME%/reports –> Work in WebUI, but not deployed into client via WebStart.

Links about Jasper Reports