Search in sources :

Example 6 with WTableDirEditor

use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.

the class WInvoiceGen method dynInit.

//	jbInit
/**
	 *	Fill Picks.
	 *		Column_ID from C_Order
	 *  @throws Exception if Lookups cannot be initialized
	 */
public void dynInit() throws Exception {
    MLookup orgL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, 2163, DisplayType.TableDir);
    fOrg = new WTableDirEditor("AD_Org_ID", false, false, true, orgL);
    //	lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
    fOrg.addValueChangeListener(this);
    //
    MLookup bpL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, 2762, DisplayType.Search);
    fBPartner = new WSearchEditor("C_BPartner_ID", false, false, true, bpL);
    //	lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addValueChangeListener(this);
    //      Document Action Prepared/ Completed
    lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
    MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 3495, /* C_Invoice.DocAction */
    DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135, /* _Document Action */
    false, "AD_Ref_List.Value IN ('CO','PR')");
    docAction = new WTableDirEditor("DocAction", true, false, true, docActionL);
    docAction.setValue(DocAction.ACTION_Complete);
    docAction.addValueChangeListener(this);
    //      Document Type Sales Order/Vendor RMA
    lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
    cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "CustomerRMA")));
    cmbDocType.addActionListener(this);
    cmbDocType.setSelectedIndex(0);
    //@@
    form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) KeyNamePair(org.compiere.util.KeyNamePair)

Example 7 with WTableDirEditor

use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.

the class WDelete method dynInit.

public void dynInit() throws Exception {
    // Client Pick
    String sql = "SELECT AD_Client_ID, Name FROM AD_Client WHERE AD_Client_ID <> 0";
    clientPick = new Combobox();
    PreparedStatement pstmt1 = DB.prepareStatement(sql, null);
    ResultSet rs1 = null;
    String clientName = null;
    Integer clientID = null;
    try {
        rs1 = pstmt1.executeQuery();
        while (rs1.next()) {
            clientID = new Integer(rs1.getInt(1));
            clientName = new String(rs1.getString(2));
            clientPick.appendItem(clientName, clientID);
            clientMap.put(clientName, clientID);
        }
    } catch (SQLException e) {
        System.out.println(e);
    } finally {
        DB.close(rs1);
        DB.close(pstmt1);
    }
    // Table Pick
    MLookup lookupTable = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, ad_table_id, DisplayType.TableDir);
    tablePick = new WTableDirEditor("AD_Table_ID", true, false, true, lookupTable);
    tablePick.setValue(new Integer((Integer) Env.getContextAsInt(Env.getCtx(), "$AD_Table_ID")));
    tablePick.addValueChangeListener(this);
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) SQLException(java.sql.SQLException) Combobox(org.adempiere.webui.component.Combobox) MLookup(org.compiere.model.MLookup) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement)

Example 8 with WTableDirEditor

use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.

the class WInOutGen method dynInit.

//	jbInit
/**
	 *	Fill Picks.
	 *		Column_ID from C_Order
	 *  @throws Exception if Lookups cannot be initialized
	 */
public void dynInit() throws Exception {
    //	C_OrderLine.M_Warehouse_ID
    MLookup orgL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, 2223, DisplayType.TableDir);
    fWarehouse = new WTableDirEditor("M_Warehouse_ID", true, false, true, orgL);
    lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
    fWarehouse.addValueChangeListener(this);
    fWarehouse.setValue(Env.getContextAsInt(Env.getCtx(), "#M_Warehouse_ID"));
    setM_Warehouse_ID(fWarehouse.getValue());
    //      Document Action Prepared/ Completed
    lDocAction.setText(Msg.translate(Env.getCtx(), "DocAction"));
    MLookup docActionL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 4324, /* M_InOut.DocAction */
    DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135, /* _Document Action */
    false, "AD_Ref_List.Value IN ('CO','PR')");
    docAction = new WTableDirEditor("DocAction", true, false, true, docActionL);
    docAction.setValue(DocAction.ACTION_Complete);
    docAction.addValueChangeListener(this);
    //	C_Order.C_BPartner_ID
    MLookup bpL = MLookupFactory.get(Env.getCtx(), form.getWindowNo(), 0, 2762, DisplayType.Search);
    fBPartner = new WSearchEditor("C_BPartner_ID", false, false, true, bpL);
    lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    fBPartner.addValueChangeListener(this);
    //Document Type Sales Order/Vendor RMA
    lDocType.setText(Msg.translate(Env.getCtx(), "C_DocType_ID"));
    cmbDocType.addItem(new KeyNamePair(MOrder.Table_ID, Msg.translate(Env.getCtx(), "Order")));
    cmbDocType.addItem(new KeyNamePair(MRMA.Table_ID, Msg.translate(Env.getCtx(), "VendorRMA")));
    cmbDocType.addActionListener(this);
    cmbDocType.setSelectedIndex(0);
    //@@
    form.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InOutGenerateSel"));
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) KeyNamePair(org.compiere.util.KeyNamePair)

Example 9 with WTableDirEditor

use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.

the class WFactReconcile method initComponents.

/**
	 *  Static Init
	 *  @throws Exception
	 */
private void initComponents() throws Exception {
    //  Buttons
    bCancel.addActionListener(this);
    //
    bGenerate.setLabel(Msg.getMsg(Env.getCtx(), "Process"));
    bGenerate.addActionListener(this);
    bGenerate.setEnabled(false);
    //	
    bReset.setLabel(Msg.getMsg(Env.getCtx(), "Reset"));
    bReset.addActionListener(this);
    bReset.setEnabled(false);
    //
    bZoom.setLabel(Msg.translate(Env.getCtx(), "Fact_Acct_ID"));
    bZoom.setEnabled(false);
    bZoom.addActionListener(this);
    //
    bRefresh.addActionListener(this);
    //  Labels
    labelBlank.setValue(" ");
    labelAcctSchema.setText(Msg.translate(Env.getCtx(), "C_AcctSchema_ID"));
    labelAccount.setText(Msg.translate(Env.getCtx(), "Account_ID"));
    labelBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
    labelDateAcct.setText(Msg.translate(Env.getCtx(), "DateAcct"));
    labelDateAcct2.setText("-");
    labelProduct.setText(Msg.translate(Env.getCtx(), "M_Product_ID"));
    //
    labelOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
    isReconciled.setText(Msg.translate(Env.getCtx(), "IsReconciled"));
    //
    statusBar.setEastVisibility(false);
    statusBar.setAttribute("zk_component_ID", "info_statusBar");
    setStatusLine(Msg.getMsg(Env.getCtx(), "SearchRows_EnterQuery"), false);
    setStatusDB("0");
    //
    differenceLabel.setText(Msg.getMsg(Env.getCtx(), "Difference"));
    differenceField.setReadonly(true);
    differenceField.setValue("0");
    differenceField.setAttribute("zk_component_ID", "ConfirmPanel_differenceField");
    //  Find context and client
    Properties ctx = Env.getCtx();
    m_AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
    // Organization filter selection
    //  Fact_Acct.C_AcctSchema_ID AD_Column_ID = 2513
    fieldAcctSchema = new WTableDirEditor("C_AcctSchema_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_C_AcctSchema_ID), DisplayType.TableDir));
    fieldAcctSchema.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_C_AcctSchema_ID");
    fieldAcctSchema.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldAcctSchema.getComponent().setAttribute("IsDynamic", "False");
    fieldAcctSchema.getComponent().setAttribute("fieldName", "fieldAcctSchema");
    fieldAcctSchema.setValue(MClient.get(Env.getCtx()).getAcctSchema().getC_AcctSchema_ID());
    //
    //Fact_Acct.AD_Org_ID (needed to allow org 0) AD_Column_ID = 839; 
    fieldOrg = new WTableDirEditor("AD_Org_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_AD_Org_ID), DisplayType.TableDir));
    fieldOrg.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_AD_Org_ID");
    fieldOrg.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldOrg.getComponent().setAttribute("IsDynamic", "False");
    fieldOrg.getComponent().setAttribute("fieldName", "fieldOrg");
    // Attempt to select "*" and fall back to context           
    fieldOrg.setValue(0);
    if (fieldOrg.getValue() == null || ((Integer) fieldOrg.getValue()).intValue() != 0)
        fieldOrg.setValue(Env.getAD_Org_ID(Env.getCtx()));
    //
    //  BPartner C_Invoice.C_BPartner_ID AD_Column_ID = 3499; 
    fieldBPartner.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_C_BPartner_ID");
    fieldBPartner.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldBPartner.getComponent().setAttribute("IsDynamic", "False");
    fieldBPartner.getComponent().setAttribute("fieldName", "fieldBPartner");
    fieldBPartner.getComponent().setWidth("200px");
    //
    // Product Fact_Acct.M_Product_ID AD_Column_ID = 2527;        
    fieldProduct.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_M_Product_ID");
    fieldProduct.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldProduct.getComponent().setAttribute("IsDynamic", "False");
    fieldProduct.getComponent().setAttribute("fieldName", "fieldProduct");
    fieldProduct.getComponent().setWidth("200px");
    //
    // The Account combo.  A bit more involved if we try to filter out the summary accounts.
    MLookup lookup;
    try {
        lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID), DisplayType.TableDir, Env.getLanguage(Env.getCtx()), MFactAcct.COLUMNNAME_Account_ID, 0, false, "C_ElementValue.IsSummary = 'N'");
    } catch (Exception e) {
        // Jut alors!  Drop the validation and try again.
        lookup = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_Account_ID), DisplayType.TableDir);
    }
    fieldAccount = new WTableDirEditor("AD_Org_ID", true, false, true, lookup);
    fieldAccount.getComponent().setAttribute("zk_component_ID", "Lookup_Criteria_Account_ID");
    fieldAccount.getComponent().setAttribute("zk_component_prefix", "Lookup_");
    fieldAccount.getComponent().setAttribute("IsDynamic", "False");
    fieldAccount.getComponent().setAttribute("fieldName", "fieldAccount");
    if (fieldAccount.getComponent().getItemCount() > 2)
        fieldAccount.getComponent().setSelectedIndex(1);
    //  Define the table
    m_sql = miniTable.prepareTable(new ColumnInfo[] { new ColumnInfo(" ", "fa.Fact_Acct_ID", IDColumn.class, false, false, null), new ColumnInfo(Msg.translate(ctx, "AmtAcct"), "(fa.amtacctdr-fa.amtacctcr)", BigDecimal.class, true, true, null), new ColumnInfo("DR/CR", "(CASE WHEN (fa.amtacctdr-fa.amtacctcr) < 0 THEN 'CR' ELSE 'DR' END)", String.class), new ColumnInfo(Msg.translate(ctx, "C_BPartner_ID"), "bp.Name", String.class), new ColumnInfo(Msg.translate(ctx, "DateAcct"), "fa.DateAcct", Timestamp.class), new ColumnInfo(Msg.translate(ctx, "GL_Category_ID"), "glc.Name", String.class), new ColumnInfo(Msg.translate(ctx, "M_Product_ID"), "p.Value", String.class), new ColumnInfo(Msg.translate(ctx, "Qty"), "Qty", BigDecimal.class), new ColumnInfo(Msg.translate(ctx, "Description"), "fa.Description", String.class), new ColumnInfo(Msg.translate(ctx, "MatchCode"), "r.MatchCode", String.class), new ColumnInfo(Msg.translate(ctx, "DateTrx"), "fa.DateTrx", Timestamp.class), new ColumnInfo(Msg.translate(ctx, "AD_Org_ID"), "o.Value", String.class), new ColumnInfo(Msg.translate(ctx, "Amt"), "abs(fa.amtacctdr-fa.amtacctcr)", BigDecimal.class, 0, true, false, null, false) }, //	FROM
    "Fact_Acct fa" + " LEFT OUTER JOIN Fact_Reconciliation r ON (fa.Fact_Acct_ID=r.Fact_Acct_ID)" + " LEFT OUTER JOIN C_BPartner bp ON (fa.C_BPartner_ID=bp.C_BPartner_ID)" + " LEFT OUTER JOIN AD_Org o ON (o.AD_Org_ID=fa.AD_Org_ID)" + " LEFT OUTER JOIN M_Product p ON (p.M_Product_ID=fa.M_Product_ID)" + " LEFT OUTER JOIN GL_Category glc ON (fa.GL_Category_ID=glc.GL_Category_ID)", //	additional where & order in loadTableInfo()
    " fa.AD_Client_ID=?", true, "fa");
    //
    miniTable.addActionListener(new EventListener() {

        public void onEvent(Event event) throws Exception {
            if (event.getName().equals("onSelect")) {
                calculateSelection();
                boolean enable = (miniTable.getSelectedCount() == 1);
                bZoom.setEnabled(enable);
            }
        }
    });
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) MLookup(org.compiere.model.MLookup) ColumnInfo(org.compiere.minigrid.ColumnInfo) Event(org.zkoss.zk.ui.event.Event) WTableModelEvent(org.adempiere.webui.event.WTableModelEvent) EventListener(org.zkoss.zk.ui.event.EventListener) Properties(java.util.Properties) SQLException(java.sql.SQLException)

Example 10 with WTableDirEditor

use of org.adempiere.webui.editor.WTableDirEditor in project adempiere by adempiere.

the class WCreateFromStatementUI method dynInit.

/**
	 *  Dynamic Init
	 *  @throws Exception if Lookups cannot be initialized
	 *  @return true if initialized
	 */
public boolean dynInit() throws Exception {
    log.config("");
    //Refresh button
    Button refreshButton = v_CreateFromPanel.getConfirmPanel().createButton(ConfirmPanel.A_REFRESH);
    refreshButton.addEventListener(Events.ON_CLICK, this);
    v_CreateFromPanel.getConfirmPanel().addButton(refreshButton);
    //  C_BankStatement.C_BankAccount_ID
    int AD_Column_ID = 4917;
    MLookup lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.TableDir);
    bankAccountField = new WTableDirEditor("C_BankAccount_ID", true, true, true, lookup);
    //  Set Default
    bankAccountField.setValue(getC_BankAccount_ID());
    //  initial Loading
    authorizationField = new WStringEditor("authorization", false, false, true, 10, 30, null, null);
    authorizationField.getComponent().addEventListener(Events.ON_CHANGE, this);
    lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
    documentTypeField = new WTableDirEditor(MPayment.COLUMNNAME_C_DocType_ID, false, false, true, lookup);
    documentTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
    lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
    tenderTypeField = new WTableDirEditor(MPayment.COLUMNNAME_TenderType, false, false, true, lookup);
    tenderTypeField.getComponent().addEventListener(Events.ON_CHANGE, this);
    lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search);
    bPartnerLookup = new WSearchEditor("C_BPartner_ID", false, false, true, lookup);
    Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
    dateToField.setValue(date);
    loadBankAccount();
    return true;
}
Also used : WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) Button(org.adempiere.webui.component.Button) MLookup(org.compiere.model.MLookup) WSearchEditor(org.adempiere.webui.editor.WSearchEditor) Timestamp(java.sql.Timestamp) WStringEditor(org.adempiere.webui.editor.WStringEditor)

Aggregations

WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)15 MLookup (org.compiere.model.MLookup)9 WSearchEditor (org.adempiere.webui.editor.WSearchEditor)8 Label (org.adempiere.webui.component.Label)5 Properties (java.util.Properties)3 SQLException (java.sql.SQLException)2 SimpleDateFormat (java.text.SimpleDateFormat)2 Combobox (org.adempiere.webui.component.Combobox)2 Row (org.adempiere.webui.component.Row)2 Rows (org.adempiere.webui.component.Rows)2 WLocatorEditor (org.adempiere.webui.editor.WLocatorEditor)2 WNumberEditor (org.adempiere.webui.editor.WNumberEditor)2 WStringEditor (org.adempiere.webui.editor.WStringEditor)2 MLocatorLookup (org.compiere.model.MLocatorLookup)2 KeyNamePair (org.compiere.util.KeyNamePair)2 Div (org.zkoss.zul.Div)2 Point (java.awt.Point)1 PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 Timestamp (java.sql.Timestamp)1