<head>
<link rel="stylesheet" href="css/jquery.ui.all.css">
	<script src="js/jquery-1.5.1.js"></script>
	<script src="ui/jquery.ui.core.js"></script>
	<script src="ui/jquery.ui.widget.js"></script>
	<script src="ui/jquery.ui.datepicker.js"></script>
	<script type="text/javascript" src="js/dynamicRow.js"></script>

<script>
	$(function() {
		$( "#datepicker" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true
		});
	});
	</script>
	<script>
	$(function() {
		$( "#datepicker1" ).datepicker({
			showOtherMonths: true,
			selectOtherMonths: true
		});
	});
	</script>
	
	
	
<script>
function valdate()
{
  
  var str1 = document.getElementById("MRNdate").value;
  var str2 = document.getElementById("Billdate").value;
  var date1 = str1.split('/');
  var compstr1 = date1[2]+date1[1]+date1[0];

  var date2 = str2.split('/');
    var compstr2 = date2[2]+date2[1]+date2[0];

 if(compstr1 >compstr2)
 {
 	alert("Please Choose Correct Date");
	document.getElementById("Billdate").focus();
	return false;
 }
 
}

function inwardvalidate()
{
  
  var str1 = document.getElementById("MRNdate").value;
  var str3 = document.getElementById("inwarddate").value;
  var date1 = str1.split('/');
  var compstr1 = date1[2]+date1[1]+date1[0];

  var date3 = str3.split('/');
    var compstr3 = date3[2]+date3[1]+date3[0];

 if(compstr1 >compstr3)
 {
 	alert("Date Not Less MRN Date.");
	document.getElementById("inwarddate").focus();
	return false;
 }
 
}

</script>
<script>
function LRdate()
{
  var str1 = document.getElementById("MRNdate").value;
  var str2 = document.getElementById("lrdate").value;
  var date1 = str1.split('/');
  var compstr1 = date1[2]+date1[1]+date1[0];

  var date2 = str2.split('/');
  var compstr2 = date2[2]+date2[1]+date2[0];

 if(compstr1 >compstr2)
 {
 	alert("Date Not Less MRN Date.");
	document.getElementById("lrdate").focus();
	return false;
 }
}
</script>	


</head>
	

<link rel="stylesheet" type="text/css" href="script/tabcontent.css" />

<script type="text/javascript">
function showbalance(str)
{
     
    var StockBalance=document.getElementById("stockbal").value;	
	var Issuequantity=document.getElementById("issueqty").value;	
	var RemaningBalance =StockBalance-Issuequantity;
	document.getElementById('remaningbalance').value =RemaningBalance;
	
}

</script>
<script language="javascript">
 var xmlHttp
function showsitename(str)
{ 
 
   xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="sitename.php";
	url=url+"?site_name="+str;
	xmlHttp.onreadystatechange=change1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function change1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	   document.getElementById("txtsite").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
</script>
<?php

$PageSecurity = 4;
ob_start();
include('includes/DefinePOClass.php');
include('includes/session.inc');
if (isset($_GET['ModifyOrderNumber']) and $_SESSION[UserStockLocation]== "HO")  {
	$title = _('Modify Purchase Order') . ' ' . $_GET['ModifyOrderNumber'];
} else {
	//$title = _('Add Issue Slip');

}
/*echo "<pre>"; print_r($_SESSION); 
die;*/


  $title = _(' Update Material Receipt Note');


include('includes/header.inc');

/*
 $time = date('h:i:s A');

  echo "$time";*/

$time = date('G:ia');
$date = date($_SESSION['DefaultDateFormat']);
//include('includes/SQL_CommonFunctions.inc');

/*If the page is called is called without an identifier being set then
 * it must be either a new order, or the start of a modification of an
 * order, and so we must create a new identifier.
 * 
 * The identifier only needs to be unique for this php session, so a 
 * unix timestamp will be sufficient.
 */
 
  /*$date1=date('M-Y');
  $date2=date('Y-m-d');*/
 
		if (empty($_GET['identifier'])) {
			 $identifier=date('U');
		} else {
			 $identifier=$_GET['identifier'];
			
		}
		
		/*Page is called with NewOrder=Yes when a new order is to be entered
		 * the session variable that holds all the PO data $_SESSION['MR'][$identifier] 
		 * is unset to allow all new details to be created */
		///////////////////////////////////////////// Add IUssue Slip  Form  By Amit Kumar////////////////////////////////////////
		 $date = date($_SESSION['DefaultDateFormat']);
		 
		 
if(isset($_REQUEST['orderno']) && $_REQUEST['orderno']!="" && isset($_REQUEST['mrnid']) && $_REQUEST['mrnid']!="")
{	 
		 
if(isset($_POST['Update']))
{
	//echo "<pre>";print_r($_POST); 	
	$_POST['PRDate']=Date($_SESSION['DefaultDateFormat']);
	$_POST['DatePrinted']=Date($_SESSION['DefaultDateFormat']);
	ConvertSQLDate($_SESSION['MR'.$identifier]->Orig_OrderDate);
	$Billdate = $_POST['Billdate'];
	$expl =explode('/',$Billdate);
	$Billdatesav = $expl['1']."/".$expl['0']."/".$expl['2'];
	$inwarddate = $_POST['inwarddate'];
	$inwardexplode = explode('/',$inwarddate);	
	$inwardate_save = $inwardexplode[1]."/".$inwardexplode[0]."/".$inwardexplode[2];
	$qty=$_REQUEST['itemcode'];
	$qty1=count($qty);
    $sql = "UPDATE addMRN SET `MRNNo`='".$_POST['MRNno']."', 
								    `MRNDate`='".FormatDateForSQL($_POST['MRNdate'])."', 
								    `MaterialReceiptOnBasis`='".$_POST['matrialreceipt']."', 
								    `OrderFromSite`='".$_POST['sitecode']."', 
								    `StoreCode`='".$_POST['storecode']."',
									`StoreName`='".$_POST['storename']."', 
									`PO/WO/MTO`='".$_POST['PO']."', 
									 `OrderDate`='".FormatDateForSQL($_POST['orderdate'])."', 
									 `ReceivedFrom`='".$_POST['stocktype']."', 
									 `R.M.R.SNo`='".$_POST['rmrsno']."', 
									 `DocumentType`='".$_POST['radiobutton']."', 
									 `BillNo`='".$_POST['billno']."', 
									 `BillDate`='".FormatDateForSQL($Billdatesav)."', 
									 `GetPassNo`='".$_POST['gatepassno']."', 
									 `Inwardsdate`='".FormatDateForSQL($inwardate_save)."', 
									 `Transp_name`='".$_POST['transport']."', 
									 `VehicleNo`='".$_POST['vehicalno']."', 
									 `TimeIn`='".$_POST['timein']."', 
									 `Timeout`='".$_POST['timeout']."', 
                                     `LRno`='".$_POST['lrno']."',
                                     `LRdate`='".FormatDateForSQL($_POST['lrdate'])."',
									 `TotalWeight`='".$_POST['total_weight']."', 
									 `RemarksIfAny`='".$_POST['RemarksIfAny']."', 
                                     `Remarks`='".$_POST['remark']."',
									 `createdby`='".$_SESSION[UserID]."',
									 `mrnstatus`='".Pending."',
									 `site_name`='".$_POST['sitename']."' 
									  Where `id`='".$_GET['mrnid']."'";
										
          	 	$ErrMsg = _('An error occurred Record Note Save') . '. ' . _('The error says');
				$insertResult = DB_query($sql,$db,$ErrMsg);
			    $swp_sql ="select id from addmrnqty Where issue_id='".$_GET['mrnid']."'";
				$resdu =DB_query($swp_sql,$db);
				$i=1;
				 while($mycol = DB_fetch_array($resdu))
				    {	
					
			     $sql = "UPDATE addmrnqty SET
						`itemcode`='".$_REQUEST['itemcode'][$i]."', 
						`desc`='".$_POST['desc'][$i]."', 
						`Make`='".$_POST['make'][$i]."', 
						`Color`='".$_POST['color'][$i]."', 
						`Gread`='".$_POST['gread'][$i]."', 
						`UOM`='".$_POST['uom'][$i]."', 
						`Qcrequd`='".$_POST['qcreqd'][$i]."', 
						`itemprice`='".$_POST['itemrate'][$i]."',
						`POQty`='".$_POST['poqty'][$i]."' 
						 Where id ='".$mycol['id']."'";					
					   	$ErrMsg = _('An error occurred Record Note Save') . '. ' . _('The error says');
				      	$insertResult = DB_query($sql,$db,$ErrMsg);
				 
				 $i++;
					 if($insertResult == true)
					 {
					  header('location:MaterialReceiptNote.php?NewOrder=Yes');
					 }
					 }
  			}
	}

  $mrnid = $_REQUEST['mrnid'];
  $sql = "SELECT * From addmrn Where `id`='".$_GET['mrnid']."'";
  $Selectresult     = DB_query($sql, $db);
  $Myresultrow      = DB_fetch_array($Selectresult);
  $sitecode         = $Myresultrow['OrderFromSite'];
  $ReceivedAgainst  = $Myresultrow['ReceivedAgainst'];
  $storecade        = $Myresultrow['StoreCode'];
  $materialre       = $Myresultrow['MaterialReceiptOnBasis'];
  $Transp_name      = $Myresultrow['Transp_name'];
  $Remarks          = $Myresultrow['Remarks'];
  
  
 ?>
 
<form name="form1"  action="" method="post">
<table width="100%" border="2" cellspacing="0" cellpadding="0">

  <tr>
    <td height="40" colspan="5" align="center" bgcolor="#999999"> <div align="center"><b><font color="#FFFFFF"><?php echo $title; ?></font></b></div> </td>
  </tr>
  <tr>
    <td height="20" colspan="5" align="center" bgcolor="#999999"> <div align="Left"><b><font color="#FFFFFF">General Details</font></b></div> </td>
  </tr>
  
  <tr>
    <td height="24">MRN.No.</td>
    <td height="24" colspan="2"><input type="text" name="MRNno" id="MRNno" readonly="readonly" size="30"  value="<?php echo $Myresultrow['MRNNo']; ?>"/></td>
    <td height="24">MRN. Date </td>
    <td height="24"  class="demo"><input type="text" name="MRNdate" id="MRNdate"  value="<?php echo ConvertSQLDate($Myresultrow['MRNDate']); ?>" /></td>
  </tr>
  <tr>
    <td>Received Against</td>
    <td colspan="2">
	      <select name="receiviedagaist">
          <option value="">Select</option>
		  <option value="Direct">Direct</option>
		  <option value="Purchase Order" selected="selected" >Purchase Order</option>
		  <option value="Against PC Material" >Against PC Material</option>
		  <option value="Against Client Material" >Against Client Material</option>
		  <option value="Against Material Shiffting Record" >Against Material Shiffting Record</option>
		  <option value="Against Work Order">Against Work Order</option>
		  
		 
        </select></td>
    <td>Material Receipt On Basis</td>
    <td>
	<select name="matrialreceipt">
<option value="">Select</option>
<option value="cash" <?php if($materialre =='cash'){ echo "Selected"; } ?>>Cash</option>
<option value="credit" <?php if($materialre =='credit'){ echo "Selected"; } ?>>Credit</option>
        </select>		</td>
  </tr>
  <tr>
    <td width="16%">Order From Site</td>
    <td width="16%">
	<?php
	    $sql = 'SELECT loccode, locationname FROM locations';
		$resultStkLocs = DB_query($sql,$db);
		?>
		<select name="sitecode" onchange="showsitename(this.value);" >
		<?php 
			while ($myrow=DB_fetch_array($resultStkLocs))
				{
				?>
				<option Value="<?php echo $myrow['loccode']; ?> <?php if($myrow['loccode']==$sitecode){ echo "Selected";} ?>"><?php echo $myrow['loccode'];?></option>
		     
			 <?  }	?>
		</select>	 	</td>
    <td width="17%" id="txtsite" ><input type="text" name="sitename" id="sitename"  value="<?php echo $Myresultrow['site_name']; ?>"></td>
    <td width="21%">Store Code/Name </td>
    <td width="30%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="39%">	
		
		<?php
	     $sql_store = 'select StoreCode, StoreName from storetype Order BY ID ASC';
		 $resultStkLocs = DB_query($sql_store,$db);
		?>
		<select name="storecode" onChange="changestorename(this.value)">
		<?php 
		while ($myrow=DB_fetch_array($resultStkLocs))
				{
				?>
				
				<option Value="<?php echo $myrow['StoreCode']; ?> <?php if($myrow['StoreCode']==$storecade){ echo  "Selected"; }  ?>"><?php echo $myrow['StoreCode']; ?></option>
					<?
				}
		
		?>
		</select>			</td>
        <td width="61%" id="txtid"><input type="text" name="storename" id="storename" value="<?php echo $Myresultrow['StoreName']; ?>"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>PO/WO/MTO Ref # </td>
    <td colspan="2"><?php 
if($_REQUEST['type']=='PO')
{
$sql="select orderno from purchorders Where Po_recive_status='Pending'";
$result = DB_query($sql,$db);
?>
<select name="select" id="PurchaseOrder" onchange="PurchaseOrderNumber();" >
  <?php  
while($myrow=DB_Fetch_array($result))
{
?>
  <option value="<?php echo $myrow['orderno']; ?>" <?php if($myrow['orderno']==$Ordernumber) { echo "Selected";  }  ?>><?php echo $myrow['orderno']; ?> </option>
  <?php }  ?>
</select>
<?php } else { ?>
<select name="selt" id="selt" >

<option value="" >Select </option>
</select>
<?php } ?></td>
    <td>Order Date </td>
    <td><input type="text" name="orderdate" id="orderdate" value="<?php echo ConvertSQLDate($Myresultrow['OrderDate']); ?>"></td>
  </tr>
  
  <tr>
    <td>Received From </td>
    <td colspan="2">
		<select name="stocktype">
		 <option value="" selected="selected">Select </option>
		</select></td>
    <td>R.M.R.S No. </td>
    <td><label>
      <input name="rmrsno" type="text" id="rmrsno" value="<?php echo $Myresultrow['R.M.R.SNo'];?>"/>
    </label></td>
  </tr>
  <tr>
    <td colspan="5"><table width="100%" border="1" cellspacing="0" cellpadding="0">
     
      <tr>
        <td width="13%">Document Type</td>
        <td width="12%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="25%"><input name="radiobutton" type="radio" value="Challan" checked="checked" /></td>
            <td width="33%">Challan</td>
            <td width="15%"><input name="radiobutton" type="radio" value="Bill" /></td>
            <td width="27%">Bill</td>
          </tr>
        </table></td>
        <td width="5%">No.</td>
        <td width="6%"><input name="billno" type="text" id="billno" size="12" value="<?php echo $Myresultrow['BillNo'];?>" /></td>
        <td width="4%">Date</td>
        <td width="9%"><input type="text" name="Billdate"size="15" id="datepicker" onblur="valdate();" value="<?php echo ConvertSQlDate($Myresultrow['BillDate']);?>"  /></td>
        <td width="15%">Inwards Get Pass No. </td>
        <td width="9%"><input type="text" name="gatepassno"size="15" value="<?php echo $Myresultrow['GetPassNo'];?>"></td>
        <td width="3%">Date</td>
        <td width="24%"><input name="inwarddate" type="text" id="datepicker1" size="15" value="<?php echo ConvertSQlDate($Myresultrow['Inwardsdate']);?>" onblur="inwardvalidate();"></td>
      </tr>
	   <tr>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td colspan="3" rowspan="6"><textarea name="RemarksIfAny" cols="30" rows="6" id="RemarksIfAny"><?php echo $Myresultrow['RemarksIfAny']; ?></textarea></td>
	     </tr>
	   <tr>
        <td>Transporter </td>
        <td>
		<?php  
		 $sql_trans = 'select supplierid, suppname from suppliers Where dgroup="Transporter"';
		 $resulttransp = DB_query($sql_trans,$db);
		  ?>
		<select name="transport">
		 <?php 
		while ($myrow=DB_fetch_array($resulttransp))
				{
				?>
			   <option Value="<?php echo $myrow['supplierid']; ?> <?php  if($myrow['supplierid']==$Transp_name){ echo "Selected"; } ?>"><?php echo $myrow['suppname']; ?></option>
				<?
				}
	        	?>
		</select>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>Remarks If Any </td>
        </tr>
      
       <tr>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
         <td>&nbsp;</td>
       </tr>
       <tr>
        <td>Vehicle No </td>
        <td><input name="vehicalno" type="text" id="vehicalno" size="12" value="<?php echo $Myresultrow['VehicleNo']; ?>"/></td>
        <td>Time In </td>
        <td><input name="timein" type="text" id="timein" size="12" value="<?php echo $Myresultrow['TimeIn']; ?>" /></td>
        <td> Out </td>
        <td><input name="timeout" type="text" id="timeout" size="12" value="<?php echo $Myresultrow['Timeout'];?>" onblur="Comparetime();" /></td>
        <td>&nbsp;</td>
        </tr>
	   <tr>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     <td>&nbsp;</td>
	     </tr>
	   <tr>
         <td>L.R.no.</td>
         <td><input name="lrno" type="text" id="lrno" size="12" value="<?php echo $Myresultrow['LRno'];?>"/></td>
         <td>L.R.Date</td>
         <td><input name="lrdate" type="text" id="lrdate" size="12" value="<?php echo ConvertSQLDate($Myresultrow['LRdate']); ?>"  onblur="LRdate();"/></td>
         <td>&nbsp;</td>
         <td>Total Weight </td>
         <td><input type="text" name="total_weight" id="total_weight" value="<?php echo $Myresultrow['TotalWeight']; ?>" /></td>
         </tr>
    </table></td>
  </tr>
  
  <tr>
    <td colspan="5" bgcolor="#999999"><b><font color="#FFFFFF">Item Details</font></b> </td>
  </tr>
   <tr>
     <td colspan="5"><table width="100%" border="1" cellspacing="0" cellpadding="0" >
  <tr>
  <td width="20%">Item Code</td>
    <td width="16%">Description</td>
    <td width="9%">Make</td>
    <td width="9%">Color</td>
    <td width="9%">Grade</td>
    <td width="8%">UOM</td>
    <td width="6%">QC Requd  </td>
    <td width="8%">Receive Qty</td>
    <td width="7%">PO Qty</td>
    <td width="8%">Item Rate </td>
  </tr>
   <tr>

     <td colspan="10"><div style="float:left">
	<!-- <input type="button" class="crmbutton small delete"  onclick="addRow('dataTable')" value="Add" />&nbsp;
	 <input type="button" class="crmbutton small delete"  onclick="deleteRow('dataTable')" value="Delete" />-->
	 </div>	 </td>
     </tr>
    <tr>
 <td colspan="10"><table width="100%" border="2" cellspacing="0" cellpadding="0">
 <?php 
         $update_sql ="select * from addmrnqty WHERE order_no='".$_REQUEST['orderno']."'";
		  $updateSqlresult=DB_query($update_sql, $db);
		  $i=0;
		  while($Itemrow =DB_fetch_array($updateSqlresult))
		  {
			 $make= $Itemrow['Make'];
			 $Color= $Itemrow['Color'];
			 $Gread= $Itemrow['Gread'];
			 $UOM= $Itemrow['UOM'];
?>
 <tbody id="dataTable">
 <tr>
     <td width="4%"><input type="checkbox" name="chk" /></td>
	 <td width="3%"><input type="hidden" value="" id="user_shipping" name="user_shipping[]"></td>
	 <td width="5%"><input type="button" name="profile_popup" value="+" id="profile_popup"  onclick="openPopupProfile(this.id);" /> </td>
     <td width="12%"><input type="text" tabindex=""  readonly="" id="washing_profile" name="itemcode[]"size="15" onblur="PO_order(this.value)" 
	 value="<?php echo $Itemrow['itemcode'] ?>" />
	 <input type="hidden" name="orderno"  id="orderno" onblur="PO_order(this.value)"  value="<?php echo $_REQUEST['orderno'];?>" />	 </td>
     <td width="17%"><input type="text" name="desc[]"   id="desc" size="25" value="<?php echo $Itemrow['desc'] ?>"/></td>
     <td width="10%">
	 <select name="make[]" id="" >
	 <option name ="">select</option>
	 <?php  $rs=DB_query("select * from product_manufacture", $db);
     while($row=DB_fetch_assoc($rs)) 
	{
     ?>
	  <option name ="<?php echo $row['manufacturer'];?>" <?php if($row['manufacturer'] ==$Itemrow['Make']){ echo "Selected"; }   ?>><?php echo $row['manufacturer'];?></option>
	 <?php } ?>
	 </select></td>
     <td width="10%"> <select name="color[]" id="" >
	 <option name ="">select</option>
	 <?php  $rs=DB_query("select * from product_color", $db);
     while($row=DB_fetch_assoc($rs)) 
	{
     ?>
	  <option name ="<?php echo $row['color'];?>"  <?php if($row['color'] ==$Itemrow['Color']){ echo "Selected"; }   ?>><?php echo $row['color'];?></option>
	 <?php } ?>
	 </select></td>
     <td width="10%"> <select name="gread[]" id="" >
	 <option name ="">select</option>
	  <?php  $rs=DB_query("select * from product_grade", $db);
     while($row=DB_fetch_assoc($rs)) 
	{
     ?>
	  <option name ="<?php echo $row['grade'];?>"  <?php if($row['grade'] ==$Itemrow['Gread']){ echo "Selected"; }   ?>><?php echo $row['grade'];?></option>
	 <?php } ?>
	 </select></td>
     <td width="8%"> <select name="uom[]" id="">
	 <option name ="">select</option>
	  	<?php  $rs=DB_query("Select unitid,unitname from unitsofmeasure", $db);
		 while($row=DB_fetch_assoc($rs)) 
		{
     	?>
	 <option name ="<?php echo $row['unitname'];?>"  <?php if($row['unitname'] ==$Itemrow['UOM']){ echo "Selected"; }   ?>><?php echo $row['unitname'];?></option>
	   <?php } ?>
	   	 </select></td>
		
     <td width="7%" align="center"><input name="qcreqd[]" type="text" id="" value="<?php echo $Itemrow['Qcrequd'];?>"  size="10"/></td>
     <td width="8%" align="center"><input name="reciveqty[]" type="text" id="" value="<?php echo $Itemrow['reciveqty'];?>"  size="10"/></td>
     <td width="6%" align="center" ><input name="poqty[]" type="text" id="" value="<?php echo $Itemrow['POQty'];?>" size="10"/></td>
	 <td width="6%" align="center" ><input name="itemrate[]" type="text" id="" value="<?php echo $Itemrow['itemprice'];?>" size="10"/></td>
     </tr>
	 </tbody>
 <?php $i++; }  ?>
 <input type="hidden" name="countval" value="<?php echo $i; ?>" />

 </table></td>
  </tr>
  
  
     <tr><td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td>&nbsp;</td>
     <td colspan="3">&nbsp;</td>
     </tr>
  </table></td>
   </tr>
  <tr>
    <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="10"  bgcolor="#999999"><b><font color="#FFFFFF">Other Details</font> </b></td>
        </tr>
    </table></td>
    </tr>
   <tr>
     <td>&nbsp;</td>
     <td colspan="4">&nbsp;</td>
   </tr>
   <tr>
     <td colspan="5"><table width="100%" border="0" cellspacing="0" cellpadding="0">
       <tr>
         <td width="63%" valign="top"><table width="100%" border="1" cellspacing="0" cellpadding="0">
           <tr bgcolor="#999999">
             <td width="4%">&nbsp;</td>
             <td width="14%"><div align="center"><b><font color="#FFFFFF">Charges</font></b></div></td>
             <td width="19%"><div align="center"><b><font color="#FFFFFF">Inclusive/Exclusive </font></b></div></td>
             <td width="23%"><div align="center"><b><font color="#FFFFFF">Percentage/Actual</font></b></div></td>
             <td width="23%"><div align="center"><b><font color="#FFFFFF">Percentage</font></b></div></td>
             <td width="17%"><div align="center"><b><font color="#FFFFFF">Amount</font></b></div></td>
           </tr>
		    <?php 
		  $sql = "select * from po_charge Where Orderno ='".$_GET['orderno']."' AND charges!='0'";
		  $Sqlresult=DB_query($sql, $db);
	      $noofrow =DB_num_rows($Sqlresult);
		  if($noofrow>0)
		  {
		  $i=1;
		  while($myrow=DB_fetch_array($Sqlresult))
		  {  
		   
			?>
          <tr>
             <td align="center"><div align="center"><?php echo $i; ?></div></td>
             <td align="center">
               <div align="center"><?php echo $myrow['ch_name']; ?></div></td>
             <td align="center"><div align="center"><?php echo $myrow['Inclusive']; ?></div></td>
             <td align="center"><div align="center"><?php echo $myrow['As_Per_Actual']; ?></div></td>
             <td align="center"><div align="center"><?php echo $myrow['charges']; ?></div></td>
             <td align="center"><div align="center"><?php echo $myrow['charges_Amount']; ?></div></td>
           </tr>
		  <?php $i++; } } else {?>
           <tr>
             <td>&nbsp;</td>
             <td colspan="5"><div align="center"><strong><font color="#FF0000">Charges Not Found</font></strong></div></td>
             </tr>
         <?php } ?>
           <tr>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
             <td>&nbsp;</td>
           </tr>
         </table></td>
         <td width="37%" valign="top"><table width="100%" border="1" cellspacing="0" cellpadding="0">
		 <?php 
		  $grand_sql = "select * from addmrn where order_no='".$_GET['orderno']."'";
		  $Grandresult=DB_query($grand_sql, $db);
		  $my_row=DB_fetch_array($Grandresult);
		  ?>
           <tr>
             <td width="43%" bgcolor="#999999"><div align="center"><b><font color="#FFFFFF">Item Amount</font></b></div></td>
             <td width="57%"><label>
               <input name="itemamount" type="text" id="itemamount" size="30" value=" <?php echo $my_row['Item Amount']; ?>" />
             </label></td>
           </tr>
           <tr>
             <td bgcolor="#999999"><div align="center"><b><font color="#FFFFFF">Charge Amount</font></b></div></td>
             <td><input name="chargeamount" type="text" id="chargeamount" size="30" value=" <?php echo $my_row['Charge_Amount']; ?>" /></td>
           </tr>
           <tr>
             <td bgcolor="#999999"><div align="center"><strong><font color="#FFFFFF">Grand Total </font></strong></div></td>
             <td><input name="grandtatal" type="text" id="grandtatal" size="30"  value=" <?php echo $my_row['grandtotal']; ?>"/></td>
           </tr>
         </table></td>
       </tr>
       
     </table></td>
    </tr>
   <tr>
     <td>&nbsp;</td>
     <td colspan="4">&nbsp;</td>
   </tr>
   <tr>
    <td>Remarks </td>
    <td colspan="4"><textarea name="remark" cols="100" rows="3" id="remark"><?php echo $Remarks; ?></textarea></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td colspan="2" align="right"> <div align="right"><input type="submit" name="Update" value="update"> </div>    </td>
    <td><input type="reset" name="Submit2" value="Cancel" onclick="javascript:history.go(-1)"></td>
    <td>&nbsp;</td>
  </tr>
</table>

</form>

 <?
include('includes/footer.inc');
?>


<script type="text/javascript">

var countries=new ddtabcontent("countrytabs")
countries.setpersist(true)
countries.setselectedClassTarget("link") //"link" or "linkparent"
countries.init()

</script>
<script language="javascript">
 var xmlHttp
function changestorename(str)
{ 
 
 // alert('hi');
   xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		  {
		    alert ("Your browser does not support AJAX!");
		    return;
		  } 
	var url="storename.php";
	url=url+"?store_code="+str;
	//alert(url);
	//url=url+"&sid="+Math.random();
	xmlHttp.onreadystatechange=NumberChanged1;
	xmlHttp.open("GET",url,true);
	xmlHttp.send(null);
}
function NumberChanged1() 
{ 
	if (xmlHttp.readyState==4)
	{ 
	   document.getElementById("txtid").innerHTML=xmlHttp.responseText;
	}
}
function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	  {
	  // Firefox, Opera 8.0+, Safari
	  xmlHttp=new XMLHttpRequest();
	  }
	catch (e)
	  {
	  // Internet Explorer
	  try
		{
		xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
	  catch (e)
		{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	  }
	return xmlHttp;
}
</script>
<script>
function openPopupProfile(i)
				{
		window.open("issu_searchpopup.php?rowcount="+i,"profiles_popup_window","height=425,width=640,toolbar=no,menubar=no,dependent=yes,resizable =no");
	}



</script>