<style type="text/css">
ul.pagination {
	font-family: "Arial", "Helvetica", sans-serif;
	font-size: 13px;
	height: 100%;
	list-style-type: none;
	margin: 20px 0;
	overflow: hidden;
	padding: 0;
}
ul.pagination li.details {
	background-color: white;
	border-color: #C8D5E0;
	border-image: none;
	border-style: solid;
	border-width: 1px 1px 2px;
	color: #1E598E;
	font-weight: bold;
	padding: 8px 10px;
	text-decoration: none;
}
ul.pagination li.dot {
	padding: 3px 0;
}
ul.pagination li {
	float: left;
	list-style-type: none;
	margin: 0 3px 0 0;
}
ul.pagination li:first-child {
	margin-left: 0;
}
ul.pagination li a {
	color: black;
	display: block;
	padding: 7px 10px;
	text-decoration: none;
}
ul.pagination li a img {
	border: medium none;
}
ul.pagination li a.current {
	background-color: white;
	border-radius: 0 0 0 0;
	color: #333333;
}
ul.pagination li a.current:hover {
	background-color: white;
}
ul.pagination li a:hover {
	background-color: #C8D5E0;
}
ul.pagination li a {
	background-color: #F6F6F6;
	border-color: #C8D5E0;
	border-image: none;
	border-style: solid;
	border-width: 1px 1px 2px;
	color: #1E598E;
	display: block;
	font-weight: bold;
	padding: 8px 10px;
	text-decoration: none;
}
</style>
<table width="100%" border="0">
<?php

$month=array('01'=>'January','02'=>'February','03'=>'March','04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August','09'=>'September','10'=>'October','11'=>'November','12'=>'December');

function pagination($per_page=10, $page, $url = '', $total){    
        
        $adjacents = "1";
		if($page==1)
		{
        $records=$page*10;
		$startrecords=1;
		}
		else
		{
		$records=($page*10);
		$startrecords=(1+$records)-10;
		}
        $page = ($page == 0 ? 1 : $page); 
        $start = ($page - 1) * $per_page;                              
         
        $prev = $page - 1;                         
        $next = $page + 1;
	
         $lastpage = ceil($total/$per_page);
        $lpm1 = $lastpage - 1;
         
        $pagination = "";
        if($lastpage > 1)
        {  
            $pagination .= "<ul class='pagination'>";
                    $pagination .= "<li class='details'>Page $page of $lastpage</li>";
					 $pagination .= "<li class='details'>Showing Records of $startrecords to  $records from  $total</li>";
            if ($lastpage < 7 + ($adjacents * 2))
            {  
                for ($counter = 1; $counter <= $lastpage; $counter++)
                {
                    if ($counter == $page)
                         $pagination.= "<li><a class='current'>$counter</a></li>";
                    else
                         $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                }
            }
            elseif($lastpage > 5 + ($adjacents * 2))
            {
                if($page < 1 + ($adjacents * 2))    
                {
                    for ($counter = 1; $counter < 4 + ($adjacents * 2); $counter++)
                    {
					
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                    $pagination.= "<li class='dot'>...</li>";
                    $pagination.= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
                    $pagination.= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";     
                }
                elseif($lastpage - ($adjacents * 2) > $page && $page > ($adjacents * 2))
                {
                    $pagination.= "<li><a href='{$url}1'>1</a></li>";
                    $pagination.= "<li><a href='{$url}2'>2</a></li>";
                    $pagination.= "<li class='dot'>...</li>";
                    for ($counter = $page - $adjacents; $counter <= $page + $adjacents; $counter++)
                    {
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                    $pagination.= "<li class='dot'>..</li>";
                    $pagination.= "<li><a href='{$url}$lpm1'>$lpm1</a></li>";
                    $pagination.= "<li><a href='{$url}$lastpage'>$lastpage</a></li>";     
                }
                else
                {
                    $pagination.= "<li><a href='{$url}1'>1</a></li>";
                    $pagination.= "<li><a href='{$url}2'>2</a></li>";
                    $pagination.= "<li class='dot'>..</li>";
                    for ($counter = $lastpage - (2 + ($adjacents * 2)); $counter <= $lastpage; $counter++)
                    {
                        if ($counter == $page)
                            $pagination.= "<li><a class='current'>$counter</a></li>";
                        else
                            $pagination.= "<li><a href='{$url}$counter'>$counter</a></li>";                   
                    }
                }
            }
             
            if ($page < $counter - 1){
                $pagination.= "<li><a href='{$url}$next'>Next</a></li>";
               // $pagination.= "<li><a href='{$url}$lastpage'>Last</a></li>";
            }else{
                //$pagination.= "<li><a class='current'>Next</a></li>";
               // $pagination.= "<li><a class='current'>Last</a></li>";
            }
            $pagination.= "</ul>\n";     
        }          
        return $pagination;
    } 	


  
	  if(!isset($_REQUEST['page']))
		{
		$page=10;
		$start=0;
		}
		 else
		 {
		 if($_REQUEST['page']==1)
		 {
	     $page =10;
		 $start =0;
		 }
		 else
		 {
		 $page=25;
	     $start =($_REQUEST['page']*10)-10;
		 }
		 }
		
		
	$GetRecord1 = "Select * from $table  order by id";
   $ResultData1 = DB_query($GetRecord1,$db);
   $total_pages1= DB_num_rows($ResultData1);
	
  
$pagination .= "<div class='pagination'>";
if ($page > 1)
{
if($page<=$total_pages1)
$pagination.= "<a href='".$path."'> Next</a>";

}
?>


<TR><td colspan="4"><?php 
 
 
  $page1=ceil($total_pages1/2);	
if(isset($_GET['page']) && $_GET['page']!=''){
	$page1=$_GET['page'];
}	
else
{
$page1=1;
}
	
echo pagination(10,$page1,'index.php?route=Production/Plant/Production_process_parameter_details&modid='.$_REQUEST['modid'].'&frmid='.$_REQUEST['frmid'].'&page=',$total_pages1); ?></td></TR>
	</table>  

<table width="100%" border="0" cellspacing="2" cellpadding="2">
   <tr class="row1">     
      <td class="tabledata1">Process </td>
	  <td class="tabledata1">Box Required </td>
   
	     
       <td class="tabledata1">EDIT</td>
       <td class="tabledata1">DELETE</td>
   </tr>
   <?php 
   
   $i=1;
   $GetRecord = "Select * from $table  order by id limit ".$start." ,".$page."  ";
   $ResultData = DB_query($GetRecord,$db);
   if(DB_num_rows($ResultData)==0)
   echo "<td>--No Record--</td>";
   
   while($RowData = DB_fetch_array($ResultData))
   {?>
 <tr align="center" bgcolor="#FFFFFF"> 
  <td width="20%"><?php echo $s->getField('Prd_process_master','id',$RowData['processid'],'description');  ?></td>
    <td width="20%"><?php echo $RowData['box_req'];  ?></td>
   
	     
	    
   <td width="20%"><div align="center"><a href="index.php?route=Production/Plant/Production_process_parameter_details&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=Edit&sample_name_id=<?php echo $RowData['id']; ?>"><img src="images/icon-edit.png"  width="10" height="10"/></a></div></td>
	<td width="20%"><div align="center"><a href="index.php?route=Production/Plant/Production_process_parameter_details&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid']?>&action=del&sample_name_id=<?php echo $RowData['id']; ?>" onclick="return confirm('Do You Want To Delete This Record')"><img src="images/Icon_Delete.png" width="10" height="10" /></a></div></td>	
  </tr>
 
	<?php $i++;}     ?> 
  
    
   </table>
 