This commit is contained in:
@@ -1723,7 +1723,7 @@ namespace AyaNova.Biz
|
||||
{
|
||||
|
||||
//automatic actions on record change, called AFTER validation
|
||||
var Contract = GetCurrentWorkOrderContractFromRelatedAsync(AyaType.WorkOrderItem, newObj.WorkOrderItemId);
|
||||
var Contract = await GetCurrentWorkOrderContractFromRelatedAsync(AyaType.WorkOrderItem, newObj.WorkOrderItemId);
|
||||
|
||||
switch (ayaEvent)
|
||||
{
|
||||
@@ -1764,12 +1764,17 @@ namespace AyaNova.Biz
|
||||
}
|
||||
|
||||
//Contract
|
||||
// todo: need to have a bombproof way to get the effective contract and statically hold it here in wobiz until processing finished because other objects in tree may also need it
|
||||
// figure out if there will only ever be ONE effective contract or multiple and then can determine how to handle here
|
||||
//Yes precedence is Unit->Customer->headoffice.
|
||||
//it's not permitted to have more than one contracted unit on a workorder
|
||||
//if a unit has a contract on workorder it applies to *entire* workorder so they must use one unit under contract and it's the entirety of the work performed
|
||||
//if they don't want the rest of wo to be discounted etc
|
||||
if (Contract != null)
|
||||
{
|
||||
//update discount pricing
|
||||
if (Contract.ServiceRatesOverridePct != 0)
|
||||
{
|
||||
if (Contract.ServiceRatesOverrideType == ContractOverrideType.CostMarkup)
|
||||
newObj.Price = newObj.Cost + (newObj.Cost * Contract.ServiceRatesOverridePct);
|
||||
else if (Contract.ServiceRatesOverrideType == ContractOverrideType.PriceDiscount)
|
||||
newObj.Price = newObj.ListPrice - (newObj.ListPrice * Contract.ServiceRatesOverridePct);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case AyaEvent.Modified:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user