- amount_cells(null, 'qty', $_POST['qty']);
-
- label_cell($_POST['units']);
- amount_cells(null, 'std_cost', $_POST['std_cost']);
- label_cell(" ");
+ $item_info = get_item_edit_info(get_post('stock_id'));
+ if ($item_info) {
+ $dec = $item_info['decimals'];
+ $_POST['std_cost'] = price_decimal_format($item_info["material_cost"], $dec2);
+ $_POST['units'] = $item_info["units"];
+ } else
+ $dec = 0;
+ if ($order->fixed_asset) {
+ hidden('qty', -1);
+ qty_cell(1, false, 0);
+ } else
+ label_cell( text_input('qty', get_post('qty', '0'), 15, 15, '', 'class="amount active" dec='.$dec), "nowrap align=right");
+
+ label_cell(get_post('units'), '', 'units');
+
+ if ($order->fixed_asset) {
+ hidden('std_cost');
+ label_cell($_POST['std_cost'], "nowrap align=right ", 'std_cost_view');
+ $price = get_purchase_value($_POST['stock_id']);
+ amount_cell($price, false, '', 'initial_price');
+ } else {
+ if (get_post('_qty_changed')) {
+ $Ajax->activate('items_table');
+ set_focus(input_num('qty') >= 0 ? 'std_cost' : 'AddItem');
+ }
+ if (input_num('qty') >= 0)
+ amount_cells(null, 'std_cost', null, null, null, $dec);
+ else {
+ hidden('std_cost');
+ label_cell($_POST['std_cost'], "nowrap align=right");
+ }
+ label_cell(" ");
+ }