This commit is contained in:
@@ -234,6 +234,7 @@ namespace AyaNova.Biz
|
||||
//////////////////////////////////
|
||||
// COMPARE TAGS COLLECTION
|
||||
//
|
||||
// A match here means *all* tags in the subscription are present in the object
|
||||
//
|
||||
public static bool TagsMatch(List<string> objectTags, List<string> subTags)
|
||||
{
|
||||
@@ -245,9 +246,8 @@ namespace AyaNova.Biz
|
||||
//not enought tags on object to match sub tags?
|
||||
if (subTags.Count > objectTags.Count) return false;
|
||||
|
||||
//ok, here it's worth checking it out
|
||||
//Do ALL the tags in the subscription exist in the object?
|
||||
return subTags.All(z => objectTags.Any(x => x == z));
|
||||
|
||||
}
|
||||
|
||||
/////////////////////////////////////////
|
||||
|
||||
@@ -1875,26 +1875,37 @@ 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)
|
||||
return;
|
||||
|
||||
var Rate = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ServiceRateId);
|
||||
if (Rate == null)
|
||||
{
|
||||
AddError(ApiErrorCode.NOT_FOUND, "generalerror", "Service rate not found");
|
||||
return;
|
||||
}
|
||||
|
||||
var s = await ct.ServiceRate.AsNoTracking().FirstOrDefaultAsync(z => z.Id == o.ServiceRateId);
|
||||
if(s==null){
|
||||
AddError()
|
||||
o.Cost = Rate.Cost;
|
||||
o.ListPrice = Rate.Charge;
|
||||
o.Price = o.ListPrice;//default is list price unless a contract overrides it
|
||||
|
||||
if (c == null)
|
||||
{
|
||||
//No contract so bail out now, it's done
|
||||
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;
|
||||
|
||||
//CONTRACT ADJUSTMENTS
|
||||
|
||||
//First check if there is a matching tagged service rate contract discount, that takes precedence
|
||||
if(c.ContractServiceRateOverrideItems.Count>0){
|
||||
//does our contract rate have a matching tag?
|
||||
|
||||
subTags.All(z => objectTags.Any(x => x == z));
|
||||
foreach(var csr in c.ContractServiceRateOverrideItems){
|
||||
csr.Tags.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//If not then check for a generic one
|
||||
|
||||
|
||||
Reference in New Issue
Block a user