X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fsales_order_entry.php;h=dfeb153279eccdc426ca84180ecf0f610f08942e;hb=3e2a432dd72688dbac39a07716201b2b00c16c8b;hp=6c82c0987c389aced16347fccdaea9733a6129d9;hpb=83bcd012e33b883779ef006c040261efa2327838;p=fa-stable.git diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 6c82c098..dfeb1532 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -16,7 +16,6 @@ include_once($path_to_root . "/sales/includes/ui/sales_order_ui.inc"); include_once($path_to_root . "/sales/includes/sales_db.inc"); include_once($path_to_root . "/sales/includes/db/sales_types_db.inc"); include_once($path_to_root . "/reporting/includes/reporting.inc"); - $js = ''; if ($use_popup_windows) { @@ -187,9 +186,8 @@ function copy_from_cart() function line_start_focus() { global $Ajax; - + $Ajax->activate('items_table'); - $Ajax->addFocus(true, '_stock_id_edit'); set_focus('_stock_id_edit'); } //-------------------------------------------------------------------------------- @@ -234,7 +232,8 @@ function can_process() { set_focus('delivery_date'); return false; } - if (date1_greater_date2($_SESSION['Items']->document_date, $_POST['delivery_date'])) { + //if (date1_greater_date2($_SESSION['Items']->document_date, $_POST['delivery_date'])) { + if (date1_greater_date2($_POST['OrderDate'], $_POST['delivery_date'])) { display_error(_("The requested delivery date is before the date of the order.")); set_focus('delivery_date'); return false; @@ -301,10 +300,9 @@ function handle_update_item() { if ($_POST['UpdateItem'] != '' && check_item_data()) { $_SESSION['Items']->update_cart_item($_POST['LineNo'], - input_num('qty'), input_num('price'), + input_num('qty'), input_num('price'), input_num('Disc') / 100 ); } - copy_from_cart(); line_start_focus(); } @@ -324,7 +322,7 @@ function handle_delete_item($line_no) function handle_new_item() { - + if (!check_item_data()) { return; } @@ -382,17 +380,18 @@ function create_cart($type, $trans_no) $doc = new Cart(30, array($trans_no)); $doc->trans_type = $type; $doc->trans_no = 0; + $doc->document_date = Today(); // 2006-06-15. Added so Invoices and Deliveries get current day if ($type == 10) $doc->due_date = get_invoice_duedate($doc->customer_id, $doc->document_date); else - $doc->due_date = $doc->document_date = Today(); + $doc->due_date = $doc->document_date; $doc->reference = references::get_next($doc->trans_type); $doc->Comments=''; foreach($doc->line_items as $line_no => $line) { $doc->line_items[$line_no]->qty_done = 0; } $_SESSION['Items'] = $doc; - } else + } else $_SESSION['Items'] = new Cart($type,array($trans_no)); copy_from_cart(); } @@ -412,12 +411,10 @@ if (isset($_POST['UpdateItem'])) if (isset($_POST['AddItem'])) handle_new_item(); -if (isset($_POST['CancelItemChanges']) || isset($_POST['UpdateItem'])) { +if (isset($_POST['CancelItemChanges'])) { line_start_focus(); } -if (isset($_POST['_customer_id_update'])) - set_focus('branch_id'); //-------------------------------------------------------------------------------- check_db_has_stock_items(_("There are no inventory items defined in the system.")); @@ -467,7 +464,7 @@ if ($customer_error == "") { _('Validate changes and update document'), true); } - submit_center_last('CancelOrder', $cancelorder, + submit_center_last('CancelOrder', $cancelorder, _('Cancels document entry or removes sales order when editing an old document')); } else { display_error($customer_error);