<?php
	include "db_connection/db_connection.php";
	include "config/config.php";
	
	if($_SESSION['admin_login_id'] == '')
	{
		echo "<script>window.location='index.php';</script>";
	}
	
	$check_acc  = check_access('26');
?>
<!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]-->
        
        <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script>
        <script type="text/javascript" src="js/waiting_for_appr_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>

        <!-- 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">
            <!--<div class="contentTop">
                <span class="pageTitle"><span class="icon-key-2"></span>Form validation engines</span>
                <ul class="quickStats">
                    <li>
                        <a href="" class="blueImg"><img src="images/icons/quickstats/plus.png" alt="" /></a>
                        <div class="floatR"><strong class="blue">5489</strong><span>visits</span></div>
                    </li>
                    <li>
                        <a href="" class="redImg"><img src="images/icons/quickstats/user.png" alt="" /></a>
                        <div class="floatR"><strong class="blue">4658</strong><span>users</span></div>
                    </li>
                    <li>
                        <a href="" class="greenImg"><img src="images/icons/quickstats/money.png" alt="" /></a>
                        <div class="floatR"><strong class="blue">1289</strong><span>orders</span></div>
                    </li>
                </ul>
                <div class="clear"></div>
            </div>-->
            <?php include "menus/top_menu.php"; ?> 
            <!-- Breadcrumbs line -->
            <div class="breadLine">
                <div class="bc">
                    <ul id="breadcrumbs" class="breadcrumbs">
                        <li><a href="home.php">Dashboard</a></li>
                        <li><a href="javascritp:">Waiting for Approval</a></li>
                    </ul>
                </div>
                <?php include "menus/top_left_menu.php"; ?>  
            </div>
            <!-- Main content -->
            <div class="wrapper"> 
			<?php if($check_acc==1){?>
            	<div class="widget">
                	<div class="whead"><h6>Waiting for Approval List</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>
                		<table cellpadding="0" cellspacing="0" border="0" class="dTable" id="dynamic">
                			<thead>
                				<tr>
                                    <th width="5%" align="center">S.No</th>
                                    <th width="7%" align="left">Status</th>
                                    <th width="7%" align="center">Quantity</th>
                                    <th width="7%" align="center">No. of Pieces</th>
                                    <th width="10%" align="center">View</th>
                               	</tr>
                			</thead>
                			<tbody>
                            <?php
								$loop=1;
				$page_id	=	base64_encode(base64_encode(base64_encode(base64_encode(1))));
				$SLCT_CAD = "SELECT emp_current_design.curr_status, COUNT(*) AS qty, SUM(no_of_pice) AS no_of_pice FROM emp_current_design,design_det WHERE design_det.design_det_id = emp_current_design.design_det_id AND (emp_current_design.curr_status='waiting' OR emp_current_design.curr_status='finished' OR emp_current_design.curr_status='process') AND emp_current_design.emp_det_id!=0 GROUP BY emp_current_design.curr_status ORDER BY FIELD(emp_current_design.curr_status, 'process', 'waiting', 'finished') ASC";
								//echo $SLCT_CAD;
								$QURY_CAD = mysqli_query($connect,$SLCT_CAD);
								if(mysqli_num_rows($QURY_CAD)>0)
								{
									while($FTCH_CAD = mysqli_fetch_object($QURY_CAD))
									{
										if($FTCH_CAD->curr_status=='waiting')
										{	
											$labl = "Waiting for Approval";
										}
										else if($FTCH_CAD->curr_status=='process')
										{
											$labl = "Work in Process";
										}
										else if($FTCH_CAD->curr_status=='finished')
										{
											$labl = "Finished";
										}
										$des_sts	=	base64_encode(base64_encode(base64_encode(base64_encode($FTCH_CAD->curr_status))));
									?>
                                        <tr >
                                            <td align="center" style="display:table-cell; vertical-align:middle;"><?php echo $loop; ?></td>
                                            <td align="left" style="display:table-cell; vertical-align:middle;"><?php echo $labl; ?></td>
                                            <td align="center" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_CAD->qty; ?></td>
                                            <td align="center" style="display:table-cell; vertical-align:middle;"><?php echo $FTCH_CAD->no_of_pice; ?></td>
                                            <td align="center" style="display:table-cell; vertical-align:middle;">  
                                            	<a href="waiting_for_appr_list.php?des_sts=<?php echo $des_sts; ?>" style="text-decoration:none; cursor:pointer;"><input type="button" name="sendMessage" class="buttonS bRed" value="View"></a>
                                            </td>                                
                                        </tr>
                    		<?php
										$loop++;
									}
								}
							?>                                
                			</tbody>
                		</table> 
                	</div>
                </div>  
<?php } else {  echo ACCESS_MSG;} ?>
            </div>
            <!-- Main content ends -->
        </div>
        <!-- Content ends -->
    </body>
</html>
