Search in sources :

Example 6 with ColumnInfo

use of org.compiere.minigrid.ColumnInfo in project adempiere by adempiere.

the class WMatch method dynInit.

//  jbInit
/**
	 *  Dynamic Init.
	 *  Table Layout, Visual, Listener
	 */
private void dynInit() {
    ColumnInfo[] layout = new ColumnInfo[] { new ColumnInfo(" ", ".", IDColumn.class, false, false, ""), //  1
    new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), ".", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), ".", Timestamp.class), //  3
    new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Line"), ".", KeyNamePair.class, "."), //  5
    new ColumnInfo(Msg.translate(Env.getCtx(), "M_Product_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Qty"), ".", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Matched"), ".", Double.class) };
    xMatchedTable.prepareTable(layout, "", "", false, "");
    xMatchedToTable.prepareTable(layout, "", "", true, "");
    matchFrom.setSelectedIndex(0);
    //  Listener
    matchFrom.addActionListener(this);
    matchTo.addActionListener(this);
    bSearch.addActionListener(this);
    xMatchedTable.addEventListener(Events.ON_SELECT, this);
    xMatchedToTable.getModel().addTableModelListener(this);
    bProcess.addActionListener(this);
    sameBPartner.addActionListener(this);
    sameProduct.addActionListener(this);
    sameQty.addActionListener(this);
    //  Init Yvonne
    String selection = (String) matchFrom.getSelectedItem().getValue();
    SimpleListModel model = new SimpleListModel(cmd_matchFrom((String) matchFrom.getSelectedItem().getLabel()));
    matchTo.setItemRenderer(model);
    matchTo.setModel(model);
    //  Set Title
    xMatchedBorder.setValue(selection);
    //  Reset Table
    xMatchedTable.setRowCount(0);
    //  sync To
    matchTo.setSelectedIndex(0);
    cmd_matchTo();
    statusBar.setStatusLine("");
    statusBar.setStatusDB("0");
}
Also used : SimpleListModel(org.adempiere.webui.component.SimpleListModel) ColumnInfo(org.compiere.minigrid.ColumnInfo)

Example 7 with ColumnInfo

use of org.compiere.minigrid.ColumnInfo 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 8 with ColumnInfo

use of org.compiere.minigrid.ColumnInfo in project adempiere by adempiere.

the class VFactReconcile method dynInit.

//  jbInit
/**
	 *  Dynamic Init.
	 *  - Load Bank Info
	 *  - Load BPartner
	 *  - Load Document Type
	 *  - Init Table
	 */
private void dynInit() {
    Properties ctx = Env.getCtx();
    //
    m_AD_Client_ID = Env.getAD_Client_ID(Env.getCtx());
    //  Fact_Acct.C_AcctSchema_ID
    fieldAcctSchema = new VLookup("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.addActionListener(this);
    fieldAcctSchema.setValue(MClient.get(Env.getCtx()).getAcctSchema().getC_AcctSchema_ID());
    Dimension dim = fieldAcctSchema.getPreferredSize();
    dim.width = 300;
    fieldAcctSchema.setPreferredSize(dim);
    // Organization filter selection
    fieldOrg = new VLookup("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));
    if (fieldOrg.getValue() == null || ((Integer) fieldOrg.getValue()).intValue() != 0)
        fieldOrg.setValue(Env.getAD_Org_ID(Env.getCtx()));
    dim = fieldOrg.getPreferredSize();
    dim.width = 300;
    fieldOrg.setPreferredSize(dim);
    //  BPartner
    //  C_Invoice.C_BPartner_ID AD_Column_ID = 3499; 
    fieldBPartner = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_C_BPartner_ID), DisplayType.Search));
    // Product
    //  Fact_Acct.M_Product_ID AD_Column_ID = 2527;        
    fieldProduct = new VLookup("M_Product_ID", false, false, true, MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, MColumn.getColumn_ID(MFactAcct.Table_Name, MFactAcct.COLUMNNAME_M_Product_ID), DisplayType.Search));
    // 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);
    }
    // Mandatory true will select first entry with no null option.
    fieldAccount = new VLookup("Account_ID", true, false, true, lookup);
    dim = fieldAccount.getPreferredSize();
    dim.width = 300;
    fieldAccount.setPreferredSize(dim);
    m_sql = miniTable.prepareTable(new ColumnInfo[] { new ColumnInfo(Msg.translate(ctx, "Amt"), "abs(fa.amtacctdr-fa.amtacctcr)", BigDecimal.class), 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(" ", "fa.Fact_Acct_ID", IDColumn.class, false, false, null), 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) }, //	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.getModel().addTableModelListener(this);
    miniTable.setColumnVisibility(miniTable.getColumnModel().getColumn(1), false);
}
Also used : MLookup(org.compiere.model.MLookup) VLookup(org.compiere.grid.ed.VLookup) ColumnInfo(org.compiere.minigrid.ColumnInfo) Dimension(java.awt.Dimension) Properties(java.util.Properties) SQLException(java.sql.SQLException)

Example 9 with ColumnInfo

use of org.compiere.minigrid.ColumnInfo in project adempiere by adempiere.

the class VMatch method dynInit.

//  jbInit
/**
	 *  Dynamic Init.
	 *  Table Layout, Visual, Listener
	 */
private void dynInit() {
    ColumnInfo[] layout = new ColumnInfo[] { new ColumnInfo(" ", ".", IDColumn.class, false, false, ""), //  1
    new ColumnInfo(Msg.translate(Env.getCtx(), "DocumentNo"), ".", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Date"), ".", Timestamp.class), //  3
    new ColumnInfo(Msg.translate(Env.getCtx(), "C_BPartner_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Line"), ".", KeyNamePair.class, "."), //  5
    new ColumnInfo(Msg.translate(Env.getCtx(), "M_Product_ID"), ".", KeyNamePair.class, "."), new ColumnInfo(Msg.translate(Env.getCtx(), "Qty"), ".", Double.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Matched"), ".", Double.class), //JAVIER
    new ColumnInfo(Msg.translate(Env.getCtx(), "AD_Org_ID"), ".", KeyNamePair.class, ".") };
    xMatchedTable.prepareTable(layout, "", "", false, "");
    xMatchedToTable.prepareTable(layout, "", "", true, "");
    //  Visual
    CompiereColor.setBackground(panel);
    //  Listener
    matchFrom.addActionListener(this);
    matchTo.addActionListener(this);
    bSearch.addActionListener(this);
    xMatchedTable.getSelectionModel().addListSelectionListener(this);
    xMatchedToTable.getModel().addTableModelListener(this);
    bProcess.addActionListener(this);
    sameBPartner.addActionListener(this);
    sameProduct.addActionListener(this);
    sameQty.addActionListener(this);
    //  Init
    matchTo.setModel(new DefaultComboBoxModel(cmd_matchFrom((String) matchFrom.getSelectedItem())));
    //  Set Title
    xMatchedBorder.setTitle((String) matchFrom.getSelectedItem());
    xMatchedScrollPane.repaint();
    //  Reset Table
    xMatchedTable.setRowCount(0);
    cmd_matchTo();
    statusBar.setStatusLine("");
    statusBar.setStatusDB(0);
}
Also used : ColumnInfo(org.compiere.minigrid.ColumnInfo) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel)

Example 10 with ColumnInfo

use of org.compiere.minigrid.ColumnInfo in project adempiere by adempiere.

the class WHRActionNotice method configureMiniTable.

// jbInit
/**
	 * Configure Table
	 */
private void configureMiniTable() {
    ColumnInfo[] layout = { new ColumnInfo(Msg.translate(Env.getCtx(), "AD_Org_ID"), "", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "HR_Concept_ID"), "", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "ValidFrom"), "", Timestamp.class), new ColumnInfo(Msg.translate(Env.getCtx(), "ColumnType"), "", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Qty"), "", BigDecimal.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Amount"), "", BigDecimal.class), new ColumnInfo(Msg.translate(Env.getCtx(), "ServiceDate"), "", Timestamp.class), new ColumnInfo(Msg.translate(Env.getCtx(), "TextMsg"), "", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "Description"), "", String.class) };
    miniTable.prepareTable(layout, "", "", false, "");
}
Also used : ColumnInfo(org.compiere.minigrid.ColumnInfo) Timestamp(java.sql.Timestamp) BigDecimal(java.math.BigDecimal)

Aggregations

ColumnInfo (org.compiere.minigrid.ColumnInfo)11 SQLException (java.sql.SQLException)5 Dimension (java.awt.Dimension)3 Properties (java.util.Properties)3 Event (org.zkoss.zk.ui.event.Event)3 BorderLayout (java.awt.BorderLayout)2 JScrollPane (javax.swing.JScrollPane)2 Row (org.adempiere.webui.component.Row)2 Rows (org.adempiere.webui.component.Rows)2 Tab (org.adempiere.webui.component.Tab)2 Tabpanel (org.adempiere.webui.component.Tabpanel)2 Tabpanels (org.adempiere.webui.component.Tabpanels)2 Tabs (org.adempiere.webui.component.Tabs)2 ALayoutConstraint (org.compiere.apps.ALayoutConstraint)2 VLookup (org.compiere.grid.ed.VLookup)2 IDColumn (org.compiere.minigrid.IDColumn)2 MLookup (org.compiere.model.MLookup)2 Borderlayout (org.zkoss.zul.Borderlayout)2 Center (org.zkoss.zul.Center)2 North (org.zkoss.zul.North)2