Search in sources :

Example 1 with BankStatement

use of com.axelor.apps.bankpayment.db.BankStatement in project axelor-open-suite by axelor.

the class BankStatementManagementRepository method copy.

@Override
public BankStatement copy(BankStatement entity, boolean deep) {
    BankStatement bankStatement = super.copy(entity, deep);
    bankStatement.setStatusSelect(this.STATUS_RECEIVED);
    return bankStatement;
}
Also used : BankStatement(com.axelor.apps.bankpayment.db.BankStatement)

Example 2 with BankStatement

use of com.axelor.apps.bankpayment.db.BankStatement in project axelor-open-suite by axelor.

the class BankReconciliationService method loadBankStatement.

@Transactional
public void loadBankStatement(BankReconciliation bankReconciliation, boolean includeBankStatement) {
    BankStatement bankStatement = bankReconciliation.getBankStatement();
    BankStatementFileFormat bankStatementFileFormat = bankStatement.getBankStatementFileFormat();
    switch(bankStatementFileFormat.getStatementFileFormatSelect()) {
        case BankStatementFileFormatRepository.FILE_FORMAT_CAMT_XXX_CFONB120_REP:
        case BankStatementFileFormatRepository.FILE_FORMAT_CAMT_XXX_CFONB120_STM:
            Beans.get(BankReconciliationLoadAFB120Service.class).loadBankStatement(bankReconciliation, includeBankStatement);
            break;
        default:
            Beans.get(BankReconciliationLoadService.class).loadBankStatement(bankReconciliation, includeBankStatement);
    }
    compute(bankReconciliation);
    bankReconciliationRepository.save(bankReconciliation);
}
Also used : BankReconciliationLoadAFB120Service(com.axelor.apps.bankpayment.service.bankreconciliation.load.afb120.BankReconciliationLoadAFB120Service) BankStatement(com.axelor.apps.bankpayment.db.BankStatement) BankReconciliationLoadService(com.axelor.apps.bankpayment.service.bankreconciliation.load.BankReconciliationLoadService) BankStatementFileFormat(com.axelor.apps.bankpayment.db.BankStatementFileFormat) Transactional(com.google.inject.persist.Transactional)

Example 3 with BankStatement

use of com.axelor.apps.bankpayment.db.BankStatement in project axelor-open-suite by axelor.

the class BankStatementController method runBankReconciliation.

public void runBankReconciliation(ActionRequest request, ActionResponse response) {
    try {
        BankStatement bankStatement = request.getContext().asType(BankStatement.class);
        bankStatement = Beans.get(BankStatementRepository.class).find(bankStatement.getId());
        List<BankReconciliation> bankReconciliationList = Beans.get(BankReconciliationCreateService.class).createAllFromBankStatement(bankStatement);
        if (bankReconciliationList != null) {
            response.setView(ActionView.define(I18n.get("Bank reconciliations")).model(BankReconciliation.class.getName()).add("grid", "bank-reconciliation-grid").add("form", "bank-reconciliation-form").param("search-filters", "bank-reconciliation-filters").domain("self.id in (" + Joiner.on(",").join(bankReconciliationList.stream().map(BankReconciliation::getId).toArray()) + ")").map());
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
    response.setReload(true);
}
Also used : BankStatement(com.axelor.apps.bankpayment.db.BankStatement) BankReconciliationCreateService(com.axelor.apps.bankpayment.service.bankreconciliation.BankReconciliationCreateService) BankReconciliation(com.axelor.apps.bankpayment.db.BankReconciliation)

Example 4 with BankStatement

use of com.axelor.apps.bankpayment.db.BankStatement in project axelor-open-suite by axelor.

the class BankStatementController method print.

public void print(ActionRequest request, ActionResponse response) {
    try {
        BankStatement bankStatement = request.getContext().asType(BankStatement.class);
        bankStatement = Beans.get(BankStatementRepository.class).find(bankStatement.getId());
        String name = bankStatement.getName();
        String fileLink = Beans.get(BankStatementService.class).print(bankStatement);
        response.setView(ActionView.define(name).add("html", fileLink).map());
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
    response.setReload(true);
}
Also used : BankStatementService(com.axelor.apps.bankpayment.service.bankstatement.BankStatementService) BankStatement(com.axelor.apps.bankpayment.db.BankStatement)

Example 5 with BankStatement

use of com.axelor.apps.bankpayment.db.BankStatement in project axelor-open-suite by axelor.

the class BankStatementCreateService method createBankStatement.

public BankStatement createBankStatement(File file, LocalDate fromDate, LocalDate toDate, BankStatementFileFormat bankStatementFileFormat, EbicsPartner ebicsPartner, LocalDateTime executionDateTime) throws IOException {
    BankStatement bankStatement = new BankStatement();
    bankStatement.setFromDate(fromDate);
    bankStatement.setToDate(toDate);
    bankStatement.setBankStatementFileFormat(bankStatementFileFormat);
    bankStatement.setEbicsPartner(ebicsPartner);
    bankStatement.setGetDateTime(executionDateTime);
    bankStatement.setBankStatementFile(Beans.get(MetaFiles.class).upload(file));
    bankStatement.setName(this.computeName(bankStatement));
    bankStatement.setStatusSelect(BankStatementRepository.STATUS_RECEIVED);
    return bankStatement;
}
Also used : BankStatement(com.axelor.apps.bankpayment.db.BankStatement)

Aggregations

BankStatement (com.axelor.apps.bankpayment.db.BankStatement)9 BankStatementFileFormat (com.axelor.apps.bankpayment.db.BankStatementFileFormat)2 EbicsPartner (com.axelor.apps.bankpayment.db.EbicsPartner)2 BankStatementService (com.axelor.apps.bankpayment.service.bankstatement.BankStatementService)2 AxelorException (com.axelor.exception.AxelorException)2 Transactional (com.google.inject.persist.Transactional)2 BankPaymentBatch (com.axelor.apps.bankpayment.db.BankPaymentBatch)1 BankReconciliation (com.axelor.apps.bankpayment.db.BankReconciliation)1 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)1 EbicsPartnerRepository (com.axelor.apps.bankpayment.db.repo.EbicsPartnerRepository)1 EbicsPartnerService (com.axelor.apps.bankpayment.ebics.service.EbicsPartnerService)1 BankReconciliationCreateService (com.axelor.apps.bankpayment.service.bankreconciliation.BankReconciliationCreateService)1 BankReconciliationLoadService (com.axelor.apps.bankpayment.service.bankreconciliation.load.BankReconciliationLoadService)1 BankReconciliationLoadAFB120Service (com.axelor.apps.bankpayment.service.bankreconciliation.load.afb120.BankReconciliationLoadAFB120Service)1 File (java.io.File)1 IOException (java.io.IOException)1 LocalDate (java.time.LocalDate)1 LocalDateTime (java.time.LocalDateTime)1 Date (java.util.Date)1