Skip to main content
Solved

Data not displayed in run service contract billing screen

  • 24 March 2023
  • 5 replies
  • 69 views

Hi Guys, I’m trying to add custom column - contract Price field from service contract and display in run service contract billing screen.

I added the field in Screen editor customization. created the DAC, and graph but I’m not able to view the data in run service contract billing screen.

Below is my custom field.

 

DAC,

#region UsrContractTotal

        PXDBDecimal]
        /PXUIField(DisplayName = "Contract Price")]
        public virtual decimal? UsrContractTotal { get; set; }
        public abstract class usrContractTotal : BqlDecimal.Field<usrContractTotal> { }
        #endregion

Graph,

Public class ContractPeriodToPostEntryExt : PXGraphExtension<CreateInvoiceByContractPost>
    {
        #region Event Handlers
        public static bool IsActive() => true;
        protected virtual void ContractPeriodToPost_ServiceContractID_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
        {
            if (InvokeBaseHandler != null)
                InvokeBaseHandler(cache, e);
            var row = (ContractPeriodToPost)e.Row;
            if (row != null)
            {

                PXResultset<FSContractPeriodDet> objservicecont = PXSelectJoin<FSContractPeriodDet,
                                               InnerJoin<FSContractPeriod,
                                                        On<FSContractPeriod.serviceContractID, Equal<FSContractPeriodDet.serviceContractID>,
                                                           And<FSContractPeriod.contractPeriodID, Equal<FSContractPeriodDet.contractPeriodID>>>>,
                                               Where<FSContractPeriodDet.serviceContractID, Equal<Required<FSServiceContract.serviceContractID>>,
                                                     And<FSContractPeriod.status, Equal<FSContractPeriod.status.Active>>>>.Select(Base, row.ServiceContractID);

                decimal totalRecSum = 0m;
                foreach (var det in objservicecont)
                {
                    totalRecSum += ((FSContractPeriodDet)detr0]).RecurringTotalPrice ?? 0m;
                }
                row.GetExtension<ContractPeriodToPostKSExt>().UsrContractTotal = totalRecSum;
            }
        }
    }
}
#endregion

When i try to debug, I’m able to get the data in graph but not in the UI. Can anyone check where it is going wrong. 

For some reason I was not able to share my customization.

5 replies

Userlevel 7
Badge +19

Hi @mice As you are using the FieldSelecting event, if you assign like below it may not populate the value.

 row.GetExtension<ContractPeriodToPostKSExt>().UsrContractTotal = totalRecSum;

There is minor you need to populate the value properly. Try below code instead of above code.

e.ReturnValue = totalRecSum;

Userlevel 1

@Naveen Boga, still same result - its empty.

 

 

Userlevel 7
Badge +19

@mice   Please use below code and check.

Also, you need to change the EVENT  like - ContractPeriodToPost_UsrContractTotal_FieldSelecting


 

protected virtual void ContractPeriodToPost_UsrContractTotal_FieldSelecting(PXCache cache, PXFieldSelectingEventArgs e, PXFieldSelecting InvokeBaseHandler)
{
if (InvokeBaseHandler != null)
InvokeBaseHandler(cache, e);
var row = (ContractPeriodToPost)e.Row;
if (row != null)
{

PXResultset<FSContractPeriodDet> objservicecont = PXSelectJoin<FSContractPeriodDet,
InnerJoin<FSContractPeriod,
On<FSContractPeriod.serviceContractID, Equal<FSContractPeriodDet.serviceContractID>,
And<FSContractPeriod.contractPeriodID, Equal<FSContractPeriodDet.contractPeriodID>>>>,
Where<FSContractPeriodDet.serviceContractID, Equal<Required<FSServiceContract.serviceContractID>>,
And<FSContractPeriod.status, Equal<FSContractPeriod.status.Active>>>>.Select(Base, row.ServiceContractID);

decimal totalRecSum = 0m;
foreach (var det in objservicecont)
{
totalRecSum += ((FSContractPeriodDet)det[0]).RecurringTotalPrice ?? 0m;
}
e.RetunValue = totalRecSum;
}
}
}
}

 

Userlevel 1

You are a STAR of Acumatica @Naveen Boga ...

Userlevel 7
Badge +19

@mice  I’m glad that I helped you and Thank you!!

Reply