Package org.apache.ofbiz.accounting.util
Class UtilAccounting
- java.lang.Object
-
- org.apache.ofbiz.accounting.util.UtilAccounting
-
public final class UtilAccounting extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
module
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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 organizationstatic java.util.List<java.lang.String>
getDescendantGlAccountClassIds(GenericValue glAccountClass)
static java.math.BigDecimal
getGlExchangeRateOfOutgoingPayment(GenericValue paymentApplication)
static java.math.BigDecimal
getGlExchangeRateOfPurchaseInvoice(GenericValue paymentApplication)
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)
-
-
-
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 productIdglAccountTypeId
- The default glAccountTypeId to look for if no ProductGlAccount is foundorganizationPartyId
- 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 accountorganizationPartyId
- The organization of the account- Returns:
- The default account ID (glAccountId) for this type
- Throws:
AccountingException
- When the default is not configured
-
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
-
getGlExchangeRateOfPurchaseInvoice
public static java.math.BigDecimal getGlExchangeRateOfPurchaseInvoice(GenericValue paymentApplication) throws GenericEntityException
- Throws:
GenericEntityException
-
getGlExchangeRateOfOutgoingPayment
public static java.math.BigDecimal getGlExchangeRateOfOutgoingPayment(GenericValue paymentApplication) throws GenericEntityException
- Throws:
GenericEntityException
-
-