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"], false, get_qty_dec($myrow["component"]));
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 $dec = get_qty_dec($myrow["stock_id"]);
117 qty_cell($myrow["units_req"], false, $dec);
118 qty_cell($myrow["units_req"] * $quantity, false, $dec);
119 qty_cell($myrow["units_issued"], false, $dec);
121 qty_cell($qoh, false, $dec);
131 display_note(_("Marked items have insufficient quantities in stock."), 0, 0, "class='red'");
135 //--------------------------------------------------------------------------------------
137 function display_wo_productions($woid)
139 global $path_to_root, $table_style;
141 $result = get_work_order_productions($woid);
143 if (db_num_rows($result) == 0)
145 display_note(_("There are no Productions for this Order."), 1, 1);
149 start_table($table_style);
150 $th = array(_("#"), _("Reference"), _("Date"), _("Quantity"));
154 $k = 0; //row colour counter
157 while ($myrow = db_fetch($result))
160 alt_table_row_color($k);
162 $total_qty += $myrow['quantity'];
164 label_cell(get_trans_view_str(29, $myrow["id"]));
165 label_cell($myrow['reference']);
166 label_cell(sql2date($myrow["date_"]));
167 qty_cell($myrow['quantity'], false, get_qty_dec($myrow['reference']));
171 label_row(_("Total"), number_format2($total_qty,user_qty_dec()),
172 "colspan=3", "nowrap align=right");
178 //--------------------------------------------------------------------------------------
180 function display_wo_issues($woid)
182 global $path_to_root, $table_style;
184 $result = get_work_order_issues($woid);
186 if (db_num_rows($result) == 0)
188 display_note(_("There are no Issues for this Order."), 0, 1);
192 start_table($table_style);
193 $th = array(_("#"), _("Reference"), _("Date"));
197 $k = 0; //row colour counter
199 while ($myrow = db_fetch($result))
202 alt_table_row_color($k);
204 label_cell(get_trans_view_str(28, $myrow["issue_no"]));
205 label_cell($myrow['reference']);
206 label_cell(sql2date($myrow["issue_date"]));
214 //--------------------------------------------------------------------------------------
216 function display_wo_payments($woid)
218 global $path_to_root, $table_style;
220 $result = get_bank_trans(null, null, payment_person_types::WorkOrder(), $woid);
222 if (db_num_rows($result) == 0)
224 display_note(_("There are no Payments for this Order."), 0, 1);
228 start_table($table_style);
229 $th = array(_("#"), _("Reference"), _("Date"), _("Amount"));
233 $k = 0; //row colour counter
235 while ($myrow = db_fetch($result))
238 alt_table_row_color($k);
240 label_cell(get_trans_view_str(1, $myrow["trans_no"]));
241 label_cell($myrow['ref']);
242 label_cell(sql2date($myrow["trans_date"]));
243 amount_cell(-($myrow['amount']));
244 label_cell($myrow['bank_curr_code']);
252 //--------------------------------------------------------------------------------------
254 function display_wo_details($woid, $suppress_view_link=false)
258 $myrow = get_work_order($woid);
260 if (strlen($myrow[0]) == 0)
262 display_note(_("The work order number sent is not valid."));
266 start_table("$table_style width=80%");
268 if ($myrow["released"] == true)
269 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
270 _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"),
271 _("Released Date"), _("Manufactured"));
273 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
274 _("Into Location"), _("Date"), _("Required By"), _("Quantity Required"));
278 if ($suppress_view_link)
279 label_cell($myrow["id"]);
281 label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
282 label_cell($myrow["wo_ref"]);
283 label_cell(wo_types::name($myrow["type"]));
284 view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
285 label_cell($myrow["location_name"]);
286 label_cell(sql2date($myrow["date_"]));
287 label_cell(sql2date($myrow["required_by"]));
288 $dec = get_qty_dec($myrow["stock_id"]);
289 qty_cell($myrow["units_reqd"], false, $dec);
291 if ($myrow["released"] == true)
293 label_cell(sql2date($myrow["released_date"]));
294 qty_cell($myrow["units_issued"], false, $dec);
298 comments_display_row(systypes::work_order(), $woid);
302 if ($myrow["closed"] == true)
304 display_note(_("This work order is closed."));
308 //--------------------------------------------------------------------------------------
310 function display_wo_details_quick($woid, $suppress_view_link=false)
314 $myrow = get_work_order($woid);
316 if (strlen($myrow[0]) == 0)
318 display_note(_("The work order number sent is not valid."));
322 start_table("$table_style width=80%");
324 $th = array(_("#"), _("Reference"), _("Type"), _("Manufactured Item"),
325 _("Into Location"), _("Date"), _("Quantity"));
329 if ($suppress_view_link)
330 label_cell($myrow["id"]);
332 label_cell(get_trans_view_str(systypes::work_order(), $myrow["id"]));
333 label_cell($myrow["wo_ref"]);
334 label_cell(wo_types::name($myrow["type"]));
335 view_stock_status_cell($myrow["stock_id"], $myrow["StockItemName"]);
336 label_cell($myrow["location_name"]);
337 label_cell(sql2date($myrow["date_"]));
339 qty_cell($myrow["units_issued"], false, get_qty_dec($myrow["stock_id"]));
343 comments_display_row(systypes::work_order(), $woid);
347 if ($myrow["closed"] == true)
349 display_note(_("This work order is closed."));