diff --git a/.vscode/launch.json b/.vscode/launch.json index 0e2049e9..8fd97968 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -53,7 +53,7 @@ "AYANOVA_FOLDER_USER_FILES": "c:\\temp\\RavenTestData\\userfiles", "AYANOVA_FOLDER_BACKUP_FILES": "c:\\temp\\RavenTestData\\backupfiles", "AYANOVA_FOLDER_TEMPORARY_SERVER_FILES": "c:\\temp\\RavenTestData\\tempfiles", - "AYANOVA_SERVER_TEST_MODE": "false", + "AYANOVA_SERVER_TEST_MODE": "true", "AYANOVA_SERVER_TEST_MODE_SEEDLEVEL": "small", "AYANOVA_SERVER_TEST_MODE_TZ_OFFSET": "-7", "AYANOVA_BACKUP_PG_DUMP_PATH": "C:\\data\\code\\postgres_13\\bin\\" diff --git a/server/AyaNova/DataList/PurchaseOrderDataList.cs b/server/AyaNova/DataList/PurchaseOrderDataList.cs index 18b9190a..6456bdb9 100644 --- a/server/AyaNova/DataList/PurchaseOrderDataList.cs +++ b/server/AyaNova/DataList/PurchaseOrderDataList.cs @@ -16,7 +16,7 @@ namespace AyaNova.DataList AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; DefaultColumns = new List() { "PurchaseOrderPONumber", "Vendor", "PurchaseOrderOrderedDate", "PurchaseOrderStatus", "PurchaseOrderExpectedReceiveDate" }; - DefaultSortBy = new Dictionary() { { "PurchaseOrderPONumber", "+" } }; + DefaultSortBy = new Dictionary() { { "PurchaseOrderPONumber", "-" } }; FieldDefinitions = new List(); FieldDefinitions.Add(new DataListFieldDefinition diff --git a/server/AyaNova/biz/PurchaseOrderBiz.cs b/server/AyaNova/biz/PurchaseOrderBiz.cs index e4e5c101..ee31e241 100644 --- a/server/AyaNova/biz/PurchaseOrderBiz.cs +++ b/server/AyaNova/biz/PurchaseOrderBiz.cs @@ -568,10 +568,15 @@ namespace AyaNova.Biz var batch = idList.Take(IReportAbleObject.REPORT_DATA_BATCH_SIZE); idList = idList.Skip(IReportAbleObject.REPORT_DATA_BATCH_SIZE).ToArray(); //query for this batch, comes back in db natural order unfortunately - var batchResults = await ct.Project.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync(); + //TODO: for reporting this would be more ideal if it populated the displayName fields + //I'm doing that in this object already by fluke, and don't really want to populate them always and in other objects but for reporting maybe + //have a report mode get or I guess just do it all here (but then need for export as well, but then again this is the way it gets for export via getreportdata) + //so perhaps we have a REPORT format of a biz object model and that format has display names mirroring all the fields + //it's fetching it here anyway, might as well do the whole shebang? + var batchResults = await ct.PurchaseOrder.AsNoTracking().Where(z => batch.Contains(z.Id)).ToArrayAsync(); //order the results back into original var orderedList = from id in batch join z in batchResults on id equals z.Id select z; - foreach (Project w in orderedList) + foreach (PurchaseOrder w in orderedList) { var jo = JObject.FromObject(w); if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"])) @@ -689,7 +694,7 @@ namespace AyaNova.Biz // public async Task HandlePotentialNotificationEvent(AyaEvent ayaEvent, ICoreBizObjectModel proposedObj, ICoreBizObjectModel currentObj = null) { - ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger(); + ILogger log = AyaNova.Util.ApplicationLogging.CreateLogger(); if (ServerBootConfig.SEEDING) return; log.LogDebug($"HandlePotentialNotificationEvent processing: [AyaType:{this.BizType}, AyaEvent:{ayaEvent}]"); diff --git a/server/AyaNova/biz/RequiredFieldsValidator.cs b/server/AyaNova/biz/RequiredFieldsValidator.cs index 74cade8b..1ee6b729 100644 --- a/server/AyaNova/biz/RequiredFieldsValidator.cs +++ b/server/AyaNova/biz/RequiredFieldsValidator.cs @@ -2,8 +2,6 @@ using AyaNova.Models; using System.Linq; using Newtonsoft.Json.Linq; - - namespace AyaNova.Biz { //VALIDATE **USER DEFINED** (not stock) REQUIRED FIELDS THAT ARE NOT CUSTOM @@ -15,13 +13,9 @@ namespace AyaNova.Biz { //No form custom = no template to check against so nothing to do if (formCustom == null || string.IsNullOrWhiteSpace(formCustom.Template)) - return; - - //var OuterJson=JObject.Parse(formCustom.Template); + return; var FormTemplate = JArray.Parse(formCustom.Template); - // var FormTemplate=(JArray)OuterJson["template"]; var FormFields = Biz.FormFieldOptionalCustomizableReference.FormFieldReferenceList(formCustom.FormKey); - // var ThisFormNormalFieldsList = FormFields.Where(z => z.Custom == false).Select(z => z.Key).ToList(); foreach (JObject jo in FormTemplate) { @@ -35,10 +29,8 @@ namespace AyaNova.Biz FormField FF = FormFields.Where(z => z.FieldKey == FldLtKey).Single(); //don't validate custom fields, just skip them - // if (!string.IsNullOrWhiteSpace(FF.PropertyName))//this used to work because there would be no property name but now there is so it doesn't if (!FF.IsCustomField) { - //Now get the actual property name from the available fields using the lt key string RequiredPropertyName = FF.FieldKey; @@ -87,21 +79,6 @@ namespace AyaNova.Biz GrandParentIndex++; } } - - // var item = proposedObject.GetType().GetProperty(FieldKeyParts[0]).GetValue(proposedObject, null); - // if (item is System.Collections.IEnumerable) - // { - // foreach (object o in (item as System.Collections.IEnumerable)) - // { - // var subitem = o.GetType().GetProperty(FieldKeyParts[1]).GetValue(o, null); - // } - // } - // else - // { - // // reflect over item - // } - // // object propertyValue = proposedObject.GetType().GetProperty(RequiredPropertyName).GetValue(proposedObject, null); - } else { diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index bc8a0639..9e3e7b53 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -714,8 +714,13 @@ namespace AyaNova.Util } } + + + + ///////////////////////////////////////////////////// //TAX CODES + long TCSales = 0, TCGoods = 0, TCBoth = 0; { { TaxCode tc = new TaxCode(); @@ -737,6 +742,7 @@ namespace AyaNova.Util log.LogError(err); throw new System.Exception(err); } + TCSales = NewObject.Id; } } { @@ -759,6 +765,7 @@ namespace AyaNova.Util log.LogError(err); throw new System.Exception(err); } + TCGoods = NewObject.Id; } } { @@ -781,11 +788,28 @@ namespace AyaNova.Util log.LogError(err); throw new System.Exception(err); } + TCBoth = NewObject.Id; + + } } } + ///////////////////////////////////////////////////// + //GLOBAL SETTINGS + { + using (AyContext ct = ServiceProviderProvider.DBContext) + { + GlobalBizSettingsBiz biz = GlobalBizSettingsBiz.GetBiz(ct); + var gbiz = await biz.GetAsync(false); + gbiz.TaxPartPurchaseId = TCGoods; + gbiz.TaxPartSaleId = TCGoods; + gbiz.TaxRateSaleId = TCSales; + await biz.PutAsync(gbiz); + } + } + /////////////////////////////////////////////// } @@ -1719,10 +1743,10 @@ namespace AyaNova.Util int partCount = Fake.Random.Int(1, 5); //simulate some items without tax codes - bool addTaxCode = (Fake.Random.Number(1, 4) != 3); + bool addTaxCode = (Fake.Random.Number(1, 4) != 3); //simulate some items not received - bool isReceived = (Fake.Random.Number(1, 4) != 3); + bool isReceived = (Fake.Random.Number(1, 4) != 3); o.Status = isReceived ? PurchaseOrderStatus.ClosedFullReceived : PurchaseOrderStatus.OpenOrdered;