This commit is contained in:
@@ -915,6 +915,7 @@ namespace AyaNova.Biz
|
|||||||
await ItemSearchIndexAsync(newObject, true);
|
await ItemSearchIndexAsync(newObject, true);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await ItemHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await ItemHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
await ItemPopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -994,6 +995,7 @@ namespace AyaNova.Biz
|
|||||||
await ItemSearchIndexAsync(putObject, false);
|
await ItemSearchIndexAsync(putObject, false);
|
||||||
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||||
await ItemHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await ItemHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await ItemPopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1303,6 +1305,7 @@ namespace AyaNova.Biz
|
|||||||
await ExpenseSearchIndexAsync(newObject, true);
|
await ExpenseSearchIndexAsync(newObject, true);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
await ExpensePopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1355,6 +1358,7 @@ namespace AyaNova.Biz
|
|||||||
await ExpenseSearchIndexAsync(putObject, false);
|
await ExpenseSearchIndexAsync(putObject, false);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||||
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await ExpenseHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await ExpensePopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1562,6 +1566,7 @@ namespace AyaNova.Biz
|
|||||||
await LaborSearchIndexAsync(newObject, true);
|
await LaborSearchIndexAsync(newObject, true);
|
||||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await LaborHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await LaborHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
await LaborPopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1617,6 +1622,7 @@ namespace AyaNova.Biz
|
|||||||
await LaborSearchIndexAsync(putObject, false);
|
await LaborSearchIndexAsync(putObject, false);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||||
await LaborHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await LaborHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await LaborPopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1688,6 +1694,27 @@ namespace AyaNova.Biz
|
|||||||
o.ServiceRateViz = await ct.ServiceRate.AsNoTracking().Where(x => x.Id == o.ServiceRateId).Select(x => x.Name).FirstOrDefaultAsync();
|
o.ServiceRateViz = await ct.ServiceRate.AsNoTracking().Where(x => x.Id == o.ServiceRateId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
if (o.TaxCodeSaleId != null)
|
if (o.TaxCodeSaleId != null)
|
||||||
o.TaxCodeSaleViz = await ct.TaxCode.AsNoTracking().Where(x => x.Id == o.TaxCodeSaleId).Select(x => x.Name).FirstOrDefaultAsync();
|
o.TaxCodeSaleViz = await ct.TaxCode.AsNoTracking().Where(x => x.Id == o.TaxCodeSaleId).Select(x => x.Name).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
//Calculate totals and taxes
|
||||||
|
o.TaxAViz = 0;
|
||||||
|
o.TaxBViz = 0;
|
||||||
|
var netPrice = (o.Price * o.ServiceRateQuantity);
|
||||||
|
if (o.TaxAPct != 0)
|
||||||
|
{
|
||||||
|
o.TaxAViz = netPrice * o.TaxAPct;
|
||||||
|
}
|
||||||
|
if (o.TaxBPct != 0)
|
||||||
|
{
|
||||||
|
if (o.TaxOnTax)
|
||||||
|
{
|
||||||
|
o.TaxBViz = (netPrice + o.TaxAViz) * o.TaxBPct;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
o.TaxBViz = netPrice * o.TaxBPct;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
o.LineTotalViz = netPrice + o.TaxAViz + o.TaxBViz;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -1695,13 +1722,14 @@ namespace AyaNova.Biz
|
|||||||
//
|
//
|
||||||
private async Task LaborBizActionsAsync(AyaEvent ayaEvent, WorkOrderItemLabor newObj, WorkOrderItemLabor oldObj, IDbContextTransaction transaction)
|
private async Task LaborBizActionsAsync(AyaEvent ayaEvent, WorkOrderItemLabor newObj, WorkOrderItemLabor oldObj, IDbContextTransaction transaction)
|
||||||
{
|
{
|
||||||
|
await Task.CompletedTask;
|
||||||
//automatic actions on record change, called AFTER validation
|
//automatic actions on record change, called AFTER validation
|
||||||
//For now calculate totals only which could be done more simply but doing it this way in case of future needs and for consistency
|
//For now calculate totals only which could be done more simply but doing it this way in case of future needs and for consistency
|
||||||
|
|
||||||
//HOW PRICING WORKS
|
//HOW PRICING WORKS
|
||||||
//Base price is the regular rate price for that rate regardless if it's a contract only or normal rate, it's the actual price
|
//Base price is the regular rate price for that rate regardless if it's a contract only or normal rate, it's the actual price
|
||||||
//manual discount is the user applying a discount above and beyond the contract discount if there is any (?? HOW IS MANUAL CALCULATED?? AFTER CONTRACT OR B4??)
|
//manual discount is the user applying a discount above and beyond the contract discount if there is any (?? HOW IS MANUAL CALCULATED?? AFTER CONTRACT OR B4??)
|
||||||
//contract discount is the actual discount the contract provides for
|
//contract discount is the actual discount the contract provides for
|
||||||
|
|
||||||
switch (ayaEvent)
|
switch (ayaEvent)
|
||||||
{
|
{
|
||||||
@@ -1857,6 +1885,7 @@ namespace AyaNova.Biz
|
|||||||
await LoanSearchIndexAsync(newObject, true);
|
await LoanSearchIndexAsync(newObject, true);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await LoanHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await LoanHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
await LoanPopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1911,6 +1940,7 @@ namespace AyaNova.Biz
|
|||||||
await LoanSearchIndexAsync(putObject, false);
|
await LoanSearchIndexAsync(putObject, false);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, putObject.Tags, dbObject.Tags);
|
||||||
await LoanHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await LoanHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await LoanPopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2127,6 +2157,7 @@ namespace AyaNova.Biz
|
|||||||
await OutsideServiceSearchIndexAsync(newObject, true);
|
await OutsideServiceSearchIndexAsync(newObject, true);
|
||||||
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
// await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||||
|
await OutsideServicePopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2181,7 +2212,9 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, putObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, putObject.Id, putObject.AyaType, AyaEvent.Modified), ct);
|
||||||
await OutsideServiceSearchIndexAsync(putObject, false);
|
await OutsideServiceSearchIndexAsync(putObject, false);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
|
|
||||||
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await OutsideServiceHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await OutsideServicePopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2389,6 +2422,7 @@ namespace AyaNova.Biz
|
|||||||
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
await EventLogProcessor.LogEventToDatabaseAsync(new Event(UserId, newObject.Id, newObject.AyaType, AyaEvent.Created), ct);
|
||||||
await PartSearchIndexAsync(newObject, true);
|
await PartSearchIndexAsync(newObject, true);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, newObject.Tags, null);
|
||||||
|
await PartPopulateVizFields(newObject);
|
||||||
return newObject;
|
return newObject;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2443,6 +2477,7 @@ namespace AyaNova.Biz
|
|||||||
await PartSearchIndexAsync(putObject, false);
|
await PartSearchIndexAsync(putObject, false);
|
||||||
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
//await TagBiz.ProcessUpdateTagsInRepositoryAsync(ct, dbObject.Tags, SnapshotOfOriginalDBObj.Tags);
|
||||||
await PartHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
await PartHandlePotentialNotificationEvent(AyaEvent.Modified, putObject, dbObject);
|
||||||
|
await PartPopulateVizFields(putObject);
|
||||||
return putObject;
|
return putObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ namespace AyaNova.Models
|
|||||||
public decimal NoChargeQuantity { get; set; }
|
public decimal NoChargeQuantity { get; set; }
|
||||||
public long? ServiceBankId { get; set; }
|
public long? ServiceBankId { get; set; }
|
||||||
public long? TaxCodeSaleId { get; set; }
|
public long? TaxCodeSaleId { get; set; }
|
||||||
|
[NotMapped]
|
||||||
|
public string TaxCodeSaleViz { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -42,14 +44,19 @@ namespace AyaNova.Models
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//PRICE FIELDS
|
//PRICE FIELDS
|
||||||
|
[Required]
|
||||||
public decimal Cost { get; set; }
|
public decimal Cost { get; set; }
|
||||||
|
[Required]
|
||||||
public decimal ListPrice { get; set; }
|
public decimal ListPrice { get; set; }
|
||||||
|
[Required]
|
||||||
public decimal Price { get; set; }
|
public decimal Price { get; set; }
|
||||||
|
[Required]
|
||||||
public string TaxName { get; set; }
|
public string TaxName { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public decimal TaxAPct { get; set; }
|
public decimal TaxAPct { get; set; }
|
||||||
[Required]
|
[Required]
|
||||||
public decimal TaxBPct { get; set; }
|
public decimal TaxBPct { get; set; }
|
||||||
|
[Required]
|
||||||
public bool TaxOnTax { get; set; }
|
public bool TaxOnTax { get; set; }
|
||||||
[NotMapped]
|
[NotMapped]
|
||||||
public decimal TaxAViz { get; set; }
|
public decimal TaxAViz { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user