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
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) Set 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) Set 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) void
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.Create CSV file.getCtx()
Get PrintLayout (Report) ContextgetHTML()
Create HTML file.Create HTML file.getIdentifier
(MTable mTable, String tableName, int recordID) Get record identifier stringint
Get LayoutgetName()
Get PrintFormat (Report) NamegetPDF()
Create PDF file.Create PDF file.Get PrintDataGet Printer (name)Get PrintFormatGet Print InfogetQuery()
Get Querystatic int
getReportEngineType
(int tableID) Get Report Engine Type from Table_IDint
Get Row Countint
getXLS()
Create XLS file.Create XLS file.getXLSX()
Create XLSX 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
void
Show Dialog and Set Paper Optionally re-calculate layoutvoid
print()
Print Reportstatic void
printConfirm
(int type, int Record_ID) Print Confirm.boolean
static void
setDefaultReportTypeToPInstance
(Properties ctx, MPInstance instance, int printFormatID) void
setIsReplaceTabContent
(boolean m_isReplaceTabContent) Sets, if current tab content should be replaced, or a new tab should be openedvoid
setLanguageID
(int languageID) void
setPrintData
(PrintData printData) Set PrintDatavoid
setPrinterName
(String printerName) Set Printer (name)void
Set PrintFormat.void
void
Set Query and generate PrintData.void
setReportType
(String type) void
setSummary
(boolean summary) void
setWhereExtended
(String whereExtended) void
setWindowNo
(int windowNo)
-
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) Set report engine with summary and null transaction- Parameters:
ctx
-pf
-query
-info
-isSummary
-
-
ReportEngine
Set 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
-
removeEventListener
-
setPrintFormat
Set PrintFormat. If Layout was created, re-create layout- Parameters:
pf
- print format
-
setQuery
Set Query and generate PrintData. If Layout was created, re-create layout- Parameters:
query
- query
-
getQuery
Get Query- Returns:
- query
-
getPrintData
Get PrintData- Returns:
- print data
-
setPrintData
Set PrintData- Parameters:
printData
- printData
-
getLayout
Get Layout- Returns:
- Layout
-
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 -
attributeUpdate
Print Service Attribute Listener.- Specified by:
attributeUpdate
in interfacePrintServiceAttributeListener
- Parameters:
psae
- event
-
pageSetupDialog
public void pageSetupDialog()Show 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 in temporary storage)- Returns:
- PDF file
-
getPDF
Create PDF file.- Parameters:
file
- file- Returns:
- PDF file
-
getHTML
Create HTML file. (created in temporary storage)- Returns:
- HTML file
-
getHTML
Create HTML file.- Parameters:
file
- file- Returns:
- HTML file
-
getCSV
Create CSV file. (created in temporary storage)- Returns:
- CSV file
-
getCSV
Create CSV file.- Parameters:
file
- file- Returns:
- CSV file
-
getXLS
Create XLS file. (created in temporary storage)- Returns:
- XLS file
-
getXLS
Create XLS file.- Parameters:
file
- file- Returns:
- XLS file
-
getXLSX
Create XLSX file. (created in temporary storage)- Returns:
- XLSX file
-
getXLSX
Create XLSX file.- Parameters:
file
- file- Returns:
- XLSX file
-
createPDF
Create PDF File- Parameters:
file
- file- Returns:
- true if success
-
createPDFData
public byte[] createPDFData()Create PDF as Data array- Returns:
- pdf data
-
createPS
Create PostScript File- Parameters:
file
- 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- Parameters:
type
- document typeRecord_ID
- record id
-
setWhereExtended
-
getWhereExtended
-
setWindowNo
public void setWindowNo(int windowNo) -
getWindowNo
public int getWindowNo() -
setSummary
public void setSummary(boolean summary) -
isSummary
public boolean isSummary() -
setLanguageID
public void setLanguageID(int languageID) -
getLanguageID
public int getLanguageID() -
setReportType
-
getReportType
-
isReplaceTabContent
public boolean isReplaceTabContent()Determines, if current tab content should be replaced, or a new tab should be opened- Returns:
-
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) -
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
-