use of com.axelor.apps.bankpayment.db.BankReconciliationLine in project axelor-open-suite by axelor.
the class BankReconciliationLineService method createBankReconciliationLine.
public BankReconciliationLine createBankReconciliationLine(LocalDate effectDate, BigDecimal debit, BigDecimal credit, String name, String reference, BankStatementLine bankStatementLine, MoveLine moveLine) {
BankReconciliationLine bankReconciliationLine = new BankReconciliationLine();
bankReconciliationLine.setEffectDate(effectDate);
bankReconciliationLine.setDebit(debit);
bankReconciliationLine.setCredit(credit);
bankReconciliationLine.setName(name);
bankReconciliationLine.setReference(reference);
bankReconciliationLine.setBankStatementLine(bankStatementLine);
bankReconciliationLine.setMoveLine(moveLine);
bankReconciliationLine.setIsPosted(false);
return bankReconciliationLine;
}
use of com.axelor.apps.bankpayment.db.BankReconciliationLine in project axelor-open-suite by axelor.
the class BankReconciliationValidateService method validate.
@Transactional(rollbackOn = { Exception.class })
public void validate(BankReconciliation bankReconciliation) throws AxelorException {
for (BankReconciliationLine bankReconciliationLine : bankReconciliation.getBankReconciliationLineList()) {
if (!bankReconciliationLine.getIsPosted()) {
if (bankReconciliationLine.getMoveLine() == null && bankReconciliationLine.getAccount() != null) {
this.validate(bankReconciliationLine);
} else if (bankReconciliationLine.getMoveLine() != null) {
bankReconciliationLineService.checkAmount(bankReconciliationLine);
updateBankReconciledAmounts(bankReconciliationLine);
}
}
}
bankReconciliation.setStatusSelect(BankReconciliationRepository.STATUS_VALIDATED);
bankReconciliation.setValidatedByUser(AuthUtils.getUser());
bankReconciliation.setValidatedDate(Beans.get(AppBaseService.class).getTodayDate(bankReconciliation.getCompany()));
bankReconciliationRepository.save(bankReconciliation);
}
use of com.axelor.apps.bankpayment.db.BankReconciliationLine in project axelor-open-suite by axelor.
the class BankReconciliationController method validateMultipleReconcile.
public void validateMultipleReconcile(ActionRequest request, ActionResponse response) {
try {
Context context = request.getContext();
Map<String, Object> bankReconciliationContext = (Map<String, Object>) context.get("_bankReconciliation");
BankReconciliation bankReconciliation = Beans.get(BankReconciliationRepository.class).find(((Integer) bankReconciliationContext.get("id")).longValue());
List<HashMap<String, Object>> moveLinesToReconcileContext = (List<HashMap<String, Object>>) context.get("toReconcileMoveLineSet");
Map<String, Object> selectedBankReconciliationLineContext = (Map<String, Object>) context.get("_selectedBankReconciliationLine");
BankReconciliationLine bankReconciliationLine = Beans.get(BankReconciliationLineRepository.class).find(((Integer) selectedBankReconciliationLineContext.get("id")).longValue());
Beans.get(BankReconciliationValidateService.class).validateMultipleBankReconciles(bankReconciliation, bankReconciliationLine, moveLinesToReconcileContext);
response.setCanClose(true);
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.bankpayment.db.BankReconciliationLine in project axelor-open-suite by axelor.
the class BankReconciliationService method compute.
@Transactional
public void compute(BankReconciliation bankReconciliation) {
BigDecimal totalPaid = BigDecimal.ZERO;
BigDecimal totalCashed = BigDecimal.ZERO;
for (BankReconciliationLine bankReconciliationLine : bankReconciliation.getBankReconciliationLineList()) {
totalPaid = totalPaid.add(bankReconciliationLine.getDebit());
totalCashed = totalCashed.add(bankReconciliationLine.getCredit());
}
bankReconciliation.setTotalPaid(totalPaid);
bankReconciliation.setTotalCashed(totalCashed);
Account cashAccount = bankReconciliation.getCashAccount();
if (cashAccount != null) {
bankReconciliation.setAccountBalance(accountService.computeBalance(cashAccount, AccountService.BALANCE_TYPE_DEBIT_BALANCE));
}
bankReconciliation.setComputedBalance(bankReconciliation.getAccountBalance().add(totalCashed).subtract(totalPaid));
}
Aggregations