X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=72ad103b1ebe6237b13ef88ba37062e38c85ec21;hb=2e2c1956eb2f82eebc95878752a19a376cc89485;hp=043d2514b5d2d4184576f84cb53d0dc44316b578;hpb=19dce8c7be29e4cc8e7be92d044259348373d456;p=fa-stable.git diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 043d2514..72ad103b 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -43,27 +43,27 @@ function add_to_order(&$order, $new_item, $new_item_qty, $price, $discount, $des } $item_price = round($item_price, user_price_dec()); - if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id']) - { // this is sales kit - recurse - add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'], - $item_price, $discount); - } - else - { // stock item record eventually with foreign code - - // check duplicate stock item - foreach ($order->line_items as $order_item) - { - if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0) + if (!$item['is_foreign'] && $item['item_code'] != $item['stock_id']) + { // this is sales kit - recurse + add_to_order($order, $item['stock_id'], $new_item_qty*$item['quantity'], + $item_price, $discount); + } + else + { // stock item record eventually with foreign code + + // check duplicate stock item + foreach ($order->line_items as $order_item) { - display_warning(_("For Part :").$item['stock_id']. " " - . _("This item is already on this document. You have been warned.")); - break; + if (strcasecmp($order_item->stock_id, $item['stock_id']) == 0) + { + display_warning(_("For Part :").$item['stock_id']. " " + . _("This item is already on this document. You have been warned.")); + break; + } } + $order->add_to_cart (count($order->line_items), $item['stock_id'], + $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description); } - $order->add_to_cart (count($order->line_items), $item['stock_id'], - $new_item_qty*$item['quantity'], $item_price, $discount, 0,0, $description); - } } } @@ -178,7 +178,6 @@ function display_order_summary($title, &$order, $editable_items=false) view_stock_status_cell($stock_item->stock_id); - //label_cell($stock_item->item_description, "nowrap" ); label_cell($stock_item->item_description ); $dec = get_qty_dec($stock_item->stock_id); qty_cell($stock_item->qty_dispatched, false, $dec); @@ -254,8 +253,6 @@ function display_order_header(&$order, $editable, $date_text) if (isset($order) && !$editable) { - // can't change the customer/branch if items already received on this order - //echo $order->customer_name . " - " . $order->deliver_to; label_row(null, $order->customer_name . " - " . $order->deliver_to); hidden('customer_id', $order->customer_id); hidden('branch_id', $order->Branch); @@ -295,7 +292,7 @@ function display_order_header(&$order, $editable, $date_text) else { - $old_order = (PHP_VERSION<5) ? $order : clone( $order ); + $old_order = (PHP_VERSION<5) ? $order : clone $order; $customer_error = get_customer_details_to_order($order, $_POST['customer_id'], $_POST['branch_id']); $_POST['Location'] = $order->Location; @@ -465,7 +462,6 @@ function display_order_header(&$order, $editable, $date_text) $line = &$order->line_items[$line_no]; $line->price = get_kit_price($line->stock_id, $order->customer_currency, $order->sales_type, $order->price_factor, get_post('OrderDate')); - // $line->discount_percent = $order->default_discount; } $Ajax->activate('items_table'); } @@ -499,21 +495,21 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) hidden('item_description', $_POST['item_description']); label_cell($_POST['item_description']); } -// } else { -// sales_items_list_cells(null,'item_description', null, false, true); -// } - //label_cell($order->line_items[$line_no]->item_description, "nowrap"); $Ajax->activate('items_table'); } else // prepare new line { - sales_items_list_cells(null,'stock_id', null, false, true, true); + if ($order->fixed_asset) + stock_disposable_fa_list_cells(null,'stock_id', null, _('[Select item]'), true, $order->line_items); + else + sales_items_list_cells(null,'stock_id', null, false, true, true); if (list_updated('stock_id')) { $Ajax->activate('price'); $Ajax->activate('units'); $Ajax->activate('qty'); $Ajax->activate('line_total'); - } + } else + sales_items_list_cells(null,'stock_id', last_sales_order_detail($order, 'stk_code'), false, true, true); $item_info = get_item_edit_info($_POST['stock_id']); $units = $item_info["units"]; @@ -527,7 +523,11 @@ function sales_order_item_controls(&$order, &$rowcounter, $line_no=-1) $_POST['Disc'] = percent_format($order->default_discount * 100); } - qty_cells(null, 'qty', $_POST['qty'], null, null, $dec); + if ($order->fixed_asset) { + label_cell(1, '', 'qty'); + hidden('qty', 1); + } else + qty_cells(null, 'qty', $_POST['qty'], null, null, $dec); if ($order->trans_no!=0) { qty_cell($line_no==-1 ? 0 :$order->line_items[$line_no]->qty_done, false, $dec); @@ -607,8 +607,8 @@ function display_delivery_details(&$order) start_outer_table(TABLESTYLE2, "width='90%'"); table_section(1); - locations_list_row(_("Deliver from Location:"), 'Location', null, false, true); - if ($order->payment_terms['days_before_due'] < 0) + locations_list_row(_("Deliver from Location:"), 'Location', null, false, true, $order->fixed_asset); + if ($order->payment_terms['days_before_due'] == -1) { $Ajax->addUpdate('items_table', 'prep_amount', price_format($order->get_trans_total())); // bind to items_table update if (!$order->is_started())