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;
}
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);
}
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);
}
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);
}
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);
}
Aggregations