<?php
	include "db_connection/db_connection.php";
	include "config/config.php";

	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='../index.php';</script>";
	}

	$ot=1;
	if(isset($_GET['ot'])!=''){
		$ot = $_GET['ot'];
	}
	$check_acc  = check_access('36');
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
<title><?php echo $PROJECT_TITLE ?></title>

<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
<script src="plugin/simple-bootstrap-paginator.js"></script>
<script src="js/pagination.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>

<script type="text/javascript" src="js/po_entry_add_JS.js"></script>

<script type="text/javascript" src="js/plugins/forms/ui.spinner.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.mousewheel.js"></script>
 
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>

<script type="text/javascript" src="js/plugins/charts/excanvas.min.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.orderBars.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.pie.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.flot.resize.js"></script>
<script type="text/javascript" src="js/plugins/charts/jquery.sparkline.min.js"></script>

<script type="text/javascript" src="js/plugins/tables/jquery.dataTables.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.sortable.js"></script>
<script type="text/javascript" src="js/plugins/tables/jquery.resizable.js"></script>

<script type="text/javascript" src="js/plugins/forms/autogrowtextarea.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.uniform.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.inputlimiter.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.tagsinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.maskedinput.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.autotab.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.chosen.min.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.dualListBox.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.cleditor.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.ibutton.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine-en.js"></script>
<script type="text/javascript" src="js/plugins/forms/jquery.validationEngine.js"></script>

<script type="text/javascript" src="js/plugins/uploader/plupload.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html4.js"></script>
<script type="text/javascript" src="js/plugins/uploader/plupload.html5.js"></script>
<script type="text/javascript" src="js/plugins/uploader/jquery.plupload.queue.js"></script>

<script type="text/javascript" src="js/plugins/wizards/jquery.form.wizard.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.validate.js"></script>
<script type="text/javascript" src="js/plugins/wizards/jquery.form.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.collapsible.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.breadcrumbs.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.tipsy.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.progress.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.timeentry.min.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.colorpicker.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.jgrowl.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fancybox.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.fileTree.js"></script>
<script type="text/javascript" src="js/plugins/ui/jquery.sourcerer.js"></script>

<script type="text/javascript" src="js/plugins/others/jquery.fullcalendar.js"></script>
<script type="text/javascript" src="js/plugins/others/jquery.elfinder.js"></script>

<script type="text/javascript" src="js/plugins/ui/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="js/files/bootstrap.js"></script>
<script type="text/javascript" src="js/files/functions.js"></script>

<script type="text/javascript" src="js/charts/chart.js"></script>
<script type="text/javascript" src="js/charts/hBar_side.js"></script>

<!-- Shared on MafiaShare.net  --><!-- Shared on MafiaShare.net  -->
<style>
.pagination {
	list-style-type: none;
	padding: 10px 0;
	display: inline-flex;
	justify-content: space-between;
	box-sizing: border-box;
}
.pagination li {
	box-sizing: border-box;
	padding-right: 10px;
}
.pagination li a {
	box-sizing: border-box;
	background-color: #e2e6e6;
	padding: 8px;
	text-decoration: none;
	font-size: 12px;
	font-weight: bold;
	color: #616872;
	border-radius: 4px;
}
.pagination li a:hover {
	background-color: #d4dada;
}
.pagination .next a, .pagination .prev a {
	text-transform: uppercase;
	font-size: 12px;
}
.pagination .currentpage a {
	background-color: #518acb;
	color: #fff;
}
.pagination .currentpage a:hover {
	background-color: #518acb;
}


</style>

</head>

<body onload="document.getElementById('addpage').focus();">

<!-- Top line begins -->
<?php include "header_footer/header.php"; ?>
<!-- Top line ends -->
<!-- Sidebar begins -->
<?php include "menus/left_menu.php"; ?>
<!-- Sidebar ends -->

<!-- Content begins -->
<div id="content">

<?php include "menus/top_menu.php"; ?>
    <!-- Breadcrumbs line -->
    <div class="breadLine">
        <div class="bc">
            <ul id="breadcrumbs" class="breadcrumbs">
                <li><a href="#">Dashboard</a></li>
                <li><a href="javascript:">Clint Request</a></li>
            </ul>
        </div>
	<?php include "menus/top_left_menu.php"; ?>

    </div>
		<?php // print_r($_POST);
		$disp='none';
		if(isset($_POST['sub_search1'])){
			$disp='block';
		}
		$disp_r = '25';
		if(isset($_POST['disp_rec'])!=''){
			$disp_r = $_POST['disp_rec'];
		}
		?>

    <!-- Main content -->
    <div class="wrapper">
	<?php if($check_acc==1){?>
    	<div class="widget">
        <div class="whead"><h6>Client Request List</h6><h6 style="float:right; margin-right:5%;"><?php echo $disp_r;?> Entries</h6><div class="clear"></div>
		<div class="tablePars" style="display:<?php echo $disp;?>; padding:0px;" id="disp_search">
		<div style="float: left; margin-top: 10px;">
		<form name="cli_form" id="cli_form" action="cli_ord_req_list.php" method="post">

		<table class="table" style="font-size:12px; color:#909090" id="myTable">
            <thead>
            <tr>
            <td style="text-align:center; vertical-align:middle; width:5%;">&nbsp;</td>
            <td  style="text-align:left; vertical-align:middle;width:5%; padding:0px; "><input type="text"  name="pcode" id="pcode" value="<?php echo @$_POST['pcode'];?>" placeholder="Party Code" size="8" ></td>
			<td style="text-align:left; vertical-align:middle;width:15%; padding:0px;"><input type="text" size="22" name="cmpname" id="cmpname" value="<?php echo @$_POST['cmpname'];?>" placeholder="Company Name"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;"><input type="text" size="8" name="req_date" id="req_date" value="<?php echo @$_POST['req_date'];?>" placeholder="dd-mm-yy"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;" placeholder><input type="text" size="8" name="req_designs" id="req_designs" 
			value="<?php echo @$_POST['req_designs'];?>" placeholder="Req Designs"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;"><input type="text" size="8" name="req_dies" id="req_dies" value="<?php echo @$_POST['req_dies'];?>" placeholder="Req Dies"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;"><input type="text" size="8" name="ord_designs" id="ord_designs" value="<?php echo @$_POST['ord_designs'];?>" placeholder="Ord Designs"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;"><input type="text" size="8" name="ord_dies" id="ord_dies" value="<?php echo @$_POST['ord_dies'];?>" placeholder="Ord Dies"></td>
            <td style="text-align:left; vertical-align:middle;width:5%; padding:0px;"><input type="button" id="sub_search1" name="sub_search1" value="Search" style="background: #333;color: #fff;   padding: 7px; margin: 5px;" onclick="search_list();"></td>
            <td style="text-align:center; vertical-align:middle;"><select style="opacity:none;" name="disp_rec" id="disp_rec" onchange="$('#cli_form').submit();" aria-controls="dynamic" style="opacity: 0;"><option value="25" <?php if(isset($_POST['disp_rec'])=='25'){ echo "selected"; }?>>25</option><option value="50" <?php if(isset($_POST['disp_rec'])=='50'){ echo "selected"; }?>>50</option><option value="75" <?php if(isset($_POST['disp_rec'])=='75'){ echo "selected"; }?>>75</option><option value="100" <?php if(isset($_POST['disp_rec'])=='100'){ echo "selected"; }?>>100</option></select></td>
            </tr>
			</table>
		<!--<table id="">
			<tr>
            <td style="width:4%;">&nbsp;</td>
            <td style="width:10%"><input type="text" size="12" name="pcode" id="pcode" value="<?php echo @$_POST['pcode'];?>" placeholder="Party Code" ></td>
			<td style="width:20%"><input type="text" size="35" name="cmpname" id="cmpname" value="<?php echo @$_POST['cmpname'];?>" placeholder="Company Name"></td>
            <td style="width:10%"><input type="text" size="10" name="req_date" id="req_date" value="<?php echo @$_POST['req_date'];?>" placeholder="dd-mm-yy"></td>
            <td style="width:10%"><input type="text" size="10" name="req_designs" id="req_designs" 
			value="<?php echo @$_POST['req_designs'];?>" placeholder="Req Designs"></td>
            <td style="width:10%"><input type="text" size="10" name="req_dies" id="req_dies" value="<?php echo @$_POST['req_dies'];?>" placeholder="Req Dies"></td>
            <td style="width:10%"><input type="text" size="10" name="ord_designs" id="ord_designs" value="<?php echo @$_POST['ord_designs'];?>" placeholder="Ord Designs"></td>
            <td style="width:10%"><input type="text" size="10" name="ord_dies" id="ord_dies" value="<?php echo @$_POST['ord_dies'];?>" placeholder="Ord Dies"></td>
            <td width="79"><input type="button" id="sub_search1" name="sub_search1" value="Search" style="background: #333;color: #fff;   padding: 7px; margin: 5px;" onclick="search_list();"></td>
			<td><select style="opacity:none;" name="disp_rec" id="disp_rec" onchange="$('#cli_form').submit();" aria-controls="dynamic" style="opacity: 0;"><option value="25" <?php if(isset($_POST['disp_rec'])=='25'){ echo "selected"; }?>>25</option><option value="50" <?php if(isset($_POST['disp_rec'])=='50'){ echo "selected"; }?>>50</option><option value="75" <?php if(isset($_POST['disp_rec'])=='75'){ echo "selected"; }?>>75</option><option value="100" <?php if(isset($_POST['disp_rec'])=='100'){ echo "selected"; }?>>100</option></select></td>
            </tr>
			</table>-->
			</div>
			</form>
		</div>
        <div id="dyn" class="hiddenpars">
        	<a href="javascript:0" id="searchlink" onfocus="foc(this.id)" onblur="stnon(this.id)" class="tOptions" title="Options" onclick="$('#disp_search').slideToggle();"><img src="images/icons/options.png" alt="" /></a>
            <table class="table table-hover table-bordered" style="font-size:12px; color:#909090" id="myTable">
            <thead>
            <tr style="background-color:#eee;">
            <th width="26" style="text-align:center; vertical-align:middle;">S.No</th>
            <th width="70" style="text-align:left; vertical-align:middle;">Party Code</th>
            <?php //if($admin_flagg==1){ ?>
			<th width="200" style="text-align:left; vertical-align:middle;">Comp Name</th>
            <?php //} ?>
            <th width="79" style="text-align:center; vertical-align:middle;">Request Date</th>
            <th width="80" style="text-align:center; vertical-align:middle;" placeholder>No of Req Designs</th>
            <th width="80" style="text-align:center; vertical-align:middle;">No of Req Dies</th>
            <th width="78" style="text-align:center; vertical-align:middle;">No of Ord Designs</th>
            <th width="78" style="text-align:center; vertical-align:middle;">No of Ord Dies</th>
            <th width="79" style="text-align:center; vertical-align:middle;">Cancel</th>
            <th width="79" style="text-align:center; vertical-align:middle;">View</th>
			 <!--<th width="61">Status</th>-->
            </tr>
            </thead>
			<tbody id="content_load">
			<?php 
			$startrec = 1;

			$no_rec=$disp_r;

			if(isset($_GET['page'])!=''){
				$page=$_GET['page'];
			} else {
				$page=1;
			}
			$limX = ($page-1) * $no_rec;
			$paginationHtml = '';
			$page_id= base64_encode(base64_encode(base64_encode(2))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for active inactive
			$bck_flg = base64_encode(base64_encode(base64_encode(1)));
			$flg1 = base64_encode(base64_encode(base64_encode(1)));

			$SLCT = "SELECT * FROM design_sel_det GROUP BY party_det_id,sel_date ORDER BY design_sel_det_id DESC LIMIT ".$limX.",".$no_rec."";
			$QURY = mysqli_query($connect,$SLCT);

			if($limX==0){
				$loop=1;
				$st_loop=1;
			} else {
				$loop=$limX;
				$st_loop=$limX;
			}
			$tc=0;
			if(mysqli_num_rows($QURY)>0)
			{
			while($FTCH = mysqli_fetch_object($QURY))
			{
				$pa_id	=	base64_encode(base64_encode(base64_encode($FTCH->party_det_id)));
				$sel_date = base64_encode(base64_encode(base64_encode($FTCH->sel_date)));
				$SLCT_dd = "SELECT COUNT(design_sel_det_id) AS sel_cnt,IFNULL(SUM(master_pieces),0) AS mas_pic FROM design_sel_det,design_det WHERE  party_det_id = '$FTCH->party_det_id' and `sel_date` ='$FTCH->sel_date' AND design_det.design_det_id = design_sel_det.design_det_id GROUP BY sel_date";
				$QURY_dd = mysqli_query($connect,$SLCT_dd);
				$FTCH_dd = mysqli_fetch_object($QURY_dd);

				/*$pcode_where='';
				if($pcode!=''){
					$pcode_where .=' and party_code="'.$pcode.'"';
				}

				$cmp_where='';
				if($pcode!=''){
					$cmp_where .=' and cmp_name like "%'.$cmpname.'%"';
				}*/


//$SLCT_E = "SELECT cmp_name,party_code FROM party_det WHERE party_det_id = '$FTCH->party_det_id' ".$pcode_where." ".$cmp_where." "; 
				$SLCT_E = "SELECT cmp_name,party_code FROM party_det WHERE party_det_id = '$FTCH->party_det_id' "; 
				$QURY_E = mysqli_query($connect,$SLCT_E);
				$FTCH_E = mysqli_fetch_object($QURY_E);
				$REST_E = mysqli_num_rows($QURY_E);

				$SLCT_Ec = "SELECT COUNT(design_sel_det_id) AS des_cnt,IFNULL(SUM(master_pieces),0) AS mas_pic FROM design_sel_det,design_det WHERE party_det_id = '$FTCH->party_det_id' AND design_det.design_det_id = design_sel_det.design_det_id AND ord_status = 'yes' and `sel_date` ='$FTCH->sel_date'";

				$QURY_Ec = mysqli_query($connect,$SLCT_Ec);
				$FTCH_Ec = mysqli_fetch_object($QURY_Ec);

				$SLCTre = "SELECT party_det_id,sel_date FROM design_sel_det WHERE party_det_id = '$FTCH->party_det_id' GROUP BY STR_TO_DATE(sel_date,'%d-%m-%Y') ORDER BY design_sel_det_id DESC";
				$QURYre = mysqli_query($connect,$SLCTre);
				$nu_rows = 0;
				$rowsre = mysqli_num_rows($QURYre);

				if($rowsre>0){
				while($FTCHre = mysqli_fetch_object($QURYre))
				{
					$SLCTre_sub = "SELECT * FROM design_sel_det WHERE party_det_id = '$FTCHre->party_det_id' and sel_date = '$FTCHre->sel_date' and ord_status='no'";
					//echo $SLCTre;
					$QURYre_sub = mysqli_query($connect,$SLCTre_sub);
					if(mysqli_num_rows($QURYre_sub)>0)
					{
						$nu_rows++;
					}
				}
				}

				$SLCT_DES = "SELECT COUNT(des_sel_cancel_id) AS canc_cnt FROM des_sel_cancel WHERE party_det_id = '$FTCH->party_det_id' AND sel_date = '$FTCH->sel_date'";
				$QURY_DES = mysqli_query($connect,$SLCT_DES);
				$FTCH_DES = mysqli_fetch_object($QURY_DES);
				if($loop%2 != "0")
					$bg = "#f2f2f2";
				else
					$bg = "#fff";

			if($REST_E>0){
			$paginationHtml.='<tr style="background-color:'.$bg.'">';
			$paginationHtml.='<td align="center" style="vertical-align:middle;">'.$st_loop.'</td>';
			$paginationHtml.='<td align="center" style="vertical-align:middle;">'.$FTCH_E->party_code.'</td>';
			if($admin_flagg==1){
				$paginationHtml.='<td>';
				$name_count = strlen($FTCH_E->cmp_name);
				$name='';
				if($name_count>25){
					$name = substr($FTCH_E->cmp_name,0,25)."...";
				} else {
					$name = $FTCH_E->cmp_name;
				}

				if($name_count>25){
					$paginationHtml.='<div class="tooltip1">'.$name.'
				<span class="tooltiptext1">'.$FTCH_E->cmp_name.'</span>
			</div>';
				} else {
					$paginationHtml.= $name;
				}

				$paginationHtml.='</td>';
			}

		$paginationHtml.='<td align="center" style="vertical-align:middle; text-align:center;">'.str_replace("-","/",$FTCH->sel_date).'</td>';

		$paginationHtml.='<td align="center" style="vertical-align:middle; text-align:center;">'.$FTCH_dd->sel_cnt;

		if($FTCH_DES->canc_cnt > 0){ 
			$paginationHtml.='<a id="viewlink1'.$loop.'" onfocus="foc(this.id)" onblur="stnon(this.id)" href="clien_cancel_view.php?po_id='.$pa_id.'&sel_date='.$sel_date.'" class="an_own">'.$FTCH_DES->canc_cnt.'</a>';
		}
		$paginationHtml.='</td>
			<td class="center" style="vertical-align:middle; text-align:center;">'.$FTCH_dd->mas_pic.'</td>
            <td class="center" style="vertical-align:middle; text-align:center;">';

			if($FTCH_Ec->des_cnt > 0){ 

			$paginationHtml.='<a id="viewlink2'.$loop.'" onfocus="foc(this.id)" onblur="stnon(this.id)" href="cli_ord_req_po_view.php?pa_id='.$pa_id.'&sel_date='.$sel_date.'" style="text-decoration:underline">'.$FTCH_Ec->des_cnt.'</a>';
			} else {
				$paginationHtml.= $FTCH_Ec->des_cnt; 
				}
			$paginationHtml.='</td>
			<td class="center" style="vertical-align:middle; text-align:center;">'.$FTCH_Ec->mas_pic.'</td>
			<td class="center" style="vertical-align:middle; text-align:center;">';

			if($FTCH_Ec->des_cnt != $FTCH_dd->sel_cnt){ 
				$paginationHtml.='<a href="cli_ord_req_cancel.php?pa_id='.$pa_id.'&sel_date='.$sel_date.'&bck_flg='.$bck_flg.'&flg='.$flg1.'" class="an_own" id="viewlink3'.$loop.'" onfocus="foc(this.id)" onblur="stnon(this.id)">Cancel</a>';
			}else{
				$paginationHtml.='-----';
			}
			$paginationHtml.='</td>
            <td class="center" align="center" style="vertical-align:middle;">';
			if($FTCH_Ec->des_cnt != $FTCH_dd->sel_cnt){ 
			if($nu_rows > 1){ 
				$paginationHtml.='<a id="viewlink4'.$loop.'" onfocus="foc(this.id)" onblur="stnon(this.id)" href="cli_ord_req_sub_view.php?pa_id='.$pa_id.'" class="an_own">View/Approve</a>';
			}else{
				$paginationHtml.='<a id="viewlink5'.$loop.'" onfocus="foc(this.id)" onblur="stnon(this.id)" href="cli_ord_req_view.php?pa_id='.$pa_id.'&sel_date='.$sel_date.'&bck_flg='.$bck_flg.'&flg='.$flg1.'" class="an_own">View/Approve</a>';
			}
			} else {
				$paginationHtml.='Approved';
			}
			$paginationHtml.='</td>
			</tr>';
			$loop++;
			$st_loop++;
			}

			 }

			 }
			echo $paginationHtml;

			 // To find pagination 

			$SLCT_page = "SELECT * FROM design_sel_det GROUP BY party_det_id,sel_date ORDER BY design_sel_det_id DESC";
			$QURY_page = mysqli_query($connect,$SLCT_page);
			$total_pages= mysqli_num_rows($QURY_page);
			$num_results_on_page = '25';//$disp_r;

			$page = isset($_GET['page']) && is_numeric($_GET['page']) ? $_GET['page'] : 1;

			?>
            </tbody>
            </table>
			<?php if (ceil($total_pages / $num_results_on_page) > 0): ?>
			<span id="paging">
			<ul class="pagination" style="float:right;">
				<?php if ($page > 1): ?>
				<li class="prev"><a href="cli_ord_req_list.php?page=<?php echo $page-1 ?>">Prev</a></li>
				<?php endif; ?>

				<?php if ($page > 3): ?>
				<li class="start"><a href="cli_ord_req_list.php?page=1">1</a></li>
				<li class="dots">...</li>
				<?php endif; ?>

				<?php if ($page-2 > 0): ?><li class="page"><a href="cli_ord_req_list.php?page=<?php echo $page-2 ?>"><?php echo $page-2 ?></a></li><?php endif; ?>
				<?php if ($page-1 > 0): ?><li class="page"><a href="cli_ord_req_list.php?page=<?php echo $page-1 ?>"><?php echo $page-1 ?></a></li><?php endif; ?>

				<li class="currentpage"><a href="cli_ord_req_list.php?page=<?php echo $page ?>"><?php echo $page ?></a></li>

				<?php if ($page+1 < ceil($total_pages / $num_results_on_page)+1): ?><li class="page"><a href="cli_ord_req_list.php?page=<?php echo $page+1 ?>"><?php echo $page+1 ?></a></li><?php endif; ?>
				<?php if ($page+2 < ceil($total_pages / $num_results_on_page)+1): ?><li class="page"><a href="cli_ord_req_list.php?page=<?php echo $page+2 ?>"><?php echo $page+2 ?></a></li><?php endif; ?>

				<?php if ($page < ceil($total_pages / $num_results_on_page)-2): ?>
				<li class="dots">...</li>
				<li class="end"><a href="cli_ord_req_list.php?page=<?php echo ceil($total_pages / $num_results_on_page) ?>"><?php echo ceil($total_pages / $num_results_on_page) ?></a></li>
				<?php endif; ?>

				<?php if ($page < ceil($total_pages / $num_results_on_page)): ?>
				<li class="next"><a href="cli_ord_req_list.php?page=<?php echo $page+1 ?>">Next</a></li>
				<?php endif; ?>
			</ul>
			</span>
<?php endif; ?>

        </div>
        </div>
        <div class="fluid"><!-- Media table --></div>
		<?php } else {  echo ACCESS_MSG;} ?>
    </div>
    <!-- Main content ends -->
</div>
<!-- Content ends -->
<script>
function search_list(){
	var page='2';
	var pcode = $('#pcode').val();
	var cmpname = $('#cmpname').val();
	var req_date = $('#req_date').val();
	var req_designs = $('#req_designs').val();
	var req_dies = $('#req_dies').val();
	var ord_designs = $('#ord_designs').val();
	var ord_dies = $('#ord_dies').val();
	var per_rec=$('#disp_r').val();
	
	$("#content_load").html('<tr><td colspan="6"><strong><img src="images/loading.gif" width="50" height="50"></strong></td></tr>');
	$('#paging').html('');
	 $.ajax({
		url:"ajax/load_data1.php",
		method:"POST",
		dataType: "text",
		data:{page:	page,pcode:pcode,cmpname:cmpname,req_date:req_date,req_designs:req_designs,req_dies:req_dies,ord_designs:ord_designs,ord_dies:ord_dies,per_rec:per_rec},

		success:function(responseData){
			var responseData = responseData.split('***');
			$('#content_load').html(responseData['0']);
			$('#paging').html(responseData['1']);
		}
	});
}
</script>
</body>
</html>
