This commit is contained in:
@@ -9,38 +9,14 @@ namespace AyaNova.DataList
|
||||
{
|
||||
public PartInventoryDataList()
|
||||
{
|
||||
DefaultListAType = AyaType.PartInventory;
|
||||
DefaultListAType = AyaType.PartInventoryDataList;
|
||||
|
||||
SQLFrom = "from vpartinventorylist ";
|
||||
/*
|
||||
"CREATE VIEW vpartinventorylist AS select apart.partnumber,apartwarehouse.name as whsname,vpartinventorynow.*,vpartsonorder.quantityonorder,"
|
||||
+"vpartsonordercommitted.quantityonordercommitted,apart.name as prtname, apart.active, apart.cost, apartstocklevel.minimumquantity,apart.retail, aws.name AS whslrname, aaws.name AS altwhslrname, "
|
||||
+"GREATEST( COALESCE(apartstocklevel.minimumquantity, 0) - (COALESCE(vpartinventorynow.balance, 0) + COALESCE(vpartsonorder.quantityonorder, 0) - "
|
||||
+"COALESCE(vpartsonordercommitted.quantityonordercommitted, 0)) ,0) AS reorderquantity FROM vpartinventorynow LEFT JOIN vpartsonordercommitted ON "
|
||||
+"vpartinventorynow.partid = vpartsonordercommitted.partid AND vpartinventorynow.partwarehouseid = vpartsonordercommitted.partwarehouseid "
|
||||
+"LEFT JOIN vpartsonorder ON vpartinventorynow.partid = vpartsonorder.partid AND vpartinventorynow.partwarehouseid = vpartsonorder.partwarehouseid "
|
||||
+"LEFT JOIN apart ON (vpartinventorynow.partid = apart.id) LEFT JOIN apartwarehouse ON (vpartinventorynow.partwarehouseid = apartwarehouse.id) "
|
||||
+"left join avendor AS aws on (apart.wholesalerid = aws.id) left join avendor AS aaws on (apart.alternativewholesalerid = aaws.id) "
|
||||
+"left join apartstocklevel on (apartstocklevel.partid = apart.id AND apartstocklevel.partwarehouseid = vpartinventorynow.partwarehouseid);"
|
||||
|
||||
|
||||
|
||||
|
||||
await ExecQueryAsync("CREATE VIEW vpartinventorylist AS select vpartinventorynow.*, vpartsonordercommitted.quantityonordercommitted, vpartsonorder.quantityonorder from vpartinventorynow "
|
||||
+ "left join vpartsonordercommitted on (vpartinventorynow.partid = vpartsonordercommitted.partid and vpartinventorynow.partwarehouseid = vpartsonordercommitted.partwarehouseid)"
|
||||
+ "left join vpartsonorder on (vpartinventorynow.partid = vpartsonorder.partid and vpartinventorynow.partwarehouseid = vpartsonorder.partwarehouseid)");
|
||||
|
||||
*/
|
||||
|
||||
//NEEDED COLUMNS
|
||||
/*
|
||||
partid, partnumber, partname, partactive, partcost, partretail, partwarehouseid, partwarehousename,wholesalername,wholesalerid,altwholesalername,altwholesalerid,
|
||||
onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty, vpartinventorynow.description, vpartinventorynow.id
|
||||
*/
|
||||
|
||||
|
||||
var RoleSet = BizRoles.GetRoleSet(DefaultListAType);
|
||||
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
|
||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartByWarehouseInventoryQuantityOnOrder", "PartByWarehouseInventoryQtyOnOrderCommitted" };
|
||||
DefaultColumns = new List<string>() { "PartPartNumber", "PartWarehouseName", "PartInventoryBalance", "PartByWarehouseInventoryMinStockLevel","PartByWarehouseInventoryReorderQuantity","PartByWarehouseInventoryQuantityOnOrder", "PartByWarehouseInventoryQtyOnOrderCommitted", "Active" };
|
||||
DefaultSortBy = new Dictionary<string, string>() { { "PartPartNumber", "+" }, { "PartWarehouseName", "+" } };
|
||||
FieldDefinitions = new List<DataListFieldDefinition>();
|
||||
|
||||
@@ -50,8 +26,8 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
FieldKey = "PartPartNumber",
|
||||
AType = (int)AyaType.Part,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apart.id",
|
||||
SqlValueColumnName = "apart.partnumber"
|
||||
SqlIdColumnName = "partid",
|
||||
SqlValueColumnName = "partnumber"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -60,8 +36,52 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
FieldKey = "PartName",
|
||||
AType = (int)AyaType.Part,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apart.id",
|
||||
SqlValueColumnName = "vpartinventorylist.vpartinventorylist"
|
||||
SqlIdColumnName = "partid",
|
||||
SqlValueColumnName = "partname"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "Active",
|
||||
FieldKey = "Active",
|
||||
UiFieldDataType = (int)UiFieldDataType.Bool,
|
||||
SqlValueColumnName = "partactive"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartCost",
|
||||
FieldKey = "PartCost",
|
||||
UiFieldDataType = (int)UiFieldDataType.Currency,
|
||||
SqlValueColumnName = "partcost"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartRetail",
|
||||
FieldKey = "PartRetail",
|
||||
UiFieldDataType = (int)UiFieldDataType.Currency,
|
||||
SqlValueColumnName = "partretail"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "PartWholesalerID",
|
||||
TKey = "PartWholesalerID",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
AType = (int)AyaType.Vendor,
|
||||
SqlIdColumnName = "wholesalerid",
|
||||
SqlValueColumnName = "wholesalername"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
FieldKey = "PartAlternativeWholesalerID",
|
||||
TKey = "PartAlternativeWholesalerID",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
AType = (int)AyaType.Vendor,
|
||||
SqlIdColumnName = "altwholesalerid",
|
||||
SqlValueColumnName = "altwholesalername"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -70,8 +90,8 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
FieldKey = "PartWarehouseName",
|
||||
AType = (int)AyaType.PartWarehouse,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartwarehouse.id",
|
||||
SqlValueColumnName = "apartwarehouse.name"
|
||||
SqlIdColumnName = "partwarehouseid",
|
||||
SqlValueColumnName = "partwarehousename"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -80,8 +100,8 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
FieldKey = "PartInventoryTransactionDescription",
|
||||
AType = (int)AyaType.PartInventory,
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "vpartinventorylist.id",//NEW: vpartinventorynow.id is actually apartinventory.id required for reporting purposes
|
||||
SqlValueColumnName = "vpartinventorylist.description",//NEW: vpartinventorynow.description which is actually apartinventory.description
|
||||
SqlIdColumnName = "partinventoryid",
|
||||
SqlValueColumnName = "partinventorydescription",
|
||||
IsMeta = true,//only so it doesn't show in the UI but is required for report
|
||||
IsRowId = true
|
||||
});
|
||||
@@ -91,7 +111,7 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
TKey = "PartInventoryBalance",
|
||||
FieldKey = "PartInventoryBalance",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "vpartinventorylist.balance"
|
||||
SqlValueColumnName = "onhandqty"
|
||||
});
|
||||
|
||||
|
||||
@@ -100,7 +120,7 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
TKey = "PartByWarehouseInventoryQuantityOnOrder",
|
||||
FieldKey = "PartByWarehouseInventoryQuantityOnOrder",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "vpartinventorylist.quantityonorder"
|
||||
SqlValueColumnName = "onorderqty"
|
||||
});
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
@@ -108,7 +128,25 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
TKey = "PartByWarehouseInventoryQtyOnOrderCommitted",
|
||||
FieldKey = "PartByWarehouseInventoryQtyOnOrderCommitted",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "vpartinventorylist.quantityonordercommitted"
|
||||
SqlValueColumnName = "onordercommittedqty"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartByWarehouseInventoryMinStockLevel",
|
||||
FieldKey = "PartByWarehouseInventoryMinStockLevel",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "restockminqty"
|
||||
});
|
||||
|
||||
|
||||
FieldDefinitions.Add(new DataListFieldDefinition
|
||||
{
|
||||
TKey = "PartByWarehouseInventoryReorderQuantity",
|
||||
FieldKey = "PartByWarehouseInventoryReorderQuantity",
|
||||
UiFieldDataType = (int)UiFieldDataType.Decimal,
|
||||
SqlValueColumnName = "reorderqty"
|
||||
});
|
||||
|
||||
|
||||
@@ -118,8 +156,8 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
|
||||
FieldKey = "metapartnumber",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apart.id",
|
||||
SqlValueColumnName = "apart.partnumber",
|
||||
SqlIdColumnName = "partid",
|
||||
SqlValueColumnName = "partnumber",
|
||||
IsMeta = true
|
||||
|
||||
});
|
||||
@@ -128,8 +166,8 @@ onhandqty, onorderqty, onordercommittedqty, restocklevel/minimumqty, reorderqty,
|
||||
{
|
||||
FieldKey = "metawarehouse",
|
||||
UiFieldDataType = (int)UiFieldDataType.Text,
|
||||
SqlIdColumnName = "apartwarehouse.id",
|
||||
SqlValueColumnName = "apartwarehouse.name",
|
||||
SqlIdColumnName = "partwarehouseid",
|
||||
SqlValueColumnName = "partwarehousename",
|
||||
IsMeta = true
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user