3 include_once($path_to_root . "/includes/ui.inc");
5 //--------------------------------------------------------------------------------------
7 function display_bom($item_check)
11 $result = get_bom($item_check);
13 if (db_num_rows($result) == 0)
15 display_note(_("The bill of material for this item is empty."), 0, 1);
20 start_table($table_style);
21 $th = array(_("Component"), _("Description"), _("Work Centre"),
22 _("From Location"), _("Quantity"), _("Unit Cost"), _("Total Cost"));
27 $k = 0; //row colour counter
31 while ($myrow = db_fetch($result))
34 alt_table_row_color($k);
36 label_cell($myrow["component"]);
37 label_cell($myrow["description"]);
38 label_cell($myrow["WorkCentreDescription"]);
39 label_cell($myrow["location_name"]);
40 qty_cell($myrow["quantity"]);
41 amount_cell($myrow["standard_cost"]);
42 amount_cell($myrow["ComponentCost"]);
44 $total_cost += $myrow["ComponentCost"];
51 }//end of page full new headings if
54 label_row("<b>" . _("Total Cost") . "</b>", "<b>" . number_format2($total_cost,user_price_dec()) ."</b>",
55 "colspan=6 align=right", "nowrap align=right");
60 //--------------------------------------------------------------------------------------
62 function display_wo_requirements($woid, $quantity, $show_qoh=false, $date=null)
66 $result = get_wo_requirements($woid);
68 if (db_num_rows($result) == 0)
70 display_note(_("There are no Requirements for this Order."), 1, 0);
75 start_table("$table_style width=80%");
76 $th = array(_("Component"), _("From Location"), _("Work Centre"),
77 _("Unit Quantity"), _("Total Quantity"), _("Units Issued"), _("On Hand"));
81 $k = 0; //row colour counter
87 while ($myrow = db_fetch($result))
92 // if it's a non-stock item (eg. service) don't show qoh
93 if (!has_stock_holding($myrow["mb_flag"]))
97 $qoh = get_qoh_on_date($myrow["stock_id"], $myrow["loc_code"], $date);
99 if ($show_qoh && ($myrow["units_req"] * $quantity > $qoh) &&
100 !sys_prefs::allow_negative_stock())
102 // oops, we don't have enough of one of the component items
103 start_row("class='stockmankobg'");
107 alt_table_row_color($k);
109 if (user_show_codes())
110 label_cell($myrow["stock_id"]. " - " . $myrow["description"]);
112 label_cell($myrow["description"]);
114 label_cell($myrow["location_name"]);
115 label_cell($myrow["WorkCentreDescription"]);
116 qty_cell($myrow["units_req"]);
117 qty_cell($myrow["units_req"] * $quantity);
118 qty_cell($myrow["units_issued"]);
130 display_note(_("Marked items have insufficient quantities in stock."), 0, 0, "class='red'");
134 //--------------------------------------------------------------------------------------
136 function display_wo_productions($woid)
138 global $path_to_root, $table_style;
140 $result = get_work_order_productions($woid);
142 if (db_num_rows($result) == 0)
144 display_note(_("There are no Productions for this Order."), 1, 1);
148 start_table($table_style);
149 $th = array(_("#"), _("Reference"), _("Date"), _("Quantity"));
153 $k = 0; //row colour counter
156 while ($myrow = db_fetch($result))
159 alt_table_row_color($k);
161 $total_qty += $myrow['quantity'];
163 label_cell(get_trans_view_str(29, $myrow["id"]));
164 label_cell($myrow['reference']);
165 label_cell(sql2date($myrow["date_"]));
166 qty_cell($myrow['quantity']);
170 label_row(_("Total"), number_format2($total_qty,user_qty_dec()),
171 "colspan=3", "nowrap align=right");
177 //--------------------------------------------------------------------------------------
179 function display_wo_issues($woid)
181 global $path_to_root, $table_style;
183 $result = get_work_order_issues($woid);
185 if (db_num_rows($result) == 0)
187 display_note(_("There are no Issues for this Order."), 0, 1);
191 start_table($table_style);
192 $th = array(_("#"), _("Reference"), _("Date"));
196 $k = 0; //row colour counter
198 while ($myrow = db_fetch($result))
201 alt_table_row_color($k);
203 label_cell(get_trans_view_str(28, $myrow["issue_no"]));
204 label_cell($myrow['reference']);
205 label_cell(sql2date($myrow["issue_date"]));
213 //--------------------------------------------------------------------------------------
215 function display_wo_payments($woid)
217 global $path_to_root, $table_style;
219 $result = get_bank_trans(null, null, payment_person_types::WorkOrder(), $woid);
221 if (db_num_rows($result) == 0)
223 display_note(_("There are no Payments for this Order."), 0, 1);
227 start_table($table_style);
228 $th = array(_("#"), _("Reference"), _("Date"), _("Amount"));
232 $k = 0; //row colour counter
234 while ($myrow = db_fetch($result))
237 alt_table_row_color($k);
239 label_cell(get_trans_view_str(1, $myrow["trans_no"]));
240 label_cell($myrow['ref']);
241 label_cell(sql2date($myrow["trans_date"]));
242 amount_cell(-($myrow['amount']));
243 label_cell($myrow['bank_curr_code']);
251 //--------------------------------------------------------------------------------------
253 function display_wo_details($woid, $suppress_view_link=false)
257 $myrow = get_work_order($woid);
259 if (strlen($myrow[0]) == 0)
261 display_note(_("The work order number sent is not valid."));
265 start_table("$table_style width=80%");
267 if ($myrow["released"] == true)
268 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
269 _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"),
270 _("Released Date"), _("Manufactured"));
272 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
273 _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"));
277 if ($suppress_view_link)
278 label_cell($myrow["id"]);
280 label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
281 label_cell($myrow["wo_ref"]);
282 label_cell(wo_types::name($myrow["type"]));
283 view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
284 label_cell($myrow["location_name"]);
285 label_cell(sql2date($myrow["date_"]));
286 label_cell(sql2date($myrow["required_by"]));
288 qty_cell($myrow["units_reqd"]);
290 if ($myrow["released"] == true)
292 label_cell(sql2date($myrow["released_date"]));
293 qty_cell($myrow["units_issued"]);
297 comments_display_row(systypes::work_order(), $woid);
301 if ($myrow["closed"] == true)
303 display_note(_("This work order is closed."));
307 //--------------------------------------------------------------------------------------
309 function display_wo_details_quick($woid, $suppress_view_link=false)
313 $myrow = get_work_order($woid);
315 if (strlen($myrow[0]) == 0)
317 display_note(_("The work order number sent is not valid."));
321 start_table("$table_style width=80%");
323 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
324 _("Into Location"), _("Date"), _("Quantity"));
328 if ($suppress_view_link)
329 label_cell($myrow["id"]);
331 label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
332 label_cell($myrow["wo_ref"]);
333 label_cell(wo_types::name($myrow["type"]));
334 view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
335 label_cell($myrow["location_name"]);
336 label_cell(sql2date($myrow["date_"]));
338 qty_cell($myrow["units_issued"]);
342 comments_display_row(systypes::work_order(), $woid);
346 if ($myrow["closed"] == true)
348 display_note(_("This work order is closed."));