Have the need to override the Calculate Overdue Charges (AR507000) Calculate action. Was going to try to override the entire CalculateFinancialCharges but that seemed to daunting (not even sure if possible). In my extension class I just want to do some post processing: If rows found on ARFinChargeRecords after running base Calculate logic then prompt user. If they answer yes, iterate through ARFinChargeRecords and update FinChargeAmt with: current invoice balance * .02
I'm very new to Acumatica development and have been through all T courses. This my first real-world problem to solve and I'm not having much luck. It appears Base.calculate calls itself? I tried using the example of the invoice release action override, but this seems different somehow.
Here is what I have so far in my extension class but nothing really working so far. var row1 = row is just there for breakpoint/debugging purposes:
public PXAction<ARFinChargesApplyMaint.ARFinChargesApplyParameters> Calculate;
[PXButton]
[PXUIField(DisplayName = "Calculate")]
protected void calculate()
{
Base.calculate.Press();
//int iCachedData = 0;
//foreach (var row in Base.ARFinChargeRecords.Cache.Cached)
//{
// iCachedData++;
// yield return row;
//}
//if (iCachedData > 0)
//{
if (Base.ARSetup.Ask("Apply Special Calculation (Percent Of Open Balance)", MessageButtons.YesNo) == WebDialogResult.Yes)
{
foreach (var row in Base.ARFinChargeRecords.Cache.Cached) {
var row1 = row;
}
// update FinChargeAmount with Balance * .02
// Base.ARFinChargeRecords
// Base.ARInvoices.
}
// }
}
