<?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/cnt_chkbox_JS.js"></script>
<script type="text/javascript" src="js/cli_ord_req_sub_view_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.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="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="home.php">Dashboard</a></li>
                <li><a href="javascript:">Purchase Order Delivery</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>-->
			<?php
				if(isset($_GET['pg']) && $_GET['pg']=='cli')
				{
					$pg_url = 'cli_ord_req_pend_list.php';
				}
				else
				{
					$pg_url = 'cli_ord_req_list.php';
				}
			?>
            <li><a href="<?php echo $pg_url; ?>" id="listpage" title="List Order Request" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
    	</ul>            
  		<?php
		$pa_id	=	base64_decode(base64_decode(base64_decode($_GET['pa_id'])));
				
		$SLCT_tp = "SELECT * FROM party_det WHERE party_det_id = '$pa_id'";
		$QURY_tp = mysqli_query($connect,$SLCT_tp);
		$FTCH_tp = mysqli_fetch_object($QURY_tp);
		
		$flg1 = base64_encode(base64_encode(base64_encode(1)));
		$flg2 = base64_encode(base64_encode(base64_encode(2)));
		$bck_flg = base64_encode(base64_encode(base64_encode(2)));
		
		
		?>

    	<!-- Chart --><!-- 6 + 6 -->
        <form id="validate" name="checklist" class="main" method="post" action="bl/cli_req_date_tem_BL.php?pa_id=<?php echo $_GET['pa_id']; ?>&flg=<?php echo $flg2; ?>&bck_flg=<?php echo $bck_flg; ?>" onsubmit="vad_date_fm();">
         <fieldset>
        <div class="fluid">
            <div class="widget">
              <div class="formRow">
                    <div class="grid2"><label>Company Code / Name:<span class="req"></span></label></div>
                    <div class="grid4"><input type="text" value="<?php echo $FTCH_tp->party_code. " / " . $FTCH_tp->cmp_name; ?>" name="cmp_nam" id="cmp_nam" readonly="readonly" disabled="disabled"/></div><div class="clear"></div>                
                </div>
                                
               <?php /*?> <div class="formRow">
                    <div class="grid2"><label>Order Date:<span class="req"></span></label></div>
                    <div class="grid4"><input type="text" value="<?php echo $FTCH_po->po_date; ?>" name="pod" id="pod" readonly="readonly"/></div><div class="clear"></div>
                </div><?php */?>
                <!--<div class="formRow">
                    <div class="grid2"><label>Delivery Date:<span class="req"></span></label></div>
                    <div class="grid4"><input type="text" value="" name="pdd" id="pdd" class="datepicker" readonly="readonly"/></div><div class="clear"></div>
                </div>-->
            </div>
        </div>
      	
        <div class="widget"> <!--style="width:600px; margin-left:150px;"-->
        <div class="whead"><span class="titleIcon check"><input type="checkbox" id="titleCheck" name="titleCheck" onclick="ckall(),hid_show();"/></span><h6>PO Request Date Wise List</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>
            <table cellpadding="0" cellspacing="0" border="0" class="dTable check" id="checkAll">
			<thead>
                <tr>
                    <td width="20"><img src="images/elements/other/tableArrows.png" alt="" /></td>
                    <th width="26">S.No<span class="sorting" style="display: block;"></span></th>
                    <th width="140">Order Request Date</th>
                    <th width="138">No.of.Design</th>
                    <th width="95" align="center">No of Dies</th>
                    <th width="166">View/Approve</th>
                    
                    <!-- <th width="60">Remarks</th>-->   
                </tr>
            </thead>
            <tbody>
            <?php
			
			$loop = 1;
			$SLCT_t = "SELECT * FROM design_sel_det WHERE party_det_id = '$pa_id' GROUP BY STR_TO_DATE(sel_date,'%d-%m-%Y') ORDER BY design_sel_det_id DESC";
			//echo $SLCT_t;
			$QURY_t = mysqli_query($connect,$SLCT_t);
			while($FTCH = mysqli_fetch_object($QURY_t))
			{
				$sel_date	=	base64_encode(base64_encode(base64_encode($FTCH->sel_date)));			
				
				$SLCT_dd = "SELECT IFNULL(SUM(master_pieces),'0') AS tot_pic,COUNT(design_sel_det_id) AS sel_cnt, ord_status FROM design_sel_det,design_det WHERE design_det.design_det_id=design_sel_det.design_det_id AND sel_date = '$FTCH->sel_date' AND party_det_id = '$pa_id'";
				//echo $SLCT_dd;
				$QURY_dd = mysqli_query($connect,$SLCT_dd);
				$FTCH_dd = mysqli_fetch_object($QURY_dd);
				
				$SLCT_aa = "SELECT ord_status FROM design_sel_det WHERE sel_date = '$FTCH->sel_date' AND party_det_id = '$pa_id' AND ord_status='no'";
				//echo $SLCT_dd;
				$QURY_aa = mysqli_query($connect,$SLCT_aa);
				$FTCH_aa = mysqli_num_rows($QURY_aa);
				
				
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
			?>
                <tr <?php echo $bg ?>>
                    <td align="center" style="display:table-cell;vertical-align:middle;"><input type="checkbox" name="category[]" id="category<?php echo $loop ?>" value="<?php echo $FTCH->sel_date ?>" onclick="cnt_chk_fn(<?php echo $loop ?>),hid_show();"/></td>
                    <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 str_replace("-", "/",$FTCH->sel_date); ?></td>
                    <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_dd->sel_cnt; ?></td>
                    <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_dd->tot_pic; ?></td>
                    <td class="center" align="center"><?php if($FTCH_aa>0) { ?><a href="cli_ord_req_view.php?pa_id=<?php echo $_GET['pa_id']; ?>&sel_date=<?php echo $sel_date ?>&flg=<?php echo $flg1; ?>&bck_flg=<?php echo $bck_flg; ?>" id="viewlink5<?php echo $loop ?>" onfocus="foc(this.id)" onblur="stnon(this.id)" class="an_own">View/Approve</a><?php } else { echo "Approved"; }?></td>                            
                    
                </tr>
            <?php
            	$loop ++;						
				}
				
			?>
			
            </tbody>
            </table> 
        </div>
        </div>    
		
		    
        <div class="fluid" id="sub_but_dv" style="display:none;">
		<div class="widget">
           <div class="formRow">
           		<!--<div class="grid2"><label>Total Cost:<span class="req"></span></label></div>
            	<div class="grid2"><input type="text" value="" name="tot_cost" id="tot_cost" readonly="readonly"/></div>-->
           		<input type="button" value="Submit" class="buttonM bBlack formSubmit" onclick="vad_date_fm();" 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>
             
       
        </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>
