<?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>

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

<link href="css/styles.css" rel="stylesheet" type="text/css" />
<!--[if IE]> <link href="css/ie.css" rel="stylesheet" type="text/css"> <![endif]-->

<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.dataTables1.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('listpage').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:">CAD Finishing</a></li>
                    
            </ul>
        </div>
	<?php include "menus/top_left_menu.php"; ?>            
        
    </div>
    
    <!-- Main content -->
    <div class="wrapper">
    
        <ul class="middleNavR">
            <!--<li><a href="#" title="Add an article" class="tipN"><img src="images/icons/middlenav/create.png" alt="" /></a></li>
            <li><a href="#" title="Upload files" class="tipN"><img src="images/icons/middlenav/upload.png" alt="" /></a></li>-->  
          <!--<li><a href="design_add.php" title="Add Design" class="tipN"><img src="images/icons/middlenav/add.png" alt="" /></a></li>-->
            <!--<li><a href="#" title="Messages" class="tipN"><img src="images/icons/middlenav/dialogs.png" alt="" /></a><strong>8</strong></li>-->
            <li><a href="cad_finishing.php" id="listpage" title="List CAD Finishing" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
    	</ul>            
  		<?php
		$loading_date	=	base64_decode(base64_decode(base64_decode($_GET['fin_dt']))); //THIS IS PAGE ID
		$emp_id	=	base64_decode(base64_decode(base64_decode($_GET['em_id']))); //THIS IS PAGE ID  
		
		$page_id= base64_encode(base64_encode(base64_encode(1))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for add
		
		$SLCT_em = "SELECT * FROM emp_det WHERE emp_det_id = '$emp_id'";
		$QURY_em = mysqli_query($connect,$SLCT_em);
		$FTCH_em = mysqli_fetch_object($QURY_em);
		
		?>

    	<!-- Chart --><!-- 6 + 6 -->
        <form id="validate" name="checklist" class="main" method="post" action="" onsubmit="checkTheBox();">
         <fieldset>
        
        
    	 <div class="widget" style="display:<?php echo $tot_dis ?>">
            <div class="whead">
            <h6>CAD Finishing View</h6><h6>Worker Name : <?php echo $FTCH_em->name; ?></h6><h6>Closed Date : <?php echo str_replace("-", "/",$loading_date); ?></h6><h6 style="float:right; margin-right:50px"><input type="text" id="cnt_chk" name="cnt_chk" value="" readonly="readonly" style="width:50px; font-size:12px; text-align:center;" disabled="disabled" /></h6><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>
            <div style="max-height:700px; overflow-y:auto;">
            <table cellpadding="0" cellspacing="0" width="100%" class="dTable check" id="checkAll">
            <thead>
            <tr>
            <th width="114">S.No<span class="sorting" style="display: block;"></span></th>
            <th width="176">Design No</th>
            <th width="108">Point </th>
            <th width="108">No. of Pieces </th>
            <th width="108">Cad Finish Time</th>
            <th width="174">Design Status</th>
            <th width="120">Image</th>
            <th width="120">View</th>
            </tr>
            </thead>
            <tbody>
            <?php
				$SLCTtt = "SELECT *,emp_current_design.emp_det_id AS emp_id FROM emp_current_design,design_det WHERE curr_status = 'closed' AND emp_current_design.design_det_id = design_det.design_det_id AND emp_current_design.`design_det_id` IN (SELECT `design_det_id` FROM cad_finishing_des WHERE cad_fin_status='no') AND STR_TO_DATE(emp_current_design.closed_dt,'%d-%m-%Y') =  STR_TO_DATE('$loading_date','%d-%m-%Y') AND emp_current_design.emp_det_id = '$emp_id' ORDER BY design_det.design_det_id ASC";
				//echo $SLCTtt;
				$QURYtt = mysqli_query($connect,$SLCTtt);
				if(mysqli_num_rows($QURYtt)>0)
				{
					while($FTCH = mysqli_fetch_object($QURYtt))
					{
						$SLCT_CURR_DET  = "SELECT SEC_TO_TIME( SUM( TIME_TO_SEC( `time_taken` ) ) ) AS tot_time FROM emp_current_design_det WHERE emp_current_design_id='$FTCH->emp_current_design_id'";
						$EXEC_CURR_DET 	= mysqli_query($connect,$SLCT_CURR_DET);
						$FTCH_CURR_DET	= mysqli_fetch_object($EXEC_CURR_DET);
		
					
						$design_id	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH->design_det_id))));
						$emp_cur_id	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH->emp_current_design_id))));
						$emp_id	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH->emp_id))));
						
						$SLCT_t = "SELECT * FROM master_cad_cat WHERE master_cad_cat_id = '$FTCH->master_cad_cat_id'";
						$QURY_t = mysqli_query($connect,$SLCT_t);
						if(mysqli_num_rows($QURY_t )>0){
						 $FTCH_t = mysqli_fetch_object($QURY_t);
						 $cad_cat_name = $FTCH_t->cad_cat_name;
						 $cad_cat_pnt = $FTCH_t->cad_points;
						}else{ $cad_cat_name = "------"; $cad_cat_pnt = "------"; }
						
						$SLCT_d = "SELECT  * FROM master_cat WHERE master_cat_id = '$FTCH->master_cat_id'";
						$QURY_d = mysqli_query($connect,$SLCT_d);
						$FTCH_d = mysqli_fetch_object($QURY_d);
					
						if($loop%2 != "0")
							$bg = "gradeX";
						else
							$bg = "class='gradeC'";
						if($FTCH->mas_fin_ext!=''){ $imag = "../mas_fin_images/S.".$FTCH->mas_fin_ext; $imag1 = "../mas_fin_images/L.".$FTCH->mas_fin_ext; }
		
						else if($FTCH->cad_fin_ext!=''){ $imag = "../cad_fin_images/S.".$FTCH->cad_fin_ext; $imag1 = "../cad_fin_images/L.".$FTCH->cad_fin_ext; }
						
						else if($FTCH->imag_ext!=''){ $imag = "../design_images/S.".$FTCH->imag_ext; $imag1 = "../design_images/L.".$FTCH->imag_ext; }
			?>
						<tr <?php echo $bg ?>>
						<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_d->master_cat_name." ".$FTCH->design_no; ?></td>
						<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $cad_cat_pnt; ?></td>
						<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH->no_of_pice; ?></td>
						<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_CURR_DET->tot_time; ?></td>
						<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH->design_status; ?></td>
						<td class="center" align="center" style="display:table-cell;vertical-align:middle">
					   		<div class="body" align="center">
								<a href="<?php echo $imag1; ?>" title="<h2><?php echo $FTCH_d->master_cat_name." ".$FTCH->design_no; ?></h2>" class="lightbox" rel="group"><img src="<?php echo $imag; ?>" width="60" height="60"/></a>            
                  			</div>
                       	</td>
						<td align="center" style="display:table-cell;vertical-align:middle"`>
                        	<a href="cad_finish_view.php?emp_cur_id=<?php echo $emp_cur_id; ?>&emp_ad_id=<?php echo $emp_id; ?>&des_id=<?php echo $design_id; ?>&fin_dt=<?php echo $_GET['fin_dt']; ?>&em_id=<?php echo $_GET['em_id']; ?>" style="text-decoration:none; cursor:pointer;">View</a></td>
                        </td>
                        </tr>
            
            <?php
						$loop ++;
		
			 }
			 }
			 ?>
			 <input type="hidden" name="jsval" id="jsval" value="<?php echo $loop ?>" />		
				
            </tbody>
            </table> 
			
            </div>
        </div> 
       </div>
        </fieldset>
        </form>
        <div class="fluid"><!-- Media table --></div>
        
        
        
    </div>
    
    <!-- Main content ends -->
    
</div>
<!-- Content ends -->
<?php /*?><?php include "header_footer/footer.php"; ?><?php */?>
</body>
</html>
