Package org.compiere.print
Class ReportEngine
- java.lang.Object
-
- org.compiere.print.ReportEngine
-
- All Implemented Interfaces:
PrintServiceAttributeListener
public class ReportEngine extends Object implements PrintServiceAttributeListener
Report Engine. For a given PrintFormat, create a ReportChange 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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classReportEngine.ColumnInfostore info of report column, now just use index to create css selector, but for later maybe will construct a complex class nameclassReportEngine.CSSInfoStore info for make css rule
-
Field Summary
Fields Modifier and Type Field Description static intCHECKCheck = 6static intDISTRIBUTION_ORDERDistribution Order = 9static intDUNNINGDunning = 7static intINVENTORYPhysical Inventory = 10static intINVOICEInvoice = 2static intMANUFACTURING_ORDERManufacturing Order = 8static intMOVEMENTInventory Move = 11static intORDEROrder = 0static intPROJECTProject = 3static intREMITTANCERemittance = 5static intRFQRfQ = 4static intSHIPMENTShipment = 1
-
Constructor Summary
Constructors Constructor Description ReportEngine(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, String trxName)Set report engine with summary = false
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCssInfo(MPrintFormatItem formatItem, int index)create css info from formatItem, add all column has same formatItem in a listvoidaddEventListener(IReportEngineEventListener listener)voidappendInlineCss(org.apache.ecs.XhtmlDocument doc)build css for table from mapCssInfovoidappendInlineCss(org.apache.ecs.XhtmlDocument doc, StringBuilder buildCssInline)voidattributeUpdate(PrintServiceAttributeEvent psae)Print Service Attribute Listener.booleancreateCSV(File file, char delimiter, Language language)Create CSV FilebooleancreateCSV(Writer writer, char delimiter, Language language)Write CSV 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 writerbooleancreatePDF(File file)Create PDF Filebyte[]createPDFData()Create PDF as Data arraybooleancreatePS(File file)Create PostScript FilebooleancreatePS(OutputStream os)Write PostScript to writervoidcreateXLS(File outFile, Language language)Create Excel filevoidcreateXLSX(File outFile, Language language)Create ExcelX filebooleancreateXML(File file)Create XML FilebooleancreateXML(Writer writer)Write 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, String trxName)Get Document Print Engine for Document Type.static ReportEngineget(Properties ctx, ProcessInfo pi)Get Report Engine for process infointgetColumnCount()Get Column CountFilegetCSV()Create CSV file.FilegetCSV(File file)Create CSV file.PropertiesgetCtx()Get PrintLayout (Report) ContextFilegetHTML()Create HTML file.FilegetHTML(File file)Create HTML file.intgetLanguageID()LayoutEnginegetLayout()Get LayoutStringgetName()Get PrintFormat (Report) NameFilegetPDF()Create PDF file.FilegetPDF(File file)Create PDF file.PrintDatagetPrintData()Get PrintDataStringgetPrinterName()Get Printer (name)MPrintFormatgetPrintFormat()Get PrintFormatPrintInfogetPrintInfo()Get Print InfoMQuerygetQuery()Get QueryStringgetReportType()intgetRowCount()Get Row CountStringgetWhereExtended()intgetWindowNo()FilegetXLS()Create XLS file.FilegetXLS(File file)Create XLS file.FilegetXLSX()Create XLSX file.FilegetXLSX(File file)Create XLSX file.booleanisSummary()voidpageSetupDialog()Show Dialog and Set Paper Optionally re-calculate layoutvoidprint()Print Reportstatic voidprintConfirm(int type, int Record_ID)Print Confirm.booleanremoveEventListener(IReportEngineEventListener listener)voidsetLanguageID(int languageID)voidsetPrintData(PrintData printData)Set PrintDatavoidsetPrinterName(String printerName)Set Printer (name)voidsetPrintFormat(MPrintFormat pf)Set PrintFormat.voidsetQuery(MQuery query)Set Query and generate PrintData.voidsetReportType(String type)voidsetSummary(boolean summary)voidsetWhereExtended(String whereExtended)voidsetWindowNo(int windowNo)
-
-
-
Field Detail
-
ORDER
public static final int ORDER
Order = 0- See Also:
- Constant Field Values
-
SHIPMENT
public static final int SHIPMENT
Shipment = 1- See Also:
- Constant Field Values
-
INVOICE
public static final int INVOICE
Invoice = 2- See Also:
- Constant Field Values
-
PROJECT
public static final int PROJECT
Project = 3- See Also:
- Constant Field Values
-
RFQ
public static final int RFQ
RfQ = 4- See Also:
- Constant Field Values
-
REMITTANCE
public static final int REMITTANCE
Remittance = 5- See Also:
- Constant Field Values
-
CHECK
public static final int CHECK
Check = 6- See Also:
- Constant Field Values
-
DUNNING
public static final int DUNNING
Dunning = 7- See Also:
- Constant Field Values
-
MANUFACTURING_ORDER
public static final int MANUFACTURING_ORDER
Manufacturing Order = 8- See Also:
- Constant Field Values
-
DISTRIBUTION_ORDER
public static final int DISTRIBUTION_ORDER
Distribution Order = 9- See Also:
- Constant Field Values
-
INVENTORY
public static final int INVENTORY
Physical Inventory = 10- See Also:
- Constant Field Values
-
MOVEMENT
public static final int MOVEMENT
Inventory Move = 11- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ReportEngine
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info)
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
public ReportEngine(Properties ctx, MPrintFormat pf, MQuery query, PrintInfo info, String trxName)
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-
-
-
Method Detail
-
addEventListener
public void addEventListener(IReportEngineEventListener listener)
-
removeEventListener
public boolean removeEventListener(IReportEngineEventListener listener)
-
setPrintFormat
public void setPrintFormat(MPrintFormat pf)
Set PrintFormat. If Layout was created, re-create layout- Parameters:
pf- print format
-
setQuery
public void setQuery(MQuery query)
Set Query and generate PrintData. If Layout was created, re-create layout- Parameters:
query- query
-
getQuery
public MQuery getQuery()
Get Query- Returns:
- query
-
getPrintData
public PrintData getPrintData()
Get PrintData- Returns:
- print data
-
setPrintData
public void setPrintData(PrintData printData)
Set PrintData- Parameters:
printData- printData
-
getLayout
public LayoutEngine getLayout()
Get Layout- Returns:
- Layout
-
getName
public String getName()
Get PrintFormat (Report) Name- Returns:
- name
-
getPrintFormat
public MPrintFormat getPrintFormat()
Get PrintFormat- Returns:
- print format
-
getPrintInfo
public PrintInfo getPrintInfo()
Get Print Info- Returns:
- info
-
getCtx
public Properties 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
public void attributeUpdate(PrintServiceAttributeEvent psae)
Print Service Attribute Listener.- Specified by:
attributeUpdatein interfacePrintServiceAttributeListener- Parameters:
psae- event
-
pageSetupDialog
public void pageSetupDialog()
Show Dialog and Set Paper Optionally re-calculate layout
-
setPrinterName
public void setPrinterName(String printerName)
Set Printer (name)- Parameters:
printerName- valid printer name
-
getPrinterName
public String getPrinterName()
Get Printer (name)- Returns:
- printer name
-
createHTML
public boolean createHTML(File file, boolean onlyTable, Language language)
Create HTML File- Parameters:
file- fileonlyTable- if false create complete HTML documentlanguage- optional language - if null the default language is used to format nubers/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 nubers/datesextension- optional extension for html output- Returns:
- true if success
-
createHTML
public boolean createHTML(Writer writer, boolean onlyTable, Language language)
Write HTML to writer- Parameters:
writer- writeronlyTable- if false create complete HTML documentlanguage- optional language - if null nubers/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
-
createCSV
public boolean createCSV(File file, char delimiter, Language language)
Create CSV File- Parameters:
file- filedelimiter- delimiter, e.g. comma, tablanguage- translation language- Returns:
- true if success
-
createCSV
public boolean createCSV(Writer writer, char delimiter, Language language)
Write CSV to writer- Parameters:
writer- writerdelimiter- delimiter, e.g. comma, tablanguage- translation language- Returns:
- true if success
-
createXML
public boolean createXML(File file)
Create XML File- Parameters:
file- file- Returns:
- true if success
-
createXML
public boolean createXML(Writer writer)
Write XML to writer- Parameters:
writer- writer- Returns:
- true if success
-
getPDF
public File getPDF()
Create PDF file. (created in temporary storage)- Returns:
- PDF file
-
getHTML
public File getHTML()
Create HTML file. (created in temporary storage)- Returns:
- HTML file
-
getHTML
public File getHTML(File file)
Create HTML file.- Parameters:
file- file- Returns:
- HTML file
-
getCSV
public File getCSV()
Create CSV file. (created in temporary storage)- Returns:
- CSV file
-
getXLS
public File getXLS()
Create XLS file. (created in temporary storage)- Returns:
- XLS file
-
getXLSX
public File getXLSX()
Create XLSX file. (created in temporary storage)- Returns:
- XLSX file
-
getXLSX
public File getXLSX(File file)
Create XLSX file.- Parameters:
file- file- Returns:
- XLSX file
-
createPDF
public boolean createPDF(File file)
Create PDF File- Parameters:
file- file- Returns:
- true if success
-
createPDFData
public byte[] createPDFData()
Create PDF as Data array- Returns:
- pdf data
-
createPS
public boolean createPS(File file)
Create PostScript File- Parameters:
file- file- Returns:
- true if success
-
createPS
public boolean createPS(OutputStream os)
Write PostScript to writer- Parameters:
os- output stream- Returns:
- true if success
-
createXLS
public void createXLS(File outFile, Language language) throws Exception
Create Excel file- Parameters:
outFile- output filelanguage-- Throws:
Exception- if error
-
createXLSX
public void createXLSX(File outFile, Language language) throws Exception
Create ExcelX file- Parameters:
outFile- output filelanguage-- Throws:
Exception- if error
-
get
public static ReportEngine get(Properties ctx, ProcessInfo pi)
Get Report Engine for process info- Parameters:
ctx- contextpi- process info with AD_PInstance_ID- Returns:
- report engine or null
-
get
public static ReportEngine get(Properties ctx, int type, int Record_ID)
Get Document Print Engine for Document Type.- Parameters:
ctx- contexttype- document typeRecord_ID- id- Returns:
- Report Engine or null
-
get
public static ReportEngine get(Properties ctx, int type, int Record_ID, String trxName)
Get Document Print Engine for Document Type.- Parameters:
ctx- contexttype- document typeRecord_ID- idtrxName-- 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
public void setWhereExtended(String whereExtended)
-
getWhereExtended
public String 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
public void setReportType(String type)
-
getReportType
public String getReportType()
-
appendInlineCss
public void appendInlineCss(org.apache.ecs.XhtmlDocument doc)
build css for table from mapCssInfo- Parameters:
doc-
-
appendInlineCss
public void appendInlineCss(org.apache.ecs.XhtmlDocument doc, StringBuilder buildCssInline)
-
addCssInfo
public void addCssInfo(MPrintFormatItem formatItem, int index)
create css info from formatItem, add all column has same formatItem in a list- Parameters:
formatItem-index-
-
-