use of com.axelor.apps.bankpayment.db.BankReconciliation in project axelor-open-suite by axelor.
the class BankReconciliationCreateService method createAllFromBankStatement.
@Transactional(rollbackOn = { Exception.class })
public List<BankReconciliation> createAllFromBankStatement(BankStatement bankStatement) throws IOException {
List<BankReconciliation> bankReconciliationList = new ArrayList<>();
List<BankDetails> bankDetailsList = getDistinctBankDetails(bankStatement);
if (bankDetailsList == null) {
return bankReconciliationList;
}
LocalDate fromDate = bankStatement.getFromDate();
LocalDate toDate = bankStatement.getToDate();
for (BankDetails bankDetails : bankDetailsList) {
Company company = companyRepository.all().filter("?1 member of self.bankDetailsList", bankDetails).fetchOne();
Currency currency = bankDetails.getCurrency();
if (currency == null) {
currency = company.getCurrency();
}
BankReconciliation bankReconciliation = createBankReconciliation(company, fromDate, toDate, currency, bankDetails, bankStatement);
bankReconciliationRepository.save(bankReconciliation);
bankReconciliationList.add(bankReconciliation);
}
return bankReconciliationList;
}
use of com.axelor.apps.bankpayment.db.BankReconciliation in project axelor-open-suite by axelor.
the class BankReconciliationCreateService method createBankReconciliation.
public BankReconciliation createBankReconciliation(Company company, LocalDate fromDate, LocalDate toDate, Currency currency, BankDetails bankDetails, BankStatement bankStatement) throws IOException {
BankReconciliation bankReconciliation = new BankReconciliation();
bankReconciliation.setCompany(company);
bankReconciliation.setFromDate(fromDate);
bankReconciliation.setToDate(toDate);
bankReconciliation.setCurrency(currency);
bankReconciliation.setBankDetails(bankDetails);
bankReconciliation.setBankStatement(bankStatement);
bankReconciliation.setName(this.computeName(bankReconciliation));
bankReconciliation.setJournal(bankReconciliationService.getJournal(bankReconciliation));
bankReconciliation.setCashAccount(bankReconciliationService.getCashAccount(bankReconciliation));
return bankReconciliation;
}
use of com.axelor.apps.bankpayment.db.BankReconciliation in project axelor-open-suite by axelor.
the class BankReconciliationController method setJournalDomain.
public void setJournalDomain(ActionRequest request, ActionResponse response) {
BankReconciliation bankReconciliation = request.getContext().asType(BankReconciliation.class);
String journalIds = null;
if (EntityHelper.getEntity(bankReconciliation).getBankDetails() != null) {
journalIds = Beans.get(BankReconciliationService.class).getJournalDomain(bankReconciliation);
}
if (Strings.isNullOrEmpty(journalIds)) {
response.setAttr("journal", "domain", "self.id IN (0)");
} else {
response.setAttr("journal", "domain", "self.id IN(" + journalIds + ")");
}
}
use of com.axelor.apps.bankpayment.db.BankReconciliation in project axelor-open-suite by axelor.
the class BankReconciliationController method setCashAccount.
public void setCashAccount(ActionRequest request, ActionResponse response) {
BankReconciliation bankReconciliation = request.getContext().asType(BankReconciliation.class);
Account cashAccount = null;
if (EntityHelper.getEntity(bankReconciliation).getBankDetails() != null) {
cashAccount = Beans.get(BankReconciliationService.class).getCashAccount(bankReconciliation);
}
response.setValue("cashAccount", cashAccount);
}
use of com.axelor.apps.bankpayment.db.BankReconciliation 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);
}
}
Aggregations