This commit is contained in:
2021-02-19 19:39:28 +00:00
parent cd1db15fa0
commit 8b012573ce
2 changed files with 15 additions and 1 deletions

View File

@@ -123,19 +123,23 @@ namespace AyaNova.Biz
//
private async Task SetDisplayFields(PurchaseOrder po)
{
//NOTE: This expects to run AFTER bizActions have been performed
if (po == null) return;
//populate server fields for client ui
//Show Warehouses
po.DisplayWarehouses = await ct.PartWarehouse.CountAsync() > 1;
//Show PartRequest fields?
//default hidden and show when traverse items if applicable
po.DisplayPartRequest = false;
po.DisplayTaxes = false;
po.DisplayReceived = false;
po.DisplayVendorNumber = false;
foreach (PurchaseOrderItem item in po.Items)
{
item.DisplayPartNumber = await ct.Part.AsNoTracking().Where(x => x.Id == item.PartId).Select(x => x.PartNumber).SingleAsync();
item.DisplayWarehouse = await ct.PartWarehouse.AsNoTracking().Where(x => x.Id == item.PartWarehouseId).Select(x => x.Name).SingleAsync();
if (item.WorkorderItemPartRequestId != null)
@@ -153,6 +157,12 @@ namespace AyaNova.Biz
po.DisplayTaxes = true;
}
if (!string.IsNullOrWhiteSpace(item.VendorPartNumber))
po.DisplayVendorNumber = true;
if (item.QuantityReceived > 0)
po.DisplayReceived = true;
//Calculate line totals
if (item.QuantityOrdered != 0 && item.PurchaseOrderCost != 0)
{

View File

@@ -48,6 +48,10 @@ namespace AyaNova.Models
public bool DisplayPartRequest { get; set; }
[NotMapped]
public bool DisplayTaxes { get; set; }
[NotMapped]
public bool DisplayReceived { get; set; }
[NotMapped]
public bool DisplayVendorNumber { get; set; }
}//eoc