I've got a customization to the Sales Order Form (SO301000) that's acting really whacky. The goal is to use 5 custom fields to calculate the added charge on a line. I've got the 5 fields working (1 int, 4 decimal 8,3), added the code and attirbutes to make them update the line after edit. After each of the fields updates I run a line update function, at the end of which it updates the Quantity, Discount amount and a custom field (which is for troubleshooting).
What's making me crazy is that it updates the quantity and custom field perfectly...but on the 4 decimal fields it seems it updates the discount only every other time. At first I thought I was running into some logic, the the int field (and I have no idea if it's related to the variable type, but that's the only difference I can see) works every single time
The code to update after each field change is all the same (other, of course, than the field name):
protected void SOLine_UsrWidthAdder_FieldUpdated(PXCache cache, PXFieldUpdatedEventArgs e)
{
UpdateLineDirect(cache, (SOLine)e.Row);
}
And the code at the end of UpdateLineDirect looks like this:
cache.SetValue<SOLine.manualDisc>(TheRow, true);
cache.SetValue<SOLine.discPct>(TheRow, dDiscountPercent);
cache.SetValue<SOLineExt.usrCostCalc>(TheRow, TestString);
cache.SetValue<SOLine.curyDiscAmt>(TheRow, dDiscountAmount);
cache.SetValueExt<SOLine.orderQty>(TheRow, dQO);
I've tried a variety of orders of updating fields, and updating them all with Ext to force a calculation each time, but none of the combos I have tried seem to make much difference.
Thanks in advance!