Class ReportEngine

  • All Implemented Interfaces:
    PrintServiceAttributeListener

    public class ReportEngine
    extends Object
    implements 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
    • Constructor Detail

      • ReportEngine

        public ReportEngine​(Properties ctx,
                            MPrintFormat pf,
                            MQuery query,
                            PrintInfo info)
        Constructor
        Parameters:
        ctx - context
        pf - Print Format
        query - Optional Query
        info - 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,
                            boolean isSummary,
                            String trxName)
        Constructor
        Parameters:
        ctx - context
        pf - Print Format
        query - Optional Query
        info - print info
        isSummary -
        trxName -
    • Method Detail

      • 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
      • 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 - file
        onlyTable - if false create complete HTML document
        language - 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 - file
        onlyTable - if false create complete HTML document
        language - optional language - if null the default language is used to format nubers/dates
        extension - 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 - writer
        onlyTable - if false create complete HTML document
        language - 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 - writer
        onlyTable - if false create complete HTML document
        language - optional language - if null numbers/dates are not formatted
        extension - 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 - writer
        onlyTable - if false create complete HTML document
        language - optional language - if null numbers/dates are not formatted
        extension - optional extension for html output
        isExport - 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 - file
        delimiter - delimiter, e.g. comma, tab
        language - translation language
        Returns:
        true if success
      • createCSV

        public boolean createCSV​(Writer writer,
                                 char delimiter,
                                 Language language)
        Write CSV to writer
        Parameters:
        writer - writer
        delimiter - delimiter, e.g. comma, tab
        language - 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
      • getPDF

        public File getPDF​(File file)
        Create PDF file.
        Parameters:
        file - file
        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
      • getCSV

        public File getCSV​(File file)
        Create CSV file.
        Parameters:
        file - file
        Returns:
        CSV file
      • getXLS

        public File getXLS()
        Create XLS file. (created in temporary storage)
        Returns:
        XLS file
      • getXLS

        public File getXLS​(File file)
        Create XLS file.
        Parameters:
        file - file
        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 file
        language -
        Throws:
        Exception - if error
      • createXLSX

        public void createXLSX​(File outFile,
                               Language language)
                        throws Exception
        Create ExcelX file
        Parameters:
        outFile - output file
        language -
        Throws:
        Exception - if error
      • get

        public static ReportEngine get​(Properties ctx,
                                       ProcessInfo pi)
        Get Report Engine for process info
        Parameters:
        ctx - context
        pi - 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 - context
        type - document type
        Record_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 - context
        type - document type
        Record_ID - id
        trxName -
        Returns:
        Report Engine or null
      • printConfirm

        public static void printConfirm​(int type,
                                        int Record_ID)
        Print Confirm. Update Date Printed
        Parameters:
        type - document type
        Record_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 -