Package org.apache.ofbiz.accounting.util
Class UtilAccounting
java.lang.Object
org.apache.ofbiz.accounting.util.UtilAccounting
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
getDefaultAccountId
(String glAccountTypeId, String organizationPartyId, Delegator delegator) As above, but explicitly looking for default account for given type and organizationgetDescendantGlAccountClassIds
(GenericValue glAccountClass) static BigDecimal
getGlExchangeRateOfOutgoingPayment
(GenericValue paymentApplication) static BigDecimal
getGlExchangeRateOfPurchaseInvoice
(GenericValue paymentApplication) static String
getProductOrgGlAccountId
(String productId, String glAccountTypeId, String organizationPartyId, Delegator delegator) Get the GL Account for a product or the default account type based on input.static boolean
isAccountClass
(GenericValue glAccount, String glAccountClassId) Checks if a GL account is of a specified GlAccountClass.glAccountClassId.static boolean
isAccountClassClass
(GenericValue glAccountClass, 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, String inputTypeId) Checks if a invoice is of a specified InvoiceType.invoiceTypeId.static boolean
isLiabilityAccount
(GenericValue account) static boolean
isPaymentType
(GenericValue payment, 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 Details
-
getProductOrgGlAccountId
public static String getProductOrgGlAccountId(String productId, String glAccountTypeId, 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 String getDefaultAccountId(String glAccountTypeId, 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 List<String> getDescendantGlAccountClassIds(GenericValue glAccountClass) throws GenericEntityException - Throws:
GenericEntityException
-
isPaymentType
public static boolean isPaymentType(GenericValue payment, 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
- Throws:
GenericEntityException
-
isDisbursement
- Throws:
GenericEntityException
-
isReceipt
- Throws:
GenericEntityException
-
isAccountClassClass
public static boolean isAccountClassClass(GenericValue glAccountClass, 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, 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
- Throws:
GenericEntityException
-
isCreditAccount
- Throws:
GenericEntityException
-
isAssetAccount
- Throws:
GenericEntityException
-
isLiabilityAccount
- Throws:
GenericEntityException
-
isEquityAccount
- Throws:
GenericEntityException
-
isIncomeAccount
- Throws:
GenericEntityException
-
isRevenueAccount
- Throws:
GenericEntityException
-
isExpenseAccount
- Throws:
GenericEntityException
-
isInvoiceType
public static boolean isInvoiceType(GenericValue invoice, 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
- Throws:
GenericEntityException
-
isSalesInvoice
- Throws:
GenericEntityException
-
isTemplate
- Throws:
GenericEntityException
-
getGlExchangeRateOfPurchaseInvoice
public static BigDecimal getGlExchangeRateOfPurchaseInvoice(GenericValue paymentApplication) throws GenericEntityException - Throws:
GenericEntityException
-
getGlExchangeRateOfOutgoingPayment
public static BigDecimal getGlExchangeRateOfOutgoingPayment(GenericValue paymentApplication) throws GenericEntityException - Throws:
GenericEntityException
-