From b5bcc3690e32172f1a3d7a1524894a14ffa44751 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 28 Apr 2021 15:28:50 +0200 Subject: [PATCH] COF #11523 / IDEMPIERE-4715 - attribute set instance: new qty available column and group results in select existing record dialog (#670) Co-authored-by: muriloht --- .../adempiere/webui/window/WPAttributeInstance.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java index d6d6356838..65b877065a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WPAttributeInstance.java @@ -179,11 +179,11 @@ public class WPAttributeInstance extends Window implements EventListener new ColumnInfo(Msg.translate(Env.getCtx(), "Lot"), "asi.Lot", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "SerNo"), "asi.SerNo", String.class), new ColumnInfo(Msg.translate(Env.getCtx(), "GuaranteeDate"), "asi.GuaranteeDate", Timestamp.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "DateMaterialPolicy"), "s.DateMaterialPolicy", Timestamp.class), new ColumnInfo(Msg.translate(Env.getCtx(), "M_Locator_ID"), "l.Value", KeyNamePair.class, "s.M_Locator_ID"), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "s.QtyOnHand", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "s.QtyReserved", Double.class), - new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "s.QtyOrdered", Double.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "SUM(s.QtyOnHand - s.QtyReserved)", Double.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "SUM(s.QtyOnHand)", Double.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "SUM(s.QtyReserved)", Double.class), + new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOrdered"), "SUM(s.QtyOrdered)", Double.class), // See RV_Storage new ColumnInfo(Msg.translate(Env.getCtx(), "GoodForDays"), "(daysbetween(asi.GuaranteeDate, getDate()))-p.GuaranteeDaysMin", Integer.class, true, true, null), new ColumnInfo(Msg.translate(Env.getCtx(), "ShelfLifeDays"), "daysbetween(asi.GuaranteeDate, getDate())", Integer.class), @@ -256,7 +256,8 @@ public class WPAttributeInstance extends Window implements EventListener m_sql = m_table.prepareTable (s_layout, s_sqlFrom, m_M_Warehouse_ID == 0 ? s_sqlWhereWithoutWarehouse : s_sqlWhere, false, "s") - + " ORDER BY s.DateMaterialPolicy, s.QtyOnHand"; // oldest, smallest first + + " GROUP BY s.M_AttributeSetInstance_ID,asi.Description,asi.Lot,asi.SerNo,asi.GuaranteeDate,l.Value,s.M_Locator_ID,p.GuaranteeDaysMin,p.GuaranteeDays" + + " ORDER BY asi.GuaranteeDate, SUM(s.QtyOnHand)"; // oldest, smallest first // m_table.addEventListener(Events.ON_SELECT, this); // @@ -269,7 +270,7 @@ public class WPAttributeInstance extends Window implements EventListener private void refresh() { String sql = m_sql; - int pos = m_sql.lastIndexOf(" ORDER BY "); + int pos = m_sql.lastIndexOf(" GROUP BY "); if (!showAll.isChecked()) { sql = m_sql.substring(0, pos)