diff --git a/docs/8.0/ayanova/docs/svc-pms.md b/docs/8.0/ayanova/docs/svc-pms.md index f21ebd6f..fe0ee734 100644 --- a/docs/8.0/ayanova/docs/svc-pms.md +++ b/docs/8.0/ayanova/docs/svc-pms.md @@ -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. diff --git a/server/AyaNova/biz/WorkOrderBiz.cs b/server/AyaNova/biz/WorkOrderBiz.cs index 782ea9dd..3b0c3f62 100644 --- a/server/AyaNova/biz/WorkOrderBiz.cs +++ b/server/AyaNova/biz/WorkOrderBiz.cs @@ -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); }