for (Account acc : accounts) { AccountInChart accInChart = new AccountInChart(); accInChart.setItsId(acc.getItsId()); accInChart.setItsName(acc.getItsName()); accInChart.setItsNumber(acc.getItsNumber()); accInChart.setDescription(acc.getDescription()); accInChart.setItsType(acc.getItsType()); accInChart.setNormalBalanceType(acc.getNormalBalanceType()); if (acc.getSubaccType() == null) { accountsInChart.add(accInChart); } else {
/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final Account createEntity( final Map<String, Object> pAddParam) throws Exception { Account entity = new Account(); addTypeCodeIntoAttrs(pAddParam); entity.setIsNew(true); return entity; }
final Account pEntity, final boolean isEntityDetached) throws Exception { if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); } else { Account oldAcc = getSrvOrm().retrieveEntityById(Account.class, pEntity.getItsId()); if (!oldAcc.getIsCreatedByUser() && (!pEntity.getItsType().equals(oldAcc.getItsType()) || !pEntity .getNormalBalanceType().equals(oldAcc.getNormalBalanceType()))) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "account_cant_be_changed"); pEntity.setSubaccounts(getSrvOrm() .retrieveEntityOwnedlist(SubaccountLine.class, pEntity)); if (pEntity.getSubaccType() == null && pEntity.getSubaccounts().size() > 0) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_paramaters"); if (pEntity.getSubaccType() != null && pEntity.getSubaccounts() .size() > 0 && !pEntity.getSubaccType().equals(pEntity .getSubaccounts().get(0).getSubaccType())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_paramaters");
.evalDatePeriodStartFor(pAddParam, pDate1).getTime())); query = query.replace(":DATE1", String.valueOf(pDate1.getTime())); query = query.replace(":ACCID", "'" + pAccount.getItsId() + "'"); String whereSubaccDebit = ""; String whereSubaccCredit = ""; .getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings(pAddParam).getRoundingMode())); if (pAccount.getNormalBalanceType() == ENormalBalanceType.DEBIT) { lpl.setBalance(lpl.getDebit().subtract(lpl.getCredit())); } else { if (pAccount.getNormalBalanceType() == ENormalBalanceType.DEBIT) { result.setBalanceAcc(result.getDebitAcc() .subtract(result.getCreditAcc()));
&& pEntity.getAccDebit().getItsId().equals("Inventory") || pEntity.getAccCredit() != null && pEntity.getAccCredit().getItsId().equals("Inventory")) && pEntity.getDebit().compareTo(bdre) > 0 || pEntity.getCredit().compareTo(bdre) > 0) { if (pEntity.getAccCredit().getSubaccType() != null && pEntity.getSubaccCreditId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, if (pEntity.getAccDebit().getSubaccType() != null && pEntity.getSubaccDebitId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PrepaymentTo pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } }
try { String accCashStr = pRequestData.getParameter("accCash"); accCash = new Account(); accCash.setItsId(accCashStr); accCash = getSrvOrm().retrieveEntity(pReqVars, accCash); if (accCash == null) { corAcc = new Account(); corAcc.setItsId(corAccStr); corAcc = getSrvOrm().retrieveEntity(pReqVars, corAcc); if (corAcc == null) { throw new Exception("cant_find_account"); if (corAcc.getSubaccType() != null) { subcorAcc = pRequestData.getParameter("subcorAcc"); String subcorAccTypeStr = pRequestData.getParameter("subcorAccType");
/** * <p>Delete entity from DB.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void deleteEntity(final Map<String, Object> pAddParam, final Account pEntity) throws Exception { deleteEntity(pAddParam, pEntity.getItsId()); }
/** * <p>Create entity.</p> * @param pAddParam additional param * @return entity instance * @throws Exception - an exception **/ @Override public final SubaccountLine createEntity( final Map<String, Object> pAddParam) throws Exception { SubaccountLine entity = new SubaccountLine(); entity.setIsNew(true); Account itsOwner = new Account(); entity.setItsOwner(itsOwner); addTypeCodeIntoAttrs(pAddParam); addAccSettingsIntoAttrs(pAddParam); return entity; }
String.valueOf(getSrvBalance().evalDatePeriodStartFor(pDate1).getTime())); query = query.replace(":DATE1", String.valueOf(pDate1.getTime())); query = query.replace(":ACCID", "'" + pAccount.getItsId() + "'"); String whereSubaccDebit = ""; String whereSubaccCredit = ""; .getCostPrecision(), getSrvAccSettings() .lazyGetAccSettings().getRoundingMode())); if (pAccount.getNormalBalanceType() == ENormalBalanceType.DEBIT) { lpl.setBalance(lpl.getDebit().subtract(lpl.getCredit())); } else { if (pAccount.getNormalBalanceType() == ENormalBalanceType.DEBIT) { result.setBalanceAcc(result.getDebitAcc() .subtract(result.getCreditAcc()));
/** * <p>Insert immutable line into DB.</p> * @param pAddParam additional param * @param pEntity entity * @param isEntityDetached ignored * @throws Exception - an exception **/ @Override public final void saveEntity(final Map<String, Object> pAddParam, final SubaccountLine pEntity, final boolean isEntityDetached) throws Exception { Account itsOwner = getSrvOrm().retrieveEntityById( Account.class, pEntity.getItsOwner().getItsId()); pEntity.setItsOwner(itsOwner); if (!pEntity.getSubaccType().equals(pEntity .getItsOwner().getSubaccType())) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "wrong_paramaters"); } if (pEntity.getIsNew()) { getSrvOrm().insertEntity(pEntity); registerSubaccountUsedIfExist(pEntity.getSubaccType(), pEntity.getSubaccId()); } else { getSrvOrm().updateEntity(pEntity); } }
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @param pRequestData Request Data * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PrepaymentFrom pEntity, final IRequestData pRequestData) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pAddParam, pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } }
/** * <p>Refresh entity from DB by given entity with ID.</p> * @param pEntity entity * @return entity or null * @throws Exception - an exception **/ @Override public final Account retrieveEntity(final Map<String, Object> pAddParam, final Account pEntity) throws Exception { addTypeCodeIntoAttrs(pAddParam); addAccSettingsIntoAttrs(pAddParam); return getSrvOrm().retrieveEntityById(this.entityClass, pEntity.getItsId()); }
for (Account acc : accounts) { AccountInChart accInChart = new AccountInChart(); accInChart.setItsId(acc.getItsId()); accInChart.setItsName(acc.getItsName()); accInChart.setItsNumber(acc.getItsNumber()); accInChart.setDescription(acc.getDescription()); accInChart.setItsType(acc.getItsType()); accInChart.setNormalBalanceType(acc.getNormalBalanceType()); if (acc.getSubaccType() == null) { accountsInChart.add(accInChart); } else {
String.valueOf(pDate1.getTime())); query = query.replace(":DATE2", String.valueOf(pDate2.getTime())); query = query.replace(":ACCID", "'" + pAccount.getItsId() + "'"); String whereSubaccDebit = ""; String whereSubaccCredit = ""; result.getSubaccCreditTotal().get(ldl.getSubaccName()) .add(ldl.getCredit())); if (pAccount.getNormalBalanceType() == ENormalBalanceType.DEBIT) { result.getSubaccBalanceTotal().put(ldl.getSubaccName(), result.getSubaccDebitTotal().get(ldl.getSubaccName())
Account accDebit = new Account(); accDebit.setItsId(accDebitId); accEntry.setAccDebit(accDebit); accEntry.setSubaccDebitType(recordSet.getInteger("SUBACCDEBITTYPE")); .lazyGetAccSettings(pAddParam).getRoundingMode())); String accCreditId = recordSet.getString("ACCCREDIT"); Account accCredit = new Account(); accCredit.setItsId(accCreditId); accEntry.setAccCredit(accCredit); accEntry
&& pEntity.getAccDebit().getItsId().equals("Inventory")) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "account_must_not_be_inventory"); && pEntity.getAccCredit().getItsId().equals("Inventory")) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "account_must_not_be_inventory"); if (pEntity.getAccCredit().getSubaccType() != null && pEntity.getSubaccCreditId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, if (pEntity.getAccDebit().getSubaccType() != null && pEntity.getSubaccDebitId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER,
/** * <p>Make save preparations before insert/update block if it's need.</p> * @param pAddParam additional param * @param pEntity entity * @throws Exception - an exception **/ @Override public final void makeFirstPrepareForSave(final Map<String, Object> pAddParam, final PrepaymentFrom pEntity) throws Exception { //BeigeORM refresh: pEntity.setAccCash(getSrvOrm() .retrieveEntity(pEntity.getAccCash())); if (pEntity.getAccCash().getSubaccType() != null && pEntity.getSubaccCashId() == null) { throw new ExceptionWithCode(ExceptionWithCode.WRONG_PARAMETER, "select_subaccount"); } }