public SuppliesLineItemGridSpec(Person currentPerson, Models.GrantAllocationAward grantAllocationAward)
        {
            ShowFilterBar      = true;
            ObjectNameSingular = Models.FieldDefinition.GrantAllocationAwardSuppliesLineItem.GetFieldDefinitionLabel();
            ObjectNamePlural   = Models.FieldDefinition.GrantAllocationAwardSuppliesLineItem.GetFieldDefinitionLabelPluralized();

            bool hasDeletePermission = new GrantAllocationAwardSuppliesLineItemDeleteFeature().HasPermissionByPerson(currentPerson);
            bool hasEditPermission   = new GrantAllocationAwardSuppliesLineItemEditAsAdminFeature().HasPermissionByPerson(currentPerson);
            bool hasCreatePermission = new GrantAllocationAwardSuppliesLineItemCreateFeature().HasPermissionByPerson(currentPerson);

            if (hasCreatePermission)
            {
                var newSuppliesLineItemUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(t => t.NewSuppliesLineItemFromGrantAllocationAward(grantAllocationAward.PrimaryKey));

                CreateEntityModalDialogForm = new ModalDialogForm(newSuppliesLineItemUrl, $"Create a new {Models.FieldDefinition.GrantAllocationAwardSupplies.GetFieldDefinitionLabel()} Line Item");
            }

            //delete column
            if (hasDeletePermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteSuppliesLineItemUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }
            //edit column
            if (hasEditPermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(x.GetEditSuppliesLineItemUrl(), $"Edit this {Models.FieldDefinition.GrantAllocationAwardSupplies.GetFieldDefinitionLabel()} Line Item")), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(Models.FieldDefinition.GrantAllocationAwardSuppliesDescription.ToGridHeaderString(), s => s.GrantAllocationAwardSuppliesLineItemDescription, 200, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.GrantAllocationAwardSuppliesTarOrMonth.ToGridHeaderString(), s => s.GrantAllocationAwardSuppliesLineItemTarOrMonth, 125, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantAllocationAwardSuppliesDate.ToGridHeaderString(), s => s.GrantAllocationAwardSuppliesLineItemDate, 125, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantAllocationAwardSuppliesAmount.ToGridHeaderString(), s => s.GrantAllocationAwardSuppliesLineItemAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardSuppliesNotes.ToGridHeaderString(), s => s.GrantAllocationAwardSuppliesLineItemNotes, 250, DhtmlxGridColumnFilterType.Text);
        }
        public LandownerCostShareLineItemGridSpec(Person currentPerson, Models.GrantAllocationAward grantAllocationAward)
        {
            ShowFilterBar      = true;
            ObjectNameSingular = Models.FieldDefinition.GrantAllocationAwardLandownerCostShareLineItem.GetFieldDefinitionLabel();
            ObjectNamePlural   = Models.FieldDefinition.GrantAllocationAwardLandownerCostShareLineItem.GetFieldDefinitionLabelPluralized();

            bool hasDeletePermission = new GrantAllocationAwardLandownerCostShareLineItemDeleteFeature().HasPermissionByPerson(currentPerson);
            bool hasEditPermission   = new GrantAllocationAwardLandownerCostShareLineItemEditAsAdminFeature().HasPermissionByPerson(currentPerson);
            bool hasCreatePermission = new GrantAllocationAwardLandownerCostShareLineItemCreateFeature().HasPermissionByPerson(currentPerson);

            if (hasCreatePermission)
            {
                var newLandownerCostShareLineItemUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(t => t.NewLandownerCostShareLineItemFromGrantAllocationAward(grantAllocationAward.PrimaryKey));

                CreateEntityModalDialogForm = new ModalDialogForm(newLandownerCostShareLineItemUrl, $"Create a new {Models.FieldDefinition.GrantAllocationAwardLandownerCostShare.GetFieldDefinitionLabel()} Line Item");
            }

            //delete column
            if (hasDeletePermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteLandownerCostShareLineItemUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }
            //edit column
            if (hasEditPermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(x.GetEditLandownerCostShareLineItemUrl(), $"Edit this {Models.FieldDefinition.GrantAllocationAwardLandownerCostShare.GetFieldDefinitionLabel()} Line Item")), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(Models.FieldDefinition.Project.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.Project.GetDetailUrl(), a.Project.ProjectName), 150, DhtmlxGridColumnFilterType.Html);
            Add(Models.FieldDefinition.ProgramIndexProjectCode.ToGridHeaderString(),
                a => a.GrantAllocationAwardID != null ? a.GrantAllocationAward.GrantAllocation.GetAssociatedProgramIndexProjectCodePairsCommaDelimited() : "Not Available",
                75, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareStatus.GetFieldDefinitionLabel(), a => a.GetStatusDisplayName(), 125, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareStartDate.GetFieldDefinitionLabel(), a => a.Treatments.FirstOrDefault()?.TreatmentStartDate, 125, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareEndDate.GetFieldDefinitionLabel(), a => a.Treatments.FirstOrDefault()?.TreatmentEndDate, 125, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareFootprintAcres.GetFieldDefinitionLabel(), a => a.Treatments.FirstOrDefault()?.TreatmentFootprintAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareChippingAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Chipping)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostSharePruningAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Pruning)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareThinningAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Thinning)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareSlashAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Slash)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareMasticationAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Mastication)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareGrazingAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Grazing)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareLopAndScatterAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.LopAndScatter)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareBiomassRemovalAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.BiomassRemoval)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareHandPileAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.HandPile)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareBroadcastBurnAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.BroadcastBurn)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareHandPileBurnAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.HandPileBurn)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareMachinePileBurnAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.MachinePileBurn)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareOtherTreatmentAcres.GetFieldDefinitionLabel(), a => a.Treatments.SingleOrDefault(x => x.TreatmentDetailedActivityType == TreatmentDetailedActivityType.Other)?.TreatmentTreatedAcres ?? 0, 75, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareAllocatedAmount.ToGridHeaderString(), a => a.GrantAllocationAwardLandownerCostShareLineItemAllocatedAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareTotalCost.ToGridHeaderString(), s => s.GrantAllocationAwardLandownerCostShareLineItemTotalCost, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareActualMatch.ToGridHeaderString(), s => s.GrantAllocationAwardLandownerCostShareLineItemActualMatch, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareGrantCost.ToGridHeaderString(), s => s.GrantAllocationAwardLandownerCostShareLineItemGrantCost, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardLandownerCostShareNotes.ToGridHeaderString(), a => a.GrantAllocationAwardLandownerCostShareLineItemNotes, 250, DhtmlxGridColumnFilterType.Text);
        }
        public void UpdateModel(Models.GrantAllocationAward grantAllocationAward)
        {
            grantAllocationAward.GrantAllocationAwardID                = GrantAllocationAwardID;
            grantAllocationAward.GrantAllocationAwardName              = GrantAllocationAwardName;
            grantAllocationAward.GrantAllocationAwardExpirationDate    = GrantAllocationAwardExpirationDate;
            grantAllocationAward.GrantAllocationAwardCalendarStartYear = GrantAllocationAwardCalendarStartYear;

            grantAllocationAward.GrantAllocationID = GrantAllocationID;
            grantAllocationAward.FocusAreaID       = FocusAreaID;
        }
        public EditGrantAllocationAwardViewModel(Models.GrantAllocationAward grantAllocationAward)
        {
            GrantAllocationAwardID                = grantAllocationAward.GrantAllocationAwardID;
            GrantAllocationAwardName              = grantAllocationAward.GrantAllocationAwardName;
            GrantAllocationAwardExpirationDate    = grantAllocationAward.GrantAllocationAwardExpirationDate == DateTime.MinValue ? DateTime.Today : grantAllocationAward.GrantAllocationAwardExpirationDate;
            GrantAllocationAwardCalendarStartYear = grantAllocationAward.GrantAllocationAwardCalendarStartYear;


            GrantAllocationID = grantAllocationAward.GrantAllocationID;
            FocusAreaID       = grantAllocationAward.FocusAreaID;
        }
        public DetailViewData(Person currentPerson,
                              Models.GrantAllocationAward grantAllocationAward,
                              string backButtonUrl,
                              string backButtonText,
                              SuppliesLineItemGridSpec suppliesLineItemGridSpec,
                              PersonnelAndBenefitsLineItemGridSpec personnelAndBenefitsLineItemGridSpec,
                              TravelLineItemGridSpec travelLineItemGridSpec,
                              LandownerCostShareLineItemGridSpec landownerCostShareLineItemGridSpec,
                              ContractorInvoiceItemGridSpec contractorInvoiceItemGridSpec
                              ) : base(currentPerson)
        {
            PageTitle       = $"{Models.FieldDefinition.GrantAllocationAward.GetFieldDefinitionLabel()}: {grantAllocationAward.GrantAllocationAwardName}";
            BreadCrumbTitle = $"{Models.FieldDefinition.GrantAllocationAward.GetFieldDefinitionLabel()} Detail";

            BackButtonUrl  = backButtonUrl;
            BackButtonText = backButtonText;

            GrantAllocationAward = grantAllocationAward;
            UserHasEditGrantAllocationAwardPermissions = new GrantAllocationAwardEditAsAdminFeature().HasPermissionByPerson(currentPerson);

            EditGrantAllocationAwardUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.Edit(grantAllocationAward.PrimaryKey));

            EditContractorInvoiceUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.EditContractorInvoice(grantAllocationAward.PrimaryKey));

            SuppliesLineItemGridName    = "grantAllocationAwardSuppliesLineItemGridName";
            SuppliesLineItemGridDataUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.SuppliesLineItemGridJsonData(grantAllocationAward.PrimaryKey));

            SuppliesLineItemGridSpec = suppliesLineItemGridSpec;

            PersonnelAndBenefitsLineItemGridName    = "grantAllocationAwardPersonnelAndBenefitsLineItemGridName";
            PersonnelAndBenefitsLineItemGridDataUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.PersonnelAndBenefitsLineItemGridJsonData(grantAllocationAward.PrimaryKey));

            PersonnelAndBenefitsLineItemGridSpec = personnelAndBenefitsLineItemGridSpec;

            TravelLineItemGridName    = "grantAllocationAwardTravelLineItemGridName";
            TravelLineItemGridDataUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.TravelLineItemGridJsonData(grantAllocationAward.PrimaryKey));

            TravelLineItemGridSpec = travelLineItemGridSpec;

            LandownerCostShareLineItemGridName    = "grantAllocationAwardLandownerCostShareLineItemGridName";
            LandownerCostShareLineItemGridDataUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.LandownerCostShareLineItemGridJsonData(grantAllocationAward));

            LandownerCostShareLineItemGridSpec = landownerCostShareLineItemGridSpec;

            ContractorInvoiceItemGridName    = "grantAllocationAwardContractorInvoiceItemGridName";
            ContractorInvoiceItemGridDataUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(x => x.ContractorInvoiceItemGridJsonData(grantAllocationAward.PrimaryKey));

            ContractorInvoiceItemGridSpec = contractorInvoiceItemGridSpec;
        }
        public PersonnelAndBenefitsLineItemGridSpec(Person currentPerson, Models.GrantAllocationAward grantAllocationAward)
        {
            ShowFilterBar      = true;
            ObjectNameSingular = Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsLineItem.GetFieldDefinitionLabel();
            ObjectNamePlural   = Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsLineItem.GetFieldDefinitionLabelPluralized();

            bool hasDeletePermission = new GrantAllocationAwardPersonnelAndBenefitsLineItemDeleteFeature().HasPermissionByPerson(currentPerson);
            bool hasEditPermission   = new GrantAllocationAwardPersonnelAndBenefitsLineItemEditAsAdminFeature().HasPermissionByPerson(currentPerson);
            bool hasCreatePermission = new GrantAllocationAwardPersonnelAndBenefitsLineItemCreateFeature().HasPermissionByPerson(currentPerson);

            if (hasCreatePermission)
            {
                var newSuppliesLineItemUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(t => t.NewPersonnelAndBenefitsLineItemFromGrantAllocationAward(grantAllocationAward.PrimaryKey));

                CreateEntityModalDialogForm = new ModalDialogForm(newSuppliesLineItemUrl, $"Create a new {Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefits.GetFieldDefinitionLabel()} Line Item");
            }

            //delete column
            if (hasDeletePermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeletePersonnelAndBenefitsLineItemUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }
            //edit column
            if (hasEditPermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(x.GetEditPersonnelAndBenefitsLineItemUrl(), $"Edit this {Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefits.GetFieldDefinitionLabel()} Line Item")), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsName.ToGridHeaderString(), s => s.Person != null ? s.Person.GetFullNameFirstLastAndOrgShortNameAsUrl() : new HtmlString(string.Empty), 200, DhtmlxGridColumnFilterType.Html);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsTarOrMonth.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemTarOrMonth, 125, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsDate.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemDate, 125, DhtmlxGridColumnFormatType.Date);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsTarHours.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemTarHours, 125, DhtmlxGridColumnFormatType.Integer, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsHourlyRate.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemHourlyRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Hourly Total", s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemHourlyTotal, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsFringeRate.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemFringeRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Fringe Total", s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemFringeTotal, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add("TAR Total", s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemTarTotal, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardPersonnelAndBenefitsNotes.ToGridHeaderString(), s => s.GrantAllocationAwardPersonnelAndBenefitsLineItemNotes, 250, DhtmlxGridColumnFilterType.Text);
        }
 public void UpdateModel(Models.GrantAllocationAward grantAllocationAward)
 {
     grantAllocationAward.GrantAllocationAwardID      = GrantAllocationAwardID;
     grantAllocationAward.ContractorInvoiceContractor = ContractorInvoiceContractor;
 }
 public EditContractorInvoiceViewModel(Models.GrantAllocationAward grantAllocationAward)
 {
     GrantAllocationAwardID      = grantAllocationAward.GrantAllocationAwardID;
     ContractorInvoiceContractor = grantAllocationAward.ContractorInvoiceContractor;
 }
        public ContractorInvoiceItemGridSpec(Person currentPerson, Models.GrantAllocationAward grantAllocationAward)
        {
            ShowFilterBar      = true;
            ObjectNameSingular = Models.FieldDefinition.GrantAllocationAwardContractorInvoiceLineItem.GetFieldDefinitionLabel();
            ObjectNamePlural   = Models.FieldDefinition.GrantAllocationAwardContractorInvoiceLineItem.GetFieldDefinitionLabelPluralized();

            bool hasDeletePermission = new GrantAllocationAwardContractorInvoiceItemDeleteFeature().HasPermissionByPerson(currentPerson);
            bool hasEditPermission   = new GrantAllocationAwardContractorInvoiceItemEditAsAdminFeature().HasPermissionByPerson(currentPerson);
            bool hasCreatePermission = new GrantAllocationAwardContractorInvoiceItemCreateFeature().HasPermissionByPerson(currentPerson);

            if (hasCreatePermission)
            {
                var newContractorInvoiceUrl = SitkaRoute <GrantAllocationAwardController> .BuildUrlFromExpression(t => t.NewContractorInvoiceItemFromGrantAllocationAward(grantAllocationAward.PrimaryKey));

                CreateEntityModalDialogForm = new ModalDialogForm(newContractorInvoiceUrl, $"Create a new {Models.FieldDefinition.GrantAllocationAwardContractorInvoice.GetFieldDefinitionLabel()} Line Item");
            }

            //delete column
            if (hasDeletePermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteContractorInvoiceUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
            }
            //edit column
            if (hasEditPermission)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(x.GetEditContractorInvoiceUrl(), $"Edit this {Models.FieldDefinition.GrantAllocationAwardContractorInvoice.GetFieldDefinitionLabel()} Line Item")), 30, DhtmlxGridColumnFilterType.None);
            }

            //need column for file download


            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceDescription.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceDescription, 200, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceNumber.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceNumber, 125, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceDate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceDate, 125, DhtmlxGridColumnFormatType.Date);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceForemanHours.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceForemanHours, 125, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceForemanRate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceForemanRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Foreman Amount", s => s.GrantAllocationAwardContractorInvoiceForemanAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceLaborHours.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceLaborHours, 125, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceLaborRate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceLaborRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Labor Amount", s => s.GrantAllocationAwardContractorInvoiceLaborAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceGrappleHours.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceGrappleHours, 125, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceGrappleRate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceGrappleRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Grapple Amount", s => s.GrantAllocationAwardContractorInvoiceGrappleAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceMasticationHours.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceMasticationHours, 125, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceMasticationRate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceMasticationRate, 125, DhtmlxGridColumnFormatType.CurrencyWithCents);
            Add("Mastication Amount", s => s.GrantAllocationAwardContractorInvoiceMasticationAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add("Invoice w/o Tax", s => s.GrantAllocationAwardContractorInvoiceTotalWithoutTax, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceTaxRate.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceTaxRate, 125, DhtmlxGridColumnFormatType.Percent);
            Add("Tax Amount", s => s.GrantAllocationAwardContractorInvoiceTaxAmount, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add("Invoice Total", s => s.GrantAllocationAwardContractorInvoiceTotalWithTax, 125, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);

            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceAcresReported.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceAcresReported, 125, DhtmlxGridColumnFormatType.Decimal, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.GrantAllocationAwardContractorInvoiceNotes.ToGridHeaderString(), s => s.GrantAllocationAwardContractorInvoiceNotes, 250, DhtmlxGridColumnFilterType.Text);
        }