當前位置: 首頁>>代碼示例>>Java>>正文


Java FinAccountHelper類代碼示例

本文整理匯總了Java中org.ofbiz.order.finaccount.FinAccountHelper的典型用法代碼示例。如果您正苦於以下問題:Java FinAccountHelper類的具體用法?Java FinAccountHelper怎麽用?Java FinAccountHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FinAccountHelper類屬於org.ofbiz.order.finaccount包,在下文中一共展示了FinAccountHelper類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testCreateFinAccountBasic

import org.ofbiz.order.finaccount.FinAccountHelper; //導入依賴的package包/類
public void testCreateFinAccountBasic() throws Exception {
    String finAccountCode;
    GenericValue account;

    finAccountCode = FinAccountHelper.getNewFinAccountCode(20, delegator);
    System.err.printf("finAccountCode=%s\n", finAccountCode);
    assertNotNull(finAccountCode);

    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNull(account);

    delegator.createSetNextSeqId(delegator.makeValue("FinAccount", UtilMisc.toMap("finAccountCode", finAccountCode)));

    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode.toUpperCase(), delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode.toLowerCase(), delegator);
    assertNotNull(account);
    assertEquals(finAccountCode, account.get("finAccountCode"));

    delegator.createSetNextSeqId(delegator.makeValue("FinAccount", UtilMisc.toMap("finAccountCode", finAccountCode)));
    account = FinAccountHelper.getFinAccountFromCode(finAccountCode, delegator);
    assertNull(account);
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:28,代碼來源:FinAccountTest.java

示例2: checkFinAccountStatus

import org.ofbiz.order.finaccount.FinAccountHelper; //導入依賴的package包/類
public static Map<String, Object> checkFinAccountStatus(DispatchContext dctx, Map<String, Object> context) {
    Delegator delegator = dctx.getDelegator();
    String finAccountId = (String) context.get("finAccountId");
    Locale locale = (Locale) context.get("locale");

    if (finAccountId == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale));
    }

    GenericValue finAccount;
    try {
        finAccount = EntityQuery.use(delegator).from("FinAccount").where("finAccountId", finAccountId).queryOne();
    } catch (GenericEntityException ex) {
        return ServiceUtil.returnError(ex.getMessage());
    }

    if (finAccount != null) {
        String statusId = finAccount.getString("statusId");
        if (statusId == null) statusId = "FNACT_ACTIVE";

        BigDecimal balance = finAccount.getBigDecimal("actualBalance");
        if (balance == null) {
            balance = FinAccountHelper.ZERO;
        }

        Debug.logInfo("Account #" + finAccountId + " Balance: " + balance + " Status: " + statusId, module);

        if ("FNACT_ACTIVE".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
            finAccount.set("statusId", "FNACT_MANFROZEN");
            Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + balance + "] (Frozen)", module);
        } else if ("FNACT_MANFROZEN".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
            finAccount.set("statusId", "FNACT_ACTIVE");
            Debug.logInfo("Financial account [" + finAccountId + "] has been made current [" + balance + "] (Un-Frozen)", module);
        }
        try {
            finAccount.store();
        } catch (GenericEntityException e) {
            return ServiceUtil.returnError(e.getMessage());
        }
    }

    return ServiceUtil.returnSuccess();
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:45,代碼來源:FinAccountServices.java

示例3: checkFinAccountStatus

import org.ofbiz.order.finaccount.FinAccountHelper; //導入依賴的package包/類
public static Map<String, Object> checkFinAccountStatus(DispatchContext dctx, Map<String, Object> context) {
    Delegator delegator = dctx.getDelegator();
    String finAccountId = (String) context.get("finAccountId");
    Locale locale = (Locale) context.get("locale");

    if (finAccountId == null) {
        return ServiceUtil.returnError(UtilProperties.getMessage(resourceError, 
                "AccountingFinAccountNotFound", UtilMisc.toMap("finAccountId", ""), locale));
    }

    GenericValue finAccount;
    try {
        finAccount = delegator.findOne("FinAccount", UtilMisc.toMap("finAccountId", finAccountId), false);
    } catch (GenericEntityException ex) {
        return ServiceUtil.returnError(ex.getMessage());
    }

    if (finAccount != null) {
        String statusId = finAccount.getString("statusId");
        if (statusId == null) statusId = "FNACT_ACTIVE";

        BigDecimal balance = finAccount.getBigDecimal("actualBalance");
        if (balance == null) {
            balance = FinAccountHelper.ZERO;
        }

        Debug.logInfo("Account #" + finAccountId + " Balance: " + balance + " Status: " + statusId, module);

        if ("FNACT_ACTIVE".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) < 1) {
            finAccount.set("statusId", "FNACT_MANFROZEN");
            Debug.logInfo("Financial account [" + finAccountId + "] has passed its threshold [" + balance + "] (Frozen)", module);
        } else if ("FNACT_MANFROZEN".equals(statusId) && balance.compareTo(FinAccountHelper.ZERO) > 0) {
            finAccount.set("statusId", "FNACT_ACTIVE");
            Debug.logInfo("Financial account [" + finAccountId + "] has been made current [" + balance + "] (Un-Frozen)", module);
        }
        try {
            finAccount.store();
        } catch (GenericEntityException e) {
            return ServiceUtil.returnError(e.getMessage());
        }
    }

    return ServiceUtil.returnSuccess();
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:45,代碼來源:FinAccountServices.java

示例4: getGiftCertSettingFromStore

import org.ofbiz.order.finaccount.FinAccountHelper; //導入依賴的package包/類
/**
 * Returns ProductStoreFinActSetting based on cart's productStoreId and FinAccountHelper's defined giftCertFinAcctTypeId
 * @param delegator the delegator
 * @return returns ProductStoreFinActSetting based on cart's productStoreId 
 * @throws GenericEntityException
 */
public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException {
    return EntityQuery.use(delegator).from("ProductStoreFinActSetting").where("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId).cache().queryOne();
}
 
開發者ID:ilscipio,項目名稱:scipio-erp,代碼行數:10,代碼來源:ShoppingCart.java

示例5: getGiftCertSettingFromStore

import org.ofbiz.order.finaccount.FinAccountHelper; //導入依賴的package包/類
/**
 * Returns ProductStoreFinActSetting based on cart's productStoreId and FinAccountHelper's defined giftCertFinAcctTypeId
 * @param delegator the delegator
 * @return returns ProductStoreFinActSetting based on cart's productStoreId 
 * @throws GenericEntityException
 */
public GenericValue getGiftCertSettingFromStore(Delegator delegator) throws GenericEntityException {
    return delegator.findOne("ProductStoreFinActSetting", UtilMisc.toMap("productStoreId", getProductStoreId(), "finAccountTypeId", FinAccountHelper.giftCertFinAccountTypeId), true);
}
 
開發者ID:gildaslemoal,項目名稱:elpi,代碼行數:10,代碼來源:ShoppingCart.java


注:本文中的org.ofbiz.order.finaccount.FinAccountHelper類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。