<?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/casting_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:">Casting 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="casting_finishing_list.php" id="listpage" title="List Casting Finishing" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
    	</ul>            
  		<?php
		if(isset($_GET['dat']))
		{
			$dat = $_GET['dat'];
			$dat_chg = str_replace("-", "/", $dat);
			$tot_dis ="block";
		}
		else
		{
			$dat = '';
			$tot_dis ="none";
		}
		$page_id= base64_encode(base64_encode(base64_encode(1))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for add		 
					 
		?>

    	<!-- Chart --><!-- 6 + 6 -->
        <form id="validate" name="checklist" class="main" method="post" action="bl/casting_finishing_BL.php?page_id=<?php echo $page_id; ?>" onsubmit="checkTheBox();">
         <fieldset>
        <div class="fluid">
		<div class="widget">
        
        <?php /*?><div class="formRow">
            <div class="grid3"><label>Casting Designer:<span class="req">*</span></label></div>
            <div class="grid6 searchDrop">
                <select data-placeholder="Choose an Employee..." class="select" name="hdes_name" id="hdes_name" style="width:350px;" tabindex="2">
                    <option value=""></option>
                    <?php
                    $SLCT_E = "SELECT  * FROM emp_det WHERE master_dept_id = '3'"; //HERE THE 1 IS REPRESENTS Casting DESIGNER ID 
                    //echo $SLCT;
                    $QURY_E = mysqli_query($connect,$SLCT_E);
                    while($FTCH_E = mysqli_fetch_object($QURY_E))
                    {
                    ?>
                    <option value="<?php echo $FTCH_E->emp_det_id ?>"><?php echo $FTCH_E->name ?></option>
                    <?php
                    }
                    ?>
                        
                </select>
            </div>
            <div class="clear"></div>
        </div><?php */?>
                        
        <div class="formRow">
            <div class="grid3"><label>Finishing Date:<span class="req">*</span></label></div>
            <div class="grid9"><input type="text" value="<?php echo $dat;?>" name="lob" id="lob" class="datepicker" onchange="reload_page();" /></div><div class="clear"></div>
            </div>
        </div>
        </div>
        
        
    	 <div class="widget" style="display:<?php echo $tot_dis ?>">
            <div class="whead"><span class="titleIcon check"><input type="checkbox" id="titleCheck" name="titleCheck" onclick="ckall()" onfocus="foc(this.id)" onblur="stnon(this.id)"/></span>
            <h6>Casting Finishing Add</h6><h6 style="float:right; margin-right:50px"><input type="text" id="cnt_chk" name="cnt_chk" value="" readonly="readonly" disabled="disabled" style="width:50px; font-size:12px; text-align:center;" /></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>
            <td width="20"><img src="images/elements/other/tableArrows.png" alt="" /></td>
            <th width="113">S.No<span class="sorting" style="display: block;"></span></th>
           <!-- <th width="96">Category</th>-->
            <th width="117">Design No</th>
            <th width="95" align="center">No of Pieces</th>
            <!--<th width="126">Loading Date</th>-->
            <th width="103">Design Status</th>
            <!--<th width="104">Casting Weight</th>-->
            <th width="124">Image</th>
           <!-- <th width="71">View</th>
            <th width="149">Status</th>-->
           
            </tr>
            </thead>
            <tbody>
            <?php
			$loop=1;
			if(isset($_GET['dat']))
		{
			$SLCT = "SELECT  * FROM wax_finishing,design_det WHERE wax_finishing.wax_fin_status = 'no' AND STR_TO_DATE(wax_finishing.finishing_date,'%d-%m-%Y')<=STR_TO_DATE('$dat','%d/%m/%Y') AND design_det.design_det_id=wax_finishing.design_det_id AND design_det.statu_s='active' AND design_det.up_status='no' AND wax_finishing.up_status='no' ORDER BY wax_finishing.design_det_id ASC";
			//echo $SLCT;
			$QURY = mysqli_query($connect,$SLCT);
			if(mysqli_num_rows($QURY)>0)
			{			
			while($FTCH = mysqli_fetch_object($QURY))
			{
				$design_id	=	base64_encode(base64_encode(base64_encode($FTCH->design_det_id)));
				
				/*$SLCT_t = "SELECT * FROM design_det WHERE design_det_id = '$FTCH->design_det_id' AND statu_s='active'";
				echo $SLCT_t;
				$QURY_t = mysqli_query($connect,$SLCT_t);
				$FTCH_t = mysqli_fetch_object($QURY_t);*/
				
				$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"><input type="checkbox" name="category[]" id="category<?php echo $loop ?>" onclick="cnt_chk_fn(<?php echo $loop ?>);" value="<?php echo $FTCH->design_det_id ?>" onfocus="foc(this.id)" onblur="stnon(this.id)"/></td>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $loop ?></td>
            <?php /*?><td align="center"><?php echo $FTCH_d->master_cat_name; ?></td><?php */?>
            <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 $FTCH->no_of_pieces; ?></td>
            <?php /*?><td align="center"><?php echo $FTCH->loading_date; ?></td><?php */?>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH->design_status; ?></td>
            <?php /*?><td align="center"><input type="text" name="casping_wt[<?php echo $loop ?>]" id="casping_wt<?php echo $loop ?>" class="casping_weit_tx"/></td><?php */?>
            <td class="center" align="center"><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>
            <?php /*?><td class="center" align="center"><a href=""><img src="design_images/S.<?php echo $FTCH_t->imag_ext; ?>" width="60" height="60"/></a></td>
            <td class="center"><a href="employee_view.php?design_id=<?php echo $design_id ?>">View</a></td>
            <td class="center"><?php if($FTCH->statu_s=="active"){ ?><a href="bl/design_BL.php?design_id=<?php echo $design_id ?>&page_id=<?php echo $page_id; ?>&statu_s=active">Active</a><?php }else{ ?><a href="bl/design_BL.php?design_id=<?php echo $design_id ?>&page_id=<?php echo $page_id; ?>&statu_s=inactive">Inactive</a> <?php } ?></td><?php */?>
            </tr>
            
            <?php
			$loop ++;
		
			 }
			 }
			}
			 ?>
           <?php /*?> <?php if($loop==1){ ?>
            <tr>
              <td colspan="10" align="center">
              <div class="nNote nFailure">
                <p>Oops Sorry No Data Found...</p>
            </div>
              </td>
              </tr>
			<?php } ?>	<?php */?>			
				
            </tbody>
            </table> 
            </div>
			</div>
        </div>         
        
       <?php if(mysqli_num_rows($QURY)>0){ ?>
        
        <div class="fluid" style="display:<?php echo $tot_dis ?>">
		<div class="widget">
           <div class="formRow">
                <input type="button" value="Submit" class="buttonM bBlack formSubmit" onclick="checkTheBox();" style="float: right; margin-left:20px;"/>
                <input type="button" value="Reset" class="buttonM bRed" style="float: right; margin-left:20px;" onclick="form_rest();"/>
                <div class="clear"></div></div>
                <div class="clear"></div>
            </div>
        </div>
       
       <?php } ?>
       
        </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>
