From c5a5f102ab7a42f4bfc5c1f0d562df03e630eeaa Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Mon, 26 Jul 2021 19:41:31 +0000 Subject: [PATCH] --- server/AyaNova/DataList/QuoteDataList.cs | 79 ++++++++++++++++-------- server/AyaNova/resource/en.json | 1 + server/AyaNova/util/Seeder.cs | 26 ++++++-- 3 files changed, 76 insertions(+), 30 deletions(-) diff --git a/server/AyaNova/DataList/QuoteDataList.cs b/server/AyaNova/DataList/QuoteDataList.cs index c53afa7b..55f27371 100644 --- a/server/AyaNova/DataList/QuoteDataList.cs +++ b/server/AyaNova/DataList/QuoteDataList.cs @@ -12,13 +12,14 @@ namespace AyaNova.DataList DefaultListAType = AyaType.Quote; SQLFrom = "from aquote " + "left join aquotestatus on (aquote.laststatusid = aquotestatus.id) " - + "left join acustomer on (aquote.customerid=acustomer.id) " - + "left join aheadoffice on (acustomer.headofficeid=aheadoffice.id) " - + "left join aproject on (aquote.projectid=aproject.id) " - + "left join acontract on (aquote.contractid=acontract.id)"; + + "left join acustomer on (aquote.customerid = acustomer.id) " + + "left join aheadoffice on (acustomer.headofficeid = aheadoffice.id) " + + "left join aproject on (aquote.projectid = aproject.id) " + + "left join auser on (aquote.preparedbyid = auser.id) " + + "left join acontract on (aquote.contractid = acontract.id)"; var RoleSet = BizRoles.GetRoleSet(DefaultListAType); AllowedRoles = RoleSet.ReadFullRecord | RoleSet.Change; - DefaultColumns = new List() { "QuoteSerialNumber", "Customer", "QuoteStatus", "Project" }; + DefaultColumns = new List() { "QuoteSerialNumber", "Customer", "QuoteQuoteStatusType", "QuoteQuoteRequestDate", "QuotePreparedByID" }; DefaultSortBy = new Dictionary() { { "QuoteSerialNumber", "-" } }; FieldDefinitions = new List(); @@ -53,6 +54,16 @@ namespace AyaNova.DataList SqlValueColumnName = "aheadoffice.name" }); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuotePreparedByID", + FieldKey = "QuotePreparedByID", + UiFieldDataType = (int)UiFieldDataType.Text, + AType = (int)AyaType.User, + SqlIdColumnName = "aquote.preparedbyid", + SqlValueColumnName = "auser.name" + }); + FieldDefinitions.Add(new DataListFieldDefinition { TKey = "QuoteQuoteStatusType", @@ -124,29 +135,45 @@ namespace AyaNova.DataList SqlValueColumnName = "aquote.customercontactname" }); - // FieldDefinitions.Add(new DataListFieldDefinition - // { - // TKey = "QuoteServiceDate", - // FieldKey = "QuoteServiceDate", - // UiFieldDataType = (int)UiFieldDataType.DateTime, - // SqlValueColumnName = "aquote.servicedate" - // }); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuoteQuoteRequestDate", + FieldKey = "QuoteQuoteRequestDate", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aquote.requested" + }); - // FieldDefinitions.Add(new DataListFieldDefinition - // { - // TKey = "QuoteCloseByDate", - // FieldKey = "QuoteCloseByDate", - // UiFieldDataType = (int)UiFieldDataType.DateTime, - // SqlValueColumnName = "aquote.completebydate" - // }); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuoteValidUntilDate", + FieldKey = "QuoteValidUntilDate", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aquote.validuntil" + }); + + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuoteDateSubmitted", + FieldKey = "QuoteDateSubmitted", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aquote.submitted" + }); + + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuoteDateApproved", + FieldKey = "QuoteDateApproved", + UiFieldDataType = (int)UiFieldDataType.DateTime, + SqlValueColumnName = "aquote.approved" + }); - // FieldDefinitions.Add(new DataListFieldDefinition - // { - // TKey = "QuoteInvoiceNumber", - // FieldKey = "QuoteInvoiceNumber", - // UiFieldDataType = (int)UiFieldDataType.Text, - // SqlValueColumnName = "aquote.invoicenumber" - // }); + FieldDefinitions.Add(new DataListFieldDefinition + { + TKey = "QuoteIntroduction", + FieldKey = "QuoteIntroduction", + UiFieldDataType = (int)UiFieldDataType.Text, + SqlValueColumnName = "aquote.introduction" + }); FieldDefinitions.Add(new DataListFieldDefinition { diff --git a/server/AyaNova/resource/en.json b/server/AyaNova/resource/en.json index 1d8a269e..dfc0873e 100644 --- a/server/AyaNova/resource/en.json +++ b/server/AyaNova/resource/en.json @@ -2208,6 +2208,7 @@ "NextPMNumber": "Next preventive maintenance", "WorkOrderErrorLocked": "Work order is set to a locked status and can't be changed", "WorkOrderSerialNumber": "Number", + "QuoteSerialNumber": "Number", "Sequence": "Sequence", "SoftDelete": "Mark for deletion", "SoftDeleteAll": "Mark all for deletion", diff --git a/server/AyaNova/util/Seeder.cs b/server/AyaNova/util/Seeder.cs index 06ae8ee4..de3837cd 100644 --- a/server/AyaNova/util/Seeder.cs +++ b/server/AyaNova/util/Seeder.cs @@ -579,7 +579,7 @@ namespace AyaNova.Util KnownUserTechRestrictedId = await SeedUserAsync(log, 1, AuthorizationRoles.TechRestricted, UserType.Service, "TechRestricted", "TechRestricted", KnownUserTags); KnownUserTechId = await SeedUserAsync(log, 1, AuthorizationRoles.Tech, UserType.Service, "Tech", "Tech", KnownUserTags); await SeedUserAsync(log, 1, AuthorizationRoles.SalesRestricted, UserType.NotService, "SalesRestricted", "SalesRestricted", KnownUserTags); - await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags); + KnownUserSalesId = await SeedUserAsync(log, 1, AuthorizationRoles.Sales, UserType.NotService, "Sales", "Sales", KnownUserTags); @@ -1692,6 +1692,7 @@ namespace AyaNova.Util public long KnownUserCustomerId = 0; public long KnownUserCustomerRestrictedId = 0; public long KnownCustomerForShadownUnitsId = 0; + public long KnownUserSalesId = 0; public async Task SeedUserAsync( @@ -2770,6 +2771,15 @@ namespace AyaNova.Util return ServiceUserIds[Fake.Random.Int(1, ServiceUserIds.Count - 1)]; } + + /* + ██╗ ██╗ ██████╗ ██████╗ ██╗ ██╗ ██████╗ ██████╗ ██████╗ ███████╗██████╗ + ██║ ██║██╔═══██╗██╔══██╗██║ ██╔╝ ██╔═══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗ + ██║ █╗ ██║██║ ██║██████╔╝█████╔╝█████╗██║ ██║██████╔╝██║ ██║█████╗ ██████╔╝ + ██║███╗██║██║ ██║██╔══██╗██╔═██╗╚════╝██║ ██║██╔══██╗██║ ██║██╔══╝ ██╔══██╗ + ╚███╔███╔╝╚██████╔╝██║ ██║██║ ██╗ ╚██████╔╝██║ ██║██████╔╝███████╗██║ ██║ + ╚══╝╚══╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═════╝ ╚══════╝╚═╝ ╚═╝ + */ private int TotalSeededWorkOrders = 0; ////////////////////////////////////////////////////// //WORK ORDER @@ -3239,8 +3249,15 @@ namespace AyaNova.Util - //--------------------- QUOTE -------------------------- + /* + ██████╗ ██╗ ██╗ ██████╗ ████████╗███████╗ + ██╔═══██╗██║ ██║██╔═══██╗╚══██╔══╝██╔════╝ + ██║ ██║██║ ██║██║ ██║ ██║ █████╗ + ██║▄▄ ██║██║ ██║██║ ██║ ██║ ██╔══╝ + ╚██████╔╝╚██████╔╝╚██████╔╝ ██║ ███████╗ + ╚══▀▀═╝ ╚═════╝ ╚═════╝ ╚═╝ ╚══════╝ + */ private int TotalSeededQuotes = 0; ////////////////////////////////////////////////////// //Quote @@ -3261,8 +3278,8 @@ namespace AyaNova.Util var woDate = DesiredTimeInUtc(new DateTime(tempDate.Year, tempDate.Month, tempDate.Day, tempHour, 0, 0)); o.CreatedDate = woDate > DateTime.UtcNow ? DateTime.UtcNow : woDate;//no created dates in future but want a range of past dates to show off age of wo - // o.CompleteByDate = woDate.AddDays(5); - // o.CustomerContactName = "contact name here"; + o.Requested = woDate.AddDays(-2); + o.PreparedById = KnownUserSalesId; o.CustomerId = GetRandomCustomerId();//Fake.Random.Long(1, TotalSeededCustomers); using (AyContext ct = ServiceProviderProvider.DBContext) @@ -3620,6 +3637,7 @@ namespace AyaNova.Util Created = woDate.AddMinutes(5) }; o.States.Add(WoState); + o.LastStatusId = WoState.QuoteStatusId; }