use of org.compiere.model.MLookup 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);
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VPayPrint method dynInit.
// VPayPrint
/**
* Dynamic Init
*/
private void dynInit() {
// C_PaySelection_ID
// C_PaySelectionCheck.C_PaySelection_ID
int AD_Column_ID = 7670;
// FR [ 297 ]
// Add DocStatus for validation
MLookupInfo info = MLookupFactory.getLookupInfo(Env.getCtx(), windowNo, AD_Column_ID, DisplayType.Search);
info.ValidationCode = "C_PaySelection.DocStatus IN('CO', 'CL') AND C_PaySelection.C_BankAccount_ID IS NOT NULL";
MLookup lookupPS = new MLookup(info, 0);
paySelectSearch = new VLookup("C_PaySelection_ID", true, false, true, lookupPS);
paySelectSearch.addVetoableChangeListener(this);
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VCreateFromStatementUI method dynInit.
/**
* Dynamic Init
* @throws Exception if Lookups cannot be initialized
* @return true if initialized
*/
public boolean dynInit() throws Exception {
log.config("");
//Refresh button
CButton refreshButton = ConfirmPanel.createRefreshButton(false);
refreshButton.setMargin(new Insets(1, 10, 0, 10));
refreshButton.setDefaultCapable(true);
refreshButton.addActionListener(this);
v_CreateFromPanel.getConfirmPanel().addButton(refreshButton);
// Add to Main Form
v_Container.getContentPane().add(v_CreateFromPanel);
// 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 VLookup("C_BankAccount_ID", true, true, true, lookup);
// Set Default
bankAccountField.setValue(getC_BankAccount_ID());
// initial Loading
authorizationField = new VString("authorization", false, false, true, 10, 30, null, null);
authorizationField.addActionListener(this);
MLookup lookupDocument = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_C_DocType_ID), DisplayType.TableDir);
documentTypeField = new VLookup(MPayment.COLUMNNAME_C_DocType_ID, false, false, true, lookupDocument);
documentTypeField.addActionListener(this);
MLookup lookupTender = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, MColumn.getColumn_ID(MPayment.Table_Name, MPayment.COLUMNNAME_TenderType), DisplayType.List);
tenderTypeField = new VLookup(MPayment.COLUMNNAME_TenderType, false, false, true, lookupTender);
tenderTypeField.addActionListener(this);
bPartnerLookup = new VLookup("C_BPartner_ID", false, false, true, MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, 3499, DisplayType.Search));
BPartner_idLabel.setLabelFor(bPartnerLookup);
Timestamp date = Env.getContextAsDate(Env.getCtx(), p_WindowNo, MBankStatement.COLUMNNAME_StatementDate);
dateToField.setValue(date);
loadBankAccount();
return true;
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VInvoiceGen 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(), m_WindowNo, 0, 2163, DisplayType.TableDir);
fOrg = new VLookup("AD_Org_ID", false, false, true, orgL);
// lOrg.setText(Msg.translate(Env.getCtx(), "AD_Org_ID"));
fOrg.addVetoableChangeListener(this);
MLookup docActionL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 3494, /* C_Invoice.DocStatus */
DisplayType.List, Env.getLanguage(Env.getCtx()), "DocAction", 135, /* _Document Action */
false, "AD_Ref_List.Value IN ('CO','PR')");
docAction = new VLookup("DocAction", true, false, true, docActionL);
// lDcoACtion.setText((Msg.translate(Env.getCtx(), "DocAction")););
docAction.addVetoableChangeListener(this);
//@Trifon - Pre-select "Prepare"
docAction.setValue("PR");
//
MLookup bpL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2762, DisplayType.Search);
fBPartner = new VLookup("C_BPartner_ID", false, false, true, bpL);
// lBPartner.setText(Msg.translate(Env.getCtx(), "C_BPartner_ID"));
fBPartner.addVetoableChangeListener(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);
//@@
panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VCreateFromInvoiceUI method initBPartner.
// vetoableChange
/**************************************************************************
* Load BPartner Field
* @param forInvoice true if Invoices are to be created, false receipts
* @throws Exception if Lookups cannot be initialized
*/
protected void initBPartner(boolean forInvoice) throws Exception {
// load BPartner
// C_Invoice.C_BPartner_ID
int AD_Column_ID = 3499;
MLookup lookup = MLookupFactory.get(Env.getCtx(), p_WindowNo, 0, AD_Column_ID, DisplayType.Search);
bPartnerField = new VLookup("C_BPartner_ID", true, false, true, lookup);
//
int C_BPartner_ID = getC_BPartner_ID();
bPartnerField.setValue(C_BPartner_ID);
// initial loading
initBPOrderDetails(C_BPartner_ID, forInvoice);
}
Aggregations