diff --git a/client/src/org/compiere/apps/form/GenForm.java b/client/src/org/compiere/apps/form/GenForm.java index 20f8db65f9..82d580e884 100644 --- a/client/src/org/compiere/apps/form/GenForm.java +++ b/client/src/org/compiere/apps/form/GenForm.java @@ -16,6 +16,7 @@ package org.compiere.apps.form; import java.util.ArrayList; import org.compiere.minigrid.IMiniTable; +import org.compiere.print.MPrintFormat; import org.compiere.process.ProcessInfo; import org.compiere.util.Trx; @@ -28,6 +29,7 @@ public abstract class GenForm private boolean m_selectionActive = true; private String title; private int reportEngineType; + private MPrintFormat printFormat = null; private String askPrintMsg; private Trx trx; @@ -108,6 +110,14 @@ public abstract class GenForm this.reportEngineType = reportEngineType; } + public MPrintFormat getPrintFormat() { + return this.printFormat; + } + + public void setPrintFormat(MPrintFormat printFormat) { + this.printFormat = printFormat; + } + public String getAskPrintMsg() { return askPrintMsg; } diff --git a/client/src/org/compiere/apps/form/VGenPanel.java b/client/src/org/compiere/apps/form/VGenPanel.java index f36db81640..04e5429b91 100644 --- a/client/src/org/compiere/apps/form/VGenPanel.java +++ b/client/src/org/compiere/apps/form/VGenPanel.java @@ -35,8 +35,15 @@ import org.compiere.apps.ProcessCtl; import org.compiere.apps.StatusBar; import org.compiere.minigrid.IDColumn; import org.compiere.minigrid.MiniTable; +import org.compiere.model.MMovement; +import org.compiere.model.MQuery; +import org.compiere.model.MTable; +import org.compiere.model.PrintInfo; import org.compiere.plaf.CompiereColor; +import org.compiere.print.MPrintFormat; import org.compiere.print.ReportCtl; +import org.compiere.print.ReportEngine; +import org.compiere.print.Viewer; import org.compiere.process.ProcessInfo; import org.compiere.process.ProcessInfoUtil; import org.compiere.swing.CPanel; @@ -237,8 +244,6 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener, public void generate() { info.setText(genForm.generate()); - - // Execute Process ProcessCtl worker = new ProcessCtl(this, Env.getWindowNo(this), genForm.getProcessInfo(), genForm.getTrx()); worker.start(); // @@ -288,7 +293,22 @@ public class VGenPanel extends CPanel implements ActionListener, ChangeListener, for (int i = 0; i < ids.length; i++) { int Record_ID = ids[i]; + + if(genForm.getPrintFormat() != null) + { + MPrintFormat format = genForm.getPrintFormat(); + MTable table = MTable.get(Env.getCtx(),format.getAD_Table_ID()); + MQuery query = new MQuery(table.getTableName()); + query.addRestriction(MMovement.COLUMNNAME_M_Movement_ID, MQuery.EQUAL, Record_ID); + // Engine + PrintInfo info = new PrintInfo(table.getTableName(),table.get_Table_ID(), Record_ID); + ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info); + re.print(); + new Viewer(re); + } + else ReportCtl.startDocumentPrint(genForm.getReportEngineType(), Record_ID, this, Env.getWindowNo(this), true); + } ADialogDialog d = new ADialogDialog (m_frame, Env.getHeader(Env.getCtx(), m_WindowNo),