<?php
  require_once('includes/load.php');
  // Checkin What level user has permission to view this page
  page_require_level(1);
?>
<?php
  $categorie = find_by_id_new('stagedetails',(int)$_GET['StageId'],'StageId');
  if(!$categorie){
    $session->msg("d","Missing Stage id.");
    redirect('Stage.php');
  }
  
  //$stockcheck = find_by_column("stockdetails",(int)$_GET['UnitId'],"UnitId");

  //if(isset($stockcheck['UnitId'])) {
   // $session->msg("d","Unable to detele!... A dependend entry is existing in the database ");
   // redirect('units.php');
  //}
  
?>
<?php
  $delete_id = delete_by_id_new('stagedetails',(int)$categorie['StageId'],'StageId');
  if($delete_id){
      $session->msg("s","Stage deleted.");
      redirect('Stage.php');
  } else {
      $session->msg("d","Stage deletion failed.");
      redirect('Stage.php');
  }
?>
