X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=0ace8627c9e1706db58ab691fbc2a03af5eb8fc2;hb=8c7347cfc3afdc92c2231a79cf08686fce07f7f7;hp=fbb669fdc0764d0143650e8603533d2c161d6bac;hpb=46c5f7a65a7659a44ae8254c63152074363d3987;p=fa-stable.git diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index fbb669fd..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); @@ -108,18 +110,19 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) // FIX - implement editable contact selector in sales order $contact = get_branch_contacts($branch_id, 'order', $customer_id); - $order->set_branch($branch_id, $myrow["tax_group_id"], - $myrow["tax_group_name"], @$contact[0]["phone"], @$contact[0]["email"]); + $myrow["tax_group_name"], @$contact["phone"], @$contact["email"]); $address = trim($myrow["br_post_address"]) != '' ? $myrow["br_post_address"] : (trim($myrow["br_address"]) != '' ? $myrow["br_address"]:$deliver); $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 @@ -165,10 +168,11 @@ 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['OrderDate']); - if ($stock_item->qty_dispatched > $qoh) + $_POST['Location'], $_POST['delivery_date']); + if (($stock_item->qty_dispatched -$stock_item->qty_done) > $qoh) { // oops, we don't have enough of one of the component items start_row("class='stockmankobg'"); @@ -394,8 +398,6 @@ function display_order_header(&$order, $editable, $date_text) $order->payment_terms = get_payment_terms($order->payment); $order->due_date = get_invoice_duedate($order->payment, $order->document_date); if ($order->payment_terms['cash_sale']) { - $order->cash_account = $order->pos['pos_account']; - $order->account_name = $order->pos['bank_account_name']; $_POST['Location'] = $order->Location = $order->pos['pos_location']; $order->location_name = $order->pos['location_name']; } @@ -413,7 +415,7 @@ function display_order_header(&$order, $editable, $date_text) } if($editable) { - $str = sales_types_list_row(_("Price List"), 'sales_type', null, true); + $str = sales_types_list_row(_("Price List:"), 'sales_type', null, true); } else { label_row(_("Price List:"), $order->sales_type_name); } @@ -586,9 +588,12 @@ function display_delivery_details(&$order) start_table(TABLESTYLE2, "width=60%"); locations_list_row(_("Deliver from Location:"), 'Location', null, false, true); - label_row(_("Cash account:"), $order->account_name); + if (list_updated('Location')) + $Ajax->activate('items_table'); + 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) {