X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fsales_order_entry.php;h=85985fb11a7c1b9cbed5188bc92879d04dc7fa20;hb=refs%2Fheads%2Fmaster;hp=618030a450d3a3855a42d386ef9e3778228232ef;hpb=61759ecf1b57f8bca2cbedf9c031974412f9e816;p=fa-stable.git diff --git a/sales/sales_order_entry.php b/sales/sales_order_entry.php index 618030a4..6318b4fd 100644 --- a/sales/sales_order_entry.php +++ b/sales/sales_order_entry.php @@ -101,6 +101,11 @@ if (isset($_GET['NewDelivery']) && is_numeric($_GET['NewDelivery'])) { page($_SESSION['page_title'], false, false, "", $js); +if (isset($_GET['ModifyOrderNumber']) && is_prepaid_order_open($_GET['ModifyOrderNumber'])) +{ + display_error(_("This order cannot be edited because there are invoices or payments related to it, and prepayment terms were used.")); + end_page(); exit; +} if (isset($_GET['ModifyOrderNumber'])) check_is_editable(ST_SALESORDER, $_GET['ModifyOrderNumber']); elseif (isset($_GET['ModifyQuotationNumber'])) @@ -117,6 +122,7 @@ if (list_updated('branch_id')) { if (isset($_GET['AddedID'])) { $order_no = $_GET['AddedID']; + display_notification_centered(sprintf( _("Order # %d has been entered."),$order_no)); submenu_view(_("&View This Order"), ST_SALESORDER, $order_no); @@ -132,6 +138,16 @@ if (isset($_GET['AddedID'])) { submenu_option(_("Enter a &New Order"), "/sales/sales_order_entry.php?NewOrder=0"); + $order = get_sales_order_header($order_no, ST_SALESORDER); + $customer_id = $order['debtor_no']; + if ($order['prep_amount'] > 0) + { + $row = db_fetch(db_query(get_allocatable_sales_orders($customer_id, $order_no, ST_SALESORDER))); + if ($row === false) + submenu_option(_("Receive Customer Payment"), "/sales/customer_payments.php?customer_id=$customer_id"); + } + submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_SALESORDER."&trans_no=$order_no"); + display_footer_exit(); } elseif (isset($_GET['UpdatedID'])) { @@ -168,6 +184,8 @@ if (isset($_GET['AddedID'])) { submenu_option(_("Enter a New &Quotation"), "/sales/sales_order_entry.php?NewQuotation=0"); + submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_SALESQUOTE."&trans_no=$order_no"); + display_footer_exit(); } elseif (isset($_GET['UpdatedQU'])) { @@ -213,6 +231,8 @@ if (isset($_GET['AddedID'])) { submenu_option(_("Enter a &New Delivery"), "/sales/sales_order_entry.php?NewDelivery=0"); + submenu_option(_("Add an Attachment"), "/admin/attachments.php?filterType=".ST_CUSTDELIVERY."&trans_no=$delivery"); + display_footer_exit(); } elseif (isset($_GET['AddedDI'])) { @@ -253,7 +273,7 @@ function copy_to_cart() { $cart = &$_SESSION['Items']; - $cart->reference = $_POST['ref']; + $cart->reference = get_post('ref'); $cart->Comments = $_POST['Comments']; @@ -448,6 +468,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; } @@ -470,10 +494,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