<?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'";
		//echo $SLCT_log;
		$QURY_log = mysqli_query($connect,$SLCT_log);
		$FTCH_log = mysqli_fetch_object($QURY_log);
		$party_id = '$FTCH_log->party_det_id';
	}
	
	$flag = 0;
   	$sta_iden = '0';
   	// THIS IS FOR CHECKING THE STAGE NAME
	
	if(isset($_GET['flg']) && $_GET['flg']!='' ) 
	{
		$flg_id 	= 	$_GET['flg'];
		$flg_id1	=	base64_decode(base64_decode(base64_decode(base64_decode($_GET['flg'])))); // this is for getting the value from url				
	}
	else
	{
		$flg_id = '';
		$flg_id1 = '';
	}
	
	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'];
		$emp_enc_id = base64_decode(base64_decode(base64_decode(base64_decode($emp_id)))); 
		
		$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 = '';
		$emp_enc_id = ''; 
		$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 =  '';
	}
	
	$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;
		}
	}
?>
<!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=iso-8859-1" />
		<title>Report</title>
		<script type="text/javascript" src="js/ftr_analize_JS.js"></script>
		<style>
			.tet_bx{ border:none; background:#FFFFFF;}
		</style>
	</head>
	<body onload="tot_count()">
		<table width="960" border="0" align="center" style="outline:#000000 solid 1px;">
			<tr><th colspan="10" scope="col">FTR Report</th></tr>
			<tr>
				<td width="20%">&nbsp;</td>
				<td width="20%">&nbsp;</td>
				<td width="20%">&nbsp;</td>
				<td width="20%">&nbsp;</td>
				<td width="20%">&nbsp;</td>
			</tr>
			<?php 
				if($flg_id1!=1)
				{
			?>
					<tr>
						<td style="display:table-cell; vertical-align:middle;"><b>Employee Name:</b></td>
						<td colspan="2" style="display:table-cell; vertical-align:middle;"><b><?php echo $emp_nm.$rmrk_nm; ?></b></td>		        
						<td colspan="2" style="display:table-cell; vertical-align:middle;">&nbsp;</td>		        
		  			</tr>
					<tr><td colspan="5">&nbsp;</td></tr>
			<?php
				}
			?>
			<tr>
				<td style="display:table-cell; vertical-align:middle;">From Date: </td>
				<td style="display:table-cell; vertical-align:middle;"><?php echo $fdate; ?></td>
				<td style="display:table-cell; vertical-align:middle;">To Date: </td>
				<td style="display:table-cell; vertical-align:middle;"><?php echo $todate; ?></td>
				<td style="display:table-cell; vertical-align:middle;">Filter:&nbsp;
					<?php if($yea_r!=''){ echo "Year"; } ?>&nbsp;-
					<?php if($mont_h!=''){ echo "Month"; } ?>&nbsp;-
					<?php if($da_y!=''){ echo "Day"; } ?>&nbsp;
				</td>
			</tr>			
			<tr><td colspan="5">&nbsp;</td></tr>
			<tr style="text-align:left">
				<td style="display:table-cell; vertical-align:middle;">Total Design Qty:</td>
				<td style="display:table-cell; vertical-align:middle;"><input type="text" class="tet_bx" id="tot_des" name="tot_des" value="" readonly="readonly" disabled="disabled" style="width:100px; font-size:12px;" />&nbsp;</td>
				<td style="display:table-cell; vertical-align:middle;">&nbsp;</td>
				<td style="display:table-cell; vertical-align:middle;">&nbsp;</td>
				<td style="display:table-cell; vertical-align:middle;">&nbsp;</td>
			</tr>
			<tr><td colspan="5">&nbsp;</td></tr>			
		</table>
		<?php
		$tot_des = 0;
		if($flg_id1==1) // THIS IS PRINT SCREEN FLAGG VALUE FOR BILLING / COLLECTION MONTH WISE
		{
		?>
			<table width="960" border="0" cellspacing="0" align="center" style="outline:#000000 solid 1px;">
				<thead>
					<tr>
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">S.No</th>
						<th width="20%" style="display:table-cell;vertical-align:middle;padding: 3px; text-align:left;">Cad Designer Name</th>
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">Total Design Finished</th>
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">First Time Finished Qty</th> 
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">First Time Finished Qty %</th>
						<?php
							$SLCT_MAS = "SELECT description FROM master_cad_remarks WHERE statu_s='active' ORDER BY master_cad_remarks_id ASC";
							$QURY_MAS = mysqli_query($connect,$SLCT_MAS);
							while($FTCH_MAS = mysqli_fetch_object($QURY_MAS))
							{
						?>
								<th width="7%"><?php echo $FTCH_MAS->description; ?></th> 
								<th width="7%"><?php echo $FTCH_MAS->description." %"; ?></th>
						<?php	
							}
						?>
					</tr>
				</thead>
				<tbody> 
				<?php
					$loop = 1;
					$SLCT_FTR = "SELECT ED.emp_det_id, ED.name, COUNT(DISTINCT DD.design_det_id) AS DES_CNT, COUNT(DD.design_det_id) AS TOT_CNT, SUM(MCC.cad_points) AS CAD_PNTS
								FROM emp_current_design ECD INNER JOIN emp_det ED ON ED.emp_det_id=ECD.emp_det_id
								INNER JOIN design_det DD ON DD.design_det_id=ECD.design_det_id
								INNER JOIN master_cad_cat MCC ON MCC.master_cad_cat_id = DD.master_cad_cat_id
								WHERE FIND_IN_SET(ECD.curr_status,'closed,cancelled,stopped') ".$dat_str."  
								GROUP BY ED.emp_det_id ORDER BY ED.emp_det_id ASC";
						$QURY_FTR = mysqli_query($connect,$SLCT_FTR);
						if(mysqli_num_rows($QURY_FTR)>0)
						{
							$pg_flag1 = base64_encode(base64_encode(base64_encode(base64_encode(1))));
							$pg_flag2 = base64_encode(base64_encode(base64_encode(base64_encode(2))));
							
							while($FTCH_FTR = mysqli_fetch_object($QURY_FTR))
							{
								$SLCT_FTR1 = "SELECT COUNT(DISTINCT ECD.design_det_id) AS FRST_CNT, COUNT(ECD.design_det_id) AS FRST_TOT FROM emp_current_design ECD WHERE FIND_IN_SET(ECD.curr_status,'closed,cancelled,stopped') AND ECD.emp_det_id='".$FTCH_FTR->emp_det_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='".$FTCH_FTR->emp_det_id."' ".$dat_str_rwrk." ) ".$dat_str." GROUP BY ECD.emp_det_id ORDER BY ECD.emp_det_id ASC";
								$QURY_FTR1 = mysqli_query($connect,$SLCT_FTR1);
								if(mysqli_num_rows($QURY_FTR1)>0)
								{
									$FTCH_FTR1 = mysqli_fetch_object($QURY_FTR1);
									$frst_per = ($FTCH_FTR1->FRST_CNT/$FTCH_FTR->DES_CNT)*100;
									$frst_cnt = $FTCH_FTR1->FRST_CNT;
								}
								else
								{
									$frst_per = 0;
									$frst_cnt = 0;
								}
								
								$emp_id = base64_encode(base64_encode(base64_encode(base64_encode($FTCH_FTR->emp_det_id))));								
				?>
								<tr>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $loop; ?></td> 
									<td align="left" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->name; ?></td> 
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->DES_CNT." ( ".$FTCH_FTR->CAD_PNTS." )"; ?></td>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $frst_cnt; ?></td> 
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo number_format($frst_per,2); ?></td>
									<?php
										$SLCT_MAS = "SELECT master_cad_remarks_id FROM master_cad_remarks WHERE statu_s='active' ORDER BY master_cad_remarks_id ASC";
										$QURY_MAS = mysqli_query($connect,$SLCT_MAS);
										while($FTCH_MAS = mysqli_fetch_object($QURY_MAS))
										{
											$SLCT_FTR2 = "SELECT COUNT(DISTINCT ECDR.design_det_id) AS DES_CNT, COUNT(ECDR.design_det_id) AS TOT_CNT FROM emp_current_design_rework ECDR WHERE ECDR.master_cad_remarks_id='".$FTCH_MAS->master_cad_remarks_id."' AND ECDR.re_emp_det_id='".$FTCH_FTR->emp_det_id."' ".$dat_str_rwrk." GROUP BY ECDR.re_emp_det_id ORDER BY ECDR.re_emp_det_id ASC";
											$QURY_FTR2 = mysqli_query($connect,$SLCT_FTR2);
											if(mysqli_num_rows($QURY_FTR2)>0)
											{
												$FTCH_FTR2 = mysqli_fetch_object($QURY_FTR2);
												if($FTCH_FTR2->DES_CNT!='0' || $FTCH_FTR2->DES_CNT!='')
												{
													if($FTCH_FTR2->DES_CNT==$FTCH_FTR2->TOT_CNT)
													{
														$des_cnt = $FTCH_FTR2->DES_CNT;	
													}
													else
													{
														$des_cnt = $FTCH_FTR2->DES_CNT." ( ".$FTCH_FTR2->TOT_CNT." ) ";
													}
													$des_per = ($FTCH_FTR2->DES_CNT/$FTCH_FTR->DES_CNT)*100;
													$des_flag = 1;
												}
												else
												{
													$des_cnt = 0;
													$des_per = 0;
													$des_flag = 2;
												}
											}
											else
											{
												$des_cnt = 0;
												$des_per = 0;
												$des_flag = 2;
											}
											$rmrk_id = base64_encode(base64_encode(base64_encode(base64_encode($FTCH_MAS->master_cad_remarks_id))));
									?>
											<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $des_cnt;?></td> 
											<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo number_format($des_per,2); ?></td>												
									<?php	
										}
									?>
								</tr>
					<?php
								$tot_des = $tot_des+$FTCH_FTR->DES_CNT;
								$loop++;
							}
						}
					?>    
				</tbody>      
			</table> 
		<?php	
		}
		else if($flg_id1==2)
		{
		?>
			<table width="960" border="0" cellspacing="0" align="center" style="outline:#000000 solid 1px;">
				<thead>
					<tr>
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">S.No</th>
						<th width="30%" style="display:table-cell;vertical-align:middle;padding: 3px;">Design No</th>
						<th width="30%" style="display:table-cell;vertical-align:middle;padding: 3px;">Point</th>
						<th width="30%" style="display:table-cell;vertical-align:middle;padding: 3px;">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;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $loop; ?></td>
								<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->master_cat_name." - ".$FTCH_FTR->design_no; ?></td>
								<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->cad_points; ?></td>
								<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR1->tot_time; ?></td>
							</tr>	    
				<?php
							$tot_des = $tot_des+1;
							$loop++;
						}
					}
				?> 
				</tbody>     
			</table> 
		<?php
		}
		else if($flg_id1==3)
		{
		?>
			<table width="960" border="0" cellspacing="0" align="center" style="outline:#000000 solid 1px;">
				<thead>
					<tr>
						<th width="10%" style="display:table-cell;vertical-align:middle;padding: 3px;">S.No</th>
						<th width="20%" style="display:table-cell;vertical-align:middle;padding: 3px;">Design No</th>
						<th width="20%" style="display:table-cell;vertical-align:middle;padding: 3px;">Point</th>
						<th width="20%" style="display:table-cell;vertical-align:middle;padding: 3px;">Design Time</th>
						<th width="30%" style="display:table-cell;vertical-align:middle;padding: 3px;">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;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $loop; ?></td>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->master_cat_name." - ".$FTCH_FTR->design_no; ?></td>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->cad_points; ?></td>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR1->tot_time; ?></td>
									<td align="center" style="display:table-cell;vertical-align:middle;padding: 3px;border-bottom: 0.1px solid gray;"><?php echo $FTCH_FTR->remark_s; ?></td>
								</tr>	    
					<?php
								$tot_des = $tot_des+1;
								$loop++;
							}
						}
					?> 
				</tbody>    
			</table>
		<?php
		}
		?>
		<input name="tot_design" id="tot_design" type="hidden" value="<?php echo $tot_des; ?>" /> 
	</body>
</html>
