Package org.compiere.print
Class ReportEngine
java.lang.Object
org.compiere.print.ReportEngine
- All Implemented Interfaces:
PrintServiceAttributeListener
Report Engine.
For a given PrintFormat, create a Report.
For a given PrintFormat, create a Report.
Change log:
- 2007-02-12 - teo_sarca - [ 1658127 ] Select charset encoding on import
- 2007-02-10 - teo_sarca - [ 1652660 ] Save XML,HTML,CSV should have utf8 charset
- 2009-02-06 - globalqss - [ 2574162 ] Priority to choose invoice print format not working
- 2009-07-10 - trifonnt - [ 2819637 ] Wrong print format on non completed order
- Version:
- $Id: ReportEngine.java,v 1.4 2006/10/08 06:52:51 comdivision Exp $
- Author:
- Jorg Janke, Teo Sarca, www.arhipac.ro
- BF [ 2828300 ] Error when printformat table differs from DOC_TABLES https://sourceforge.net/p/adempiere/bugs/1995/
- BF [ 2828886 ] Problem with reports from temporary tables https://sourceforge.net/p/adempiere/bugs/2000/ FR 2872010 - Dunning Run for a complete Dunning (not just level) - Developer: Carlos Ruiz - globalqss - Sponsor: Metas
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Check = 6static final int
Distribution Order = 9static final int
Dunning = 7static final int
Physical Inventory = 10static final int
Invoice = 2static final int
Manufacturing Order = 8static final int
Inventory Move = 11static final int
Order = 0static final int
Project = 3static final int
Remittance = 5static final int
RfQ = 4static final int
Shipment = 1 -
Constructor Summary
ConstructorDescriptionReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info) ConstructorReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary) Create report engine with summary and null transactionReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName) ConstructorReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName, int windowNo) ConstructorReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName) Create report engine with summary = falseReportEngine
(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName, int windowNo) Set report engine with summary = false -
Method Summary
Modifier and TypeMethodDescriptionvoid
addEventListener
(IReportEngineEventListener listener) Add report engine event listenervoid
Print Service Attribute Listener.boolean
Create delimited text fileboolean
Write delimited content to writerboolean
createHTML
(File file, boolean onlyTable, Language language) Create HTML Fileboolean
createHTML
(File file, boolean onlyTable, Language language, IHTMLExtension extension) Create HTML Fileboolean
createHTML
(Writer writer, boolean onlyTable, Language language) Write HTML to writerboolean
createHTML
(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension) Write HTML to writer with isExport = falseboolean
createHTML
(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension, boolean isExport) Write HTML to writerboolean
Create PDF Filebyte[]
Create PDF as Data arrayboolean
Create PostScript Fileboolean
createPS
(OutputStream os) Write PostScript to writervoid
Create Excel filevoid
createXLSX
(File outFile, Language language) Create ExcelX fileboolean
Create XML Fileboolean
Write XML to writerstatic ReportEngine
get
(Properties ctx, int type, int Record_ID) Get Document Print Engine for Document Type.static ReportEngine
get
(Properties ctx, int type, int Record_ID, int windowNo) Get Document Print Engine for Document Type.static ReportEngine
get
(Properties ctx, int type, int Record_ID, String trxName) Get Document Print Engine for Document Type.static ReportEngine
get
(Properties ctx, int type, int Record_ID, String trxName, int windowNo) Get Document Print Engine for Document Type.static ReportEngine
get
(Properties ctx, ProcessInfo pi) Get Report Engine for process infostatic ReportEngine
get
(Properties ctx, ProcessInfo pi, int windowNo) Get Report Engine for process infoint
Get Column CountgetCSV()
Create CSV file (created as temporary file).Create CSV file.getCtx()
Get PrintLayout (Report) ContextgetHTML()
Create HTML file (created as temporary file).Create HTML file.getIdentifier
(MTable mTable, String tableName, int recordID) Get record identifier stringint
Get language idGet Layout EnginegetName()
Get PrintFormat (Report) NamegetPDF()
Create PDF file (created as temporary file).Create PDF file.Get PrintDataGet Printer (name)Get PrintFormatGet Print InfogetQuery()
Get Querystatic int
getReportEngineType
(int tableID) Get Report Engine Type from Table_IDGet report output typeint
Get Row CountGet extended where clauseint
Get window nogetXLS()
Create XLS file (created as temporary file).Create XLS file.getXLSX()
Create XLSX file (created as temporary file).Create XLSX file.void
initName()
Initialize Report Namestatic boolean
isDisplayPFItem
(PrintData printData, MPrintFormatItem item) Evaluate display logic of a print format itemboolean
Determines, if current tab content should be replaced, or a new tab should be openedboolean
Is summary reportvoid
Show Print Dialog and Set Paper.
Optionally re-calculate layout.void
print()
Print Report.static void
printConfirm
(int type, int Record_ID) Print Confirm.
Update Date Printed.boolean
Remove report engine event listenerstatic void
setDefaultReportTypeToPInstance
(Properties ctx, MPInstance instance, int printFormatID) Update AD_PInstance with default report output type (if it is not set)void
setIsReplaceTabContent
(boolean m_isReplaceTabContent) Sets, if current tab content should be replaced, or a new tab should be openedvoid
setLanguageID
(int languageID) Set language idvoid
setPrintData
(PrintData printData) Set PrintDatavoid
setPrinterName
(String printerName) Set Printer (name)void
Set PrintFormat.void
void
Set Query and load PrintData.
If Layout was created, re-create layout.
Fire onQueryChanged event.void
setReportType
(String type) Set report output typevoid
setSummary
(boolean summary) Set summary reportvoid
setWhereExtended
(String whereExtended) Set extended where clausevoid
setWindowNo
(int windowNo) Set windowNo of the report to parse the context
-
Field Details
-
ORDER
public static final int ORDEROrder = 0- See Also:
-
SHIPMENT
public static final int SHIPMENTShipment = 1- See Also:
-
INVOICE
public static final int INVOICEInvoice = 2- See Also:
-
PROJECT
public static final int PROJECTProject = 3- See Also:
-
RFQ
public static final int RFQRfQ = 4- See Also:
-
REMITTANCE
public static final int REMITTANCERemittance = 5- See Also:
-
CHECK
public static final int CHECKCheck = 6- See Also:
-
DUNNING
public static final int DUNNINGDunning = 7- See Also:
-
MANUFACTURING_ORDER
public static final int MANUFACTURING_ORDERManufacturing Order = 8- See Also:
-
DISTRIBUTION_ORDER
public static final int DISTRIBUTION_ORDERDistribution Order = 9- See Also:
-
INVENTORY
public static final int INVENTORYPhysical Inventory = 10- See Also:
-
MOVEMENT
public static final int MOVEMENTInventory Move = 11- See Also:
-
-
Constructor Details
-
ReportEngine
Constructor- Parameters:
ctx
- contextpf
- Print Formatquery
- Optional Queryinfo
- print info
-
ReportEngine
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary) Create report engine with summary and null transaction- Parameters:
ctx
-pf
-query
-info
-isSummary
-
-
ReportEngine
Create report engine with summary = false- Parameters:
ctx
-pf
-query
-info
-trxName
-
-
ReportEngine
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName) Constructor- Parameters:
ctx
- contextpf
- Print Formatquery
- Optional Queryinfo
- print infoisSummary
-trxName
-
-
ReportEngine
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName, int windowNo) Set report engine with summary = false- Parameters:
ctx
-pf
-query
-info
-trxName
-windowNo
-
-
ReportEngine
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, boolean isSummary, String trxName, int windowNo) Constructor- Parameters:
ctx
- contextpf
- Print Formatquery
- Optional Queryinfo
- print infoisSummary
-trxName
-windowNo
-
-
-
Method Details
-
addEventListener
Add report engine event listener- Parameters:
listener
-
-
removeEventListener
Remove report engine event listener- Parameters:
listener
-- Returns:
- true if found and remove
-
setPrintFormat
Set PrintFormat. If Layout was created, re-create layout- Parameters:
pf
- print format
-
setQuery
Set Query and load PrintData.
If Layout was created, re-create layout.
Fire onQueryChanged event.- Parameters:
query
- query
-
getQuery
Get Query- Returns:
- query
-
getPrintData
Get PrintData- Returns:
- print data
-
setPrintData
Set PrintData- Parameters:
printData
- printData
-
getLayout
Get Layout Engine- Returns:
- Layout engine
-
initName
public void initName()Initialize Report Name -
getName
Get PrintFormat (Report) Name- Returns:
- name
-
getPrintFormat
Get PrintFormat- Returns:
- print format
-
getPrintInfo
Get Print Info- Returns:
- info
-
getCtx
Get PrintLayout (Report) Context- Returns:
- context
-
getRowCount
public int getRowCount()Get Row Count- Returns:
- row count
-
getColumnCount
public int getColumnCount()Get Column Count- Returns:
- column count
-
print
public void print()Print Report. Issue print job to printer. -
attributeUpdate
Print Service Attribute Listener.- Specified by:
attributeUpdate
in interfacePrintServiceAttributeListener
- Parameters:
psae
- event
-
pageSetupDialog
public void pageSetupDialog()Show Print Dialog and Set Paper.
Optionally re-calculate layout. -
setPrinterName
Set Printer (name)- Parameters:
printerName
- valid printer name
-
getPrinterName
Get Printer (name)- Returns:
- printer name
-
createHTML
Create HTML File- Parameters:
file
- fileonlyTable
- if false create complete HTML documentlanguage
- optional language - if null the default language is used to format numbers/dates- Returns:
- true if success
-
createHTML
public boolean createHTML(File file, boolean onlyTable, Language language, IHTMLExtension extension) Create HTML File- Parameters:
file
- fileonlyTable
- if false create complete HTML documentlanguage
- optional language - if null the default language is used to format numbers/datesextension
- optional extension for html output- Returns:
- true if success
-
createHTML
Write HTML to writer- Parameters:
writer
- writeronlyTable
- if false create complete HTML documentlanguage
- optional language - if null numbers/dates are not formatted- Returns:
- true if success
-
createHTML
public boolean createHTML(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension) Write HTML to writer with isExport = false- Parameters:
writer
- writeronlyTable
- if false create complete HTML documentlanguage
- optional language - if null numbers/dates are not formattedextension
- optional extension for html output- Returns:
- true if success
-
createHTML
public boolean createHTML(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension, boolean isExport) Write HTML to writer- Parameters:
writer
- writeronlyTable
- if false create complete HTML documentlanguage
- optional language - if null numbers/dates are not formattedextension
- optional extension for html outputisExport
- when isExport = true will don't embed resource dependent zk framework- Returns:
- true if success
-
getIdentifier
Get record identifier string- Parameters:
mTable
-tableName
-recordID
-- Returns:
- String identifier
-
createCSV
Create delimited text file- Parameters:
file
- filedelimiter
- delimiter, e.g. comma, tablanguage
- translation language- Returns:
- true if success
-
createCSV
Write delimited content to writer- Parameters:
writer
- writerdelimiter
- delimiter, e.g. comma, tablanguage
- translation language- Returns:
- true if success
-
createXML
Create XML File- Parameters:
file
- file- Returns:
- true if success
-
createXML
Write XML to writer- Parameters:
writer
- writer- Returns:
- true if success
-
getPDF
Create PDF file (created as temporary file).- Returns:
- PDF file
-
getPDF
Create PDF file.- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- PDF file
-
getHTML
Create HTML file (created as temporary file).- Returns:
- HTML file
-
getHTML
Create HTML file.- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- HTML file
-
getCSV
Create CSV file (created as temporary file).- Returns:
- CSV file
-
getCSV
Create CSV file.- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- CSV file
-
getXLS
Create XLS file (created as temporary file).- Returns:
- XLS file
-
getXLS
Create XLS file.- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- XLS file
-
getXLSX
Create XLSX file (created as temporary file).- Returns:
- XLSX file
-
getXLSX
Create XLSX file.- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- XLSX file
-
createPDF
Create PDF File- Parameters:
file
- optional, null to use system generated temporary file- Returns:
- true if success
-
createPDFData
public byte[] createPDFData()Create PDF as Data array- Returns:
- pdf data
-
createPS
Create PostScript File- Parameters:
file
- output file- Returns:
- true if success
-
createPS
Write PostScript to writer- Parameters:
os
- output stream- Returns:
- true if success
-
createXLS
Create Excel file- Parameters:
outFile
- output filelanguage
-- Throws:
Exception
- if error
-
createXLSX
Create ExcelX file- Parameters:
outFile
- output filelanguage
-- Throws:
Exception
- if error
-
get
Get Report Engine for process info- Parameters:
ctx
- contextpi
- process info with AD_PInstance_ID- Returns:
- report engine or null
-
get
Get Report Engine for process info- Parameters:
ctx
- contextpi
- process info with AD_PInstance_IDwindowNo
- Window No- Returns:
- report engine or null
-
get
Get Document Print Engine for Document Type.- Parameters:
ctx
- contexttype
- document typeRecord_ID
- id- Returns:
- Report Engine or null
-
get
Get Document Print Engine for Document Type.- Parameters:
ctx
- contexttype
- document typeRecord_ID
- id- Returns:
- Report Engine or null
-
get
Get Document Print Engine for Document Type.- Parameters:
ctx
- contexttype
- document typeRecord_ID
- idtrxName
-- Returns:
- Report Engine or null
-
get
public static ReportEngine get(Properties ctx, int type, int Record_ID, String trxName, int windowNo) Get Document Print Engine for Document Type.- Parameters:
ctx
- contexttype
- document typeRecord_ID
- idtrxName
-windowNo
-- Returns:
- Report Engine or null
-
printConfirm
public static void printConfirm(int type, int Record_ID) Print Confirm.
Update Date Printed. -
setWhereExtended
Set extended where clause- Parameters:
whereExtended
-
-
getWhereExtended
Get extended where clause- Returns:
- extended where clause
-
setWindowNo
public void setWindowNo(int windowNo) Set windowNo of the report to parse the context -
getWindowNo
public int getWindowNo()Get window no- Returns:
- window no
-
setSummary
public void setSummary(boolean summary) Set summary report- Parameters:
summary
-
-
isSummary
public boolean isSummary()Is summary report- Returns:
- true if it is a summary report
-
setLanguageID
public void setLanguageID(int languageID) Set language id- Parameters:
languageID
-
-
getLanguageID
public int getLanguageID()Get language id- Returns:
- language id
-
setReportType
Set report output type- Parameters:
type
- output type (pdf, html, etc)
-
getReportType
Get report output type- Returns:
- report output type (pdf, html, etc)
-
isReplaceTabContent
public boolean isReplaceTabContent()Determines, if current tab content should be replaced, or a new tab should be opened- Returns:
- true if it is to replace content of current active tab
-
setIsReplaceTabContent
public void setIsReplaceTabContent(boolean m_isReplaceTabContent) Sets, if current tab content should be replaced, or a new tab should be opened- Parameters:
m_isReplaceTabContent
-
-
getReportEngineType
public static int getReportEngineType(int tableID) Get Report Engine Type from Table_ID- Parameters:
tableID
-- Returns:
- Report Engine Type -1 if Report Engine Type was not found
-
setDefaultReportTypeToPInstance
public static void setDefaultReportTypeToPInstance(Properties ctx, MPInstance instance, int printFormatID) Update AD_PInstance with default report output type (if it is not set)- Parameters:
ctx
-instance
-printFormatID
-
-
setProcessInfo
- Parameters:
pi
-
-
getProcessInfo
- Returns:
- ProcessInfo
-
isDisplayPFItem
Evaluate display logic of a print format item- Parameters:
printData
- data for display logic evaluationitem
- print format item- Returns:
- true if item has no display logic or display logic evaluate to true
-