Files
raven/server/AyaNova/DataList/PartRestockDataList.cs
2021-02-26 19:42:10 +00:00

95 lines
4.5 KiB
C#

using System.Collections.Generic;
using AyaNova.Biz;
namespace AyaNova.DataList
{
internal class PartRestockDataList : DataListProcessingBase
{
//NOTE: this object has NO rowid as it's a synthetic list not primarily based on any particular db table
public PartRestockDataList()
{
DefaultListObjectType = AyaType.PartInventoryRestock;
SQLFrom = "FROM vrestockrequired";
var RoleSet = BizRoles.GetRoleSet(DefaultListObjectType);
AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change;
DefaultColumns = new List<string>() { "PartRestockname", "PartRestockPartRestockOverseerID", "PartRestockDateStarted", "PartRestockDateCompleted",
"PartRestockAccountNumber", "PartRestockactive", "PartRestocktags" };
DefaultSortBy = new Dictionary<string, string>() { { "PartRestockname", "+" } };
FieldDefinitions = new List<DataListFieldDefinition>();
// SELECT apart.id AS partid, apartwarehouse.id AS partwarehouseid, apart.partnumber, apartwarehouse.name AS displaywarehouse, "
// + "amanufacturer.id AS manufactureid, amanufacturer.name AS displaymanufacturer, awholesaler.id AS wholesalerid, awholesaler.name AS displaywholesaler, "
// + "aalternativewholesaler.id AS ayalternativewholesalerid, aalternativewholesaler.name AS displayalternativewholesaler,"
// + "apartstocklevel.minimumquantity, vpartinventorynow.balance, COALESCE(vpartsonorder.quantityonorder,0) AS onorderquantity, "
// + "apartstocklevel.minimumquantity - (COALESCE(vpartinventorynow.balance, 0) + COALESCE(vpartsonorder.quantityonorder, 0)) AS requiredquantity "
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartRestockName",
FieldKey = "PartRestockname",
AyaObjectType = (int)AyaType.PartRestock,
UiFieldDataType = (int)UiFieldDataType.Text,
SqlIdColumnName = "aPartRestock.id",
SqlValueColumnName = "aPartRestock.name"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartRestockNotes",
FieldKey = "PartRestocknotes",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "aPartRestock.notes"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "Active",
FieldKey = "PartRestockactive",
UiFieldDataType = (int)UiFieldDataType.Bool,
SqlValueColumnName = "aPartRestock.active"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "Tags",
FieldKey = "PartRestocktags",
UiFieldDataType = (int)UiFieldDataType.Tags,
SqlValueColumnName = "aPartRestock.tags"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartRestockAccountNumber",
FieldKey = "PartRestockAccountNumber",
UiFieldDataType = (int)UiFieldDataType.Text,
SqlValueColumnName = "aPartRestock.accountnumber"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
FieldKey = "PartRestockPartRestockOverseerID",
TKey = "PartRestockPartRestockOverseerID",
UiFieldDataType = (int)UiFieldDataType.Text,
AyaObjectType = (int)AyaType.User,
SqlIdColumnName = "auser.id",
SqlValueColumnName = "auser.name"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartRestockDateStarted",
FieldKey = "PartRestockDateStarted",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aPartRestock.datestarted"
});
FieldDefinitions.Add(new DataListFieldDefinition
{
TKey = "PartRestockDateCompleted",
FieldKey = "PartRestockDateCompleted",
UiFieldDataType = (int)UiFieldDataType.DateTime,
SqlValueColumnName = "aPartRestock.datecompleted"
});
}
}//eoc
}//eons