Class InvoiceServices


  • public class InvoiceServices
    extends java.lang.Object
    InvoiceServices - Services for creating invoices Note that throughout this file we use BigDecimal to do arithmetic. It is critical to understand the way BigDecimal works if you wish to modify the computations in this file. The most important things to keep in mind: Critically important: BigDecimal arithmetic methods like add(), multiply(), divide() do not modify the BigDecimal itself. Instead, they return a new BigDecimal. For example, to keep a running total of an amount, make sure you do this: amount = amount.add(subAmount); and not this, amount.add(subAmount); Use .setScale(scale, roundingMode) after every computation to scale and round off the decimals. Check the code to see how the scale and roundingMode are obtained and how the function is used. use .compareTo() to compare big decimals ex. (amountOne.compareTo(amountTwo) == 1) checks if amountOne is greater than amountTwo Use .signum() to test if value is negative, zero, or positive ex. (amountOne.signum() == 1) checks if the amount is a positive non-zero number Never use the .equals() function becaues it considers 2.0 not equal to 2.00 (the scale is different) Instead, use .compareTo() or .signum(), which handles scale correctly. For reference, check the official Sun Javadoc on java.math.BigDecimal.
    • Field Detail

      • module

        public static final java.lang.String module
    • Constructor Detail

      • InvoiceServices

        public InvoiceServices()
    • Method Detail

      • createInvoiceForOrderAllItems

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoiceForOrderAllItems​(DispatchContext dctx,
                                                                                                           java.util.Map<java.lang.String,​java.lang.Object> context)
      • createInvoiceForOrder

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoiceForOrder​(DispatchContext dctx,
                                                                                                   java.util.Map<java.lang.String,​java.lang.Object> context)
      • createCommissionInvoices

        public static java.util.Map<java.lang.String,​java.lang.Object> createCommissionInvoices​(DispatchContext dctx,
                                                                                                      java.util.Map<java.lang.String,​java.lang.Object> context)
      • readyInvoices

        public static java.util.Map<java.lang.String,​java.lang.Object> readyInvoices​(DispatchContext dctx,
                                                                                           java.util.Map<java.lang.String,​java.lang.Object> context)
      • createInvoicesFromShipment

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoicesFromShipment​(DispatchContext dctx,
                                                                                                        java.util.Map<java.lang.String,​java.lang.Object> context)
      • setInvoicesToReadyFromShipment

        public static java.util.Map<java.lang.String,​java.lang.Object> setInvoicesToReadyFromShipment​(DispatchContext dctx,
                                                                                                            java.util.Map<java.lang.String,​java.lang.Object> context)
      • createSalesInvoicesFromDropShipment

        public static java.util.Map<java.lang.String,​java.lang.Object> createSalesInvoicesFromDropShipment​(DispatchContext dctx,
                                                                                                                 java.util.Map<java.lang.String,​java.lang.Object> context)
      • createInvoicesFromShipments

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoicesFromShipments​(DispatchContext dctx,
                                                                                                         java.util.Map<java.lang.String,​? extends java.lang.Object> context)
      • createInvoicesFromReturnShipment

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoicesFromReturnShipment​(DispatchContext dctx,
                                                                                                              java.util.Map<java.lang.String,​java.lang.Object> context)
      • createInvoiceFromReturn

        public static java.util.Map<java.lang.String,​java.lang.Object> createInvoiceFromReturn​(DispatchContext dctx,
                                                                                                     java.util.Map<java.lang.String,​java.lang.Object> context)
      • checkInvoicePaymentApplications

        public static java.util.Map<java.lang.String,​java.lang.Object> checkInvoicePaymentApplications​(DispatchContext ctx,
                                                                                                             java.util.Map<java.lang.String,​java.lang.Object> context)
      • updatePaymentApplication

        public static java.util.Map<java.lang.String,​java.lang.Object> updatePaymentApplication​(DispatchContext dctx,
                                                                                                      java.util.Map<java.lang.String,​java.lang.Object> context)
        Service to add payment application records to indicate which invoices have been paid/received. For invoice processing, this service works on the invoice level when 'invoiceProcessing' parameter is set to "Y" else it works on the invoice item level.
      • updatePaymentApplicationDef

        public static java.util.Map<java.lang.String,​java.lang.Object> updatePaymentApplicationDef​(DispatchContext dctx,
                                                                                                         java.util.Map<java.lang.String,​java.lang.Object> context)
        Service to add payment application records to indicate which invoices have been paid/received. For invoice processing, this service works on the invoice level when 'invoiceProcessing' parameter is set to "Y" else it works on the invoice item level. This version will apply as much as possible when no amountApplied is provided.
      • updatePaymentApplicationDefBd

        public static java.util.Map<java.lang.String,​java.lang.Object> updatePaymentApplicationDefBd​(DispatchContext dctx,
                                                                                                           java.util.Map<java.lang.String,​java.lang.Object> context)
      • calculateInvoicedAdjustmentTotal

        public static java.util.Map<java.lang.String,​java.lang.Object> calculateInvoicedAdjustmentTotal​(DispatchContext dctx,
                                                                                                              java.util.Map<java.lang.String,​java.lang.Object> context)
      • checkPaymentInvoices

        public static java.util.Map<java.lang.String,​java.lang.Object> checkPaymentInvoices​(DispatchContext dctx,
                                                                                                  java.util.Map<java.lang.String,​java.lang.Object> context)
      • importInvoice

        public static java.util.Map<java.lang.String,​java.lang.Object> importInvoice​(DispatchContext dctx,
                                                                                           java.util.Map<java.lang.String,​java.lang.Object> context)