This commit is contained in:
2021-05-14 15:32:37 +00:00
parent 8947ec0cac
commit d1ff92c4e1

View File

@@ -1874,16 +1874,30 @@ namespace AyaNova.Biz
//in v7 it was ok to have no service rate selected
//not sure why but carried forward to v8 so..
if (o.ServiceRateId != null)
if (o.ServiceRateId == null)
{
var s = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ServiceRateId);
if (s != null)
{
o.Cost = s.Cost;
o.ListPrice = s.Charge;
}
return;
}
var s = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ServiceRateId);
if(s==null){
AddError()
return;
}
if (s != null)
{
o.Cost = s.Cost;
o.ListPrice = s.Charge;
}
//default is list price unless a contract overrides it
o.Price = o.ListPrice;
//First check if there is a matching tagged service rate contract discount, that takes precedence
//If not then check for a generic one
if (c == null || c.ServiceRatesOverridePct == 0)
{
o.Price = o.ListPrice;//default with no contract