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_order(&$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 order. You can change the quantity ordered of the existing line if necessary.");
13 $order->add_to_cart (count($order->line_items), $new_item, $new_item_qty, $standard_cost);
16 //--------------------------------------------------------------------------------
18 function display_order_header(&$order)
22 start_table("width=70% $table_style");
23 echo "<tr><td width=33% valign=top>"; // outer table
26 locations_list_row(_("From Location:"), 'FromStockLocation', null);
27 locations_list_row(_("To Location:"), 'ToStockLocation', null);
31 echo "</td><td width=33%>"; // outer table
35 ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::location_transfer()));
37 date_row(_("Date:"), 'AdjDate');
41 echo "</td><td width=33%>"; // outer table
44 movement_types_list_row(_("Transfer Type:"), 'type', null);
48 end_table(1); // outer table
51 //---------------------------------------------------------------------------------
53 function display_transfer_items($title, &$order)
55 global $table_style, $path_to_root;
57 display_heading($title);
58 div_start('items_table');
59 start_table("$table_style width=80%");
60 $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"), '');
63 $k = 0; //row colour counter
65 $id = find_submit('Edit');
66 foreach ($order->line_items as $line_no=>$stock_item)
71 alt_table_row_color($k);
73 label_cell("<a target='_blank' href='$path_to_root/inventory/inquiry/stock_status.php?" . SID . "stock_id=" . $stock_item->stock_id . "'>$stock_item->stock_id</a>");
74 label_cell($stock_item->item_description);
75 qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
76 label_cell($stock_item->units);
78 edit_button_cell("Edit$line_no", _("Edit"),
79 _('Edit document line'));
80 edit_button_cell("Delete$line_no", _("Delete"),
81 _('Remove line from document'));
86 transfer_edit_item_controls($order, $line_no);
91 transfer_edit_item_controls($order);
97 //---------------------------------------------------------------------------------
99 function transfer_edit_item_controls(&$order, $line_no=-1)
104 $id = find_submit('Edit');
105 if ($line_no != -1 && $line_no == $id)
107 $_POST['stock_id'] = $order->line_items[$id]->stock_id;
108 $_POST['qty'] = qty_format($order->line_items[$id]->quantity, $order->line_items[$id]->stock_id, $dec);
109 $_POST['units'] = $order->line_items[$id]->units;
111 hidden('stock_id', $_POST['stock_id']);
112 label_cell($_POST['stock_id']);
113 label_cell($order->line_items[$id]->item_description);
114 $Ajax->activate('items_table');
118 stock_costable_items_list_cells(null, 'stock_id', null, false, true);
119 if(isset($_POST['_stock_id_update'])) {
120 $Ajax->activate('units');
121 $Ajax->activate('qty');
124 $item_info = get_item_edit_info($_POST['stock_id']);
126 $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
127 $_POST['units'] = $item_info["units"];
130 small_qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
131 label_cell($_POST['units'], '', 'units');
135 edit_button_cell('UpdateItem', _("Update"),
136 _('Confirm changes'));
137 edit_button_cell('CancelItemChanges', _("Cancel"),
138 _('Cancel changes'));
139 hidden('LineNo', $line_no);
144 submit_cells('AddItem', _("Add Item"), "colspan=2",
145 _('Add new item to document'), true);
152 //---------------------------------------------------------------------------------
154 function transfer_options_controls()
159 textarea_row(_("Memo"), 'memo_', null, 50, 3);
165 //---------------------------------------------------------------------------------