<?php

$class_third = 'am_wo_routing_detail';
$$class_third = &$am_wo_routing_detail;
$class_fourth = 'am_wo_bom';
$$class_fourth = &$am_wo_bom;
?>

<?php

if (!empty($_GET["am_wo_header_id"]) && (!is_array($_GET["am_wo_header_id"]))) {
 $am_wo_header_id = $_GET["am_wo_header_id"];
} elseif (!empty($_POST["am_wo_header_id"][0])) {
 $am_wo_header_id = $_POST["am_wo_header_id"][0];
} else {
 $am_wo_bom = new am_wo_bom();
 $am_wo_bom_object = array();
 array_push($am_wo_bom_object, $am_wo_bom);

 $am_wo_routing_line = new am_wo_routing_line();
 $am_wo_routing_line_object = array();
 array_push($am_wo_routing_line_object, $am_wo_routing_line);
}

if (!empty($am_wo_header_id)) {
 $item_activity = new item();
 $item_activity->findBy_id($$class->activity_item_id_m);
 if (!empty($item_activity)) {
  $$class->activity_item_number = $item_activity->item_number;
  $$class->processing_lt = $item_activity->processing_lt;
 }
 //am asset number details
 if (!empty($$class->am_asset_id)) {
  $am_ast_d = am_asset::find_by_id($$class->am_asset_id);
  $$class->am_asset_number = $am_ast_d->asset_number;
 }


 $am_wo_bom_object = am_wo_bom::find_by_am_wo_headerId($am_wo_header_id);
 if (count($am_wo_bom_object) == 0) {
  $am_wo_bom = new am_wo_bom;
  $am_wo_bom_object = array();
  array_push($am_wo_bom_object, $am_wo_bom);
 } else {
  $routing_line_details = am_wo_routing_line::find_by_am_wo_headerId($am_wo_header_id);
 }

 $am_wo_routing_line_object = am_wo_routing_line::find_by_am_wo_headerId($am_wo_header_id);
 if (count($am_wo_routing_line_object) == 0) {
  $am_wo_routing_line = new am_wo_routing_line;
  $am_wo_routing_line_object = array();
  array_push($am_wo_routing_line_object, $am_wo_routing_line);
 } else {
  
 }
}

if (empty($$class->wo_type)) {
 $$class->wo_type = 'STANDARD';
}


if (empty($$class->quantity)) {
 $$class->quantity = 1;
}

if (!empty($$class->item_id_m) && !empty($$class->org_id)) {
 $revision_name_a = inv_item_revision::find_by_itemIdM_orgId($$class->item_id_m, $$class->org_id);
}
if (empty($revision_name_a)) {
 $revision_name_a = [];
}


if ($$class->wo_status == 'CLOSED') {
 $readonly = 1;
 $mode = 2;
}
?>
