3 include_once($path_to_root . "/includes/ui.inc");
4 include_once($path_to_root . "/includes/ui/items_cart.inc");
6 //--------------------------------------------------------------------------------
8 function add_to_issue(&$order, $new_item, $new_item_qty, $standard_cost)
10 if ($order->find_cart_item($new_item))
11 display_error(_("For Part :") . $new_item . " " . "This item is already on this issue. You can change the quantity issued of the existing line if necessary.");
13 $order->add_to_cart (count($order->line_items), $new_item, $new_item_qty, $standard_cost);
15 //---------------------------------------------------------------------------------
17 function display_issue_items($title, &$order)
19 global $table_style, $path_to_root;
21 display_heading($title);
22 div_start('items_table');
23 start_table("$table_style width=80% colspan=7");
24 $th = array(_("Item Code"), _("Item Description"), _("Quantity"),
25 _("Unit"), _("Unit Cost"), '');
26 if ( count($order->line_items)) $th[] = '';
30 $k = 0; //row colour counter
32 $id = find_submit('Edit');
33 foreach ($order->line_items as $line_no=>$stock_item)
36 // $total += ($stock_item->standard_cost * $stock_item->quantity);
40 alt_table_row_color($k);
42 view_stock_status_cell($stock_item->stock_id);
43 label_cell($stock_item->item_description);
44 qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
45 label_cell($stock_item->units);
46 amount_cell($stock_item->standard_cost);
47 // amount_cell($stock_item->standard_cost * $stock_item->quantity);
49 edit_button_cell("Edit$line_no", _("Edit"),
50 _('Edit document line'));
51 edit_button_cell("Delete$line_no", _("Delete"),
52 _('Remove line from document'));
57 issue_edit_item_controls($order, $line_no);
62 issue_edit_item_controls($order);
64 // label_row(_("Total"), number_format2($total,user_price_dec()), "colspan=5", "align=right");
70 //---------------------------------------------------------------------------------
72 function issue_edit_item_controls(&$order, $line_no=-1)
77 $id = find_submit('Edit');
78 if ($line_no != -1 && $line_no == $id)
80 $_POST['stock_id'] = $order->line_items[$id]->stock_id;
81 $_POST['qty'] = qty_format($order->line_items[$id]->quantity,
82 $order->line_items[$id]->stock_id, $dec);
83 $_POST['std_cost'] = price_format($order->line_items[$id]->standard_cost);
84 $_POST['units'] = $order->line_items[$id]->units;
86 hidden('stock_id', $_POST['stock_id']);
87 label_cell($_POST['stock_id']);
88 label_cell($order->line_items[$id]->item_description);
89 $Ajax->activate('items_table');
93 $wo_details = get_work_order($_SESSION['issue_items']->order_id);
95 stock_component_items_list_cells(null, 'stock_id',
96 $wo_details["stock_id"], null, false, true);
97 if(isset($_POST['_stock_id_update'])) {
98 $Ajax->activate('units');
99 $Ajax->activate('qty');
100 $Ajax->activate('std_cost');
103 $item_info = get_item_edit_info($_POST['stock_id']);
105 $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
106 $_POST['std_cost'] = price_format($item_info["standard_cost"]);
107 $_POST['units'] = $item_info["units"];
110 qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
111 label_cell($_POST['units'], '', 'units');
113 amount_cells(null, 'std_cost', $_POST['std_cost']);
117 edit_button_cell('UpdateItem', _("Update"),
118 _('Confirm changes'));
119 edit_button_cell('CancelItemChanges', _("Cancel"),
120 _('Cancel changes'));
121 hidden('LineNo', $line_no);
126 submit_cells('AddItem', _("Add Item"), "colspan=2",
127 _('Add new item to document'), true);
134 //---------------------------------------------------------------------------------
136 function issue_options_controls()
140 ref_row(_("Reference:"), 'ref', '', references::get_next(28));
142 if (!isset($_POST['IssueType']))
143 $_POST['IssueType'] = 0;
145 yesno_list_row(_("Type:"), 'IssueType', $_POST['IssueType'],
146 _("Return Items to Location"), _("Issue Items to Work order"));
148 locations_list_row(_("From Location:"), 'Location');
149 workcenter_list_row(_("To Work Centre:"), 'WorkCentre');
151 date_row(_("Issue Date:"), 'date_');
153 textarea_row(_("Memo"), 'memo_', null, 50, 3);
157 //---------------------------------------------------------------------------------