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 $already_on_order = 0;
12 foreach ($order->line_items as $order_item)
14 if (strcasecmp($order_item->stock_id, $new_item) == 0)
16 $already_on_order = 1;
17 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.");
21 if ($already_on_order != 1)
23 $order->add_to_cart ($new_item, $new_item_qty, $standard_cost);
24 } /* end of if not already on the order */
27 //--------------------------------------------------------------------------------
29 function display_order_header(&$order)
33 start_table("width=70% $table_style");
34 echo "<tr><td width=33% valign=top>"; // outer table
37 locations_list_row(_("From Location:"), 'FromStockLocation', null);
38 locations_list_row(_("To Location:"), 'ToStockLocation', null);
42 echo "</td><td width=33%>"; // outer table
46 ref_row(_("Reference:"), 'ref', '', references::get_next(systypes::location_transfer()));
48 date_row(_("Date:"), 'AdjDate');
52 echo "</td><td width=33%>"; // outer table
55 movement_types_list_row(_("Transfer Type:"), 'type', null);
59 end_table(1); // outer table
62 //---------------------------------------------------------------------------------
64 function display_transfer_items($title, &$order)
66 global $table_style, $path_to_root;
68 display_heading($title);
69 start_table("$table_style width=80%");
70 $th = array(_("Item Code"), _("Item Description"), _("Quantity"), _("Unit"),'');
73 $k = 0; //row colour counter
75 foreach ($order->line_items as $stock_item)
78 $quantity = number_format2($stock_item->quantity,user_qty_dec());
80 if (!isset($_GET['Edit']) || $_GET['Edit'] != $stock_item->stock_id)
82 alt_table_row_color($k);
84 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>");
85 label_cell($stock_item->item_description);
86 qty_cell($stock_item->quantity, false, get_qty_dec($stock_item->stock_id));
87 label_cell($stock_item->units);
89 edit_link_cell(SID . "Edit=$stock_item->stock_id");
90 delete_link_cell(SID . "Delete=$stock_item->stock_id");
95 transfer_edit_item_controls($order, $stock_item->stock_id);
99 if (!isset($_GET['Edit']))
100 transfer_edit_item_controls($order);
105 //---------------------------------------------------------------------------------
107 function transfer_edit_item_controls(&$order, $stock_id=null)
111 if (isset($_GET['Edit']) and $stock_id!=null)
113 if (!isset($_POST['stock_id']))
114 $_POST['stock_id'] = $order->line_items[$stock_id]->stock_id;
115 if (!isset($_POST['qty']) || $_POST['qty'] == '')
116 $_POST['qty'] = qty_format($order->line_items[$stock_id]->quantity, $order->line_items[$stock_id]->stock_id, $dec);
118 $_POST['units'] = $order->line_items[$stock_id]->units;
120 hidden('stock_id', $_POST['stock_id']);
121 label_cell($_POST['stock_id']);
122 label_cell($order->line_items[$stock_id]->item_description);
126 echo "<TD colspan=2>";
127 stock_costable_items_list('stock_id', null, false, true);
130 $item_info = get_item_edit_info($_POST['stock_id']);
132 $_POST['qty'] = qty_format(0, $_POST['stock_id'], $dec);
133 $_POST['units'] = $item_info["units"];
137 small_qty_cells(null, 'qty', $_POST['qty'], null, null, $dec);
138 label_cell($_POST['units']);
140 if (isset($_GET['Edit']))
142 submit_cells('UpdateItem', _("Update"));
143 submit_cells('CancelItemChanges', _("Cancel"));
147 submit_cells('AddItem', _("Add Item"), "colspan=2");
154 //---------------------------------------------------------------------------------
156 function transfer_options_controls()
161 textarea_row(_("Memo"), 'memo_', null, 50, 3);
167 //---------------------------------------------------------------------------------