X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fsales_order_entry.php;h=dad3c63c1e846014e232a26c246676a1dd59a384;hb=6073c62f33af72638076b01b1c538f8f5521d46d;hp=58958eb15ecd70b72e2b11137d0c8a472486867d;hpb=f11b39846d81bd043490ba9596224b859e47467c;p=fa-stable.git diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 58958eb1..dad3c63c 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -453,6 +453,10 @@ function can_process() { display_error("Invoice total amount cannot be less than zero."); return false; } + + if ($_SESSION['Items']->payment_terms['cash_sale'] && + ($_SESSION['Items']->trans_type == ST_CUSTDELIVERY || $_SESSION['Items']->trans_type == ST_SALESINVOICE)) + $_SESSION['Items']->due_date = $_SESSION['Items']->document_date; return true; } @@ -475,10 +479,9 @@ if (isset($_POST['ProcessOrder']) && can_process()) { $ref = $Refs->get_next($_SESSION['Items']->trans_type, null, array('date' => Today())); if ($ref != $_SESSION['Items']->reference) { + unset($_POST['ref']); // force refresh reference display_error(_("The reference number field has been increased. Please save the document again.")); - $_POST['ref'] = $_SESSION['Items']->reference = $ref; - $Ajax->activate('ref'); - } + } set_focus('ref'); } else