Enable in GenFrom and VGenPanel to use any PrintFormat
https://sourceforge.net/tracker/?func=detail&aid=2878578&group_id=176962&atid=879335
This commit is contained in:
parent
a9776d5284
commit
261240908f
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Reference in New Issue