<?php
if (!empty($_GET['inv_count_header_id']) && empty($inv_count_schedule_object)) {
 $inv_count_schedule_object = inv_count_schedule::find_by_parent_id($_GET['inv_count_header_id']);
}

if (empty($inv_count_schedule_object)) {
 $inv_count_schedule_object = [new inv_count_schedule()];
}

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

if (!empty($inv_count_schedule_object)) {
 foreach ($inv_count_schedule_object as &$count_schedule) {
  if (!empty($count_schedule->item_id_m)) {
   $item = item::find_by_item_id_m($count_schedule->item_id_m);
   if ($item) {
    $count_schedule->item_number = $item->item_number;
    $count_schedule->item_description = $item->item_description;
   } else {
    $count_schedule->item_number = null;
    $count_schedule->item_description = null;
   }
  } else {
   $count_schedule->item_number = null;
   $count_schedule->item_description = null;
  }
 }
}


if (!empty($$class->inv_abc_assignment_header_id)) {
 $abc_assigment = inv_abc_assignment_header::find_by_id($$class->inv_abc_assignment_header_id);
 $$class->abc_assignment_name = $abc_assigment->abc_assignment_name;
}
?>
