}
$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);
- }
}
}
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);
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);
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;
}
}
- 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);
$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');
}
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 (list_updated('stock_id')) {
- $Ajax->activate('price');
- $Ajax->activate('units');
- $Ajax->activate('qty');
- $Ajax->activate('line_total');
- }
+ if ($order->fixed_asset)
+ stock_disposable_fa_list_cells(null,'stock_id', null, _('[Select item]'), true, $order->line_items);
+ else {
+ if (!isset($_POST['stock_id'])) { // Check if stock_id dosesn't exist
+ $_POST['stock_id'] = last_sales_order_detail($order, 'stk_code'); //get the llast sales stock id.
+ }
+ sales_items_list_cells(null,'stock_id', $_POST['stock_id'], false, true, true);
+ }
+ if (list_updated('stock_id')) {
+ $Ajax->activate('price');
+ $Ajax->activate('units');
+ $Ajax->activate('qty');
+ $Ajax->activate('line_total');
+ }
$item_info = get_item_edit_info($_POST['stock_id']);
$units = $item_info["units"];
$_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);
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())