Topic: How to limit customer negative balance

Hi I want t insert a query in sales_order_entry.php file
that if total of Current balance and sales invoice is less than -500 then form should display a error and if balance is min than max than -500 then it will alow to submit.

I have created an array which is showing customer current balance before submitting a form. ( $bal )
Example:

if (($bal - $_SESSION['Items']->get_items_total()) < '-500') {
        display_error("Customer balance can not be less than -500.");
        return false;
       
    }
I used this code in sales_order_entry.php at line 438 just like this---------------

if ($_SESSION['Items']->get_items_total() < 0) {
        display_error("Bill total amount cannot be less than zero.");
        return false;
       
    }
       
    return true;

Pls help me how to write this code and where to paste it.......

Re: How to limit customer negative balance

It seems no one is interested in this function smile
but it's effective function and good idea ... but for now i don't know how to use it