SL_eob_invoice – when only deleting a line, it asks for adjustment reason for the entire code (or every code for the encounter)
Dr. Berlin wrote:
It’s actually a bug in the system that needs to be reported.
In validate() function, it has the following 2 lines:
let cPay = parseFloat(f[pfx + '[pay]'].value).toFixed(2);
let cAdjust = parseFloat(f[pfx + '[adj]'].value).toFixed(2);
The problem is, in the old system it worked fine, but it must be new behavior for JavaScript, because parseFloat spits out a number, but toFixed(2) actually spits out a string, not a number. So later in the same function, when it says if (cAdjust !=0), it fails, because it’s now comparing a string to a number. This will present multiple problems with the validate function.
The way I fixed it for now was to remove toFixed at the end of each line. This is just validation, so we don’t need to necessarily round it to 2 decimal points at this point (only when it’s saved). There is probably another solution to round the number and keep as number, but that’s what I did.
In general field level validations if limited to form inputs should be done in a listener for change event. Submit validations should enforce complex checks involving multiple fields. Here is untested suggestion:
@juggernautsei - We don’t use this script so no idea what the global setting does from business perspective. We for one would expect many installations will want calculations done automatically. So Dr. Berlin’s comment should still be valid.