X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=0ace8627c9e1706db58ab691fbc2a03af5eb8fc2;hb=aed0d601bf245cda4ae5867b8c2f54925658644d;hp=272429289287d13e1e5f3c07bbbb9d4ee2a80e4e;hpb=1188ac04a620a54d238454ecf9107dd5e98857d2;p=fa-stable.git diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 27242928..0ace8627 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -72,6 +72,8 @@ function add_to_order(&$order, $new_item, $new_item_qty, $price, $discount, $des function get_customer_details_to_order(&$order, $customer_id, $branch_id) { + global $SysPrefs; + $ret_error = ""; $myrow = get_customer_to_order($customer_id); @@ -116,9 +118,11 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) $order->set_delivery($myrow["default_ship_via"], $myrow["br_name"], $address); - if ($order->trans_type == ST_SALESINVOICE || $order->trans_type == ST_SALESORDER) { + if ($order->trans_type == ST_SALESINVOICE) { $order->due_date = get_invoice_duedate($order->payment, $order->document_date); } + elseif ($order->trans_type == ST_SALESORDER) + $order->due_date = add_days($order->document_date, $SysPrefs->default_delivery_required_by()); if($order->payment_terms['cash_sale']) { $order->set_location($order->pos["pos_location"], $order->pos["location_name"]); } else @@ -164,7 +168,8 @@ function display_order_summary($title, &$order, $editable_items=false) $qoh_msg = ''; if (!$editable_items || $id != $line_no) { - if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id)) { + if (!$SysPrefs->allow_negative_stock() && is_inventory_item($stock_item->stock_id) && + $order->trans_type != ST_SALESORDER && $order->trans_type!=ST_SALESQUOTE) { $qoh = get_qoh_on_date($stock_item->stock_id, $_POST['Location'], $_POST['delivery_date']); if (($stock_item->qty_dispatched -$stock_item->qty_done) > $qoh) @@ -588,6 +593,7 @@ function display_delivery_details(&$order) label_row(_("Cash account:"), $order->pos['bank_account_name']); textarea_row(_("Comments:"), "Comments", $order->Comments, 31, 5); end_table(); + hidden('delivery_date', $order->due_date); } else { if ($order->trans_type==ST_SALESINVOICE) {