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 class
ReportEngine.ColumnInfo
store info of report column, now just use index to create css selector, but for later maybe will construct a complex class nameclass
ReportEngine.CSSInfo
Store info for make css rule
-
Field Summary
Fields Modifier and Type Field Description static int
CHECK
Check = 6static int
DISTRIBUTION_ORDER
Distribution Order = 9static int
DUNNING
Dunning = 7static int
INVENTORY
Physical Inventory = 10static int
INVOICE
Invoice = 2static int
MANUFACTURING_ORDER
Manufacturing Order = 8static int
MOVEMENT
Inventory Move = 11static int
ORDER
Order = 0static int
PROJECT
Project = 3static int
REMITTANCE
Remittance = 5static int
RFQ
RfQ = 4static int
SHIPMENT
Shipment = 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 void
addCssInfo(MPrintFormatItem formatItem, int index)
create css info from formatItem, add all column has same formatItem in a listvoid
addEventListener(IReportEngineEventListener listener)
void
appendInlineCss(org.apache.ecs.XhtmlDocument doc)
build css for table from mapCssInfovoid
appendInlineCss(org.apache.ecs.XhtmlDocument doc, StringBuilder buildCssInline)
void
attributeUpdate(PrintServiceAttributeEvent psae)
Print Service Attribute Listener.boolean
createCSV(File file, char delimiter, Language language)
Create CSV Fileboolean
createCSV(Writer writer, char delimiter, Language language)
Write CSV 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
createPDF(File file)
Create PDF Filebyte[]
createPDFData()
Create PDF as Data arrayboolean
createPS(File file)
Create PostScript Fileboolean
createPS(OutputStream os)
Write PostScript to writervoid
createXLS(File outFile, Language language)
Create Excel filevoid
createXLSX(File outFile, Language language)
Create ExcelX fileboolean
createXML(File file)
Create XML Fileboolean
createXML(Writer writer)
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, String trxName)
Get Document Print Engine for Document Type.static ReportEngine
get(Properties ctx, ProcessInfo pi)
Get Report Engine for process infoint
getColumnCount()
Get Column CountFile
getCSV()
Create CSV file.File
getCSV(File file)
Create CSV file.Properties
getCtx()
Get PrintLayout (Report) ContextFile
getHTML()
Create HTML file.File
getHTML(File file)
Create HTML file.int
getLanguageID()
LayoutEngine
getLayout()
Get LayoutString
getName()
Get PrintFormat (Report) NameFile
getPDF()
Create PDF file.File
getPDF(File file)
Create PDF file.PrintData
getPrintData()
Get PrintDataString
getPrinterName()
Get Printer (name)MPrintFormat
getPrintFormat()
Get PrintFormatPrintInfo
getPrintInfo()
Get Print InfoMQuery
getQuery()
Get QueryString
getReportType()
int
getRowCount()
Get Row CountString
getWhereExtended()
int
getWindowNo()
File
getXLS()
Create XLS file.File
getXLS(File file)
Create XLS file.File
getXLSX()
Create XLSX file.File
getXLSX(File file)
Create XLSX file.boolean
isSummary()
void
pageSetupDialog()
Show Dialog and Set Paper Optionally re-calculate layoutvoid
print()
Print Reportstatic void
printConfirm(int type, int Record_ID)
Print Confirm.boolean
removeEventListener(IReportEngineEventListener listener)
void
setLanguageID(int languageID)
void
setPrintData(PrintData printData)
Set PrintDatavoid
setPrinterName(String printerName)
Set Printer (name)void
setPrintFormat(MPrintFormat pf)
Set PrintFormat.void
setQuery(MQuery query)
Set Query and generate PrintData.void
setReportType(String type)
void
setSummary(boolean summary)
void
setWhereExtended(String whereExtended)
void
setWindowNo(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:
attributeUpdate
in 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
-
-
-