<?php
if (!empty($_GET["bom_header_id"])) {
 $bom_header_id = htmlentities($_GET["bom_header_id"]);
} else {
 $bom_lines = new bom_line();
 $bom_line_object = array();
 array_push($bom_line_object, $bom_lines);
}

if (!empty($bom_header_id)) {
 if (!empty($bom_header->item_id_m)) {
	$item = item::find_by_id($bom_header->item_id_m);
	$bom_header->item_number = $item->item_number;
	$bom_header->item_description = $item->item_description;
	$bom_header->uom = $item->uom_id;
 }

 $routing_header_details = bom_routing_header::find_by_itemId($bom_header->item_id_m);
 if (!empty($routing_header_details[0])) {
	$routing_line_details = bom_routing_line::find_by_routing_headerId($routing_header_details[0]->bom_routing_header_id);
 }


 $bom_line_object = bom_line::find_all_by_bomHeaderId($bom_header_id);

 if (count($bom_line_object) < 1) {
	$bom_lines = new bom_line();
	$bom_line_object = array();
	array_push($bom_line_object, $bom_lines);
 } else {
	foreach ($bom_line_object as &$bom_lines) {
	 $item = item::find_by_id($bom_lines->component_item_id_m);
	 $bom_lines->component_item_number = $item->item_number;
	 $bom_lines->component_description = $item->item_description;
	 $bom_lines->component_uom = $item->uom_id;
	}
 }
}
?>