Search in sources :

Example 1 with AccountingReport

use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.

the class AccountingReportController method getAccount.

/**
 * @param request
 * @param response
 */
public void getAccount(ActionRequest request, ActionResponse response) {
    AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
    try {
        Account account = Beans.get(AccountingReportService.class).getAccount(accountingReport);
        logger.debug("Compte : {}", account);
        response.setValue("account", account);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : Account(com.axelor.apps.account.db.Account) AccountingReport(com.axelor.apps.account.db.AccountingReport) AccountingReportService(com.axelor.apps.account.service.AccountingReportService)

Example 2 with AccountingReport

use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.

the class AccountingReportController method showMoveExported.

public void showMoveExported(ActionRequest request, ActionResponse response) {
    AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
    ActionViewBuilder actionViewBuilder = ActionView.define(I18n.get(IExceptionMessage.ACCOUNTING_REPORT_6));
    actionViewBuilder.model(Move.class.getName());
    actionViewBuilder.add("grid", "move-grid");
    actionViewBuilder.param("search-filters", "move-filters");
    actionViewBuilder.domain("self.accountingReport.id = :_accountingReportId");
    actionViewBuilder.context("_accountingReportId", accountingReport.getId());
    response.setView(actionViewBuilder.map());
}
Also used : AccountingReport(com.axelor.apps.account.db.AccountingReport) Move(com.axelor.apps.account.db.Move) ActionViewBuilder(com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)

Example 3 with AccountingReport

use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.

the class AccountingReportController method printExportMoveLine.

/**
 * @param request
 * @param response
 */
public void printExportMoveLine(ActionRequest request, ActionResponse response) {
    AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
    accountingReport = Beans.get(AccountingReportRepository.class).find(accountingReport.getId());
    AccountingReportService accountingReportService = Beans.get(AccountingReportService.class);
    try {
        int typeSelect = accountingReport.getReportType().getTypeSelect();
        if (accountingReport.getExportTypeSelect() == null || accountingReport.getExportTypeSelect().isEmpty() || typeSelect == 0) {
            response.setFlash(I18n.get(IExceptionMessage.ACCOUNTING_REPORT_4));
            response.setReload(true);
            return;
        }
        if (accountingReportService.isThereTooManyLines(accountingReport)) {
            response.setAlert(I18n.get("A large number of recording has been fetched in this period. Edition can take a while. Do you want to proceed ?"));
        }
        logger.debug("Type selected : {}", typeSelect);
        if ((typeSelect >= AccountingReportRepository.EXPORT_ADMINISTRATION && typeSelect < AccountingReportRepository.REPORT_ANALYTIC_BALANCE)) {
            MoveLineExportService moveLineExportService = Beans.get(MoveLineExportService.class);
            MetaFile accesssFile = moveLineExportService.exportMoveLine(accountingReport);
            if (typeSelect == AccountingReportRepository.EXPORT_ADMINISTRATION && accesssFile != null) {
                response.setView(ActionView.define(I18n.get("Export file")).model(App.class.getName()).add("html", "ws/rest/com.axelor.meta.db.MetaFile/" + accesssFile.getId() + "/content/download?v=" + accesssFile.getVersion()).param("download", "true").map());
            }
        } else {
            accountingReportService.setPublicationDateTime(accountingReport);
            String name = accountingReport.getReportType().getName() + " " + accountingReport.getRef();
            String fileLink = accountingReportService.getReportFileLink(accountingReport, name);
            logger.debug("Printing " + name);
            response.setView(ActionView.define(name).add("html", fileLink).map());
            accountingReportService.setStatus(accountingReport);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : App(com.axelor.apps.base.db.App) AccountingReport(com.axelor.apps.account.db.AccountingReport) MoveLineExportService(com.axelor.apps.account.service.MoveLineExportService) MetaFile(com.axelor.meta.db.MetaFile) AccountingReportService(com.axelor.apps.account.service.AccountingReportService)

Example 4 with AccountingReport

use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.

the class AccountingReportController method replayExport.

/**
 * @param request
 * @param response
 */
public void replayExport(ActionRequest request, ActionResponse response) {
    AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
    accountingReport = Beans.get(AccountingReportRepository.class).find(accountingReport.getId());
    MoveLineExportService moveLineExportService = Beans.get(MoveLineExportService.class);
    try {
        moveLineExportService.replayExportMoveLine(accountingReport);
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : AccountingReport(com.axelor.apps.account.db.AccountingReport) MoveLineExportService(com.axelor.apps.account.service.MoveLineExportService)

Example 5 with AccountingReport

use of com.axelor.apps.account.db.AccountingReport in project axelor-open-suite by axelor.

the class AccountingReportController method getJournalType.

/**
 * @param request
 * @param response
 */
public void getJournalType(ActionRequest request, ActionResponse response) {
    AccountingReport accountingReport = request.getContext().asType(AccountingReport.class);
    try {
        JournalType journalType = Beans.get(AccountingReportService.class).getJournalType(accountingReport);
        if (journalType != null) {
            String domainQuery = "self.journalType.id = " + journalType.getId();
            response.setAttr("journal", "domain", domainQuery);
        }
    } catch (Exception e) {
        TraceBackService.trace(response, e);
    }
}
Also used : AccountingReport(com.axelor.apps.account.db.AccountingReport) JournalType(com.axelor.apps.account.db.JournalType) AccountingReportService(com.axelor.apps.account.service.AccountingReportService)

Aggregations

AccountingReport (com.axelor.apps.account.db.AccountingReport)10 AccountingReportService (com.axelor.apps.account.service.AccountingReportService)4 MoveLineExportService (com.axelor.apps.account.service.MoveLineExportService)2 ActionViewBuilder (com.axelor.meta.schema.actions.ActionView.ActionViewBuilder)2 BigDecimal (java.math.BigDecimal)2 Account (com.axelor.apps.account.db.Account)1 JournalType (com.axelor.apps.account.db.JournalType)1 Move (com.axelor.apps.account.db.Move)1 MoveLine (com.axelor.apps.account.db.MoveLine)1 AccountingReportBankPaymentService (com.axelor.apps.bankpayment.service.AccountingReportBankPaymentService)1 App (com.axelor.apps.base.db.App)1 Company (com.axelor.apps.base.db.Company)1 AxelorException (com.axelor.exception.AxelorException)1 MetaFile (com.axelor.meta.db.MetaFile)1 Transactional (com.google.inject.persist.Transactional)1 LocalDate (java.time.LocalDate)1