This commit is contained in:
2021-06-17 19:22:44 +00:00
parent c51cbe763f
commit 7785448b8b

View File

@@ -1309,8 +1309,8 @@ namespace AyaNova.Biz
else else
{ {
await ct.WorkOrderState.AddAsync(newObject); await ct.WorkOrderState.AddAsync(newObject);
var wo=await ct.WorkOrder.FirstOrDefaultAsync(x=>x.Id==newObject.WorkOrderId); var wo = await ct.WorkOrder.FirstOrDefaultAsync(x => x.Id == newObject.WorkOrderId);
wo.LastStatusId=newObject.WorkOrderStatusId; wo.LastStatusId = newObject.WorkOrderStatusId;
await ct.SaveChangesAsync(); await ct.SaveChangesAsync();
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderStatus, AyaEvent.Created), ct); await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, AyaType.WorkOrderStatus, AyaEvent.Created), ct);
@@ -2227,31 +2227,47 @@ namespace AyaNova.Biz
o.TaxCodeViz = Tax.Name; o.TaxCodeViz = Tax.Name;
//Calculate totals and taxes //Calculate totals and taxes
o.TaxAViz = 0; if (o.ChargeToCustomer)
o.TaxBViz = 0;
if (Tax != null)
{ {
if (Tax.TaxAPct != 0) o.TaxAViz = 0;
o.TaxBViz = 0;
if (Tax != null)
{ {
o.TaxAViz = o.ChargeAmount * (Tax.TaxAPct / 100); if (Tax.TaxAPct != 0)
}
if (Tax.TaxBPct != 0)
{
if (Tax.TaxOnTax)
{ {
o.TaxBViz = (o.ChargeAmount + o.TaxAViz) * (Tax.TaxBPct / 100); o.TaxAViz = o.ChargeAmount * (Tax.TaxAPct / 100);
} }
else if (Tax.TaxBPct != 0)
{ {
o.TaxBViz = o.ChargeAmount * (Tax.TaxBPct / 100); if (Tax.TaxOnTax)
{
o.TaxBViz = (o.ChargeAmount + o.TaxAViz) * (Tax.TaxBPct / 100);
}
else
{
o.TaxBViz = o.ChargeAmount * (Tax.TaxBPct / 100);
}
} }
} o.LineTotalViz = o.ChargeAmount + o.TaxAViz + o.TaxBViz;
}else{
o.LineTotalViz = o.ChargeAmount + o.TaxPaid;
}
} }
o.LineTotalViz = o.ChargeAmount + o.TaxAViz + o.TaxBViz;
} }
/*
As of Alpha.109 "LineTotalViz" is derived incorrectly. It is presently looking like it uses TotalCost and "ChargeToCustomer"=true, instead needs to be based on ChargeAmount
IF "ChargeToCustomer" = true then do below to get "LineTotalViz": ,
If "ChargeTaxCodeId" has a value, then "LineTotalViz": = ( "ChargeAmount" + ((TaxA% * "ChargeAmount") + (TaxB% * "ChargeAmount"))
ELSE
If "ChargeTaxCodeId" does NOT have a value then "LineTotalViz": = ( "ChargeAmount" + "TaxPaid")
ELSE skip and "LineTotalViz" is empty
*/
// //////////////////////////////////////////////////////////////////////////////////////////////// // ////////////////////////////////////////////////////////////////////////////////////////////////
// //BIZ ACTIONS // //BIZ ACTIONS
// // // //