<?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_cancel_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="home.php">Dashboard</a></li>
                <li><a href="javascript:">Purchase Order Entry</a></li>
                    
            </ul>
        </div>
	<?php include "menus/top_left_menu.php"; ?>            
        
    </div>
    
    <!-- Main content -->
    <div class="wrapper">
     <ul class="middleNavR">
	 	<?php 
			if(isset($_GET['pg']) && $_GET['pg']=='cli')
			{
				$pg_url = 'cli_ord_req_pend_list.php';
				$pg		= "&pg=cli";
			}
			else
			{
				$pg_url = 'cli_ord_req_list.php';
				$pg	=	'';
			}
		?>
		
        <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
		$cancel_id= base64_encode(base64_encode(base64_encode(5)));
		$flg	=	base64_decode(base64_decode(base64_decode($_GET['flg'])));
		$bck_flg	=	base64_decode(base64_decode(base64_decode($_GET['bck_flg'])));
				
		$pa_id		=	base64_decode(base64_decode(base64_decode($_GET['pa_id']))); 
		if($flg==3)
		{
			$page_id= base64_encode(base64_encode(base64_encode(0))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for active inactive
		}
		else
		{
			$page_id= base64_encode(base64_encode(base64_encode(1))); //THIS IS FOR PAGE IDENTIFICATION IN BL FILE for client order request
		}
		
		$SLCT_E = "SELECT * FROM party_det WHERE party_det_id = '$pa_id'"; //HERE THE 1 IS REPRESENTS CAD DESIGNER ID 
		$QURY_E = mysqli_query($connect,$SLCT_E);
		$FTCH_E = mysqli_fetch_object($QURY_E);
		?>
    	<!-- Chart --><!-- 6 + 6 -->
        <form id="validate" name="checklist" class="main" method="post" action="bl/po_entry_BL.php?page_id=<?php echo $cancel_id.$pg; ?>">
         <fieldset>
		 <input name="party_id" id="party_id" type="hidden" value="<?php echo $pa_id; ?>" />
    	 <div class="widget">
            <div class="whead"><span class="titleIcon check"><input type="checkbox" id="titleCheck" name="titleCheck" onclick="ckall(),hid_show(),check_all_cnt();"/></span><h6>Client Request Cancel</h6><h6 style="float:right; margin-right:100px;"><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" border="0" class="dTable check" id="checkAll">
            <thead>
            <tr>
            <th width="20"><img src="images/elements/other/tableArrows.png" alt="" /></th>
            <th align="center" width="56">S.No<span class="sorting" style="display: block;"></span></th>
            <th align="center" width="87">Request Date</th>
            <th align="center" width="114">Design No</th>
            <th width="95" align="center">No of Dies</th>
			 <th width="104">No.Of. Order </th>
            <th width="103">No.Of Stock </th>
           <th width="129">Image</th>
			<th width="186">Remarks</th>
            
           <!-- <td width="71">View</td>
            <td width="149">Status</td>-->
            </tr>
            </thead>
            <tbody>
            <?php
			$date_s = '';
			if($flg == 1)
			{
				$sel_date	=	base64_decode(base64_decode(base64_decode($_GET['sel_date']))); 
				$SLCT = "SELECT * FROM design_sel_det WHERE ord_status = 'no' AND party_det_id = '$pa_id' ORDER BY design_sel_det_id ASC";	
			}
			else if($flg == 2)
			{
				$SLCT_dtm = "SELECT * FROM cli_req_date_tem";
				$QURY_dtm = mysqli_query($connect,$SLCT_dtm);
				while($FTCH_dtm = mysqli_fetch_object($QURY_dtm))
				{
					$date_s = $date_s."'".$FTCH_dtm->date_values."'".",";
				}
				$date_s = trim($date_s,",");		 
											
				$SLCT = "SELECT * FROM design_sel_det WHERE sel_date IN ($date_s) AND ord_status = 'no' AND party_det_id = '$pa_id' ORDER BY design_sel_det_id ASC";	
			}
			if($flg == 3)
			{
				$SLCT = "SELECT * FROM guest_user_details,guest_user WHERE guest_user_details.ord_status = 'no' AND guest_user_details.guest_user_id = guest_user.guest_id AND guest_user.party_det_id='$pa_id' ORDER BY guest_user_details.guest_user_details_id ASC";	
			}
						
			//echo $SLCT;
			$QURY = mysqli_query($connect,$SLCT);
			$loop=1;
			if(mysqli_num_rows($QURY)>0)
			{			
			while($FTCH = mysqli_fetch_object($QURY))
			{
								
				$SLCT_t = "SELECT * FROM design_det WHERE design_det_id = '$FTCH->design_det_id'";
				$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_t->master_cat_id'";
				$QURY_d = mysqli_query($connect,$SLCT_d);
				$FTCH_d = mysqli_fetch_object($QURY_d);
				
				$SLCT_or = "SELECT COUNT(design_det_id) AS or_cnt FROM po_entry_det WHERE po_entry_det.design_det_id = '$FTCH->design_det_id' AND po_entry_det.fin_status = 'no'"; 
                $QURY_or = mysqli_query($connect,$SLCT_or);
                $FTCH_or = mysqli_fetch_object($QURY_or);
				
				$SLCT_st = "SELECT COUNT(design_det_id) AS st_cnt FROM stock_det WHERE stock_det.design_det_id = '$FTCH->design_det_id' AND stock_det.st_fin_status = 'no'"; 
                $QURY_st = mysqli_query($connect,$SLCT_st);
                $FTCH_st = mysqli_fetch_object($QURY_st);	
				
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
					
				if($FTCH_t->mas_fin_ext!=''){ $imag = "../mas_fin_images/S.".$FTCH_t->mas_fin_ext;$imag1 = "../mas_fin_images/L.".$FTCH_t->mas_fin_ext; }

				else if($FTCH_t->cad_fin_ext!=''){ $imag = "../cad_fin_images/S.".$FTCH_t->cad_fin_ext; $imag1 = "../cad_fin_images/L.".$FTCH_t->cad_fin_ext;}
				
				else if($FTCH_t->imag_ext!=''){ $imag = "../design_images/S.".$FTCH_t->imag_ext; $imag1 = "../design_images/L.".$FTCH_t->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 ?>" value="<?php echo $FTCH->design_det_id ?>" onclick="cnt_chk_fn(<?php echo $loop ?>),hid_show(),check_ajax(<?php echo $loop ?>,this.value);"/></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 date("d/m/Y", strtotime($FTCH->sel_date));?></td>
            <td align="center" style="display:table-cell;vertical-align:middle;"><?php echo $FTCH_d->master_cat_name." ".$FTCH_t->design_no; ?></td>
		<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_t->master_pieces; ?></td>
			<td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_or->or_cnt; ?></td>
            <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_st->st_cnt; ?></td>
           <td align="center"><div class="body" align="center">
                	<a href="<?php echo $imag1; ?>" title="<?php echo $FTCH_d->master_cat_name." ".$FTCH_t->design_no; ?>" class="lightbox" rel="group"><img src="<?php echo $imag; ?>" width="60" height="60"/></a>
                </div></td>
		   	<td class="center" style="display:table-cell;vertical-align:middle">
           		<input name="remak[<?php echo $loop ?>]" id="remak<?php echo $loop ?>" type="text" class="rem_tx"/>
          		<input name="des_sel_dt[<?php echo $loop ?>]" id="des_sel_dt<?php echo $loop ?>" type="hidden" value="<?php echo date("d/m/Y", strtotime($FTCH->sel_date)); ?>" />
            </td>
           </tr>
            
            <?php
			$loop ++;
		
			 }
			 }
			 ?>
            <?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 } ?>				
            </tbody>
            </table> 
            <input name="des_tot_cnt" id="des_tot_cnt" type="hidden" value="<?php echo $loop-1; ?>" />
             <input name="sel_date" id="sel_date" type="hidden" value="<?php echo $FTCH->sel_date; ?>" />
              <input name="des_id" id="des_id" type="hidden" value="<?php echo $FTCH->design_det_id; ?>" />
			</div>
           </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>
