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

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

?>
<!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  --></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">
    	<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;?>;" 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 id="">
			<!--<tr>
            <td width="50"></td>
            <td width="70" style="text-align:left; vertical-align:middle;">
			<input type="text" size="10" name="pcode" id="pcode" ></td>
			<td width="200" style="text-align:left; vertical-align:middle;"><input type="text" size="40" name="cmpname" id="cmpname"></td>
            <td width="79" style="text-align:center; vertical-align:middle;">
			<input type="text" size="10" name="req_date" id="req_date"></td>
			<td><input type="submit" id="sub_search1" name="sub_search1"  value="Search"></td>
            </tr>-->
			<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="submit" id="sub_search1" name="sub_search1" value="Search" style="background: #333;color: #fff;   padding: 7px; margin: 5px;"></td>
			<td><select size="1" 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($_POST['disp_rec']=='50'){ echo "selected"; }?>>50</option><option value="75" <?php if($_POST['disp_rec']=='75'){ echo "selected"; }?>>75</option><option value="100" <?php if($_POST['disp_rec']=='100'){ echo "selected"; }?>>100</option></select></td>
            </tr>
			</table>
			</div>
			</form>


		</div>
		<div id="get-list-view"></div>
		<div id="load-msg"></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>
			<?php
			$perPage = $disp_r;
			
				
			$sqlQuery = "SELECT party_det_id,sel_date FROM design_sel_det   GROUP BY party_det_id,sel_date ORDER BY design_sel_det_id DESC";
			$result = mysqli_query($connect, $sqlQuery);
			
			/*$SLCT = "SELECT party_det_id,sel_date FROM design_sel_det ".$reqdate_where." GROUP BY party_det_id,sel_date";
			$QURY = mysqli_query($connect,$SLCT);

			
			if(mysqli_num_rows($QURY)>0)
			{
			while($FTCH = mysqli_fetch_object($QURY))
			{
				$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(isset($_POST['pcode'])!=''){
					$pcode_where .=' and party_code="'.$_POST['pcode'].'"';
				} 

				$cmp_where='';
				if(isset($_POST['cmpname'])!=''){
					$cmp_where .=' and cmp_name like "%'.$_POST['cmpname'].'%"';
				}

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

				if($REST_E>0){

				}
				$tn++;
			}

			}
			*/
			
			$totalRecords =  mysqli_num_rows($result);
			$totalPages = ceil($totalRecords/$perPage);
			
			?>
			<tbody id="content_load">
            </tbody>
            </table>
			<div id="pagination" style="float:right;"></div>
		<input type="hidden" id="totalPages" value="<?php echo $totalPages; ?>">
        </div>
        </div>
        <div class="fluid"><!-- Media table --></div>
    </div>
    <!-- Main content ends -->
</div>
<!-- Content ends -->

</body>
</html>
