<?php


if (!empty($$class->service_person_employee_id)) {
 $emp_details = hr_employee::find_by_id($$class->service_person_employee_id);
 $$class->service_person = $emp_details->first_name . ' ' . $emp_details->last_name;
}

if (empty($pm_formula_ingredient_object) && !empty($$class->pm_formula_header_id)) {
 $pm_formula_ingredient_object = pm_formula_ingredient::find_by_parent_id($$class->pm_formula_header_id);
}
if (empty($pm_formula_ingredient_object)) {
 $pm_formula_ingredient_object = array(new pm_formula_ingredient());
}

if (empty($pm_formula_byproduct_object) && !empty($$class->pm_formula_header_id)) {
 $pm_formula_byproduct_object = pm_formula_byproduct::find_by_parent_id($$class->pm_formula_header_id);
}
if (empty($pm_formula_byproduct_object)) {
 $pm_formula_byproduct_object = array(new pm_formula_byproduct());
}


if ((!empty($$class->arproval_status)) && ($$class->arproval_status == 'CANCELLED')) {
 $mode = 2;
 $readonly = 1;
}

$add_to_order_a = [];

// foreach ($pm_formula_line_object as $pm_formula_line) {
//  if(!in_array($pm_formula_line->sd_so_header_id, $add_to_order_a)){
//   $add_to_order_a[$pm_formula_line->sd_so_header_id] = $pm_formula_line->sd_so_header_id;
//  }
// }

$pageno = !empty($_GET['pageno']) ? $_GET['pageno'] : 1;
$per_page = !empty($_GET['per_page']) ? $_GET['per_page'] : 10;
$total_count = count($pm_formula_line_object);
$pagination = new pagination($pageno, $per_page, $total_count);
$pagination->setProperty('_path', 'form');
$position = ($pageno - 1) * $per_page;
?>

