org.ofbiz.accounting.util
Class UtilAccounting

java.lang.Object
  extended by org.ofbiz.accounting.util.UtilAccounting

public class UtilAccounting
extends java.lang.Object


Field Summary
static java.lang.String module
           
 
Constructor Summary
UtilAccounting()
           
 
Method Summary
static java.lang.String getDefaultAccountId(java.lang.String glAccountTypeId, java.lang.String organizationPartyId, Delegator delegator)
          As above, but explicitly looking for default account for given type and organization
static java.util.List<java.lang.String> getDescendantGlAccountClassIds(GenericValue glAccountClass)
           
static java.math.BigDecimal getNetBalance(GenericValue account)
           
static java.math.BigDecimal getNetBalance(GenericValue account, java.lang.String debugModule)
          Little method to figure out the net or ending balance of a GlAccountHistory or GlAccountAndHistory value, based on what kind of account (DEBIT or CREDIT) it is
static java.lang.String getProductOrgGlAccountId(java.lang.String productId, java.lang.String glAccountTypeId, java.lang.String organizationPartyId, Delegator delegator)
          Get the GL Account for a product or the default account type based on input.
static boolean isAccountClass(GenericValue glAccount, java.lang.String glAccountClassId)
          Checks if a GL account is of a specified GlAccountClass.glAccountClassId.
static boolean isAccountClassClass(GenericValue glAccountClass, java.lang.String parentGlAccountClassId)
          Determines if a glAccountClass is of a child of a certain parent glAccountClass.
static boolean isAssetAccount(GenericValue account)
           
static boolean isCreditAccount(GenericValue account)
           
static boolean isDebitAccount(GenericValue account)
           
static boolean isDisbursement(GenericValue payment)
           
static boolean isEquityAccount(GenericValue account)
           
static boolean isExpenseAccount(GenericValue account)
           
static boolean isIncomeAccount(GenericValue account)
           
static boolean isInvoiceType(GenericValue invoice, java.lang.String inputTypeId)
          Checks if a invoice is of a specified InvoiceType.invoiceTypeId.
static boolean isLiabilityAccount(GenericValue account)
           
static boolean isPaymentType(GenericValue payment, java.lang.String inputTypeId)
          Checks if a payment is of a specified PaymentType.paymentTypeId.
static boolean isPurchaseInvoice(GenericValue invoice)
           
static boolean isReceipt(GenericValue payment)
           
static boolean isRevenueAccount(GenericValue account)
           
static boolean isSalesInvoice(GenericValue invoice)
           
static boolean isTaxPayment(GenericValue payment)
           
static boolean isTemplate(GenericValue invoice)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

module

public static java.lang.String module
Constructor Detail

UtilAccounting

public UtilAccounting()
Method Detail

getProductOrgGlAccountId

public static java.lang.String getProductOrgGlAccountId(java.lang.String productId,
                                                        java.lang.String glAccountTypeId,
                                                        java.lang.String organizationPartyId,
                                                        Delegator delegator)
                                                 throws AccountingException
Get the GL Account for a product or the default account type based on input. This replaces the simple-method service getProductOrgGlAccount. First it will look in ProductGlAccount using the primary keys productId and productGlAccountTypeId. If none is found, it will look up GlAccountTypeDefault to find the default account for organizationPartyId with type glAccountTypeId.

Parameters:
productId - When searching for ProductGlAccounts, specify the productId
glAccountTypeId - The default glAccountTypeId to look for if no ProductGlAccount is found
organizationPartyId - The organization party of the default account
Returns:
The account ID (glAccountId) found
Throws:
AccountingException - When the no accounts found or an entity exception occurs

getDefaultAccountId

public static java.lang.String getDefaultAccountId(java.lang.String glAccountTypeId,
                                                   java.lang.String organizationPartyId,
                                                   Delegator delegator)
                                            throws AccountingException
As above, but explicitly looking for default account for given type and organization

Parameters:
glAccountTypeId - The type of account
organizationPartyId - The organization of the account
Returns:
The default account ID (glAccountId) for this type
Throws:
AccountingException - When the default is not configured

getNetBalance

public static java.math.BigDecimal getNetBalance(GenericValue account,
                                                 java.lang.String debugModule)
Little method to figure out the net or ending balance of a GlAccountHistory or GlAccountAndHistory value, based on what kind of account (DEBIT or CREDIT) it is

Parameters:
account - - GlAccountHistory or GlAccountAndHistory value
Returns:
balance - a BigDecimal

getNetBalance

public static java.math.BigDecimal getNetBalance(GenericValue account)
                                          throws GenericEntityException
Throws:
GenericEntityException

getDescendantGlAccountClassIds

public static java.util.List<java.lang.String> getDescendantGlAccountClassIds(GenericValue glAccountClass)
                                                                       throws GenericEntityException
Throws:
GenericEntityException

isPaymentType

public static boolean isPaymentType(GenericValue payment,
                                    java.lang.String inputTypeId)
                             throws GenericEntityException
Checks if a payment is of a specified PaymentType.paymentTypeId. Return false if payment is null. It's better to use the more specific calls like isTaxPayment().

Throws:
GenericEntityException

isTaxPayment

public static boolean isTaxPayment(GenericValue payment)
                            throws GenericEntityException
Throws:
GenericEntityException

isDisbursement

public static boolean isDisbursement(GenericValue payment)
                              throws GenericEntityException
Throws:
GenericEntityException

isReceipt

public static boolean isReceipt(GenericValue payment)
                         throws GenericEntityException
Throws:
GenericEntityException

isAccountClassClass

public static boolean isAccountClassClass(GenericValue glAccountClass,
                                          java.lang.String parentGlAccountClassId)
                                   throws GenericEntityException
Determines if a glAccountClass is of a child of a certain parent glAccountClass.

Throws:
GenericEntityException

isAccountClass

public static boolean isAccountClass(GenericValue glAccount,
                                     java.lang.String glAccountClassId)
                              throws GenericEntityException
Checks if a GL account is of a specified GlAccountClass.glAccountClassId. Returns false if account is null. It's better to use the more specific calls like isDebitAccount().

Throws:
GenericEntityException

isDebitAccount

public static boolean isDebitAccount(GenericValue account)
                              throws GenericEntityException
Throws:
GenericEntityException

isCreditAccount

public static boolean isCreditAccount(GenericValue account)
                               throws GenericEntityException
Throws:
GenericEntityException

isAssetAccount

public static boolean isAssetAccount(GenericValue account)
                              throws GenericEntityException
Throws:
GenericEntityException

isLiabilityAccount

public static boolean isLiabilityAccount(GenericValue account)
                                  throws GenericEntityException
Throws:
GenericEntityException

isEquityAccount

public static boolean isEquityAccount(GenericValue account)
                               throws GenericEntityException
Throws:
GenericEntityException

isIncomeAccount

public static boolean isIncomeAccount(GenericValue account)
                               throws GenericEntityException
Throws:
GenericEntityException

isRevenueAccount

public static boolean isRevenueAccount(GenericValue account)
                                throws GenericEntityException
Throws:
GenericEntityException

isExpenseAccount

public static boolean isExpenseAccount(GenericValue account)
                                throws GenericEntityException
Throws:
GenericEntityException

isInvoiceType

public static boolean isInvoiceType(GenericValue invoice,
                                    java.lang.String inputTypeId)
                             throws GenericEntityException
Checks if a invoice is of a specified InvoiceType.invoiceTypeId. Return false if invoice is null. It's better to use more specific calls like isPurchaseInvoice().

Throws:
GenericEntityException

isPurchaseInvoice

public static boolean isPurchaseInvoice(GenericValue invoice)
                                 throws GenericEntityException
Throws:
GenericEntityException

isSalesInvoice

public static boolean isSalesInvoice(GenericValue invoice)
                              throws GenericEntityException
Throws:
GenericEntityException

isTemplate

public static boolean isTemplate(GenericValue invoice)
                          throws GenericEntityException
Throws:
GenericEntityException