IDEMPIERE-524 Product Info Windows, Description Tab does not show DocumentNote
This commit is contained in:
parent
506e1eb6fd
commit
beeac4449a
|
@ -302,7 +302,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
/** Where Clause */
|
||||
String s_sqlWhere = "Value = ?";
|
||||
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
|
||||
m_sqlWarehouse += " Group By Warehouse, documentnote ";
|
||||
m_sqlWarehouse += " GROUP BY Warehouse";
|
||||
warehouseTbl.setRowSelectionAllowed(true);
|
||||
warehouseTbl.setMultiSelection(false);
|
||||
warehouseTbl.addMouseListener(this);
|
||||
|
@ -368,7 +368,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
list.add(new ColumnInfo(Msg.translate(Env.getCtx(), "PriceLimit"), "bomPriceLimit(pp.M_Product_ID, pp.M_PriceList_Version_ID) AS PriceLimit", Double.class));
|
||||
ColumnInfo[] s_layoutProductPrice = new ColumnInfo[list.size()];
|
||||
list.toArray(s_layoutProductPrice);
|
||||
s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID";
|
||||
s_sqlFrom = "M_ProductPrice pp INNER JOIN M_PriceList_Version plv ON (pp.M_PriceList_Version_ID = plv.M_PriceList_Version_ID)";
|
||||
s_sqlWhere = "pp.M_Product_ID = ? AND plv.IsActive = 'Y' AND pp.IsActive = 'Y'";
|
||||
m_sqlProductprice = productpriceTbl.prepareTable(s_layoutProductPrice, s_sqlFrom, s_sqlWhere, false, "pp") + " ORDER BY plv.ValidFrom DESC";
|
||||
productpriceTbl.setRowSelectionAllowed(false);
|
||||
|
@ -427,8 +427,6 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
{
|
||||
//int M_Product_ID = 0;
|
||||
String sql = m_sqlWarehouse;
|
||||
//Add description to the query
|
||||
sql = sql.replace(" FROM", ", DocumentNote FROM");
|
||||
log.finest(sql);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -450,27 +448,8 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
}
|
||||
|
||||
m_M_Product_ID = getSelectedRowKey();
|
||||
sql = "SELECT DocumentNote FROM M_Product WHERE M_Product_ID = ?;";
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_M_Product_ID);
|
||||
fieldDescription.setText("");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next())
|
||||
if(rs.getString("DocumentNote") != null)
|
||||
fieldDescription.setText(rs.getString("DocumentNote"));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
sql = "SELECT DocumentNote FROM M_Product WHERE M_Product_ID=?";
|
||||
fieldDescription.setText(DB.getSQLValueString(null, sql, m_M_Product_ID));
|
||||
|
||||
sql = m_sqlSubstitute;
|
||||
log.finest(sql);
|
||||
|
@ -480,7 +459,6 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pstmt.setInt(2, M_PriceList_Version_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
substituteTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -498,7 +476,6 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pstmt.setInt(2, M_PriceList_Version_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
relatedTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -517,7 +494,6 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pstmt.setInt(1, m_M_Product_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
productpriceTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -618,6 +594,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pickPriceList.addItem(kn);
|
||||
}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
|
||||
// Warehouse
|
||||
SQL = MRole.getDefault().addAccessSQL (
|
||||
|
@ -636,6 +613,7 @@ public class InfoProduct extends Info implements ActionListener, ChangeListener
|
|||
pickWarehouse.addItem(kn);
|
||||
}
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
|
||||
// Product Category
|
||||
SQL = MRole.getDefault().addAccessSQL (
|
||||
|
|
|
@ -386,7 +386,7 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
/** Where Clause */
|
||||
String s_sqlWhere = "Value = ?";
|
||||
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
|
||||
m_sqlWarehouse += " Group By Warehouse, documentnote ";
|
||||
m_sqlWarehouse += " GROUP BY Warehouse";
|
||||
warehouseTbl.setMultiSelection(false);
|
||||
warehouseTbl.setShowTotals(true);
|
||||
warehouseTbl.autoSize();
|
||||
|
@ -626,23 +626,27 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
log.finer(sqlCount);
|
||||
m_count = -1;
|
||||
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sqlCount, null);
|
||||
pstmt = DB.prepareStatement(sqlCount, null);
|
||||
setParameters (pstmt, false);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
m_count = rs.getInt(1);
|
||||
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, sqlCount, e);
|
||||
m_count = -2;
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
|
||||
log.fine("#" + m_count + " - " + (System.currentTimeMillis()-start) + "ms");
|
||||
|
||||
|
@ -663,8 +667,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
{
|
||||
//int M_Product_ID = 0;
|
||||
String sql = m_sqlWarehouse;
|
||||
//Add description to the query
|
||||
sql = sql.replace(" FROM", ", DocumentNote FROM");
|
||||
log.finest(sql);
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
@ -686,27 +688,8 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
}
|
||||
|
||||
m_M_Product_ID = getSelectedRowKey();
|
||||
sql = "SELECT DocumentNote FROM M_Product WHERE M_Product_ID = ?;";
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_M_Product_ID);
|
||||
fieldDescription.setText("");
|
||||
rs = pstmt.executeQuery();
|
||||
if(rs.next())
|
||||
if(rs.getString("DocumentNote") != null)
|
||||
fieldDescription.setText(rs.getString("DocumentNote"));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
sql = "SELECT DocumentNote FROM M_Product WHERE M_Product_ID=?";
|
||||
fieldDescription.setText(DB.getSQLValueString(null, sql, m_M_Product_ID));
|
||||
|
||||
sql = m_sqlSubstitute;
|
||||
log.finest(sql);
|
||||
|
@ -716,7 +699,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
pstmt.setInt(2, M_PriceList_Version_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
substituteTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -734,7 +716,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
pstmt.setInt(2, M_PriceList_Version_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
relatedTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -753,7 +734,6 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
pstmt.setInt(1, m_M_Product_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
productpriceTbl.loadTable(rs);
|
||||
rs.close();
|
||||
} catch (Exception e) {
|
||||
log.log(Level.WARNING, sql, e);
|
||||
}
|
||||
|
@ -826,17 +806,19 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
// Add Access & Order
|
||||
SQL = MRole.getDefault().addAccessSQL (SQL, "M_PriceList_Version", true, false) // fully qualidfied - RO
|
||||
+ " ORDER BY M_PriceList_Version.Name";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pickPriceList.appendItem("",new Integer(0));
|
||||
PreparedStatement pstmt = DB.prepareStatement(SQL, null);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
pstmt = DB.prepareStatement(SQL, null);
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next())
|
||||
{
|
||||
pickPriceList.appendItem(rs.getString(2),new Integer(rs.getInt(1)));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
|
||||
// Warehouse
|
||||
SQL = MRole.getDefault().addAccessSQL (
|
||||
|
@ -852,8 +834,8 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
{
|
||||
pickWarehouse.appendItem(rs.getString("ValueName"), new Integer(rs.getInt("M_Warehouse_ID")));
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
|
||||
// Elaine 2008/11/21
|
||||
// Product Category
|
||||
|
@ -879,6 +861,11 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
log.log(Level.SEVERE, SQL, e);
|
||||
setStatusLine(e.getLocalizedMessage(), true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
} // fillPicks
|
||||
|
||||
/**
|
||||
|
@ -951,24 +938,29 @@ public class InfoProductPanel extends InfoPanel implements EventListener<Event>
|
|||
+ " AND pl.M_PriceList_ID=? " // 1
|
||||
+ "ORDER BY plv.ValidFrom DESC";
|
||||
// find newest one
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, M_PriceList_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
while (rs.next() && retValue == 0)
|
||||
{
|
||||
Timestamp plDate = rs.getTimestamp(2);
|
||||
if (!priceDate.before(plDate))
|
||||
retValue = rs.getInt(1);
|
||||
}
|
||||
rs.close();
|
||||
pstmt.close();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
log.log(Level.SEVERE, sql, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null; pstmt = null;
|
||||
}
|
||||
Env.setContext(Env.getCtx(), p_WindowNo, "M_PriceList_Version_ID", retValue);
|
||||
return retValue;
|
||||
} // findPLV
|
||||
|
|
Loading…
Reference in New Issue