IDEMPIERE-339 - Improve Info Product Window
(transplanted from bfbf103ae59f8e2cec4ad9508aefdae11b41f6e9)
This commit is contained in:
parent
57c669ce71
commit
e647070a60
|
@ -873,9 +873,34 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
public void actionPerformed (ActionEvent e)
|
||||
{
|
||||
// don't requery if fieldValue and fieldName are empty
|
||||
if ((e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
|
||||
&& (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0))
|
||||
return;
|
||||
if (e.getSource() == pickWarehouse || e.getSource() == pickPriceList)
|
||||
{
|
||||
// IDEMPIERE-337 - Improve Info Product Window
|
||||
boolean execute = true;
|
||||
if (fieldValue.getText().length() == 0 && fieldName.getText().length() == 0 && p_table.getRowCount() == 0)
|
||||
execute = false;
|
||||
p_table.setRowCount(0);
|
||||
((DefaultTableModel)p_table.getModel()).setColumnCount(0);
|
||||
int M_Warehouse_ID = ((KeyNamePair)pickWarehouse.getSelectedItem()).getKey();
|
||||
// Create Grid
|
||||
StringBuffer where = new StringBuffer();
|
||||
where.append("p.IsActive='Y'");
|
||||
if (M_Warehouse_ID != 0)
|
||||
where.append(" AND p.IsSummary='N'");
|
||||
// dynamic Where Clause
|
||||
if (p_whereClause != null && p_whereClause.length() > 0)
|
||||
where.append(" AND ") // replace fully qualified name with alias
|
||||
.append(Util.replace(p_whereClause, "M_Product.", "p."));
|
||||
//
|
||||
p_table.removeMouseListener(this);
|
||||
prepareTable(getProductLayout(),
|
||||
s_productFrom,
|
||||
where.toString(),
|
||||
"");
|
||||
p_table.setShowTotals(false);
|
||||
if (!execute)
|
||||
return;
|
||||
}
|
||||
|
||||
// Product Attribute Search
|
||||
if (e.getSource().equals(m_InfoPAttributeButton))
|
||||
|
@ -906,7 +931,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
//
|
||||
super.actionPerformed(e);
|
||||
} // actionPerformed
|
||||
|
||||
|
||||
/**
|
||||
* Enable PAttribute if row selected/changed
|
||||
*/
|
||||
|
@ -1053,33 +1078,47 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
*/
|
||||
protected Info_Column[] getProductLayout()
|
||||
{
|
||||
if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
return s_productLayout;
|
||||
// IDEMPIERE-337
|
||||
//if (s_productLayout != null && s_productLayoutRole == MRole.getDefault().getAD_Role_ID())
|
||||
// return s_productLayout;
|
||||
//
|
||||
s_productLayout = null;
|
||||
s_productLayoutRole = MRole.getDefault().getAD_Role_ID();
|
||||
// IDEMPIERE_337
|
||||
int M_Warehouse_ID = 0;
|
||||
KeyNamePair warehouse = (KeyNamePair)pickWarehouse.getSelectedItem();
|
||||
M_Warehouse_ID = warehouse.getKey();
|
||||
int M_PriceList_ID = 0;
|
||||
KeyNamePair pricelist = (KeyNamePair)pickPriceList.getSelectedItem();
|
||||
M_PriceList_ID = pricelist.getKey();
|
||||
|
||||
ArrayList<Info_Column> list = new ArrayList<Info_Column>();
|
||||
list.add(new Info_Column(" ", "p.M_Product_ID", IDColumn.class, !p_multiSelection));
|
||||
list.add(new Info_Column(" ", "DISTINCT p.M_Product_ID", IDColumn.class, !p_multiSelection));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Discontinued").substring(0, 1), "p.Discontinued", Boolean.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Value"), "p.Value", String.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Name"), "p.Name", String.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyAvailable"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyAvailable(p.M_Product_ID,?,0) end AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false))
|
||||
// IDEMPIERE-337
|
||||
if (M_Warehouse_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyAvailable"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyAvailable(p.M_Product_ID,?,0) end AS QtyAvailable", Double.class, true, true, null));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3027/*PriceList*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceList"), "bomPriceList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList", BigDecimal.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && M_PriceList_ID !=0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceStd"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOnHand"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyOnHand(p.M_Product_ID,?,0) end AS QtyOnHand", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
if (M_Warehouse_ID != 0)
|
||||
{
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOnHand"), "case when p.IsBOM='N' and (p.ProductType!='I' OR p.IsStocked='N') then to_number(get_Sysconfig('QTY_TO_SHOW_FOR_SERVICES', '99999', p.ad_client_id, 0), '99999999999') else bomQtyOnHand(p.M_Product_ID,?,0) end AS QtyOnHand", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyReserved"), "bomQtyReserved(p.M_Product_ID,?,0) AS QtyReserved", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyOrdered"), "bomQtyOrdered(p.M_Product_ID,?,0) AS QtyOrdered", Double.class));
|
||||
if (isUnconfirmed())
|
||||
{
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmed"), "(SELECT SUM(c.TargetQty) FROM M_InOutLineConfirm c INNER JOIN M_InOutLine il ON (c.M_InOutLine_ID=il.M_InOutLine_ID) INNER JOIN M_InOut i ON (il.M_InOut_ID=i.M_InOut_ID) WHERE c.Processed='N' AND i.M_Warehouse_ID=? AND il.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmed", Double.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "QtyUnconfirmedMove"), "(SELECT SUM(c.TargetQty) FROM M_MovementLineConfirm c INNER JOIN M_MovementLine ml ON (c.M_MovementLine_ID=ml.M_MovementLine_ID) INNER JOIN M_Locator l ON (ml.M_LocatorTo_ID=l.M_Locator_ID) WHERE c.Processed='N' AND l.M_Warehouse_ID=? AND ml.M_Product_ID=p.M_Product_ID) AS QtyUnconfirmedMove", Double.class));
|
||||
}
|
||||
}
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3028/*PriceStd*/, false) && MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Margin"), "bomPriceStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "Vendor"), "bp.Name", String.class));
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false))
|
||||
if (MRole.getDefault().isColumnAccess(251 /*M_ProductPrice*/, 3029/*PriceLimit*/, false) && M_PriceList_ID != 0)
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit", BigDecimal.class));
|
||||
list.add(new Info_Column(Msg.translate(Env.getCtx(), "IsInstanceAttribute"), "pa.IsInstanceAttribute", Boolean.class));
|
||||
s_productLayout = new Info_Column[list.size()];
|
||||
|
|
Loading…
Reference in New Issue