<?php

$class_third = 'bom_detail_line';
$$class_third = &$bom_detail_line;

if (!empty($_GET["bom_routing_header_id"])) {
 $bom_routing_header_id = ($_GET["bom_routing_header_id"]);
} elseif (!empty($_BOMST["bom_routing_header_id"][0])) {
 $bom_routing_header_id = $_BOMST["bom_routing_header_id"][0];
} else {
 $bom_routing_line = new bom_routing_line();
 $bom_routing_line_object = array();
 array_push($bom_routing_line_object, $bom_routing_line);
//	$field_array = bom_routing_line::$field_array;
}

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

 if (!empty($$class->common_routing_item_id_m)) {
  $c_item = item::find_by_item_id_m($$class->common_routing_item_id_m);
  $$class->commonRouting_item_number = $c_item->item_number;
  $$class->commonRouting_item_description = $c_item->item_description;
  $bomrh = bom_routing_header::find_by_itemId_orgId($$class->common_routing_item_id_m, $$class->org_id);
  if ($bomrh) {
   $bom_routing_line_object = bom_routing_line::find_by_routing_headerId($bomrh->bom_routing_header_id);
  }
 }



 foreach ($bom_routing_line_object as &$bom_routing_lines) {
  if (!empty($bom_routing_lines->item_id_m)) {
   $item = new item();
   $item_i = $item->findBy_id($bom_routing_lines->item_id_m);
   $bom_routing_lines->item_number = $item_i->item_number;
   $bom_routing_lines->uom = $item_i->uom_id;
   $bom_routing_lines->item_description = $item_i->item_description;
  }
 }
// echo "<pre>";
// print_r($bom_routing_line_object);
 if (count($bom_routing_line_object) == 0) {
  $bom_routing_line = new bom_routing_line;
  $bom_routing_line_object = array();
  array_push($bom_routing_line_object, $bom_routing_line);
 }
}


if (!empty($_GET['am_asset_type'])) {
 $hidden_field = $f->hidden_field_withCLass('am_asset_type', $_GET['am_asset_type'], 'popup_value');
 $form_name_header = ucwords(str_replace('_', ' ', $_GET['am_asset_type']));
}
?>
