Search in sources :

Example 1 with ADialogDialog

use of org.compiere.apps.ADialogDialog in project adempiere by adempiere.

the class VInOutInvoiceGen method generateShipments_complete.

//	generateShipments
/**
	 *  Complete generating shipments.
	 *  Called from Unlock UI
	 *  @param pi process info
	 */
private void generateShipments_complete(ProcessInfo pi) {
    //  Switch Tabs
    tabbedPane.setSelectedIndex(1);
    //
    ProcessInfoUtil.setLogFromDB(pi);
    //StringBuffer iText = new StringBuffer();
    iText.append("<b>").append(pi.getSummary()).append("</b><br>(").append(Msg.getMsg(Env.getCtx(), "InOutGenerateInfo")).append(")<br>").append(pi.getLogInfo(true));
    info.setText(iText.toString());
    //	Reset Selection
    /*
		String sql = "UPDATE C_Order SET IsSelected='N' WHERE " + m_whereClause;
		int no = DB.executeUpdate(sql, null);
		log.config("Reset=" + no);*/
    //	Get results
    int[] ids = pi.getIDs();
    if (ids == null || ids.length == 0)
        return;
    log.config("PrintItems=" + ids.length);
    confirmPanelGen.getOKButton().setEnabled(false);
    //	OK to print shipments
    if (ADialog.ask(m_WindowNo, this, "PrintShipments")) {
        //	info.append("\n\n" + Msg.getMsg(Env.getCtx(), "PrintShipments"));
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        //	see also ProcessDialog.printShipments/Invoices
        int retValue = ADialogDialog.A_CANCEL;
        do {
            //	Loop through all items
            for (int i = 0; i < ids.length; i++) {
                int M_InOut_ID = ids[i];
                ReportCtl.startDocumentPrint(ReportEngine.SHIPMENT, M_InOut_ID, this, Env.getWindowNo(this), true);
            }
            //	Yamel Senih 2015-11-23 FR [ 114 ] Add support to dynamic create from
            ADialogDialog d = new ADialogDialog(m_frame.getCFrame(), Env.getHeader(Env.getCtx(), m_WindowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
            //	End Yamel Senih
            retValue = d.getReturnCode();
        } while (retValue == ADialogDialog.A_CANCEL);
        setCursor(Cursor.getDefaultCursor());
    }
    //	OK to print shipments
    //
    confirmPanelGen.getOKButton().setEnabled(true);
}
Also used : ADialogDialog(org.compiere.apps.ADialogDialog)

Example 2 with ADialogDialog

use of org.compiere.apps.ADialogDialog in project adempiere by adempiere.

the class VPrintDocument method print.

@Override
public void print(PO document, String printFormantName, int windowNo) {
    JFrame window = Env.getWindow(windowNo);
    if (ADialog.ask(windowNo, window, "PrintShipments")) {
        window.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        //	see also ProcessDialog.printShipments/Invoices
        int retValue = ADialogDialog.A_CANCEL;
        do {
            String keyColumnName = document.get_KeyColumns()[0];
            MPrintFormat format = MPrintFormat.get(Env.getCtx(), MPrintFormat.getPrintFormat_ID(printFormantName, document.get_Table_ID(), 0), false);
            MQuery query = new MQuery(document.get_TableName());
            query.addRestriction(keyColumnName, MQuery.EQUAL, document.get_ValueAsInt(keyColumnName));
            //	Engine
            PrintInfo info = new PrintInfo(document.get_TableName(), document.get_Table_ID(), document.get_ValueAsInt(keyColumnName));
            ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
            re.print();
            new Viewer(re);
            ADialogDialog d = new ADialogDialog(window, Env.getHeader(Env.getCtx(), windowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
            retValue = d.getReturnCode();
        } while (retValue == ADialogDialog.A_CANCEL);
        window.setCursor(Cursor.getDefaultCursor());
    }
}
Also used : MPrintFormat(org.compiere.print.MPrintFormat) ReportEngine(org.compiere.print.ReportEngine) JFrame(javax.swing.JFrame) ADialogDialog(org.compiere.apps.ADialogDialog) MQuery(org.compiere.model.MQuery) PrintInfo(org.compiere.model.PrintInfo) Viewer(org.compiere.print.Viewer)

Example 3 with ADialogDialog

use of org.compiere.apps.ADialogDialog in project adempiere by adempiere.

the class VInOutInvoiceGen method generateInvoice_complete.

//	generateInvoices
/**
	 *  Complete generating invoices.
	 *  Called from Unlock UI
	 *  @param pi process info
	 */
private void generateInvoice_complete(ProcessInfo pi) {
    //  Switch Tabs
    tabbedPane.setSelectedIndex(1);
    //
    ProcessInfoUtil.setLogFromDB(pi);
    //StringBuffer iText = new StringBuffer();
    iText.append("<b>").append(pi.getSummary()).append("</b><br>(").append(Msg.getMsg(Env.getCtx(), "InvGenerateInfo")).append(")<br>").append(pi.getLogInfo(true));
    info.setText(iText.toString());
    //	Reset Selection
    /*
		String sql = "UPDATE C_Order SET IsSelected = 'N' WHERE " + m_whereClause;
		int no = DB.executeUpdate(sql, null);
		log.config("Reset=" + no);*/
    //	Get results
    int[] ids = pi.getIDs();
    if (ids == null || ids.length == 0)
        return;
    confirmPanelGen.getOKButton().setEnabled(false);
    //	OK to print invoices
    if (ADialog.ask(m_WindowNo, this, "PrintInvoices")) {
        //	info.append("\n\n" + Msg.getMsg(Env.getCtx(), "PrintInvoices"));
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        int retValue = ADialogDialog.A_CANCEL;
        do {
            //	Loop through all items
            for (int i = 0; i < ids.length; i++) {
                int C_Invoice_ID = ids[i];
                ReportCtl.startDocumentPrint(ReportEngine.INVOICE, C_Invoice_ID, this, Env.getWindowNo(this), true);
            }
            //	Yamel Senih 2015-11-23 FR [ 114 ] Add support to dynamic create from
            ADialogDialog d = new ADialogDialog(m_frame.getCFrame(), Env.getHeader(Env.getCtx(), m_WindowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
            //	End Yamel Senih
            retValue = d.getReturnCode();
        } while (retValue == ADialogDialog.A_CANCEL);
        setCursor(Cursor.getDefaultCursor());
    }
    //	OK to print invoices
    //
    confirmPanelGen.getOKButton().setEnabled(true);
}
Also used : ADialogDialog(org.compiere.apps.ADialogDialog)

Example 4 with ADialogDialog

use of org.compiere.apps.ADialogDialog in project adempiere by adempiere.

the class VGenPanel method generateComplete.

/**
	 *  Complete generating shipments/invoices.
	 *  Called from Unlock UI
	 *  @param pi process info
	 */
public void generateComplete(ProcessInfo pi) {
    //  Switch Tabs
    tabbedPane.setSelectedIndex(1);
    //
    ProcessInfoUtil.setLogFromDB(pi);
    StringBuffer iText = new StringBuffer();
    iText.append("<b>").append(pi.getSummary()).append("</b><br>(").append(Msg.getMsg(Env.getCtx(), genForm.getTitle())).append(")<br>").append(pi.getLogInfo(true));
    info.setText(iText.toString());
    //	Reset Selection
    /*
		String sql = "UPDATE C_Order SET IsSelected='N' WHERE " + m_whereClause;
		int no = DB.executeUpdate(sql, null);
		log.config("Reset=" + no);*/
    //	Get results
    int[] ids = pi.getIDs();
    if (ids == null || ids.length == 0)
        return;
    log.config("PrintItems=" + ids.length);
    confirmPanelGen.getOKButton().setEnabled(false);
    //	OK to print
    if (ADialog.ask(m_WindowNo, this, genForm.getAskPrintMsg())) {
        this.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        //	see also ProcessDialog.printShipments/Invoices
        int retValue = ADialogDialog.A_CANCEL;
        do {
            //	Loop through all items
            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(table.getTableName() + "_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(m_frame.getGraphicsConfiguration(), re);
                } else
                    ReportCtl.startDocumentPrint(genForm.getReportEngineType(), Record_ID, this, Env.getWindowNo(this), true);
            }
            //	Yamel Senih 2015-11-23 FR [ 114 ] Add Supoort to dynamic create from
            ADialogDialog d = new ADialogDialog(m_frame.getCFrame(), Env.getHeader(Env.getCtx(), m_WindowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
            //	End Yamel Senih
            retValue = d.getReturnCode();
        } while (retValue == ADialogDialog.A_CANCEL);
        this.setCursor(Cursor.getDefaultCursor());
    }
    //	OK to print
    //
    confirmPanelGen.getOKButton().setEnabled(true);
}
Also used : MPrintFormat(org.compiere.print.MPrintFormat) ReportEngine(org.compiere.print.ReportEngine) MTable(org.compiere.model.MTable) ADialogDialog(org.compiere.apps.ADialogDialog) MQuery(org.compiere.model.MQuery) PrintInfo(org.compiere.model.PrintInfo) Viewer(org.compiere.print.Viewer)

Example 5 with ADialogDialog

use of org.compiere.apps.ADialogDialog in project adempiere by adempiere.

the class VOrderDistributionReceipt method generateMovements_complete.

/**
	 *  Complete generating movements.
	 * @param movement
	 */
private void generateMovements_complete(MMovement movement) {
    //  Switch Tabs
    tabbedPane.setSelectedIndex(1);
    StringBuffer iText = new StringBuffer();
    iText.append("<b>").append("").append("</b><br>").append(Msg.translate(Env.getCtx(), "DocumentNo") + " : " + movement.getDocumentNo()).append("<br>").append("");
    info.setText(iText.toString());
    confirmPanelGen.getOKButton().setEnabled(false);
    //	OK to print shipments
    if (ADialog.ask(m_WindowNo, this, "PrintShipments")) {
        setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
        //	see also ProcessDialog.printShipments/Invoices
        int retValue = ADialogDialog.A_CANCEL;
        do {
            MPrintFormat format = MPrintFormat.get(Env.getCtx(), MPrintFormat.getPrintFormat_ID("Inventory Move Hdr (Example)", MMovement.Table_ID, 0), false);
            MQuery query = new MQuery(MMovement.Table_Name);
            query.addRestriction(MMovement.COLUMNNAME_M_Movement_ID, MQuery.EQUAL, movement.getM_Movement_ID());
            //	Engine
            PrintInfo info = new PrintInfo(MMovement.Table_Name, MMovement.Table_ID, movement.getM_Movement_ID());
            ReportEngine re = new ReportEngine(Env.getCtx(), format, query, info);
            re.print();
            new Viewer(re);
            //	Yamel Senih FR [ 114 ] 2015-11-23
            ADialogDialog d = new ADialogDialog(m_frame.getCFrame(), Env.getHeader(Env.getCtx(), m_WindowNo), Msg.getMsg(Env.getCtx(), "PrintoutOK?"), JOptionPane.QUESTION_MESSAGE);
            retValue = d.getReturnCode();
        } while (retValue == ADialogDialog.A_CANCEL);
        setCursor(Cursor.getDefaultCursor());
    }
    //	OK to print shipments
    //
    confirmPanelGen.getOKButton().setEnabled(true);
}
Also used : MPrintFormat(org.compiere.print.MPrintFormat) ReportEngine(org.compiere.print.ReportEngine) ADialogDialog(org.compiere.apps.ADialogDialog) MQuery(org.compiere.model.MQuery) PrintInfo(org.compiere.model.PrintInfo) Viewer(org.compiere.print.Viewer)

Aggregations

ADialogDialog (org.compiere.apps.ADialogDialog)5 MQuery (org.compiere.model.MQuery)3 PrintInfo (org.compiere.model.PrintInfo)3 MPrintFormat (org.compiere.print.MPrintFormat)3 ReportEngine (org.compiere.print.ReportEngine)3 Viewer (org.compiere.print.Viewer)3 JFrame (javax.swing.JFrame)1 MTable (org.compiere.model.MTable)1