<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
	else // THIS IS FOR GETTING PARTY DET ID ROM LOAGIN DET AND PARTY DET TABLE
	{
		$admin_id = $_SESSION['admin_login_id'];
		$SLCT_log = "SELECT * FROM login_details,ac_party_det WHERE ac_party_det.party_det_id = login_details.party_det_id AND login_details.admin_id = '$admin_id'";
		$QURY_log = mysqli_query($connect,$SLCT_log);
		$FTCH_log = mysqli_fetch_object($QURY_log);
		$party_id = '$FTCH_log->party_det_id';
	}
?>
<!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>
		<script type="text/javascript" src="js/ftr_analize_JS.js"></script>
		<link href="css/styles.css" rel="stylesheet" type="text/css" />
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.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="tot_count()">
		<!-- 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:">FTR Analyze</a></li>
		                    
		            </ul>
		        </div>
				<?php include "menus/top_left_menu.php"; ?>    
    		</div>
    		<!-- Main content -->
    		<div class="wrapper">    
			<?php
			   	$flag = 0;
			   	$sta_iden = '0';
			   	// THIS IS FOR CHECKING THE STAGE NAME
				if(isset($_GET['fdate']) && $_GET['fdate']!='' ){ $fdate = $_GET['fdate'];	}else{ $fdate = ''; }
				if(isset($_GET['todate']) && $_GET['todate']!='' ){ $todate = $_GET['todate'];	}else{ $todate = ''; }				
				if(isset($_GET['yea_r']) && $_GET['yea_r']!='' ){ $yea_r = 'checked="checked"'; $y_r = $_GET['yea_r'];}else{ $yea_r = ''; $y_r = '';}
				if(isset($_GET['mont_h']) && $_GET['mont_h']!='' ){ $mont_h = 'checked="checked"'; $m_h = $_GET['mont_h'];}else{ $mont_h = ''; $m_h = ''; }
				if(isset($_GET['da_y']) && $_GET['da_y']!='' ){ $da_y = 'checked="checked"'; $d_y = $_GET['da_y'];}else{ $da_y = ''; $d_y = ''; }				
				
				if(isset($_GET['emp_id']) && $_GET['emp_id']!='')
				{
					$emp_id = $_GET['emp_id'];
					$pg_flg = $_GET['pg_flg'];
					$emp_enc_id = base64_decode(base64_decode(base64_decode(base64_decode($emp_id)))); 
					$pg_flag = base64_decode(base64_decode(base64_decode(base64_decode($pg_flg)))); 
					
					$SLCT_MAS = "SELECT name FROM emp_det WHERE emp_det_id='$emp_enc_id'";
					$QURY_MAS = mysqli_query($connect,$SLCT_MAS);
					$FTCH_MAS = mysqli_fetch_object($QURY_MAS);					
					$emp_nm =  $FTCH_MAS->name;
				}
				else
				{
					$emp_id = '';
					$pg_flg = '';
					$emp_enc_id = ''; 
					$pg_flag = ''; 
					$emp_nm =  '';
				}
				if(isset($_GET['rmrk_id']) && $_GET['rmrk_id']!='')
				{
					$rmrk_id = $_GET['rmrk_id'];
					$rmrk_enc_id = base64_decode(base64_decode(base64_decode(base64_decode($rmrk_id)))); 
					
					$SLCT_MAS1 = "SELECT description FROM master_cad_remarks WHERE master_cad_remarks_id='$rmrk_enc_id'";
					$QURY_MAS1 = mysqli_query($connect,$SLCT_MAS1);
					$FTCH_MAS1 = mysqli_fetch_object($QURY_MAS1);					
					$rmrk_nm =  " - ".$FTCH_MAS1->description;
				}
				else
				{
					$rmrk_id = '';
					$rmrk_enc_id = '';
					$rmrk_nm =  '';
				}
			?>    
	        	<ul class="middleNavR">
		            <li><a href="ftr_analize.php?fdate=<?php echo $fdate; ?>&todate=<?php echo $todate; ?>&yea_r=<?php echo $y_r; ?>&mont_h=<?php echo $m_h; ?>&da_y=<?php echo $d_y; ?>" title="Analyze List" id="listpage" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
		        </ul>           
	    		<form id="acc_dat" name="acc_dat" class="main" method="post" action="acc_report.php" target="_blank">		
	            	<fieldset>
	    				<div class="widget">
	    					<div class="formRow" >
								<table width="100%">
									<tr>
										<td width="20%" style="display:table-cell; vertical-align:middle;"><b>Employee Name:</b></td>
										<td width="80%"><b><?php echo $emp_nm.$rmrk_nm; ?></b></td>
								        
						  			</tr>
								</table>
								<div class="clear"></div>
							</div>
            				<div class="formRow" >	            				
								<table width="100%">
									<tr>
										<td width="9%" style="display:table-cell; vertical-align:middle;">From Date:</td>
										<td width="22%"><div class="grid6"><input type="text" name="fdate" id="fdate" value="<?php echo $fdate ?>" class="datepicker" disabled="" /></div></td>
								        <td width="9%" style="display:table-cell; vertical-align:middle;">To Date:</td>
								        <td width="23%"><div class="grid6"><input type="text" name="todate" id="todate" value="<?php echo $todate ?>" class="datepicker" disabled="" /></div></td>
								        <td width="10%" style="display:table-cell; vertical-align:middle;">Filter:</td>
								        <td width="8%"><input id="yea_r"  name="filter" type="checkbox" value="y" <?php echo $yea_r ?> disabled=""/> <label for="yea_r">Year</label></td>
								        <td width="8%"><input id="mont_h" name="filter2" type="checkbox" value="m" <?php echo $mont_h ?> disabled="" /> <label for="mont_h">Month</label></td>
								        <td width="11%"><input id="da_y" name="filter3" type="checkbox" value="d" <?php echo $da_y ?> disabled="" /> <label for="da_y">Day</label></td>
						  			</tr>
								</table>
								<div class="clear"></div>
							</div>					
                        	<div class="clear"></div>
                    	</div> 
                    	<?php if(isset($_GET['fdate']) && $_GET['fdate']!='' || isset($_GET['todate']) && $_GET['todate']!=''){ ?>	
	                    	<input type="hidden" value="<?php echo $_GET['fdate']; ?>" name="std" id="std" />
							<input type="hidden" value="<?php echo $_GET['todate']; ?>" name="edd" id="edd" />
							<input type="hidden" value="<?php echo $_GET['yea_r']; ?>" name="yr" id="yr" />
							<input type="hidden" value="<?php echo $_GET['mont_h']; ?>" name="mnt" id="mnt" />
							<input type="hidden" value="<?php echo $_GET['da_y']; ?>" name="dty" id="dty" />
							<input type="hidden" value="<?php echo $_GET['todate']; ?>" name="edd" id="edd" />
							<input type="hidden" value="" name="par_id" id="par_id" />
							<?php
								$ftr_date = "ECD.closed_dt"; 
								$rew_date = "ECDR.rework_dt";
								$dat_str = ''; //THIS IS FOR QUERY STRING	
								$dat_str_rwrk = '';						
								if($fdate!='' && $todate!='')
								{
									$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') BETWEEN STR_TO_DATE('$fdate','%d/%m/%Y') AND STR_TO_DATE('$todate','%d/%m/%Y')"; 
									$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') BETWEEN STR_TO_DATE('$fdate','%d/%m/%Y') AND STR_TO_DATE('$todate','%d/%m/%Y')"; 
									$flgg=1;				
								}
								else if($fdate=='' && $todate!='')
								{
									if($yea_r!='' && $mont_h!='' && $da_y!='')
									{ 
										$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$flgg = 1;				
									}									
									else if($yea_r!='' && $mont_h!='' && $da_y=='')
									{
										$vl = explode("/",$todate);
										$todat_vl = $vl[2]."-".$vl[1]."-".$vl[0];
									 	$dat_str = " AND DATE_FORMAT(STR_TO_DATE(".$ftr_date.",'%d-%m-%Y'),'%m-%Y') = DATE_FORMAT(STR_TO_DATE('$todate','%d/%m/%Y'),'%m-%Y')";  
										$dat_str_rwrk = " AND DATE_FORMAT(STR_TO_DATE(".$rew_date.",'%d-%m-%Y'),'%m-%Y') = DATE_FORMAT(STR_TO_DATE('$todate','%d/%m/%Y'),'%m-%Y')";  
										$flgg = 1;					
									}									
									else if($yea_r!='' && $mont_h=='' && $da_y=='')
									{ 
										$vl = explode("/",$todate);
										$todat_vl = ($vl[2]-1)."-12-31";
										$dat_str = " AND YEAR(STR_TO_DATE(".$ftr_date.",'%d-%m-%Y')) = YEAR(STR_TO_DATE('$todate','%d/%m/%Y'))"; 				
										$dat_str_rwrk = " AND YEAR(STR_TO_DATE(".$rew_date.",'%d-%m-%Y')) = YEAR(STR_TO_DATE('$todate','%d/%m/%Y'))"; 				
										$flgg = 1;
									}									
									else if($yea_r=='' && $mont_h=='' && $da_y=='')
									{ 
										$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') <= STR_TO_DATE('$todate','%d/%m/%Y')"; 				
										$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') <= STR_TO_DATE('$todate','%d/%m/%Y')"; 				
										$flgg = 0;
									}									
									else if($yea_r=='' && $mont_h!='' && $da_y=='')
									{ 
										$vl = explode("/",$todate);
										$todat_vl = $vl[2]."-".$vl[1]."-".$vl[0];
										$dat_str = " AND DATE_FORMAT(STR_TO_DATE(".$ftr_date.",'%d-%m-%Y'),'%m-%Y') = DATE_FORMAT(STR_TO_DATE('$todate','%d/%m/%Y'),'%m-%Y')";  
										$dat_str_rwrk = " AND DATE_FORMAT(STR_TO_DATE(".$rew_date.",'%d-%m-%Y'),'%m-%Y') = DATE_FORMAT(STR_TO_DATE('$todate','%d/%m/%Y'),'%m-%Y')";  
										$flgg = 1;
									}									
									else if($yea_r=='' && $mont_h=='' && $da_y!='')
									{ 
										$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$flgg = 1;
									}									
									else if($yea_r!='' && $mont_h=='' && $da_y!='')
									{ 
										$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 
										$flgg = 1;
									}									
									else if($yea_r=='' && $mont_h!='' && $da_y!='')
									{ 
										$dat_str = " AND STR_TO_DATE(".$ftr_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 				
										$dat_str_rwrk = " AND STR_TO_DATE(".$rew_date.",'%d-%m-%Y') = STR_TO_DATE('$todate','%d/%m/%Y')"; 				
										$flgg = 1;
									}
								}
								$tot_des = 0;
								if($pg_flag==1)
								{										
							?>
			    					<div class="widget" style="display: block">
			        					<div class="whead">
			        						<h6>FTR Report</h6>
			        						<ul class="titleToolbar">
									            <li><h6 style=" margin-right:0px; text-align:center;">&nbsp;&nbsp;&nbsp;Total Design Qty<input class="dataNumGrey" type="text" id="tot_des" name="tot_des" value="" readonly="readonly" disabled="disabled" style="width:90px; font-size:12px; text-align:right; padding-right: 5px; margin: 0;" /></h6></li>
							            		<li><h6 style=" margin-right:42px; text-align:center;"><a href="ftr_analize_print.php?emp_id=<?php echo $emp_id; ?>&flg=<?php echo base64_encode(base64_encode(base64_encode(base64_encode('2')))); ?>&fdate=<?php echo $fdate; ?>&todate=<?php echo $todate; ?>&yea_r=<?php echo $y_r; ?>&mont_h=<?php echo $m_h; ?>&da_y=<?php echo $d_y; ?>" target="_blank">Print</a></h6></li>
									        </ul>
			        						<div class="clear"></div>
										</div>
			        					<div id="dyn" class="hiddenpars">
			        						<a href="javascript:0" id="searchlink" onfocus="foc(this.id)" onblur="stnon(this.id)" class="tOptions" title="Options"><img src="images/icons/options.png" alt="" /></a>
			            					<table width="677" border="0" cellpadding="0" cellspacing="0" class="dTable" id="dynamic">
			            						<thead>
			            							<tr>
														<th width="10%" style="display:table-cell;vertical-align:middle">S.No<span class="sorting" style="display: block;"></span></th>
														<th width="30%" style="display:table-cell;vertical-align:middle">Design No</th>
														<th width="30%" style="display:table-cell;vertical-align:middle">Point</th>
														<th width="30%" style="display:table-cell;vertical-align:middle">Design Time</th>
													</tr>
			            						</thead>
			            						<tbody>  
			            							<?php
			            								$loop=1;
			            								$SLCT_FTR = "SELECT ECD.design_det_id, DD.design_no, MC.master_cat_name, MCC.cad_points, ECD.emp_current_design_id
			            											FROM emp_current_design ECD, design_det DD, master_cat MC, master_cad_cat MCC 
			            											WHERE DD.design_det_id=ECD.design_det_id AND MC.master_cat_id=DD.master_cat_id 
			            											AND MCC.master_cad_cat_id = DD.master_cad_cat_id
			            											AND FIND_IN_SET(ECD.curr_status,'closed,cancelled,stopped') 
			            											AND ECD.emp_det_id='".$emp_enc_id."' AND ECD.design_det_id 
			            											NOT IN( SELECT ECDR.design_det_id FROM emp_current_design_rework ECDR WHERE ECDR.re_emp_det_id='".$emp_enc_id."' ".$dat_str_rwrk." ) ".$dat_str." 
			            											GROUP BY ECD.design_det_id ORDER BY ECD.design_det_id ASC";
														$QURY_FTR = mysqli_query($connect,$SLCT_FTR);
			            								if(mysqli_num_rows($QURY_FTR)>0)
			            								{
			            									while($FTCH_FTR = mysqli_fetch_object($QURY_FTR))
			            									{
			            										$SLCT_FTR1 = "SELECT tot_time FROM emp_current_design_det ECDD WHERE ECDD.emp_current_design_id='".$FTCH_FTR->emp_current_design_id."' ORDER BY ECDD.emp_current_design_det_id DESC";
																$QURY_FTR1 = mysqli_query($connect,$SLCT_FTR1);
																$FTCH_FTR1 = mysqli_fetch_object($QURY_FTR1);
			            							?>
						            							<tr>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $loop; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR->master_cat_name." - ".$FTCH_FTR->design_no; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR->cad_points; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR1->tot_time; ?></td>
																</tr>	    
													<?php
																$tot_des = $tot_des+1;
																$loop++;
															}
														}
													?> 
			            						</tbody>    
			            					</table> 
			        					</div>
			        				</div>
	        			<?php 
	        					}
	        					else if($pg_flag==2)
	        					{
	        			?>
	        						<div class="widget" style="display: block">
			        					<div class="whead">
			        						<h6>FTR Report</h6>
			        						<ul class="titleToolbar">
									            <li><h6 style=" margin-right:0px; text-align:center;">&nbsp;&nbsp;&nbsp;Total Design Qty<input class="dataNumGrey" type="text" id="tot_des" name="tot_des" value="" readonly="readonly" disabled="disabled" style="width:90px; font-size:12px; text-align:right; padding-right: 5px; margin: 0;" /></h6></li>
							            		<li><h6 style=" margin-right:42px; text-align:center;"><a href="ftr_analize_print.php?emp_id=<?php echo $emp_id; ?>&rmrk_id=<?php echo $rmrk_id; ?>&flg=<?php echo base64_encode(base64_encode(base64_encode(base64_encode('3')))); ?>&fdate=<?php echo $fdate; ?>&todate=<?php echo $todate; ?>&yea_r=<?php echo $y_r; ?>&mont_h=<?php echo $m_h; ?>&da_y=<?php echo $d_y; ?>" target="_blank">Print</a></h6></li>
									        </ul>
			        						<div class="clear"></div>
										</div>
			        					<div id="dyn" class="hiddenpars">
			        						<a href="javascript:0" id="searchlink" onfocus="foc(this.id)" onblur="stnon(this.id)" class="tOptions" title="Options"><img src="images/icons/options.png" alt="" /></a>
			            					<table width="677" border="0" cellpadding="0" cellspacing="0" class="dTable" id="dynamic">
			            						<thead>
			            							<tr>
														<th width="10%" style="display:table-cell;vertical-align:middle">S.No<span class="sorting" style="display: block;"></span></th>
														<th width="20%" style="display:table-cell;vertical-align:middle">Design No</th>
														<th width="20%" style="display:table-cell;vertical-align:middle">Point</th>
														<th width="20%" style="display:table-cell;vertical-align:middle">Design Time</th>
														<th width="30%" style="display:table-cell;vertical-align:middle">Commands</th>
													</tr>
			            						</thead>
			            						<tbody>  
			            							<?php
			            								$loop=1;			            								
		            									$SLCT_FTR = "SELECT ECDR.design_det_id, DD.design_no, MC.master_cat_name, MCC.cad_points, ECDR.emp_current_design_id, ECDR.remark_s
		            												FROM emp_current_design_rework ECDR, design_det DD, master_cat MC, master_cad_cat MCC 
		            												WHERE ECDR.master_cad_remarks_id='".$rmrk_enc_id."' 
		            												AND DD.design_det_id=ECDR.design_det_id AND MC.master_cat_id=DD.master_cat_id 
			            											AND MCC.master_cad_cat_id = DD.master_cad_cat_id
		            												AND ECDR.re_emp_det_id='".$emp_enc_id."' ".$dat_str_rwrk." 
		            												GROUP BY ECDR.design_det_id ORDER BY ECDR.re_emp_det_id ASC";
														$QURY_FTR = mysqli_query($connect,$SLCT_FTR);
			            								if(mysqli_num_rows($QURY_FTR)>0)
			            								{
			            									while($FTCH_FTR = mysqli_fetch_object($QURY_FTR))
			            									{
			            										$SLCT_FTR1 = "SELECT tot_time FROM emp_current_design_det ECDD WHERE ECDD.emp_current_design_id='".$FTCH_FTR->emp_current_design_id."' ORDER BY ECDD.emp_current_design_det_id DESC";
																$QURY_FTR1 = mysqli_query($connect,$SLCT_FTR1);
																$FTCH_FTR1 = mysqli_fetch_object($QURY_FTR1);
			            							?>
						            							<tr>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $loop; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR->master_cat_name." - ".$FTCH_FTR->design_no; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR->cad_points; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR1->tot_time; ?></td>
																	<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_FTR->remark_s; ?></td>
																</tr>	    
													<?php
																$tot_des = $tot_des+1;
																$loop++;
															}
														}
													?> 
			            						</tbody>    
			            					</table> 
			        					</div>	
			        				</div>
	        			<?php			
								} 
							}
	        			?>
	        			<input name="tot_design" id="tot_design" type="hidden" value="<?php echo $tot_des; ?>" /> 	
        			</fieldset>
     			</form>
        		<div class="fluid"><!-- Media table --></div>       
    		</div>
    		<!-- Main content ends -->    
		</div>
		<!-- Content ends -->
	</body>
</html>
