This commit is contained in:
@@ -761,7 +761,7 @@ namespace AyaNova.Biz
|
|||||||
foreach (WorkOrderItemLabor o in wi.Labors)
|
foreach (WorkOrderItemLabor o in wi.Labors)
|
||||||
await LaborPopulateVizFields(o, true);
|
await LaborPopulateVizFields(o, true);
|
||||||
foreach (WorkOrderItemLoan o in wi.Loans)
|
foreach (WorkOrderItemLoan o in wi.Loans)
|
||||||
await LoanPopulateVizFields(o, null, true);
|
await LoanPopulateVizFields(o, true);
|
||||||
foreach (WorkOrderItemPart o in wi.Parts)
|
foreach (WorkOrderItemPart o in wi.Parts)
|
||||||
await PartPopulateVizFields(o, true);
|
await PartPopulateVizFields(o, true);
|
||||||
foreach (WorkOrderItemTravel o in wi.Travels)
|
foreach (WorkOrderItemTravel o in wi.Travels)
|
||||||
@@ -2775,17 +2775,39 @@ namespace AyaNova.Biz
|
|||||||
if (calculateTotalsOnly == false)
|
if (calculateTotalsOnly == false)
|
||||||
{
|
{
|
||||||
if (o.UserId != null)
|
if (o.UserId != null)
|
||||||
o.UserViz = await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync();
|
{
|
||||||
|
if (!vc.Has("user", o.UserId))
|
||||||
|
{
|
||||||
|
vc.Add(await ct.User.AsNoTracking().Where(x => x.Id == o.UserId).Select(x => x.Name).FirstOrDefaultAsync(), "user", o.UserId);
|
||||||
|
}
|
||||||
|
o.UserViz = vc.Get("user", o.UserId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ServiceRate Rate = null;
|
ServiceRate Rate = null;
|
||||||
if (o.ServiceRateId != null)
|
if (o.ServiceRateId != null)
|
||||||
{
|
{
|
||||||
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
if (!oc.Has("servicerate", o.ServiceRateId))
|
||||||
|
{
|
||||||
|
Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.ServiceRateId);
|
||||||
|
oc.Add(Rate, "servicerate", o.ServiceRateId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Rate = (ServiceRate)oc.Get("servicerate", o.ServiceRateId);
|
||||||
o.ServiceRateViz = Rate.Name;
|
o.ServiceRateViz = Rate.Name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
TaxCode Tax = null;
|
TaxCode Tax = null;
|
||||||
if (o.TaxCodeSaleId != null)
|
if (o.TaxCodeSaleId != null)
|
||||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
{
|
||||||
|
if (!oc.Has("tax", o.TaxCodeSaleId))
|
||||||
|
{
|
||||||
|
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeSaleId);
|
||||||
|
oc.Add(Tax, "tax", o.TaxCodeSaleId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Tax = (TaxCode)oc.Get("tax", o.TaxCodeSaleId);
|
||||||
|
}
|
||||||
if (Tax != null)
|
if (Tax != null)
|
||||||
o.TaxCodeViz = Tax.Name;
|
o.TaxCodeViz = Tax.Name;
|
||||||
|
|
||||||
@@ -3185,7 +3207,7 @@ namespace AyaNova.Biz
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//VIZ POPULATE
|
//VIZ POPULATE
|
||||||
//
|
//
|
||||||
private async Task LoanPopulateVizFields(WorkOrderItemLoan o, List<NameIdItem> loanUnitRateEnumList = null, bool calculateTotalsOnly = false)
|
private async Task LoanPopulateVizFields(WorkOrderItemLoan o, bool calculateTotalsOnly = false)
|
||||||
{
|
{
|
||||||
if (calculateTotalsOnly == false)
|
if (calculateTotalsOnly == false)
|
||||||
{
|
{
|
||||||
@@ -3197,16 +3219,25 @@ namespace AyaNova.Biz
|
|||||||
o.UnitOfMeasureViz = loanUnitRateEnumList.Where(x => x.Id == (long)o.Rate).Select(x => x.Name).First();
|
o.UnitOfMeasureViz = loanUnitRateEnumList.Where(x => x.Id == (long)o.Rate).Select(x => x.Name).First();
|
||||||
}
|
}
|
||||||
|
|
||||||
LoanUnit loanUnit = await ct.LoanUnit.AsNoTracking().FirstOrDefaultAsync(x => x.Id == o.LoanUnitId);
|
if (!vc.Has("loanunit", o.LoanUnitId))
|
||||||
o.LoanUnitViz = loanUnit.Name;
|
vc.Add(await ct.LoanUnit.AsNoTracking().Where(x => x.Id == o.LoanUnitId).Select(x => x.Name).FirstOrDefaultAsync(), "loanunit", o.LoanUnitId);
|
||||||
|
o.LoanUnitViz = vc.Get("loanunit", o.LoanUnitId);
|
||||||
|
|
||||||
|
|
||||||
TaxCode Tax = null;
|
TaxCode Tax = null;
|
||||||
if (o.TaxCodeId != null)
|
if (o.TaxCodeId != null)
|
||||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
{
|
||||||
|
if (!oc.Has("tax", o.TaxCodeId))
|
||||||
|
{
|
||||||
|
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||||
|
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||||
|
}
|
||||||
if (Tax != null)
|
if (Tax != null)
|
||||||
o.TaxCodeViz = Tax.Name;
|
o.TaxCodeViz = Tax.Name;
|
||||||
|
|
||||||
|
|
||||||
//manual price overrides anything
|
//manual price overrides anything
|
||||||
o.PriceViz = o.ListPrice;
|
o.PriceViz = o.ListPrice;
|
||||||
if (o.PriceOverride != null)
|
if (o.PriceOverride != null)
|
||||||
@@ -3243,8 +3274,8 @@ namespace AyaNova.Biz
|
|||||||
//RESTRICTED COST FIELD??
|
//RESTRICTED COST FIELD??
|
||||||
if (!UserCanViewLoanerCosts)
|
if (!UserCanViewLoanerCosts)
|
||||||
o.Cost = 0;//cost already used in calcs and will not be updated on any update operation so this ensures the cost isn't sent over the wire
|
o.Cost = 0;//cost already used in calcs and will not be updated on any update operation so this ensures the cost isn't sent over the wire
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private List<NameIdItem> loanUnitRateEnumList = null;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
//BIZ ACTIONS
|
//BIZ ACTIONS
|
||||||
@@ -3583,16 +3614,39 @@ namespace AyaNova.Biz
|
|||||||
if (calculateTotalsOnly == false)
|
if (calculateTotalsOnly == false)
|
||||||
{
|
{
|
||||||
if (o.UnitId != 0)
|
if (o.UnitId != 0)
|
||||||
o.UnitViz = await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync();
|
{
|
||||||
|
if (!vc.Has("unitserial", o.UnitId))
|
||||||
|
vc.Add(await ct.Unit.AsNoTracking().Where(x => x.Id == o.UnitId).Select(x => x.Serial).FirstOrDefaultAsync(), "unitserial", o.UnitId);
|
||||||
|
o.UnitViz = vc.Get("unitserial", o.UnitId);
|
||||||
|
}
|
||||||
|
|
||||||
if (o.VendorSentToId != null)
|
if (o.VendorSentToId != null)
|
||||||
o.VendorSentToViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync();
|
{
|
||||||
|
if (!vc.Has("vendorname", o.VendorSentToId))
|
||||||
|
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentToId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentToId);
|
||||||
|
o.VendorSentToViz = vc.Get("vendorname", o.VendorSentToId);
|
||||||
|
}
|
||||||
|
|
||||||
if (o.VendorSentViaId != null)
|
if (o.VendorSentViaId != null)
|
||||||
o.VendorSentViaViz = await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync();
|
{
|
||||||
|
if (!vc.Has("vendorname", o.VendorSentViaId))
|
||||||
|
vc.Add(await ct.Vendor.AsNoTracking().Where(x => x.Id == o.VendorSentViaId).Select(x => x.Name).FirstOrDefaultAsync(), "vendorname", o.VendorSentViaId);
|
||||||
|
o.VendorSentViaViz = vc.Get("vendorname", o.VendorSentViaId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TaxCode Tax = null;
|
TaxCode Tax = null;
|
||||||
if (o.TaxCodeId != null)
|
if (o.TaxCodeId != null)
|
||||||
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
{
|
||||||
|
if (!oc.Has("tax", o.TaxCodeId))
|
||||||
|
{
|
||||||
|
Tax = await ct.TaxCode.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.TaxCodeId);
|
||||||
|
oc.Add(Tax, "tax", o.TaxCodeId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Tax = (TaxCode)oc.Get("tax", o.TaxCodeId);
|
||||||
|
}
|
||||||
|
|
||||||
if (Tax != null)
|
if (Tax != null)
|
||||||
o.TaxCodeViz = Tax.Name;
|
o.TaxCodeViz = Tax.Name;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user