Search in sources :

Example 1 with ReportSettings

use of com.axelor.apps.report.engine.ReportSettings in project axelor-open-suite by axelor.

the class DepositSlipServiceImpl method publish.

@Override
@Transactional(rollbackOn = { Exception.class })
public String publish(DepositSlip depositSlip) throws AxelorException {
    confirmPayments(depositSlip);
    ReportSettings settings = ReportFactory.createReport(getReportName(depositSlip), getFilename(depositSlip));
    settings.addParam("DepositSlipId", depositSlip.getId());
    settings.addParam("Locale", ReportSettings.getPrintingLocale(null));
    settings.addParam("Timezone", depositSlip.getCompany() != null ? depositSlip.getCompany().getTimezone() : null);
    settings.addFormat("pdf");
    String fileLink = settings.toAttach(depositSlip).generate().getFileLink();
    depositSlip.setPublicationDate(Beans.get(AppBaseService.class).getTodayDate(depositSlip.getCompany()));
    return fileLink;
}
Also used : ReportSettings(com.axelor.apps.report.engine.ReportSettings) Transactional(com.google.inject.persist.Transactional)

Example 2 with ReportSettings

use of com.axelor.apps.report.engine.ReportSettings in project axelor-open-suite by axelor.

the class SaleOrderPrintServiceImpl method prepareReportSettings.

@Override
public ReportSettings prepareReportSettings(SaleOrder saleOrder, boolean proforma, String format) throws AxelorException {
    if (saleOrder.getPrintingSettings() == null) {
        if (saleOrder.getCompany().getPrintingSettings() != null) {
            saleOrder.setPrintingSettings(saleOrder.getCompany().getPrintingSettings());
        } else {
            throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, String.format(I18n.get(IExceptionMessage.SALE_ORDER_MISSING_PRINTING_SETTINGS), saleOrder.getSaleOrderSeq()), saleOrder);
        }
    }
    String locale = ReportSettings.getPrintingLocale(saleOrder.getClientPartner());
    String title = saleOrderService.getFileName(saleOrder);
    ReportSettings reportSetting = ReportFactory.createReport(IReport.SALES_ORDER, title + " - ${date}");
    return reportSetting.addParam("SaleOrderId", saleOrder.getId()).addParam("Timezone", saleOrder.getCompany() != null ? saleOrder.getCompany().getTimezone() : null).addParam("Locale", locale).addParam("ProformaInvoice", proforma).addParam("HeaderHeight", saleOrder.getPrintingSettings().getPdfHeaderHeight()).addParam("FooterHeight", saleOrder.getPrintingSettings().getPdfFooterHeight()).addFormat(format);
}
Also used : AxelorException(com.axelor.exception.AxelorException) ReportSettings(com.axelor.apps.report.engine.ReportSettings)

Example 3 with ReportSettings

use of com.axelor.apps.report.engine.ReportSettings in project axelor-open-suite by axelor.

the class ManufOrderPrintServiceMaintenanceImpl method prepareReportSettings.

@Override
public ReportSettings prepareReportSettings(ManufOrder manufOrder) {
    String title = getFileName(manufOrder);
    ReportSettings reportSetting = ReportFactory.createReport(manufOrder.getTypeSelect() == ManufOrderRepository.TYPE_MAINTENANCE ? IReport.MAINTENANCE_MANUF_ORDER : com.axelor.apps.production.report.IReport.MANUF_ORDER, title);
    return reportSetting.addParam("Locale", ReportSettings.getPrintingLocale(null)).addParam("ManufOrderId", manufOrder.getId().toString()).addParam("activateBarCodeGeneration", Beans.get(AppBaseService.class).getAppBase().getActivateBarCodeGeneration()).addFormat(ReportSettings.FORMAT_PDF);
}
Also used : ReportSettings(com.axelor.apps.report.engine.ReportSettings)

Example 4 with ReportSettings

use of com.axelor.apps.report.engine.ReportSettings in project axelor-open-suite by axelor.

the class PickingStockMovePrintServiceimpl method prepareReportSettings.

@Override
public ReportSettings prepareReportSettings(StockMove stockMove, String format) throws AxelorException {
    if (stockMove.getPrintingSettings() == null) {
        throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, String.format(I18n.get(IExceptionMessage.STOCK_MOVES_MISSING_PRINTING_SETTINGS), stockMove.getStockMoveSeq()), stockMove);
    }
    String locale = ReportSettings.getPrintingLocale(stockMove.getPartner());
    String title = getFileName(stockMove);
    ReportSettings reportSetting = ReportFactory.createReport(IReport.PICKING_STOCK_MOVE, title + " - ${date}");
    return reportSetting.addParam("StockMoveId", stockMove.getId()).addParam("Timezone", stockMove.getCompany() != null ? stockMove.getCompany().getTimezone() : null).addParam("Locale", locale).addParam("HeaderHeight", stockMove.getPrintingSettings().getPdfHeaderHeight()).addParam("FooterHeight", stockMove.getPrintingSettings().getPdfFooterHeight()).addFormat(format);
}
Also used : AxelorException(com.axelor.exception.AxelorException) ReportSettings(com.axelor.apps.report.engine.ReportSettings)

Example 5 with ReportSettings

use of com.axelor.apps.report.engine.ReportSettings in project axelor-open-suite by axelor.

the class StockMovePrintServiceImpl method prepareReportSettings.

@Override
public ReportSettings prepareReportSettings(StockMove stockMove, String format) throws AxelorException {
    if (stockMove.getPrintingSettings() == null) {
        throw new AxelorException(TraceBackRepository.CATEGORY_MISSING_FIELD, String.format(I18n.get(IExceptionMessage.STOCK_MOVES_MISSING_PRINTING_SETTINGS), stockMove.getStockMoveSeq()), stockMove);
    }
    String locale = ReportSettings.getPrintingLocale(stockMove.getPartner());
    String title = getFileName(stockMove);
    AppBase appBase = appBaseService.getAppBase();
    ReportSettings reportSetting = ReportFactory.createReport(IReport.STOCK_MOVE, title + " - ${date}");
    return reportSetting.addParam("StockMoveId", stockMove.getId()).addParam("Timezone", stockMove.getCompany() != null ? stockMove.getCompany().getTimezone() : null).addParam("Locale", locale).addParam("GroupProducts", appBase.getIsRegroupProductsOnPrintings() && stockMove.getGroupProductsOnPrintings()).addParam("GroupProductTypes", appBase.getRegroupProductsTypeSelect()).addParam("GroupProductLevel", appBase.getRegroupProductsLevelSelect()).addParam("GroupProductProductTitle", appBase.getRegroupProductsLabelProducts()).addParam("GroupProductServiceTitle", appBase.getRegroupProductsLabelServices()).addParam("HeaderHeight", stockMove.getPrintingSettings().getPdfHeaderHeight()).addParam("FooterHeight", stockMove.getPrintingSettings().getPdfFooterHeight()).addFormat(format);
}
Also used : AxelorException(com.axelor.exception.AxelorException) ReportSettings(com.axelor.apps.report.engine.ReportSettings) AppBase(com.axelor.apps.base.db.AppBase)

Aggregations

ReportSettings (com.axelor.apps.report.engine.ReportSettings)20 AxelorException (com.axelor.exception.AxelorException)12 MetaFile (com.axelor.meta.db.MetaFile)3 File (java.io.File)3 ArrayList (java.util.ArrayList)3 AppBase (com.axelor.apps.base.db.AppBase)2 MetaFiles (com.axelor.meta.MetaFiles)2 Invoice (com.axelor.apps.account.db.Invoice)1 EbicsUser (com.axelor.apps.bankpayment.db.EbicsUser)1 BirtTemplateParameter (com.axelor.apps.base.db.BirtTemplateParameter)1 AppBaseService (com.axelor.apps.base.service.app.AppBaseService)1 StockMove (com.axelor.apps.stock.db.StockMove)1 User (com.axelor.auth.db.User)1 Transactional (com.google.inject.persist.Transactional)1 IOException (java.io.IOException)1 BirtException (org.eclipse.birt.core.exception.BirtException)1