X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=ae2bd96471b46aa8bf830d7d441d5f667f80da56;hb=ec3b5ef00ee07bdf7559c8bdb6f857b7464c3fbe;hp=2b2b028465ea5d045677f52ec424a38fa8f3bd29;hpb=66626dafdf0a397406e36663f3ed15321d09984a;p=fa-stable.git diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 2b2b0284..ae2bd964 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -34,38 +34,44 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) $deliver = $myrow['address']; // in case no delivery address. - $order->set_customer($customer_id, $name, $myrow['curr_code'], $myrow['discount']); + $order->set_customer($customer_id, $name, $myrow['curr_code'], + $myrow['discount'], $myrow['pymt_discount']); // the sales type determines the price list to be used by default $order->set_sales_type($myrow['salestype'], $myrow['sales_type'], $myrow['tax_included'], $myrow['factor']); -// if ($order->Branch != 0) - { - $result = get_branch_to_order($customer_id, $branch_id); + $result = get_branch_to_order($customer_id, $branch_id); - if (db_num_rows($result) == 0) - { + if (db_num_rows($result) == 0) + { return _("The selected customer and branch are not valid, or the customer does not have any branches."); - } - - $myrow = db_fetch($result); + } - $order->set_branch($branch_id, $myrow["tax_group_id"], - $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]); + $myrow = db_fetch($result); - $address = $myrow["br_post_address"]; + $order->set_branch($branch_id, $myrow["tax_group_id"], + $myrow["tax_group_name"], $myrow["phone"], $myrow["email"]); - if (strlen($address) <= 1) // if branch has no address - $address = $deliver; // set sales order address + $address = $myrow["br_post_address"]; - $order->set_location($myrow["default_location"], $myrow["location_name"]); - $order->set_delivery($myrow["default_ship_via"], $myrow["br_name"], + if (strlen($address) <= 1) // if branch has no address + $address = $deliver; // set sales order address + $order->set_delivery($myrow["default_ship_via"], $myrow["br_name"], $address); - if ($order->trans_type == 10) - $order->due_date = get_invoice_duedate($customer_id, $order->document_date); + if ($order->trans_type == 10) { + $order->due_date = get_invoice_duedate($customer_id, $order->document_date); + if ($order->pos != -1) + $order->cash = date_diff($order->due_date, Today(), 'd')<2; } - + if($order->cash ) { + if($order->pos != -1) { + $paym = get_sales_point($order->pos); + $order->set_location($paym["pos_location"], $paym["location_name"]); + } + } else + $order->set_location($myrow["default_location"], $myrow["location_name"]); + return $ret_error; } @@ -73,7 +79,7 @@ function get_customer_details_to_order(&$order, $customer_id, $branch_id) function display_order_summary($title, &$order, $editable_items=false) { - global $table_style, $path_to_root, $Ajax; + global $table_style, $path_to_root; display_heading($title); @@ -205,6 +211,7 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group $_POST['deliver_to'] = $order->deliver_to; $_POST['delivery_address'] = $order->delivery_address; $_POST['phone'] = $order->phone; + $_POST['cash'] = $order->cash; if ($order->trans_type == 10) { $_POST['delivery_date'] = $order->due_date; @@ -214,6 +221,7 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group $Ajax->activate('deliver_to'); $Ajax->activate('phone'); $Ajax->activate('delivery_address'); + $Ajax->activate('cash'); // change prices if necessary // what about discount in template case? if ($old_order->customer_currency != $order->customer_currency) { @@ -253,6 +261,26 @@ function display_order_header(&$order, $editable, $date_text, $display_tax_group echo "
"; // outer table
-
- echo " | "; // outer table
+ if ($order->trans_type==10)
+ {
+ $title = _("Delivery Details");
+ $delname = _("Due Date").':';
+ }
+ elseif ($order->trans_type==13)
+ {
+ $title = _("Invoice Delivery Details");
+ $delname = _("Invoice before").':';
+ }
+ else
+ {
+ $title = _("Order Delivery Details");
+ $delname = _("Required Delivery Date").':';
+ }
+ display_heading($title);
+ echo " "; + start_table("$table_style2 width=90%"); + echo " |
"; // outer table
+ echo ""; // outer table
- small_amount_row(_("Shipping Charge:"), 'freight_cost',
- price_format(get_post('freight_cost',0)));
+ echo " | ";
- end_table(1); // outer table
+ shippers_list_row(_("Shipping Company:"), 'ship_via', $order->ship_via);
+ echo " |