X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sales%2Fincludes%2Fui%2Fsales_order_ui.inc;h=72ad103b1ebe6237b13ef88ba37062e38c85ec21;hb=2e2c1956eb2f82eebc95878752a19a376cc89485;hp=1f7f7534a3086b8c024e8e88a21d2d22ca171bbd;hpb=5b8f4c4b4aa8cf996bc071f116bfce1273200fa2;p=fa-stable.git diff --git a/sales/includes/ui/sales_order_ui.inc b/sales/includes/ui/sales_order_ui.inc index 1f7f7534..72ad103b 100644 --- a/sales/includes/ui/sales_order_ui.inc +++ b/sales/includes/ui/sales_order_ui.inc @@ -10,7 +10,6 @@ See the License here . ***********************************************************************/ include_once($path_to_root . "/sales/includes/cart_class.inc"); -include_once($path_to_root . "/includes/manufacturing.inc"); //-------------------------------------------------------------------------------- function add_to_order(&$order, $new_item, $new_item_qty, $price, $discount, $description='') @@ -44,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 + 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) + // 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); - } } } @@ -142,7 +141,8 @@ function display_order_summary($title, &$order, $editable_items=false) display_heading($title); div_start('items_table'); - start_table(TABLESTYLE, "colspan=7 width=90%"); + start_table(TABLESTYLE, "width='90%'"); + $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Delivered"), _("Unit"), $order->tax_included ? _("Price after Tax") : _("Price before Tax"), _("Discount %"), _("Total"), ""); @@ -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); @@ -245,7 +244,7 @@ function display_order_header(&$order, $editable, $date_text) { global $Ajax, $SysPrefs; - start_outer_table(TABLESTYLE2, "width=80%"); + start_outer_table(TABLESTYLE2, "width='80%'"); table_section(1); @@ -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; @@ -361,7 +358,7 @@ function display_order_header(&$order, $editable, $date_text) } } - ref_row(_("Reference").':', 'ref', _('Reference number unique for this document type'), null, ''); + ref_row(_("Reference").':', 'ref', _('Reference number unique for this document type'), null, '', $order->trans_type, array('date'=> @$_POST['OrderDate'])); table_section(2); @@ -377,6 +374,7 @@ function display_order_header(&$order, $editable, $date_text) label_row(_("Customer Discount:"), ($order->default_discount * 100) . "%"); table_section(3); + start_row(); if (($order->pos['cash_sale'] || $order->pos['credit_sale']) && !$order->is_started()) { // editable payment type @@ -399,6 +397,7 @@ function display_order_header(&$order, $editable, $date_text) } else { label_cells(_('Payment:'), $order->payment_terms['terms'], "class='label'"); } + end_row(); if($editable) { $str = sales_types_list_row(_("Price List:"), 'sales_type', null, true); @@ -463,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'); } @@ -497,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"]; @@ -525,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); @@ -571,7 +573,7 @@ function display_delivery_details(&$order) if ($order->payment_terms['cash_sale']) { // Direct payment sale $Ajax->activate('items_table'); display_heading(_('Cash payment')); - start_table(TABLESTYLE2, "width=60%"); + start_table(TABLESTYLE2, "width='60%'"); locations_list_row(_("Deliver from Location:"), 'Location', null, false, true); if (list_updated('Location')) @@ -602,11 +604,11 @@ function display_delivery_details(&$order) $delname = _("Required Delivery Date").':'; } display_heading($title); - start_outer_table(TABLESTYLE2, "width=90%"); + 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()) @@ -621,7 +623,7 @@ function display_delivery_details(&$order) date_row($delname, 'delivery_date', $order->trans_type==ST_SALESORDER ? _('Enter requested day of delivery') : $order->trans_type==ST_SALESQUOTE ? _('Enter Valid until Date') : ''); - text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 40, 40, + text_row(_("Deliver To:"), 'deliver_to', $order->deliver_to, 50, 60, _('Additional identifier for delivery e.g. name of receiving person')); textarea_row(_("Address:"), 'delivery_address', $order->delivery_address, 35, 5,