use of org.compiere.model.MLookup in project adempiere by adempiere.
the class WStocktake method dynParameter.
// jbInit
/**
* Initialize Parameter fields
* @throws Exception if Lookups cannot be initialized
*/
private void dynParameter() throws Exception {
Properties ctx = Env.getCtx();
// Physical Inventory
String vcode = "M_Inventory.IsStocktake='Y' ";
MLookup inventoryLookup = MLookupFactory.get(ctx, m_WindowNo, 3563, DisplayType.TableDir, Env.getLanguage(Env.getCtx()), "M_Inventory_ID", 53249, true, vcode);
inventoryField = new WTableDirEditor("M_Inventory_ID", false, false, true, inventoryLookup);
// Locator
MLocatorLookup locatorLookup = new MLocatorLookup(ctx, m_WindowNo);
locatorField = new WLocatorEditor("M_Locator_ID", false, false, true, locatorLookup, m_WindowNo);
// locatorField.addVetoableChangeListener(this);
// Product
MLookup productLookup = MLookupFactory.get(ctx, m_WindowNo, 0, 3668, DisplayType.Search);
productField = new WSearchEditor("M_Product_ID", false, false, true, productLookup);
productField.addValueChangeListener(this);
// Aisle(X)
MLookup aislexLookup = MLookupFactory.get(ctx, m_WindowNo, 1399, DisplayType.Table, Env.getLanguage(Env.getCtx()), "X", 53562, false, null);
aislexField = new WTableDirEditor("X", false, false, true, aislexLookup);
// Dates
lineFField = new WNumberEditor();
lineTField = new WNumberEditor();
//
confirmPanel.addActionListener(this);
statusBar.setStatusLine("");
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class WFieldRecordInfo method addLine.
// dynInit
/**
* Add Line
* @param AD_Column_ID column
* @param Updated updated
* @param UpdatedBy user
* @param OldValue old
* @param NewValue new
*/
private void addLine(int AD_Column_ID, Timestamp Updated, int UpdatedBy, String OldValue, String NewValue) {
Vector<String> line = new Vector<String>();
// Column
MColumn column = MColumn.get(Env.getCtx(), AD_Column_ID);
//
if (OldValue != null && OldValue.equals(MChangeLog.NULL))
OldValue = null;
String showOldValue = OldValue;
if (NewValue != null && NewValue.equals(MChangeLog.NULL))
NewValue = null;
String showNewValue = NewValue;
//
try {
if (DisplayType.isText(column.getAD_Reference_ID()))
;
else if (column.getAD_Reference_ID() == DisplayType.YesNo) {
if (OldValue != null) {
boolean yes = OldValue.equals("true") || OldValue.equals("Y");
showOldValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
}
if (NewValue != null) {
boolean yes = NewValue.equals("true") || NewValue.equals("Y");
showNewValue = Msg.getMsg(Env.getCtx(), yes ? "Y" : "N");
}
} else if (column.getAD_Reference_ID() == DisplayType.Amount) {
if (OldValue != null)
showOldValue = m_amtFormat.format(new BigDecimal(OldValue));
if (NewValue != null)
showNewValue = m_amtFormat.format(new BigDecimal(NewValue));
} else if (column.getAD_Reference_ID() == DisplayType.Integer) {
if (OldValue != null)
showOldValue = m_intFormat.format(new Integer(OldValue));
if (NewValue != null)
showNewValue = m_intFormat.format(new Integer(NewValue));
} else if (DisplayType.isNumeric(column.getAD_Reference_ID())) {
if (OldValue != null)
showOldValue = m_numberFormat.format(new BigDecimal(OldValue));
if (NewValue != null)
showNewValue = m_numberFormat.format(new BigDecimal(NewValue));
} else if (column.getAD_Reference_ID() == DisplayType.Date) {
if (OldValue != null)
showOldValue = m_dateFormat.format(Timestamp.valueOf(OldValue));
if (NewValue != null)
showNewValue = m_dateFormat.format(Timestamp.valueOf(NewValue));
} else if (column.getAD_Reference_ID() == DisplayType.DateTime) {
if (OldValue != null)
showOldValue = m_dateTimeFormat.format(Timestamp.valueOf(OldValue));
if (NewValue != null)
showNewValue = m_dateTimeFormat.format(Timestamp.valueOf(NewValue));
} else if (DisplayType.isLookup(column.getAD_Reference_ID())) {
MLookup lookup = MLookupFactory.get(Env.getCtx(), 0, AD_Column_ID, column.getAD_Reference_ID(), Env.getLanguage(Env.getCtx()), column.getColumnName(), column.getAD_Reference_Value_ID(), column.isParent(), null);
if (OldValue != null) {
Object key = OldValue;
NamePair pp = lookup.get(key);
if (pp != null)
showOldValue = pp.getName();
}
if (NewValue != null) {
Object key = NewValue;
NamePair pp = lookup.get(key);
if (pp != null)
showNewValue = pp.getName();
}
} else if (DisplayType.isLOB(column.getAD_Reference_ID()))
;
} catch (Exception e) {
log.log(Level.WARNING, OldValue + "->" + NewValue, e);
}
//
line.add(showNewValue);
line.add(showOldValue);
// UpdatedBy
MUser user = MUser.get(Env.getCtx(), UpdatedBy);
line.add(user.getName());
// Updated
line.add(m_dateFormat.format(Updated));
m_data.add(line);
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VAllocation method dynInit.
// dispose
/**
* Dynamic Init (prepare dynamic fields)
* @throws Exception if Lookups cannot be initialized
*/
public void dynInit() throws Exception {
// Currency
// C_Invoice.C_Currency_ID
int AD_Column_ID = 3505;
MLookup lookupCur = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
currencyPick = new VLookup("C_Currency_ID", true, false, true, lookupCur);
currencyPick.setValue(new Integer(m_C_Currency_ID));
currencyPick.addVetoableChangeListener(this);
// Organization filter selection
//C_Period.AD_Org_ID (needed to allow org 0)
AD_Column_ID = 839;
MLookup lookupOrg = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
organizationPick = new VLookup("AD_Org_ID", true, false, true, lookupOrg);
organizationPick.setValue(Env.getAD_Org_ID(Env.getCtx()));
organizationPick.addVetoableChangeListener(this);
// BPartner
// C_Invoice.C_BPartner_ID
AD_Column_ID = 3499;
MLookup lookupBP = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, AD_Column_ID, DisplayType.Search);
bpartnerSearch = new VLookup("C_BPartner_ID", true, false, true, lookupBP);
bpartnerSearch.addVetoableChangeListener(this);
// Translation
statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "AllocateStatus"));
statusBar.setStatusDB("");
// Date set to Login Date
dateField.setValue(Env.getContextAsDate(Env.getCtx(), "#Date"));
dateField.addVetoableChangeListener(this);
// C_AllocationLine.C_Charge_ID
AD_Column_ID = 61804;
MLookup lookupCharge = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, AD_Column_ID, DisplayType.TableDir);
chargePick = new VLookup("C_Charge_ID", false, false, true, lookupCharge);
chargePick.setValue(new Integer(m_C_Charge_ID));
chargePick.addVetoableChangeListener(this);
// APAR
// T_InvoiceGL.APAR
AD_Column_ID = 14082;
MLookup lookupAPAR = MLookupFactory.get(Env.getCtx(), getWindowNo(), 0, AD_Column_ID, DisplayType.List);
aparPick = new VLookup("APAR", true, false, true, lookupAPAR);
aparPick.setValue(APAR_A);
aparPick.addVetoableChangeListener(this);
}
use of org.compiere.model.MLookup in project adempiere by adempiere.
the class VInOutInvoiceGen method fillPicks.
// jbInit
/**
* Fill Picks.
* Column_ID from C_Order
* @throws Exception if Lookups cannot be initialized
*/
private void fillPicks() throws Exception {
// C_OrderLine.M_Warehouse_ID
MLookup orgL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 2223, DisplayType.TableDir);
fWarehouse = new VLookup("M_Warehouse_ID", true, false, true, orgL);
lWarehouse.setText(Msg.translate(Env.getCtx(), "M_Warehouse_ID"));
fWarehouse.addVetoableChangeListener(this);
m_M_Warehouse_ID = fWarehouse.getValue();
// C_Order.C_BPartner_ID
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(), "VendorRMA")));
cmbDocType.addActionListener(this);
}
use of org.compiere.model.MLookup in project lar_361 by comitsrl.
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 {
// @m_zuniga custom
if (MSysConfig.getBooleanValue("ERGIO_InvoiceGen_Login_ORG_and_PDV", true, Env.getAD_Client_ID(Env.getCtx()))) {
// Muestra unicamente la Organización con que se logueó
MLookup orgL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 2163, /* C_Order.AD_Org_ID */
DisplayType.TableDir, Env.getLanguage(Env.getCtx()), "AD_Org_ID", 3000023, /* AD_Org Login */
false, "");
// Campo obligatorio para evitar selección vacía y que se muestren órdenes de otras organizaciones
fOrg = new VLookup("AD_Org_ID", true, false, true, orgL);
} else // @m_zuniga custom
{
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);
// @mzuniga Deja por defecto la acción Completar
docAction.setValue("CO");
//
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);
// @m_zuniga custom
if (MSysConfig.getBooleanValue("ERGIO_InvoiceGen_Login_ORG_and_PDV", true, Env.getAD_Client_ID(Env.getCtx()))) {
// Muestra PDVS disponibles para la Organización con que se logueó
MLookup posL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 3000068, /* C_Invoice.C_POS_ID */
DisplayType.Table, Env.getLanguage(Env.getCtx()), "C_POS_ID", 3000022, /* LAR_POS_ID Login Org*/
false, "");
fPOS = new VLookup("C_POS_ID", true, false, true, posL);
} else // @m_zuniga custom
// @emmie custom
{
MLookup posL = MLookupFactory.get(Env.getCtx(), m_WindowNo, 0, 3000068, DisplayType.Table);
fPOS = new VLookup("C_POS_ID", true, false, true, posL);
}
lPOS.setText("PDV");
// @emmie custom
// @@
panel.getStatusBar().setStatusLine(Msg.getMsg(Env.getCtx(), "InvGenerateSel"));
}
Aggregations