<?php /*?><?php // Script to create footer links at bottom of search pages

$page_num = 1;
$link_from = 0;
$show=$show;
$show;

if (!isset($table_width)) {
	$table_width = "100%";
}

// ==================================================================================
// Work out the values for the 'Previous' and 'Next' page links
 $link_prev = $_GET[from] - $show;
 $link_next = $_GET[from] + $show;

if ($link_prev >= 0) {
	$previous = "<a class=\"white_content\" href=\"$html_query&from=$link_prev\"><b>Previous</b></a>&nbsp;&nbsp;";
} else {
	$previous = "";
}

if ($link_next < $num_results) { $next = "&nbsp;&nbsp;<a class=\"white_content\" href=\"$html_query&from=$link_next\"><b>Next</b></a>"; }

// ==================================================================================

?>


<title></title>
<?php */?>
<?php function get_customer12($customer_name)
{
	 $sql="select * from  customer_entry where  customer_name='$customer_name' ";
   $rs=mysql_query($sql);
	$s_no=0;
   		while($rsdata=mysql_fetch_array($rs))
  			{
                 $id=$rsdata['id'];
	}
return $id;
}
 ?>
<table border="0" cellpadding="0" cellspacing="0" width="371" height="25"  align="right">
  <tr bordercolor="#FFFFFF">
    <td width="400" height="20" nowrap="nowrap" class="white_content" style="text-align: center;  background-color:#CCCCCC; color:#FFF; border: 1px solid #8e8e8e; "><div align="left"><span class="white_content" style="text-align: center;">
      <?php

$page_num = 1;
$link_from = 0;
$show=$show;
//echo $show;

if (!isset($table_width)) {
	$table_width = "100%";
}


// Work out the values for the 'Previous' and 'Next' page links
 $_GET[from];
  $customer_type=$_GET['customer_type'];
$customer_name=$_GET['customer_name'];
$customer_id=get_customer12($customer_name);
$from_date=$_GET['from_date'];
$to_date=$_GET['to_date'];
$job_card_no=$_GET['job_card_no'];

  $link_prev = $_GET[from] - $show;
  $link_next = $_GET[from] + $show;

if ($link_prev >= 0) {
	$previous = "<a href=\"$html_query&from=$link_prev&job_card_no=$job_card_no\"><b> << Previous</b></a>&nbsp;&nbsp;";
} else {
	$previous = "";
}

if ($link_next < $num_results) { 
 $next = "&nbsp;&nbsp;<a href=\"$html_query&from=$link_next&job_card_no=$job_card_no\"><b>Next >> </b></a>"; }

// ==================================================================================

		while ($link_from < $num_results) {
			
			$link_to = $link_from + $show;
			
			if ($link_to > $num_results) {
				$link_to = $num_results;
				$max_show = $link_to - $link_from;
				$show_query = "$prev_show=$show&max_show=$max_show";
			} else {
				$show_query = "$show=$show";
			}
			
			$link_from_plus_1 = $link_from + 1;
			
			if ($link_from == $_GET[from]) {
				$page[$page_num] = "$page_num ";
				$current_page = $page_num;
			} else {
	 $page[$page_num] = "<a href=\"$html_query&from=$link_from&job_card_no=$job_card_no\"><u>$page_num</u></a> ";
			}
			
			$link_from = $link_from + $show;
			++$page_num;
		}
		
		echo $previous;
		
		for ($back_page = ($current_page - $num_links); $back_page < $current_page; ++$back_page) {
			echo $page[$back_page];
		}
		
		echo $page[$current_page];
		
		for ($fwd_page = ($current_page + 1); $fwd_page <= ($current_page + $num_links); ++$fwd_page) {
			echo $page[$fwd_page];
		}
		
		echo $next;	
		
		?>
    </span></div></td>
  </tr>
</table>
