Class InvoiceGenerator


  • class InvoiceGenerator
    extends java.lang.Object
    Helper class for generation of HTML/TXT invoices.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      (package private) class  InvoiceGenerator.ProjectRow
      Comparable object representing one project in the summary on invoice.
      (package private) class  InvoiceGenerator.TaskRow
      Comparable object representing one task in the summary on invoice.
    • Constructor Summary

      Constructors 
      Constructor Description
      InvoiceGenerator​(java.io.File outputFile, java.lang.String title, java.lang.String userDetails, java.lang.String customerDetails, java.lang.String paymentDetails, java.lang.Integer dueDays, java.lang.Double price, java.lang.String currency, java.lang.Double tax, java.lang.String rowsRepresent, java.util.Vector days, java.util.Vector selectFilters)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      private java.util.Vector filterTasks​(java.util.Vector tasks)
      Filters given vector of tasks trough all used filters and returns vector of tasks satisfying all filters.
      (package private) void generateInvoice()
      Generates invoice based on data provided in constructor of InvoiceGenerator class.
      private InvoiceGenerator.ProjectRow[] getProjectRows()
      Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates projects statistic (@see ProjectRow).
      private InvoiceGenerator.TaskRow[] getTaskRows()
      Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates its statistic (@see TaskRow).
      private void writeFooter​(java.io.OutputStreamWriter writer)  
      private void writeHeader​(java.io.OutputStreamWriter writer)  
      private void writeHTMLFooter​(java.io.OutputStreamWriter writer)  
      private void writeHTMLHeader​(java.io.OutputStreamWriter writer)  
      private void writeHTMLPaymentDetails​(java.io.OutputStreamWriter writer)  
      private void writeHTMLProjectsTasks​(java.io.OutputStreamWriter writer)  
      private void writeHTMLSubjects​(java.io.OutputStreamWriter writer)  
      private void writeHTMLTasks​(java.io.OutputStreamWriter writer)  
      private void writePaymentDetails​(java.io.OutputStreamWriter writer)  
      private void writeProjectsTasks​(java.io.OutputStreamWriter writer)  
      private void writeSubjects​(java.io.OutputStreamWriter writer)  
      private void writeTasks​(java.io.OutputStreamWriter writer)  
      private void writeTXTFooter​(java.io.OutputStreamWriter writer)  
      private void writeTXTHeader​(java.io.OutputStreamWriter writer)  
      private void writeTXTPaymentDetails​(java.io.OutputStreamWriter writer)  
      private void writeTXTProjectsTasks​(java.io.OutputStreamWriter writer)  
      private void writeTXTSubjects​(java.io.OutputStreamWriter writer)  
      private void writeTXTTasks​(java.io.OutputStreamWriter writer)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • file

        private java.io.File file
      • title

        private java.lang.String title
      • userDetails

        private java.lang.String userDetails
      • customerDetails

        private java.lang.String customerDetails
      • paymentDetails

        private java.lang.String paymentDetails
      • dueDays

        private java.lang.Integer dueDays
      • price

        private java.lang.Double price
      • currency

        private java.lang.String currency
      • tax

        private java.lang.Double tax
      • rowsRepresent

        private java.lang.String rowsRepresent
      • days

        private java.util.Vector days
      • selectFilters

        private java.util.Vector selectFilters
    • Constructor Detail

      • InvoiceGenerator

        InvoiceGenerator​(java.io.File outputFile,
                         java.lang.String title,
                         java.lang.String userDetails,
                         java.lang.String customerDetails,
                         java.lang.String paymentDetails,
                         java.lang.Integer dueDays,
                         java.lang.Double price,
                         java.lang.String currency,
                         java.lang.Double tax,
                         java.lang.String rowsRepresent,
                         java.util.Vector days,
                         java.util.Vector selectFilters)
    • Method Detail

      • generateInvoice

        void generateInvoice()
        Generates invoice based on data provided in constructor of InvoiceGenerator class.
      • writeHeader

        private void writeHeader​(java.io.OutputStreamWriter writer)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeSubjects

        private void writeSubjects​(java.io.OutputStreamWriter writer)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • writeProjectsTasks

        private void writeProjectsTasks​(java.io.OutputStreamWriter writer)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTasks

        private void writeTasks​(java.io.OutputStreamWriter writer)
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • writePaymentDetails

        private void writePaymentDetails​(java.io.OutputStreamWriter writer)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFooter

        private void writeFooter​(java.io.OutputStreamWriter writer)
                          throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLHeader

        private void writeHTMLHeader​(java.io.OutputStreamWriter writer)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLSubjects

        private void writeHTMLSubjects​(java.io.OutputStreamWriter writer)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLProjectsTasks

        private void writeHTMLProjectsTasks​(java.io.OutputStreamWriter writer)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLTasks

        private void writeHTMLTasks​(java.io.OutputStreamWriter writer)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLPaymentDetails

        private void writeHTMLPaymentDetails​(java.io.OutputStreamWriter writer)
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeHTMLFooter

        private void writeHTMLFooter​(java.io.OutputStreamWriter writer)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTHeader

        private void writeTXTHeader​(java.io.OutputStreamWriter writer)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTSubjects

        private void writeTXTSubjects​(java.io.OutputStreamWriter writer)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTProjectsTasks

        private void writeTXTProjectsTasks​(java.io.OutputStreamWriter writer)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTPaymentDetails

        private void writeTXTPaymentDetails​(java.io.OutputStreamWriter writer)
                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTFooter

        private void writeTXTFooter​(java.io.OutputStreamWriter writer)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTXTTasks

        private void writeTXTTasks​(java.io.OutputStreamWriter writer)
                            throws java.io.IOException
        Throws:
        java.io.IOException
      • getProjectRows

        private InvoiceGenerator.ProjectRow[] getProjectRows()
        Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates projects statistic (@see ProjectRow). Finally, sorts all entries according to user's preference.
        Returns:
        Sorted array of project rows to be included on the invoice.
      • getTaskRows

        private InvoiceGenerator.TaskRow[] getTaskRows()
        Processes all days in selected period and their tasks and for each non-idle, non-private (unless required) task calculates its statistic (@see TaskRow). Finally, sorts all entries according to user's preference.
        Returns:
        Sorted array of task rows to be included on the invoice.
      • filterTasks

        private java.util.Vector filterTasks​(java.util.Vector tasks)
        Filters given vector of tasks trough all used filters and returns vector of tasks satisfying all filters.
        Parameters:
        tasks - Vector of tasks to be filtered.
        Returns:
        Vector of tasks that satisfied all filters.