While creating GI for sales order screen I want to display the total number of lines in document details tab. Can anyone suggest a way to start implementing this?
After including the custom field in GI it doesn't populate the column with data.
The code for printing the row count is as below which is also discussed in Adding custom button in acumatica
public void SOOrder_UsrTotalTransactions_FieldSelecting(PXCache sender, PXFieldSelectingEventArgs e)
{
e.ReturnValue = GetTotalTransactions(sender);
}
// Update values
public void SOLine_RowDeleted(PXCache sender, PXRowDeletedEventArgs e)
{
UpdateTotals(sender, e.Row as SOOrder, true);
}
public void SOLine_RowInserted(PXCache sender, PXRowInsertedEventArgs e)
{
UpdateTotals(sender, e.Row as SOOrder, true);
}
public void SOLine_OrderQty_FieldUpdated(PXCache sender, PXFieldUpdatedEventArgs e)
{
UpdateTotals(sender, e.Row as SOOrder, false);
}
public void UpdateTotals(PXCache sender, SOOrder soOrder, bool isUpdateTranCount)
{
// Get SOOrder DAC extension
if (soOrder != null)
{
SOOrderExt soOrderExt = sender.GetExtension<SOOrderExt>(soOrder);
if (soOrderExt != null)
{
if (isUpdateTranCount)
{
sender.SetValueExt<SOOrderExt.usrTotalTransactions>(soOrder, GetTotalTransactions(sender));
}
}
}
}
public int? GetTotalTransactions(PXCache sender)
{
return Base.Transactions.Select().Count();
}
}
}
the DAC code is: [PXDBInt] [PXUIField(DisplayName="Total Lines", Enabled = false)]