Round seeder prices and costs to proper money values at 2 decimal places
This commit is contained in:
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@@ -48,7 +48,7 @@
|
|||||||
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
"AYANOVA_DATA_PATH": "c:\\temp\\ravendata",
|
||||||
"AYANOVA_USE_URLS": "http://*:7575;",
|
"AYANOVA_USE_URLS": "http://*:7575;",
|
||||||
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
|
//"AYANOVA_PERMANENTLY_ERASE_DATABASE":"true",
|
||||||
"AYANOVA_SERVER_TEST_MODE": "false",
|
"AYANOVA_SERVER_TEST_MODE": "true",
|
||||||
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"60",
|
//"AYANOVA_REPORT_RENDERING_TIMEOUT":"60",
|
||||||
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
"AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small",
|
||||||
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
"AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_14\\bin\\"
|
||||||
|
|||||||
@@ -11,10 +11,8 @@ namespace AyaNova.Util
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="d"></param>
|
/// <param name="d"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static decimal Round(decimal d)
|
public static decimal Round(decimal d) => Decimal.Round(d, 2, MidpointRounding.AwayFromZero);
|
||||||
{
|
|
||||||
return Decimal.Round(d, 2, MidpointRounding.AwayFromZero);
|
|
||||||
}
|
|
||||||
|
|
||||||
}//eoc
|
}//eoc
|
||||||
|
|
||||||
|
|||||||
@@ -540,8 +540,6 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
private string[] TagSet = new[] { "red", "orange", "yellow", "green", "blue", "indigo", "violet", "brown", "black", "white", "silver", "gold", "fuchsia", "jade", "mauve", "purple", "quince", "xanthic", "zebra", "zone0", "zone1", "zone2", "zone3", "zone4", "zone5", "zone6", "zone7", "zone8", "zone9" };
|
||||||
|
|
||||||
private List<string> RandomTags()
|
private List<string> RandomTags()
|
||||||
@@ -896,7 +894,7 @@ namespace AyaNova.Util
|
|||||||
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
|
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
|
||||||
o.EmailAddress = Fake.Internet.ExampleEmail();
|
o.EmailAddress = Fake.Internet.ExampleEmail();
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
VendorBiz biz = VendorBiz.GetBiz(ct);
|
VendorBiz biz = VendorBiz.GetBiz(ct);
|
||||||
@@ -1881,7 +1879,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
CustomerBiz biz = CustomerBiz.GetBiz(ct);
|
CustomerBiz biz = CustomerBiz.GetBiz(ct);
|
||||||
@@ -1958,7 +1956,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct);
|
HeadOfficeBiz biz = HeadOfficeBiz.GetBiz(ct);
|
||||||
@@ -2036,7 +2034,7 @@ namespace AyaNova.Util
|
|||||||
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
|
o.WebAddress = Fake.Internet.Protocol() + "://example." + Fake.Internet.DomainSuffix();
|
||||||
o.EmailAddress = Fake.Internet.ExampleEmail();
|
o.EmailAddress = Fake.Internet.ExampleEmail();
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
VendorBiz biz = VendorBiz.GetBiz(ct);
|
VendorBiz biz = VendorBiz.GetBiz(ct);
|
||||||
@@ -2083,7 +2081,7 @@ namespace AyaNova.Util
|
|||||||
o.ProjectOverseerId = Fake.Random.Long(2, 13);//NOTE: this is exactly 13 not total seeded users because it needs to be inside users and they're seeded first
|
o.ProjectOverseerId = Fake.Random.Long(2, 13);//NOTE: this is exactly 13 not total seeded users because it needs to be inside users and they're seeded first
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//This seems wrong to do in a loop but is 4 times faster this way
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
ProjectBiz biz = ProjectBiz.GetBiz(ct);
|
ProjectBiz biz = ProjectBiz.GetBiz(ct);
|
||||||
@@ -2128,13 +2126,13 @@ namespace AyaNova.Util
|
|||||||
o.Notes = Fake.Lorem.Sentence(null, 3);
|
o.Notes = Fake.Lorem.Sentence(null, 3);
|
||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
o.Cost = Fake.Random.Decimal(0.25m, 50);
|
o.Cost = MoneyUtil.Round(Fake.Random.Decimal(0.25m, 50));
|
||||||
o.Charge = o.Cost * 1.55m;
|
o.Charge = MoneyUtil.Round(o.Cost * 1.55m);
|
||||||
o.Unit = "hour";
|
o.Unit = "hour";
|
||||||
o.ContractOnly = contractOnly;
|
o.ContractOnly = contractOnly;
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct);
|
ServiceRateBiz biz = ServiceRateBiz.GetBiz(ct);
|
||||||
@@ -2178,13 +2176,13 @@ namespace AyaNova.Util
|
|||||||
o.Notes = Fake.Lorem.Sentence(null, 3);
|
o.Notes = Fake.Lorem.Sentence(null, 3);
|
||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
o.Cost = Fake.Random.Decimal(0.25m, 10);
|
o.Cost = MoneyUtil.Round(Fake.Random.Decimal(0.25m, 10));
|
||||||
o.Charge = o.Cost * 2m;
|
o.Charge = MoneyUtil.Round(o.Cost * 2m);
|
||||||
o.Unit = Fake.PickRandom(Units);
|
o.Unit = Fake.PickRandom(Units);
|
||||||
o.ContractOnly = contractOnly;
|
o.ContractOnly = contractOnly;
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
TravelRateBiz biz = TravelRateBiz.GetBiz(ct);
|
TravelRateBiz biz = TravelRateBiz.GetBiz(ct);
|
||||||
@@ -2237,7 +2235,7 @@ namespace AyaNova.Util
|
|||||||
o.WarrantyLength = Fake.PickRandom(WarrantyMonths);
|
o.WarrantyLength = Fake.PickRandom(WarrantyMonths);
|
||||||
o.WarrantyTerms = Fake.PickRandom(WarrantyTerms);
|
o.WarrantyTerms = Fake.PickRandom(WarrantyTerms);
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
UnitModelBiz biz = UnitModelBiz.GetBiz(ct);
|
UnitModelBiz biz = UnitModelBiz.GetBiz(ct);
|
||||||
@@ -2337,7 +2335,7 @@ namespace AyaNova.Util
|
|||||||
o.UnitHasOwnAddress = false;
|
o.UnitHasOwnAddress = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
UnitBiz biz = UnitBiz.GetBiz(ct);
|
UnitBiz biz = UnitBiz.GetBiz(ct);
|
||||||
@@ -2396,18 +2394,18 @@ namespace AyaNova.Util
|
|||||||
o.Notes = Fake.Lorem.Sentence(null, 3);
|
o.Notes = Fake.Lorem.Sentence(null, 3);
|
||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
o.RateHour = Fake.Random.Decimal(1, 25);
|
o.RateHour = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
|
||||||
o.RateHourCost = o.RateHour / 2;
|
o.RateHourCost = MoneyUtil.Round(o.RateHour / 2);
|
||||||
o.RateHalfDay = o.RateHour * 4;
|
o.RateHalfDay = MoneyUtil.Round(o.RateHour * 4);
|
||||||
o.RateHalfDayCost = o.RateHalfDay / 2;
|
o.RateHalfDayCost = MoneyUtil.Round(o.RateHalfDay / 2);
|
||||||
o.RateDay = o.RateHour * 8;
|
o.RateDay = MoneyUtil.Round(o.RateHour * 8);
|
||||||
o.RateDayCost = o.RateDay / 2;
|
o.RateDayCost = MoneyUtil.Round(o.RateDay / 2);
|
||||||
o.RateWeek = o.RateHour * 36.8m;
|
o.RateWeek = MoneyUtil.Round(o.RateHour * 36.8m);
|
||||||
o.RateWeekCost = o.RateWeek / 2;
|
o.RateWeekCost = MoneyUtil.Round(o.RateWeek / 2);
|
||||||
o.RateMonth = o.RateHour * 21 * 8;
|
o.RateMonth = MoneyUtil.Round(o.RateHour * 21 * 8);
|
||||||
o.RateMonthCost = o.RateMonth / 2;
|
o.RateMonthCost = MoneyUtil.Round(o.RateMonth / 2);
|
||||||
o.RateYear = o.RateHour * 36.8m * 52;
|
o.RateYear = MoneyUtil.Round(o.RateHour * 36.8m * 52);
|
||||||
o.RateYearCost = o.RateYear / 2;
|
o.RateYearCost = MoneyUtil.Round(o.RateYear / 2);
|
||||||
o.DefaultRate = Fake.Random.Enum<LoanUnitRateUnit>();
|
o.DefaultRate = Fake.Random.Enum<LoanUnitRateUnit>();
|
||||||
|
|
||||||
|
|
||||||
@@ -2518,7 +2516,7 @@ namespace AyaNova.Util
|
|||||||
o.Tags = RandomTags();
|
o.Tags = RandomTags();
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct);
|
PartWarehouseBiz biz = PartWarehouseBiz.GetBiz(ct);
|
||||||
@@ -2570,13 +2568,13 @@ namespace AyaNova.Util
|
|||||||
o.AlternativeWholeSalerId = Fake.Random.Long(7, 9);
|
o.AlternativeWholeSalerId = Fake.Random.Long(7, 9);
|
||||||
o.AlternativeWholeSalerNumber = "aws-" + o.Name;
|
o.AlternativeWholeSalerNumber = "aws-" + o.Name;
|
||||||
|
|
||||||
o.Cost = Fake.Random.Decimal(1, 25);
|
o.Cost = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
|
||||||
o.Retail = o.Cost * 1.2m;
|
o.Retail = MoneyUtil.Round(o.Cost * 1.2m);
|
||||||
o.UnitOfMeasure = "each";
|
o.UnitOfMeasure = "each";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
PartBiz biz = PartBiz.GetBiz(ct);
|
PartBiz biz = PartBiz.GetBiz(ct);
|
||||||
@@ -2678,7 +2676,7 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct);
|
PartAssemblyBiz biz = PartAssemblyBiz.GetBiz(ct);
|
||||||
@@ -2744,7 +2742,7 @@ namespace AyaNova.Util
|
|||||||
} while (partsAdded.Contains(partId));
|
} while (partsAdded.Contains(partId));
|
||||||
partsAdded.Add(partId);
|
partsAdded.Add(partId);
|
||||||
var qty = Fake.Random.Int(1, 5);
|
var qty = Fake.Random.Int(1, 5);
|
||||||
var cost = Fake.Random.Decimal(1, 25);
|
var cost = MoneyUtil.Round(Fake.Random.Decimal(1, 25));
|
||||||
|
|
||||||
// 50% chance it has received serial numbers
|
// 50% chance it has received serial numbers
|
||||||
string serials = string.Empty;
|
string serials = string.Empty;
|
||||||
@@ -2774,7 +2772,7 @@ namespace AyaNova.Util
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct);
|
PurchaseOrderBiz biz = PurchaseOrderBiz.GetBiz(ct);
|
||||||
@@ -3187,7 +3185,7 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
UserId = RandomServiceTechUserId(),
|
UserId = RandomServiceTechUserId(),
|
||||||
//TotalCost = cost,
|
//TotalCost = cost,
|
||||||
ChargeAmount = cost * 1.2m,
|
ChargeAmount = MoneyUtil.Round(cost * 1.2m),
|
||||||
ChargeToCustomer = true,
|
ChargeToCustomer = true,
|
||||||
ReimburseUser = true,
|
ReimburseUser = true,
|
||||||
ChargeTaxCodeId = TCGoods,
|
ChargeTaxCodeId = TCGoods,
|
||||||
@@ -3200,7 +3198,7 @@ namespace AyaNova.Util
|
|||||||
{
|
{
|
||||||
UserId = RandomServiceTechUserId(),
|
UserId = RandomServiceTechUserId(),
|
||||||
// TotalCost = cost * 2m,
|
// TotalCost = cost * 2m,
|
||||||
ChargeAmount = cost * 2.2m,
|
ChargeAmount = MoneyUtil.Round(cost * 2.2m),
|
||||||
ChargeToCustomer = true,
|
ChargeToCustomer = true,
|
||||||
ReimburseUser = true,
|
ReimburseUser = true,
|
||||||
ChargeTaxCodeId = TCGoods,
|
ChargeTaxCodeId = TCGoods,
|
||||||
@@ -3214,8 +3212,8 @@ namespace AyaNova.Util
|
|||||||
//OUTSIDE SERVICES
|
//OUTSIDE SERVICES
|
||||||
if (Fake.Random.Int(1, 10) == 2)//10% chance
|
if (Fake.Random.Int(1, 10) == 2)//10% chance
|
||||||
{
|
{
|
||||||
var ShippingCost = Fake.Random.Decimal(5, 20);
|
var ShippingCost = MoneyUtil.Round(Fake.Random.Decimal(5, 20));
|
||||||
var RepairCost = Fake.Random.Decimal(50, 1000);
|
var RepairCost = MoneyUtil.Round(Fake.Random.Decimal(50, 1000));
|
||||||
var woItemOutsideService = new WorkOrderItemOutsideService()
|
var woItemOutsideService = new WorkOrderItemOutsideService()
|
||||||
{
|
{
|
||||||
UnitId = GetNextUnitForCustomer(o.CustomerId),
|
UnitId = GetNextUnitForCustomer(o.CustomerId),
|
||||||
@@ -3225,9 +3223,9 @@ namespace AyaNova.Util
|
|||||||
RMANumber = "RMA" + Fake.Finance.Account(6),
|
RMANumber = "RMA" + Fake.Finance.Account(6),
|
||||||
TrackingNumber = "TR" + Fake.Finance.Account(8),
|
TrackingNumber = "TR" + Fake.Finance.Account(8),
|
||||||
RepairCost = RepairCost,
|
RepairCost = RepairCost,
|
||||||
RepairPrice = RepairCost * 1.5m,
|
RepairPrice = MoneyUtil.Round(RepairCost * 1.5m),
|
||||||
ShippingCost = ShippingCost,
|
ShippingCost = ShippingCost,
|
||||||
ShippingPrice = ShippingCost * 1.5m,
|
ShippingPrice = MoneyUtil.Round(ShippingCost * 1.5m),
|
||||||
SentDate = woDate,
|
SentDate = woDate,
|
||||||
ETADate = woDate.AddDays(7),
|
ETADate = woDate.AddDays(7),
|
||||||
ReturnDate = woDate.AddDays(8),
|
ReturnDate = woDate.AddDays(8),
|
||||||
@@ -3354,7 +3352,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
|
WorkOrderBiz biz = WorkOrderBiz.GetBiz(ct);
|
||||||
@@ -3768,7 +3766,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
QuoteBiz biz = QuoteBiz.GetBiz(ct);
|
QuoteBiz biz = QuoteBiz.GetBiz(ct);
|
||||||
@@ -4183,7 +4181,7 @@ namespace AyaNova.Util
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//This seems wrong to do in a loop but is 4 times faster this way ?!?
|
//intentional: tested and faster in loop
|
||||||
using (AyContext ct = ServiceProviderProvider.DBContext)
|
using (AyContext ct = ServiceProviderProvider.DBContext)
|
||||||
{
|
{
|
||||||
PMBiz biz = PMBiz.GetBiz(ct);
|
PMBiz biz = PMBiz.GetBiz(ct);
|
||||||
|
|||||||
Reference in New Issue
Block a user