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

ERP 2.50:Developers Guide/How to change an existing report/it

One of the most likely changes that would be required in any ERP implementation is to modify reports to meet customer needs. This "How To" article, walks through the scenario to change a report based on the modularity guidelines of Openbravo.

Contents

Obiettivo

The scenario that is presented in this article is to modify the "Purchase Order" printed from the Purchase Order Menu option. The changes that are implemented are

Along the way you will learn how to

Impostare il contesto

A few points to be understood before we begin

Bulbgraph.png   For Openbravo 2.50 you must use iReport 3.0.0

Modularità

View larger

All new developments must belong to a module that is not the core module. Please follow the How to create a new module section of the Modularity Developer's Manual to create a new module.

In this scenario, it is assumed that a module com.example.bigbazaar.openbravo.module has already been created and the module has been set as under "Development" and made as the default module for any changes.

Trovare il report e fare una copia nel nuovo modulo

View larger

Since this (Purchase Order) is an existing report, the new version of the report can be based on the original report that is packaged and shipped along with the core version of the product. You should not change anything that is part of the core as it would prevent upgrading the product without loosing the changes. The standard approach in Openbravo is to make a copy of the report within the development module that has already been defined ( com.example.bigbazaar.openbravo.module ). Then you can make changes to this copy without any risk of losing it when the original module ( core ) is upgraded.

To start with locate the report. To find the location of the Purchase Order Report

  1. Login with an id that has access to the client administrator role. For BigBazaar, it is the Big Bazaar Admin role
  2. Choose the option Financial Management || Accounting || Setup || Document Type.
  3. Move to grid view and find the document Purchase Order and open it in detail view
View larger

Look at the report configuration and use it to locate the report source file (jrxml)

  1. Switch to Report Templates tab and note down the Template Location and Template Filename. As a default, Template Location is set as @basedesign@/org/openbravo/erpReports and Template Filename is RptC_OrderPO.jrxml .
  2. Copy the template file which would be <OB Root Directory>/src/org/openbravo/erpReports/RptC_OrderPO.jrxml to the module report source folder . If your package name is com.example.bigbazaar.openbravo.module then the module report source folder is <OB Root Directory>/modules/com.example.bigbazaar.openbravo.module/src/com/example/bigbazaar/openbravo/module/erpReports). Create the directory structure if it is not already created.
  3. Copy any related subreports as well. There would be mentioned as SUBREP_<filename> in the document structure pane within iReport . In the case of Purchase Order, it has one sub-report viz RptC_OrderPO_Lines.jrxml.

Modificare e testare il report usando iReport

BigBaazarDocumentLogo.png
View larger
View larger
SELECT M_PRODUCT.VALUE, M_PRODUCT_PO.VENDORPRODUCTNO, M_PRODUCT.NAME, SUM(C_ORDERLINE.QTYORDERED) AS QTYORDERED, 
       C_UOM.UOMSYMBOL AS UOMSYMBOL, C_ORDERLINE.LINENETAMT AS PRICEACTUAL,
       C_ORDERLINE.PRICEACTUAL AS UNITPRICE,
          (CASE WHEN M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESET_ID IS NULL THEN '' 
                WHEN M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESET_ID='0' THEN '' 
                ELSE TO_CHAR(M_ATTRIBUTESETINSTANCE.DESCRIPTION) END) AS ATTRIBUTE,
          (CASE SUM(C_ORDERLINE.QTYORDERED)*M_PRODUCT.WEIGHT WHEN 0 THEN NULL 
                ELSE SUM(C_ORDERLINE.QTYORDERED)*M_PRODUCT.WEIGHT END) AS WEIGHT
FROM M_PRODUCT inner join C_ORDERLINE on C_ORDERLINE.M_PRODUCT_ID = M_PRODUCT.M_PRODUCT_ID
               inner join C_ORDER on C_ORDER.C_ORDER_ID = C_ORDERLINE.C_ORDER_ID
               left join M_PRODUCT_PO on M_PRODUCT.M_PRODUCT_ID = M_PRODUCT_PO.M_PRODUCT_ID 
                                         AND M_PRODUCT_PO.C_BPARTNER_ID = C_ORDER.C_BPARTNER_ID
               left join  M_ATTRIBUTESETINSTANCE on C_ORDERLINE.M_ATTRIBUTESETINSTANCE_ID = M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESETINSTANCE_ID, C_UOM 
WHERE C_ORDERLINE.C_UOM_ID = C_UOM.C_UOM_ID
AND C_ORDER.C_ORDER_ID = '1002010'
GROUP BY M_PRODUCT.NAME, M_PRODUCT_PO.VENDORPRODUCTNO, M_PRODUCT.VALUE, C_ORDERLINE.LINENETAMT, C_ORDERLINE.PRICEACTUAL,
      (CASE WHEN M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESET_ID IS NULL THEN '' 
            WHEN M_ATTRIBUTESETINSTANCE.M_ATTRIBUTESET_ID='0' THEN '' 
            ELSE TO_CHAR(M_ATTRIBUTESETINSTANCE.DESCRIPTION) END), M_PRODUCT.WEIGHT, C_UOM.UOMSYMBOL

Distribuire il report su Openbravo

ant smartbuild -Dlocal=yes -Drestart=yes  

Controllare l'output finale

View larger


Retrieved from "http://wiki.openbravo.com/wiki/ERP_2.50:Developers_Guide/How_to_change_an_existing_report/it"

This page has been accessed 5,876 times. This page was last modified on 14 June 2011, at 11:04. Content is available under Creative Commons Attribution-ShareAlike 2.5 Spain License.