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

<!--THIS CODE FOR POP UP WINDOW FOR COURIER DETAILS-->
<style type="text/css">
#mask {
	display: none;
	background: #000; 
	position: fixed; left: 0; top: 0; 
	z-index: 10;
	width: 100%; height: 100%;
	opacity: 0.8;
	z-index: 999;
}

.login-popup{
width:210px;
height:350px;
	
	display:none;
	background: #333;
	padding: 10px; 	
	border: 2px solid #ddd;
	float: left;
	font-size: 1.2em;
	position: fixed;
	top: 50%; left: 50%;
	z-index: 99999;
	box-shadow: 0px 0px 20px #999;
	-moz-box-shadow: 0px 0px 20px #999; /* Firefox */
    -webkit-box-shadow: 0px 0px 20px #999; /* Safari, Chrome */
	border-radius:3px 3px 3px 3px;
    -moz-border-radius: 3px; /* Firefox */
    -webkit-border-radius: 3px; /* Safari, Chrome */
}

img.btn_close {
	float: right; 
	margin: -28px -28px 0 0;
}

fieldset { 
	border:none; 
}

form.signin .textbox label { 
	display:block; 
	padding-bottom:7px; 
}

form.signin .textbox span { 
	display:block;
	color:#FFFFFF;
}

form.signin p, form.signin span { 
	color:#999; 
	font-size:11px; 
	line-height:18px;
} 

form.signin input:-moz-placeholder { color:#bbb; text-shadow:0 0 2px #000; }
form.signin input::-webkit-input-placeholder { color:#bbb; text-shadow:0 0 2px #000;  }

.button { 
	background: -moz-linear-gradient(center top, #f3f3f3, #dddddd);
	background: -webkit-gradient(linear, left top, left bottom, from(#f3f3f3), to(#dddddd));
	background:  -o-linear-gradient(top, #f3f3f3, #dddddd);
    filter: progid:DXImageTransform.Microsoft.gradient(startColorStr='#f3f3f3', EndColorStr='#dddddd');
	border-color:#000; 
	border-width:1px;
	border-radius:4px 4px 4px 4px;
	-moz-border-radius: 4px;
    -webkit-border-radius: 4px;
	color:#333;
	cursor:pointer;
	display:inline-block;
	padding:6px 6px 4px;
	margin-top:10px;
	font:12px; 
	width:214px;
}

.button:hover { background:#ddd; }

</style>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript">
//$.noConflict();
$(document).ready(function() {
	$('a.login-window').click(function() {
		
		// Getting the variable's value from a link 
		var loginBox = $(this).attr('href');

		//Fade in the Popup and add close button
		$(loginBox).fadeIn(300);
		
		//Set the center alignment padding + border
		var popMargTop = ($(loginBox).height() + 24) / 2; 
		var popMargLeft = ($(loginBox).width() + 24) / 2; 
		
		$(loginBox).css({ 
			'margin-top' : -popMargTop,
			'margin-left' : -popMargLeft
		});
		
		// Add the mask to body
		$('body').append('<div id="mask"></div>');
		$('#mask').fadeIn(300);
		
		return false;
	});
	
	// When clicking on the button close or the mask layer the popup closed
	$('a.close, #mask').live('click', function() { 
	  $('#mask , .login-popup').fadeOut(300 , function() {
		$('#mask').remove();  
	}); 
	return false;
	});
});
</script>
<script type="text/javascript">
function hid_show_cr(ids,idss)
{
	document.getElementById('hled'+idss).style.display='block';
	
	if(ids==1){ document.getElementById('cour_dr'+idss).style.display='none'; document.getElementById('han_del'+idss).style.display='block'; }else if(ids==2){ 
	document.getElementById('cour_dr'+idss).style.display='block'; document.getElementById('han_del'+idss).style.display='none'; }
}
</script>
<script type="text/javascript">
function fom_validate(fm_no)
{
	if(document.getElementById('corier_ch'+fm_no).checked==true)
	{
		if(document.getElementById('cour'+fm_no).value=='')
		{
			alert('Please Select the Courier Name');  
			document.getElementById('cour'+fm_no).focus();  
			return false; 
		}
		if(document.getElementById('track_id'+fm_no).value=='')
		{
			alert('Please Enter the Tracking ID Name');  
			document.getElementById('track_id'+fm_no).focus();  
			return false; 
		}
		
	}
	else if(document.getElementById('hand_ch'+fm_no).checked==true)
	{
		if(document.getElementById('hnd'+fm_no).value=='')
		{
			alert('Please Select the Employee Name');  
			document.getElementById('hnd'+fm_no).focus();  
			return false; 
		}
		
	}
	
	var letters=/^(0?[1-9]|[12][0-9]|3[01])[\/\-](0?[1-9]|1[012])[\/\-]\d{4}$/;
	if(document.getElementById('date_dl'+fm_no).value=='')
	{
		alert('Please Enter the Delivery Date');  
		document.getElementById('date_dl'+fm_no).focus();  
		return false; 
	}
	else if(letters.test(document.getElementById('date_dl'+fm_no).value)==false)  
	{
		alert('Delivery Date must be in the given Format');  
		document.getElementById('date_dl'+fm_no).focus();  
		return false;  
	}	
	
	var where_to= confirm("Do you really want to Submit the Data?");
	if (where_to== true)
	{
		var cm_name = 'cor'+fm_no;
		return true;
		//document.cm_name.submit();
	}
	else
	{
		return false;	
	}	
}
</script>
<!--THIS CODE FOR POP UP WINDOW FOR COURIER DETAILS-->
<!-- 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>-->
            <li><a href="po_delivery_list.php" id="listpage" title="List Purchase Order Delivery" class="tipN"><img src="images/icons/middlenav/stats.png" alt="" /></a></li>
    	</ul>            
  		<?php
		$po_id	=	base64_decode(base64_decode(base64_decode($_GET['po_id'])));
			$page_id= base64_encode(base64_encode(base64_encode(1))); 
		$identy = $_GET['identy'];
		
		$SLCT_po = "SELECT * FROM po_entry WHERE po_entry_id='$po_id'";
		//echo $SLCT_po;
		$QURY_po = mysqli_query($connect,$SLCT_po);
		$FTCH_po = mysqli_fetch_object($QURY_po);		
		
		$SLCT_tp = "SELECT * FROM party_det WHERE party_det_id = '$FTCH_po->party_det_id'";
		//echo $SLCT_tp;
		$QURY_tp = mysqli_query($connect,$SLCT_tp);
		$FTCH_tp = mysqli_fetch_object($QURY_tp);
		$po_id_en	=	base64_encode(base64_encode(base64_encode($po_id)));			 
		?>

    	<!-- Chart --><!-- 6 + 6 -->
        
        <div class="fluid">
            <div class="widget">
                <div class="formRow">
                    <div class="grid2"><label>PO No:<span class="req"></span></label></div>
                    <div class="grid4"><input type="text" value="<?php echo $FTCH_po->po_no; ?>" name="po_no" id="po_no" readonly="readonly" disabled="disabled"/></div><div class="clear"></div>
                </div>
                
                <?php if($admin_flagg==1){ ?>
                <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 } else if($admin_flagg==2){ ?>
                 <div class="formRow">
                    <div class="grid2"><label>Company Code :<span class="req"></span></label></div>
                    <div class="grid4"><input type="text" value="<?php echo $FTCH_tp->party_code; ?>" name="cmp_nam" id="cmp_nam" readonly="readonly" disabled="disabled"/></div><div class="clear"></div>                
                </div>
                 <?php } ?>
                                
               <?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="tot_admt_cal1();"/></span>--><h6>Delivered 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 check" id="checkAll">
			<thead>
                <tr>
                    <!--<td width="30"><img src="images/elements/other/tableArrows.png" alt="" /></td>-->
                    <th width="35">S.No<span class="sorting" style="display: block;"></span></th>
                    <th width="168">Delivery Date</th>
                    <th width="108">No. of Design</th>
                    <th width="95" align="center">No of Dies</th>
                    <th width="247"><?php if($identy=="img"){ echo "Image"; }else if($identy=="upd"){ echo "Update"; } ?></th>
                    
                    <?php if($admin_flagg==1){ if($identy=="img"){ ?><th width="234">Courier Details </th>
                    <?php } } ?>
                   <!-- <th width="60">Remarks</th>-->   
                </tr>
            </thead>
            <tbody>
            <?php
			$flg= base64_encode(base64_encode(base64_encode(3)));
			$loop = 1;
			$i = 1;
			$SLCT_t = "SELECT * FROM po_delivery WHERE po_entry_id='$po_id' GROUP BY delivery_date ORDER BY po_delivery_id ASC";
			$QURY_t = mysqli_query($connect,$SLCT_t);
			while($FTCH = mysqli_fetch_object($QURY_t))
			{
				$po_id	=	base64_encode(base64_encode(base64_encode($FTCH->po_entry_id)));
				$po_del_id	=	base64_encode(base64_encode(base64_encode($FTCH->po_delivery_id)));
				
				$SLCT_dd = "SELECT IFNULL(SUM(master_pieces),'0') AS tot_pic, COUNT(po_delivery_det_id) AS del_cnt FROM po_delivery_det,design_det WHERE design_det.design_det_id=po_delivery_det.design_det_id AND cancelled ='no' AND po_delivery_id = '$FTCH->po_delivery_id'";
				$QURY_dd = mysqli_query($connect,$SLCT_dd);
				$FTCH_dd = mysqli_fetch_object($QURY_dd);
				
				if($FTCH_dd->del_cnt > 0)
				{
				
				$SLCT_cr = "SELECT * FROM po_del_cour_det WHERE po_delivery_id = '$FTCH->po_delivery_id'";
				$QURY_cr = mysqli_query($connect,$SLCT_cr);
				if(mysqli_num_rows($QURY_cr)>0)
				{
					$FTCH_cr = mysqli_fetch_object($QURY_cr);
					if($FTCH_cr->mas_cour_det_id!=0)
					{
						$quer_id = $FTCH_cr->mas_cour_det_id;
						$track_id = $FTCH_cr->track_id;
						$em_id = '';
						$ds1='block';
						$ds2='none';
					}
					else if($FTCH_cr->emp_det_id!=0)
					{
						$em_id = $FTCH_cr->emp_det_id;
						$ds1='none';
						$ds2='block';
						
					}
					$del_date = $FTCH_cr->del_date;
				}
				else
				{
					$quer_id = '';
					$track_id = '';
					$em_id = '';
					$del_date = '';
				}
				
				$ids = base64_encode(base64_encode(base64_encode($i)));
				$ds="block";
				if($loop%2 != "0")
					$bg = "gradeX";
				else
					$bg = "class='gradeC'";
			?>
                <tr <?php echo $bg ?>>
                   <?php /*?> <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 .",".$FTCH->po_finish_id.",".$FTCH_t->po_entry_det_id ?>" onchange="tot_admt_cal();"/></td><?php */?>
                    <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->delivery_date); ?></td>
                    <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_dd->del_cnt; ?></td>
                    <td align="center" style="display:table-cell;vertical-align:middle"><?php echo $FTCH_dd->tot_pic; ?></td>
                    <td align="center" class="center">
					<?php if($identy=="img"){ ?>
					<a href="des_img_list_pdf.php?po_del_id=<?php echo $po_del_id ?>&flg=<?php echo $flg; ?>&po_id=<?php echo $po_id ?>" target="_blank" class="an_own">Print</a>
					<?php }else if($identy=="upd"){ ?> 
					<a href="po_delivery_upd.php?po_del_id=<?php echo $po_del_id ?>&po_id=<?php echo $po_id ?>" target="_blank" class="an_own">Cancel</a>
					<?php  } ?>					</td>                            
                     <?php if($admin_flagg==1){ if($identy=="img"){ ?><td align="center" class="center"><a href="#login-box<?php echo $i; ?>" class="login-window"><?php if($del_date ==''){ ?>Courier Detail <?php } else{ echo "Delivered"; } ?></a>
					 
					 <div id="login-box<?php echo $i; ?>" class="login-popup">
						<a href="#" class="close"><img src="images/close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>
						  <form name="cor<?php echo $i; ?>" onsubmit="return fom_validate(<?php echo $i; ?>);" method="post" class="signin" action="bl/po_del_cour_det_BL.php?page_id=<?php echo $page_id; ?>&ids=<?php echo $ids; ?>&po_del_id=<?php echo $po_del_id; ?>&po_id=<?php echo $po_id; ?>">
								<fieldset class="textbox">
								
								
								<span style="text-align:left; padding-left:5px;"><strong>Deliver Type</strong></span>
								<?php if($del_date ==''){ ?>
									<div align="left" style="padding-left:5px;">
									<label><input name="tpe[<?php echo $i; ?>]" id="hand_ch<?php echo $i; ?>" type="radio" <?php if($em_id!=''){ ?> checked="checked" <?php } ?> value="1" onclick="hid_show_cr(1,<?php echo $i;?>)" /><font color="#FFFFFF" style="font-size:12px;">Hand</font></label>
									<label><input name="tpe[<?php echo $i; ?>]" id="corier_ch<?php echo $i; ?>" type="radio" <?php if($em_id==''){ ?> checked="checked" <?php } ?> value="2" onclick="hid_show_cr(2,<?php echo $i;?>)" /><font color="#FFFFFF" style="font-size:12px;">Courier</font></label> 
									</div>
								<?php } else{  ?>
									<div align="left" style="padding-left:5px;">
									<?php if($em_id!=''){ ?><label><input name="tpe[<?php echo $i; ?>]" id="hand_ch<?php echo $i; ?>" type="radio"  checked="checked"  value="1" onclick="hid_show_cr(1,<?php echo $i;?>)" /><font color="#FFFFFF" style="font-size:12px;">Hand</font></label><?php } else {?>
									<label><input name="tpe[<?php echo $i; ?>]" id="corier_ch<?php echo $i; ?>" type="radio" checked="checked"  value="2" onclick="hid_show_cr(2,<?php echo $i;?>)" /><font color="#FFFFFF" style="font-size:12px;">Courier</font></label> <?php } ?>
									</div>
								<?php } ?>
								<div id="hled<?php echo $i; ?>"><!--THIS IS HOLE DIVE HIDE SHOW WHEN OPENING THE POP UP STARTS HERE-->
								
								<?php if($em_id==''){ ?>
								<div id="cour_dr<?php echo $i; ?>" style="display:<?php echo $ds1; ?>"> <!--THIS IS FOR COURIER DETAILS STARTS HERE-->
								
								<label class="username">
								<span style="text-align:left; padding-left:5px;"><strong>Courier Name</strong></span>
							   <select name="cour[<?php echo $i; ?>]" id="cour<?php echo $i; ?>" style="width:200px;"> 
							   <option value="">Select</option>
							   <?php
							   if($quer_id!='')
							   {
							   		$SLCT_m = "SELECT * FROM mas_cour_det WHERE mas_cour_det_id='$quer_id'";
							   }
							   else
							   {
							   	 	$SLCT_m = "SELECT * FROM mas_cour_det WHERE statu_s='active'";
							   }
								$QURY_m = mysqli_query($connect,$SLCT_m);
								while($FTCH_m = mysqli_fetch_object($QURY_m))
								{
							   ?>
							   <option <?php if($quer_id == $FTCH_m->mas_cour_det_id){ ?> selected="selected" <?php } ?> value="<?php echo $FTCH_m->mas_cour_det_id; ?>"><?php echo $FTCH_m->cour_name; ?></option>
							   <?php } ?>
							   </select>
								</label>
								
								<label class="password">
								<span style="text-align:left; padding-left:5px;"><strong>Track Id</strong></span>
								<input id="track_id<?php echo $i; ?>" name="track_id[<?php echo $i; ?>]" value="<?php echo $track_id; ?>" <?php if($track_id!=''){ ?> readonly="" <?php } ?> type="text" style="width:200px;">
								</label>					
										
								</div><!--THIS IS FOR COURIER DETAILS ENDS HERE-->
								<?php } ?>
								 
								<?php /*?><?php if($em_id!=''){ $ds="block"; ?><?php */?>
								<div id="han_del<?php echo $i; ?>" style="display:<?php echo $ds2; ?>"><!--THIS IS FOR HAND DELIVERY DETAILS STARTS HERE-->
								
								<label class="username">
								<span style="text-align:left; padding-left:5px;"><strong>Delivered Person</strong></span>
							   <select name="hnd[<?php echo $i; ?>]" id="hnd<?php echo $i; ?>" style="width:200px;"> 
							   <option value="">Select</option>
							   <?php
							   if($em_id!='')
							   {
							   		$SLCT_m = "SELECT * FROM emp_det WHERE key_person='yes' AND emp_det_id='$em_id'";
							   }
							   else
							   {
							   	 	$SLCT_m = "SELECT * FROM emp_det WHERE key_person='yes' AND statu_s='active'";
							   }
								$QURY_m = mysqli_query($connect,$SLCT_m);
								while($FTCH_m = mysqli_fetch_object($QURY_m))
								{
							   ?>
							   <option <?php if($em_id == $FTCH_m->emp_det_id){ ?> selected="selected" <?php } ?> value="<?php echo $FTCH_m->emp_det_id; ?>"><?php echo $FTCH_m->name; ?></option>
							   <?php } ?>
							   </select>
								</label>
								</div> <!--THIS IS FOR HAND DELIVERY DETAILS ENDS HERE-->
								<?php /*?><?php } ?><?php */?>
								
								<label class="password">
								<span style="text-align:left; padding-left:5px;"><strong>Delivery Date ( dd/mm/yyyy )</strong></span>
								<input id="date_dl<?php echo $i; ?>" name="date_dl[<?php echo $i; ?>]" value="<?php echo $del_date; ?>" <?php if($del_date!=''){ ?> readonly="" <?php } ?> type="text" style="width:200px;">
								</label>
								
								<?php if($del_date==''){ ?><button class="submit button" type="submit" onclick="">Submit</button><?php } ?>
								
								</div> <!--THIS IS HOLE DIVE HIDE SHOW WHEN OPENING THE POP UP ENDS HERE-->							
								</fieldset>
						  </form>
						</div>
					 
					 
					 </td><?php } } ?>
                </tr>
            <?php
            	$loop ++;	
				$i++;					
				}
				
			}
			?>
            </tbody>
            </table> 
        </div>
        </div>    
       
        <?php /*?> <?php if(mysqli_num_rows($QURY)>0){ ?>
        <div class="fluid">
		<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="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 } ?>  <?php */?>
       
       
      
        
        <div class="fluid"><!-- Media table --></div>
        
        
        
    </div>
    <!-- Main content ends -->
    
</div>
<!-- Content ends -->
<?php /*?><?php include "header_footer/footer.php"; ?><?php */?>


</body>
</html>
