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
FieldsModifier and TypeFieldDescriptionstatic final intCheck = 6static final intDistribution Order = 9static final intDunning = 7static final intPhysical Inventory = 10static final intInvoice = 2static final intManufacturing Order = 8static final intInventory Move = 11static final intOrder = 0static final intProject = 3static final intRemittance = 5static final intRfQ = 4static final intShipment = 1 -
Constructor Summary
ConstructorsConstructorDescriptionReportEngine(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 TypeMethodDescriptionvoidaddEventListener(IReportEngineEventListener listener) Add report engine event listenervoidPrint Service Attribute Listener.booleanCreate delimited text filebooleanWrite delimited content to writerbooleancreateHTML(File file, boolean onlyTable, Language language) Create HTML FilebooleancreateHTML(File file, boolean onlyTable, Language language, IHTMLExtension extension) Create HTML FilebooleancreateHTML(Writer writer, boolean onlyTable, Language language) Write HTML to writerbooleancreateHTML(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension) Write HTML to writer with isExport = falsebooleancreateHTML(Writer writer, boolean onlyTable, Language language, IHTMLExtension extension, boolean isExport) Write HTML to writerbooleanCreate PDF Filebyte[]Create PDF as Data arraybooleanCreate PostScript FilebooleancreatePS(OutputStream os) Write PostScript to writervoidCreate Excel filevoidcreateXLSX(File outFile, Language language) Create ExcelX filebooleanCreate XML FilebooleanWrite XML to writerstatic ReportEngineget(Properties ctx, int type, int Record_ID) Get Document Print Engine for Document Type.static ReportEngineget(Properties ctx, int type, int Record_ID, int windowNo) Get Document Print Engine for Document Type.static ReportEngineget(Properties ctx, int type, int Record_ID, String trxName) Get Document Print Engine for Document Type.static ReportEngineget(Properties ctx, int type, int Record_ID, String trxName, int windowNo) Get Document Print Engine for Document Type.static ReportEngineget(Properties ctx, ProcessInfo pi) Get Report Engine for process infostatic ReportEngineget(Properties ctx, ProcessInfo pi, int windowNo) Get Report Engine for process infointGet 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 stringintGet 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 intgetReportEngineType(int tableID) Get Report Engine Type from Table_IDGet report output typeintGet Row CountGet extended where clauseintGet window nogetXLS()Create XLS file (created as temporary file).Create XLS file.getXLSX()Create XLSX file (created as temporary file).Create XLSX file.voidinitName()Initialize Report Namestatic booleanisDisplayPFItem(PrintData printData, MPrintFormatItem item) Evaluate display logic of a print format itembooleanDetermines, if current tab content should be replaced, or a new tab should be openedbooleanIs summary reportvoidShow Print Dialog and Set Paper.
Optionally re-calculate layout.voidprint()Print Report.static voidprintConfirm(int type, int Record_ID) Print Confirm.
Update Date Printed.booleanRemove report engine event listenerstatic voidsetDefaultReportTypeToPInstance(Properties ctx, MPInstance instance, int printFormatID) Update AD_PInstance with default report output type (if it is not set)voidsetIsReplaceTabContent(boolean m_isReplaceTabContent) Sets, if current tab content should be replaced, or a new tab should be openedvoidsetLanguageID(int languageID) Set language idvoidsetPrintData(PrintData printData) Set PrintDatavoidsetPrinterName(String printerName) Set Printer (name)voidSet PrintFormat.voidvoidSet Query and load PrintData.
If Layout was created, re-create layout.
Fire onQueryChanged event.voidsetReportType(String type) Set report output typevoidsetSummary(boolean summary) Set summary reportvoidsetWhereExtended(String whereExtended) Set extended where clausevoidsetWindowNo(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:
attributeUpdatein 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
-