SL_eob_invoice – when only deleting a line asks for adjustment reason

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:

<input type="number" class="numFixed" data-decimals='2' value="0.00" placeholder="0.00" step="0.01" />
<input type="number" class="numFixed" data-decimals='4' value="0.0000" placeholder="0.0000" step="0.0001" />

<script>
        $(".numFixed").change(function() {
            let el = $(this);
            el.val(parseFloat(el.val()).toFixed(el.data('decimals'));
        });
    });
</script>
1 Like

hi @juggernautsei @mdsupport , there’s also a global that can be used.

1 Like

@stephenwaite so people can just turn off that feature? Then the nag screen will go away.

1 Like

@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.

1 Like

it disables the auto adjustment in the Adjust box however the WO will still accomplish the same with one click

could also add a delcount check to ignore the validation without touching the global