This commit is contained in:
2022-02-10 20:23:27 +00:00
parent 9906b656ed
commit 9ca0a68af6
2 changed files with 10 additions and 5 deletions

View File

@@ -201,7 +201,4 @@ This menu option makes a service work order by copying the shared fields from th
This menu option makes a [Quote](svc-quotes.md) by copying the shared fields from the PM to a new Quote. Use this feature if an existing PM is nearly identical to a Quote that needs to be made to save typing or to re-quote an existing PM schedule that's nearing it's end of term.
#### Quote status list
This is a link to edit the Quote states available. See the [Quote status help page](svc-quote-status.md) for more details.

View File

@@ -565,19 +565,27 @@ namespace AyaNova.Biz
//called when there is a definite possibility of change of close by i.e. new contract, new customer, new workorder
//RESPONSE TIME / COMPLETE BY AUTO SET
//precedence: manually pre-set -> contract -> global biz
//if work order doesn't have a service date set then use utcnow otherwise use the selected date
DateTime referenceDate = DateTime.UtcNow;
if (newObj.ServiceDate != null)
{
referenceDate = (DateTime)newObj.ServiceDate;
}
if (newObj.ContractId != null)
{
await GetCurrentContractFromContractIdAsync(newObj.ContractId);
if (mContractInEffect != null && mContractInEffect.ResponseTime != TimeSpan.Zero)
{
newObj.CompleteByDate = DateTime.UtcNow.Add(mContractInEffect.ResponseTime);
newObj.CompleteByDate = referenceDate.Add(mContractInEffect.ResponseTime);
return; //our work here is done
}
}
//not set yet, maybe the global default is the way...
if (AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderCompleteByAge != TimeSpan.Zero)
newObj.CompleteByDate = DateTime.UtcNow.Add(AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderCompleteByAge);
newObj.CompleteByDate = referenceDate.Add(AyaNova.Util.ServerGlobalBizSettings.Cache.WorkOrderCompleteByAge);
}