This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user