[ 1823612 ] Product Info Screen Improvements

add views to generate the model in postgresql
This commit is contained in:
vpj-cd 2007-12-05 21:50:13 +00:00
parent 23b2846722
commit e687c34da8
4 changed files with 46 additions and 11 deletions

View File

@ -227,10 +227,10 @@ public final class InfoProduct extends Info implements ActionListener
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class)};
/** From Clause */
String s_sqlFrom = " M_Product_Stock_V ";
String s_sqlFrom = " M_PRODUCT_STOCK_V ";
/** Where Clause */
String s_sqlWhere = "Value = ?";
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_Product_Stock_V");
m_sqlWarehouse = warehouseTbl.prepareTable(s_layoutWarehouse, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_STOCK_V");
warehouseTbl.setRowSelectionAllowed(true);
warehouseTbl.setMultiSelection(false);
warehouseTbl.addMouseListener(this);
@ -242,15 +242,15 @@ public final class InfoProduct extends Info implements ActionListener
ColumnInfo[] s_layoutSubstitute = new ColumnInfo[]{
new ColumnInfo(
Msg.translate(Env.getCtx(), "Value"),
"(Select Value from M_Product p where p.M_Product_ID=M_Product_SubstituteRelated_V.M_Product_ID)",
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.M_Product_ID)",
String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)};
s_sqlFrom = "M_Product_SubstituteRelated_V";
s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'S'";
m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_Product_SubstituteRelated_V");
m_sqlSubstitute = substituteTbl.prepareTable(s_layoutSubstitute, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
substituteTbl.setRowSelectionAllowed(false);
substituteTbl.setMultiSelection(false);
substituteTbl.addMouseListener(this);
@ -262,15 +262,15 @@ public final class InfoProduct extends Info implements ActionListener
ColumnInfo[] s_layoutRelated = new ColumnInfo[]{
new ColumnInfo(
Msg.translate(Env.getCtx(), "Value"),
"(Select Value from M_Product p where p.M_Product_ID=M_Product_SubstituteRelated_V.M_Product_ID)",
"(Select Value from M_Product p where p.M_Product_ID=M_PRODUCT_SUBSTITUTERELATED_V.M_Product_ID)",
String.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyAvailable"), "QtyAvailable", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyOnHand"), "QtyOnHand", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "QtyReserved"), "QtyReserved", Double.class),
new ColumnInfo(Msg.translate(Env.getCtx(), "PriceStd"), "PriceStd", Double.class)};
s_sqlFrom = "M_Product_SubstituteRelated_V";
s_sqlFrom = "M_PRODUCT_SUBSTITUTERELATED_V";
s_sqlWhere = "M_Product_ID = ? AND M_PriceList_Version_ID = ? and RowType = 'R'";
m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_Product_SubstituteRelated_V");
m_sqlRelated = relatedTbl.prepareTable(s_layoutRelated, s_sqlFrom, s_sqlWhere, false, "M_PRODUCT_SUBSTITUTERELATED_V");
relatedTbl.setRowSelectionAllowed(false);
relatedTbl.setMultiSelection(false);
relatedTbl.addMouseListener(this);

View File

@ -0,0 +1,13 @@
--create views
CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
AS
SELECT
ms.AD_Client_ID, ms.AD_Org_ID, ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
mp.value, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand,
ms.qtyreserved, mp.description, mw.name as warehouse, mw.m_warehouse_id, mw.ad_client_id,
mw.ad_org_id, mp.documentnote
FROM m_storage ms
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
ORDER BY mw.name;

View File

@ -0,0 +1,19 @@
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATE_V AS
SELECT
s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' as rowtype, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
FROM m_substitute s
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id
UNION
SELECT r.ad_client_id, r.ad_org_id, r.m_product_id, r.relatedproduct_id, r.description, 'R' as rowtype, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
FROM m_relatedproduct r
JOIN m_storage ms ON ms.m_product_id = r.relatedproduct_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id
JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
JOIN m_productprice mpr ON ms.m_product_id = mpr.m_product_id;
COMMIT;

View File

@ -51,9 +51,10 @@ INSERT INTO ad_column(ad_column_id, ad_client_id, ad_org_id, isactive, created,
VALUES(53027, 0, 0, 'Y', '2007-07-26 00:00:00.0', '2007-07-26 00:00:00.0', 0, 0, 'On Hand Quantity', 'On Hand Quantity', 'The On Hand Quantity indicates the quantity of a product that is on hand in a warehouse.', 1, 'D', 'QtyOnHand', 53015, 29, NULL, NULL, 22, NULL, 'N', 'N', 'Y', 'N', NULL, 'N', NULL, 'N', 'N', NULL, NULL, NULL, NULL, 'N', 530, NULL, 'N', 'N', NULL, NULL);
--create views
CREATE OR REPLACE VIEW m_product_stock_v
CREATE OR REPLACE VIEW M_PRODUCT_STOCK_V
AS
SELECT
ms.AD_Client_ID, ms.AD_Org_ID, ms.IsActive, ms.Created, ms.CreatedBy, ms.Updated, ms.UpdatedBy,
mp.value, mp.help, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand,
ms.qtyreserved, mp.description, mw.name as warehouse, mw.m_warehouse_id, mw.ad_client_id,
mw.ad_org_id, mp.documentnote
@ -63,8 +64,10 @@ JOIN m_locator ml ON ms.m_locator_id = ml.m_locator_id
JOIN m_warehouse mw ON ml.m_warehouse_id = mw.m_warehouse_id
ORDER BY mw.name;
CREATE OR REPLACE VIEW M_Product_SubstituteRelated_V AS
SELECT s.ad_client_id, s.ad_org_id, s.m_product_id, s.substitute_id, s.description, 'S' as rowtype, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
CREATE OR REPLACE VIEW M_PRODUCT_SUBSTITUTERELATE_V AS
SELECT
s.AD_Client_ID, s.AD_Org_ID, s.IsActive, s.Created, s.CreatedBy, s.Updated, s.UpdatedBy, s.m_product_id, s.substitute_id, s.description, 'S' as rowtype, (ms.qtyonhand - ms.qtyreserved) AS qtyavailable, ms.qtyonhand, ms.qtyreserved, mpr.pricestd, mpr.m_pricelist_version_id, mw.m_warehouse_id
FROM m_substitute s
JOIN m_storage ms ON ms.m_product_id = s.substitute_id
JOIN m_product mp ON ms.m_product_id = mp.m_product_id