<?php ob_start();
$PageSecurity = 4;
$PageName = 'MaterialReceiptNote';
include('includes/DefinePOClass.php');
include('includes/session.inc');
include('includes/SQL_CommonFunctions.inc');
include('includes/function_lib.php');
if (isset($_GET['ModifyOrderNumber']) and $_SESSION[UserType]=='SuperAdmin')  {
$title = _('Modify Purchase Order') . ' ' . $_GET['ModifyOrderNumber'];
} else {
}
if(isset($_GET['issueid'])  && isset($_GET['issueid']) !=''){
$title = _('Update Issue Slip');
}
else{
$title = _('Add Material Receipt Note');
}
include('includes/header.inc');
?>
<link rel="stylesheet" href="css/jquery.ui.all.css">
<link rel="stylesheet" type="text/css" href="script/tabcontent.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 src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js"></script>
<script src="js/tax_calculation.js"></script>
<script src="js/add_mrn.js"></script>
  <!--  To display calender ---->
<script type="text/javascript">
</script>
<form action="" method="post">
<table width="100%" height="442" border="0" cellpadding="2" cellspacing="1">
<tr>
<td height="202"><table width="100%" border="0" cellspacing="1" cellpadding="2" align="center">
  <tr>
  <th colspan="6" align="center"><strong>GENERAL DETAILS</strong></th>
  </tr>
  <tr>
    <th width="18%" scope="row"><strong>Mrn No. </strong></th>
    <td colspan="2"><input type="text" value="" size="35" name="MRNNo"></td>
    <th width="23%"><strong>MRN Date </strong></th>
    <td colspan="2"><input type="text" name="MRNdate" value="" id="MRNdate" class="datepicker"></td>
  </tr>
  <tr>
    <th height="29" scope="row"><strong>Site Code - Name </strong></th>
    <td width="8%"><select name="sitecode" onchange="showsitename(this.value)" tabindex="9" >
      <option value="000">---Select---</option> 
	  <?php 
	$sql = 'SELECT loccode, locationname FROM locations';
	$resultStkLocs = DB_query($sql,$db);
	  while ($myrow=DB_fetch_array($resultStkLocs))
	  {
	  	$p='';
	  	if($myrow['loccode']==$_REQUEST['sitecode'])
	  	$p="selected";
 		?>
	  <option value="<?php echo $myrow['loccode']; ?>" <?php echo $p; ?>><?php echo $myrow['loccode'];?></option>
      <?php  }	?>
    </select></td>
    <td width="23%">
	<?php 
	$sql="Select loccode, locationname from locations Where loccode ='".$_REQUEST['sitecode']."'";
	$result = DB_query($sql,$db);
	$myrow=DB_Fetch_array($result);
	$sitenamelocat =$myrow['locationname'];
	if(isset($_REQUEST['sitecode'])){?>
	<input type="text" name="sitename" id="sitename"  value="<?php echo $sitenamelocat?>" tabindex="10" >
	<?php }else{
	?>
	<input type="text" name="sitename" id="sitename" readonly="true" tabindex="10">
	<?php } ?>	
	</td>
    <th><strong>Srore Code - Name </strong></th>
    <td width="10%"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
		<td width="39%">	
		<?php
		$sql_store = "select StoreCode, StoreName from storetype where Store_Site='".$_GET['sitecode']."' ";
		$resultStkLocs = DB_query($sql_store,$db);
		?>
		<select name="storecode" onChange="changestorename(this.value)"  tabindex="12">
		<option value="000">Select</option> 
		<?php 
		while ($myrow=DB_fetch_array($resultStkLocs))
		{
				$p='';
				if($myrow['StoreCode']==$_REQUEST['storecode'])
				$p="selected";
		?>
			<option Value="<?php echo $myrow['StoreCode']; ?>" <?php echo $p; ?>><?php echo $myrow['StoreCode']; ?></option>
		<?php }
		?>
		</select>			</td>
        <td width="61%" id="txtid"><input type="text" name="storename" id="storename" size="20" readonly="true" value="<?php echo $_REQUEST['storename'] ?>"  tabindex="13"></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <th scope="row"><strong>Received Against</strong></th>
    <td colspan="2">
	<input id="hidden_form_site" type="hidden" value="<?php echo $_REQUEST['sitecode'];?>" />
    <input id="hidden_form_type" type="hidden" value="<?php echo $_GET['type'];?>" />
	<select name="receiviedagaist" id="receiviedagaist"  onchange="PurchaseOrderNumber();" tabindex="7">
 		  <option value="000">---Select---</option>
		  <option value="PO" <?php if($_GET['type']=='PO') { echo "Selected";  }?> >Purchase Order</option>
		  <option value="Direct" <?php if($_GET['type']=='Direct') { echo "Selected";  }?>>Direct</option>
		  <option value="APCM" <?php if($_GET['type']=='APCM') { echo "Selected";  }  ?>>PC Material</option>
		  <option value="ACM" <?php if($_GET['type']=='ACM') { echo "Selected";  }  ?>>Client Material</option>
		 <option value="AMSR" <?php if($_GET['type']=='AMSR') { echo "Selected";  }  ?>>Material Shiffting Record</option>
		 <option value="AWO" <?php if($_GET['type']=='AWO') { echo "Selected";  }  ?>>Work Order</option>
        </select>		
	<input type="hidden" name="receive_type" id="receive_type" value="<?php echo $_GET['type'];?>" />
	</td>
    <th><strong>Material Received On Basis </strong></th>
    <td colspan="2"><select name="matrialreceipt" tabindex="8">	
	<?php 
	if($_GET['type']=='PO')
	{ ?>
 		<option value="credit">Credit</option>
		<option value="cash">Cash</option>
		<option value="debitable">Debitable</option>
		<option value="rental">Rental</option>
		<option value="hiring">Hiring</option>
	<?php }
	else
	{?>
 	<option value="credit">Credit</option>
	<option value="cash">Cash</option>
<?php } ?>	
	</select></td>
  </tr>
  <tr>
    <th scope="row"><strong>PO/Challan/WO/ Ref.No.</strong></th>
    <td colspan="2">
	<?php
if($_REQUEST['type']=='PO'){
 	$sql="select orderno, PO_Orderno from purchorders Where Po_recive_status='Pending' and sitecode='".$_REQUEST['sitecode']."'";
	$result = DB_query($sql,$db);
?>
<select name="PO" id="PurchaseOrder" onchange="FiendPurchasenumber(this.value)"  style="width:210px" tabindex="11">
  <option value="000">Select</option>
  <?php  
  while($myrow=DB_Fetch_array($result))
  {
?>
  <option value="<?php echo $myrow['orderno']; ?>" <?php if($myrow['orderno']==$Ordernumber) { echo "Selected";  }  ?>><?php echo $myrow['PO_Orderno']; ?> </option>
  <?php }?> 
 <!--<input type="text" name="display_order" id="display_order" value="" />-->
 </select>
<?php }
 else if($_REQUEST['type']=='Direct') { ?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"  tabindex="11"/>
<?php } else if($_REQUEST['type']=='APCM') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"  tabindex="11"/>
<?php } else if($_REQUEST['type']=='ACM') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"  tabindex="11"/>
<?php } else if($_REQUEST['type']=='AMSR') {?>
<input type="text"   id="PO" name="PO" size="15" value="<?php echo $_REQUEST['PO'] ?>"select  tabindex="11"/>
<?php } else if($_REQUEST['type']=='AWO') {?>
<input type="text"  id="PO" name="PO"  size="15" value="<?php echo $_REQUEST['PO'] ?>"  tabindex="11"/>
<?php } else{?>
<select name=""  tabindex="11">
<option value="" >---Select---</option>
</select>
<?php } ?> 
	</td>
    <th><strong>Order Date </strong></th>
    <td colspan="2"><?php
	   if($_REQUEST['type']=='PO'){ ?>
	    <input type="text" name="orderdate" id="orderdate" value="<?php echo ConvertSQLDate($Order_Date); ?>" readonly="true"  tabindex="13">
		<?php }else{
	    ?>
	   <input type="text" name="orderdate" id="orderdate" value="<?php echo date('d/m/Y'); ?>" tabindex="13"></td>
	<?php } ?>
  </tr>
  <tr>
    <th scope="row"><strong>Recevied From </strong></th>
    <td colspan="2"><?php 
		 if($_GET['type']=='PO')
		 {
		 	$SQL = "select vendor_name from suppliers where vendor_code='".$suppno."'";
		 	$result1 = DB_query($SQL,$db);
			$supp_result1 = DB_fetch_array($result1);
		 ?>
      <input name="vendor" value="<?php echo $suppno; ?>"  type="hidden">
		<input  value="<?php echo $supp_result1['vendor_name']; ?>" readonly="true">
		<?php
		 }
		 else
		 if($_GET['type']=='Direct')
		 {
		 	$sql="select vendor_code, vendor_name from suppliers";
			$result = DB_query($sql, $db);
			?>
			<select name="vendor" id="vendor">
			<?php
			while($myrow = DB_fetch_array($result))
			{ ?>
			 <option  value="<?php echo $myrow['vendor_code']; ?>"><?php echo $myrow['vendor_name']; ?></option>
			<?php }
			?>
			</select>
			<?php 
		 }
		 else
		 if($_GET['type']=='ACM')
		 {
		 	$SQL = "Select clientmaster.id, clientmaster.c_name from clientmaster";
		 	$result = DB_query($SQL,$db);
		 ?>
		<select name="vendor">
		<?php 
		while($myrow = DB_fetch_array($result))
		{
		  ?>
		 <option value="<?php echo $myrow['id']; ?>" ><?php echo $myrow['c_name']; ?></option>
		 <?php } ?>
		</select>
		<?php }  else if($_GET['type']=='APCM') {
			$SQL = "Select id, pc_name from pcopening";
			$result = DB_query($SQL,$db);
		 ?>
		
		<select name="vendor"> 
		<?php 
		while($myrow = DB_fetch_array($result))
		{
		  ?>
		 <option value="<?php echo $myrow['id']; ?>"><?php echo $myrow['pc_name']; ?></option>
		 <?php } ?>
		</select>
		<?php  } else if($_GET['type']=='AMSR')  {

			$SQL = "select loccode, locationname From locations";
			$result = DB_query($SQL,$db);
		?>		
		<select name="vendor" tabindex="5">
		<?php 
		while($myrow = DB_fetch_array($result))
		{
		  ?>
		 <option value="<?php echo $myrow['loccode']; ?>" ><?php echo $myrow['locationname']; ?></option>
		 <?php } ?>
		</select>
		
		<?php } else { ?>
		<select name="vendor" tabindex="5">
		 <option value="<?php echo $supplierno; ?>"><?php echo $supplier_name; ?></option>
		</select>
	  <?php } ?>	</td>
    <th><strong>R.M.R.S. No. </strong></th>
    <td colspan="2"><input name="rmrs_no" type="text" value="<?php  echo $rmrs_no;?>" /></td>
  </tr>
</table></td>
</tr>
<tr>
<td align="center" height="237"><table width="100%" border="1" cellspacing="1" cellpadding="2" align="center">
  <tr>
    <td width="13%"><strong>Document Type </strong></td>
    <td width="12%"><p>
      <input name="DocumentType" type="radio" value="Challan" checked="checked" />
      <strong>Chalaan</strong></p>
      <p>
      <input name="DocumentType" type="radio" value="Bill" />
        <strong> Bill</strong></p></td>
    <td width="12%"><strong>No.
      </strong>
      <input name="billno" type="text" id="billno" size="12"  value="<?php  echo $_REQUEST['billno'] ?>" /></td>
    <td width="16%"><strong>Voucher Date</strong>      
      <input type="text" name="MRNVoucherDate"size="12" class="datepicker"  onblur="valdate();"  value="<?php echo date('d/m/Y'); ?>" tabindex="6"/></td>
    <td width="9%"><strong>Inwards Gate Pass</strong></td>
    <td width="18%"><strong> No. </strong>
      <input type="text" name="gatepassno"size="15" id="gatepassno"  value="<?php echo $_REQUEST['gatepassno'] ?>" /></td>
    <td width="20%"><strong>Date</strong>
      <input type="text" name="inwardate_save"size="15" id="inwardate_save"  value="<?php echo date('d/m/Y'); ?>" class="datepicker"  /></td>
  </tr>
  <tr>
    <td><strong>Transporter Name </strong></td>
    <td><?php  
		$sql_trans = 'select vendor_code, vendor_name from suppliers Where vendor_type="Transporter"';
		$resulttransp = DB_query($sql_trans,$db);
		  ?>
		<select name="transport">
		 <?php 
		 while ($myrow=DB_fetch_array($resulttransp))
		 {?>
		 	<option selected Value="<?php echo $myrow['vendor_code'];?>"><?php echo $myrow['vendor_name'];?></option>
		 <?php }
		?>
		</select></td>
    <td><strong>Vehicle No. </strong></td>
    <td><input name="vehicalno" type="text" id="vehicalno" size="12"  value="<?php echo $_REQUEST['vehicalno'] ?>"/></td>
    <td><strong>Time</strong></td>
    <td><p><strong>In </strong></p>
      <p><strong>Out</strong></p></td>
    <td><p>
      <input name="timein" type="text" id="timein" size="12" value="<?php echo $time; ?>" />
    </p>
      <p>
        <input name="timeout" type="text" id="timeout" size="12" value="<?php echo $time; ?>" onblur="Comparetime();" />
</p></td>
  </tr>
  <tr>
    <td><strong>L R No. </strong></td>
    <td><input name="lrno" type="text" id="lrno" size="12"  value="<?php echo $_REQUEST['lrno'] ?>"/></td>
    <td><strong>L R Date </strong></td>
    <td><input name="lrdate" type="text" id="lrdate" size="12" value="<?php echo $date; ?>"  onblur="LRdate();" class="datepicker"/></td>
    <td><strong>Total Weight </strong></td>
    <td><input type="text" name="total_weight" id="total_weight"  value="<?php echo $_REQUEST['total_weight'] ?>"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td><strong>Remarks If Any </strong></td>
    <td colspan="6"><input name="RemarksIfAny" type="text" id="RemarksIfAny" value="<?php echo $_REQUEST['RemarksIfAny'] ;?>" size="100">
	</td>
  </tr>
</table></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
    <tr>
      <td height="117" colspan="2">Item table</td>
    </tr>
    <tr>
      <td width="61%" height="264">
	  <table align="left">
	  <tr>
	  <th><strong>GENERAL DETAILS</strong></th>
	  </tr>
	  </table>
	  <?php if($_REQUEST['type'] =='PO')
				 {
				 
				 $CR=1;
				 	  	 $sql = "select A.*, B.* from po_charge A,  inclusivecharge  B Where A.Orderno ='".$_GET['orderno']."' AND charges!='0' and B.Chargesdescription=A.ch_name";
					    $Sqlresult=DB_query($sql, $db);
					     $noofrow =DB_num_rows($Sqlresult);
						
						?>
						 <?php 
  $var="Charge_".$myrow['Chargesid'];
    $actu_var="actual_".$myrow['Chargesid'];
 
    if($_POST[$var]=='YES'){
		$p1="selected";
		$q1='';
		}
		if($_POST[$var]=='NO'){
		$q1="selected";$p1='';
		}?>
						 <table width="100%" border="1">
					<tr>
					  <th width="5%">Description</th>
					  <th width="10%">Inclusive</th>
					  <th width="10%">As Per Actual</th>
					 <th width="20%">Amount</th>
					</tr>
					<?php 
						while($myrow=DB_fetch_array($Sqlresult))
					 	{?>
							<tr><th><strong><?php echo $myrow['Chargesdescription'];?></strong></th>
 <input type="hidden" name="desc_<?php echo $myrow['Chargesid'];?>" value="<?php echo $myrow['Chargesdescription'];?>">
							<td><input name="charges_name_<?php echo $myrow['Chargesid'];?>" type="hidden" value="<?php echo $myrow['Chargesdescription'];?>" />
							  <select name="Charge_<?php echo $myrow['Chargesid'];?>" id="Charge_<?php echo $myrow['Chargesid'];?>" onchange="ChargeAmount1(this.value,<?php echo $myrow['Chargesid']; ?>)">
  <option value="NO" <?php echo $q1; ?>>NO</option>
<option value="YES" <?php echo $p1; ?>>YES</option>
</select> 							</td>
							<td colspan="2">
							<?php $p= "PerActual".$myrow['Chargesid']?>
							<div id="<?php echo $p?>">
					
							<table width="100%" border="1"  >
							  <tr>
								<td  width="36%"><?php // echo $myrow['Chargesid'];?>  
  
<?php  
 if($_POST[$var]=='YES')
 {
 $visibility='disabled="disabled"';
 }else{
 $visibility='';
 }
?>
  <select name="AsPerActual_<?php echo $myrow['Chargesid'];?>" id="AsPerActual_<?php echo $myrow['Chargesid'];?>" <?php  echo $visibility?>>
 <option value="Amount">Amount</option>
  </select> 								 </td>
								 <td>
<input name="<?php echo $myrow['Chargesid'];?>" id="<?php echo $myrow['Chargesid'];?>" type="text" size="8" onblur="ChargeCalculater(this.value,<?php echo $myrow['Chargesid'];?>)" value="<?php  echo $myrow['charges'];?>" <?php  echo $visibility?> >=
							<input name="actual_<?php echo $myrow['Chargesid'];?>" id="actual_<?php echo $myrow['Chargesid'];?>" type="text" size="8" value="<?php  echo $myrow['charges'];?>" readonly <?php  echo $visibility?> ></td>
							  </tr>
							</table>
							</div>							</td>
							</tr>
						<?php  $CR++;
					 	} 
						?>
						 <input type="hidden" name="countcharges" id="countcharges" value="<?php echo $CR;?>">
						 </table>
			<?php 			
						
						
						} 
				else 
				 {?>
				  <table width="100%" border="1">
					<tr>
					  <th width="5%"><strong>Description</strong></th>
					  <th width="10%"><strong>Inclusive</strong></th>
					  <th width="10%"><strong>As Per Actual</strong></th>
					 <th width="20%"><strong>Amount</strong></th>
					</tr>
				
						
				<?php 	 
						
				$result=DB_query('SELECT Chargesid, Chargesdescription FROM inclusivecharge where Chargesdescription not in("OCT","SUR")',$db);
				
				$CR=1;
 				while($myrow=DB_fetch_array($result))
				  {
				     
					 	
				  ?>
					   <tr><th><strong><?php echo $myrow['Chargesdescription'];?></strong></th>
 <input type="hidden" name="desc_<?php echo $myrow['Chargesid'];?>" value="<?php echo $myrow['Chargesdescription'];?>">
							<td><input name="charges_name_<?php echo $myrow['Chargesid'];?>" type="hidden" value="<?php echo $myrow['Chargesdescription'];?>" />
  		<?php 
  $var="Charge_".$myrow['Chargesid'];
    $actu_var="actual_".$myrow['Chargesid'];
 
    if($_POST[$var]=='YES'){
		$p1="selected";
		$q1='';
		}
		if($_POST[$var]=='NO'){
		$q1="selected";$p1='';
		}?>
		
<select name="Charge_<?php echo $myrow['Chargesid'];?>" id="Charge_<?php echo $myrow['Chargesid'];?>" onchange="ChargeAmount1(this.value,<?php echo $myrow['Chargesid']; ?>)">
  <option value="NO" <?php echo $q1; ?>>NO</option>
<option value="YES" <?php echo $p1; ?>>YES</option>
</select> 							</td>
							<td colspan="2">
							<?php $p= "PerActual".$myrow['Chargesid']?>
							<div id="<?php echo $p?>">
					
							<table width="100%" border="1"  >
							  <tr>
								<td  width="36%"><?php // echo $myrow['Chargesid'];?>  
  
<?php  
 if($_POST[$var]=='YES')
 {
 $visibility='disabled="disabled"';
 }else{
 $visibility='';
 }
?>
  <select name="AsPerActual_<?php echo $myrow['Chargesid'];?>" id="AsPerActual_<?php echo $myrow['Chargesid'];?>" <?php  echo $visibility?>>
 <option value="Amount">Amount</option>
  </select> 								 </td>
								 <td>
<input name="<?php echo $myrow['Chargesid'];?>" id="<?php echo $myrow['Chargesid'];?>" type="text" size="8" onblur="ChargeCalculater(this.value,<?php echo $myrow['Chargesid'];?>)" value="<?php  echo $_POST[$actu_var];?>" <?php  echo $visibility?> >=
							<input name="actual_<?php echo $myrow['Chargesid'];?>" id="actual_<?php echo $myrow['Chargesid'];?>" type="text" size="8" value="<?php  echo $_POST[$actu_var];?>" readonly <?php  echo $visibility?> ></td>
							  </tr>
							</table>
							</div>							</td>
					</tr> 
							<?php 
							$CR++;
				  }	  
 			  ?>
			 <input type="hidden" name="countcharges" id="countcharges" value="<?php echo $CR;?>">
			 </table>
				 <?php }  ?>
	  </td>
      <td width="39%" align="right" valign="middle"><table width="79%" border="1" cellspacing="0" cellpadding="0">
            <tr>
             <td width="43%" bgcolor="#999999"><div align="center"><b><font color="#FFFFFF"> Basic Amount</font></b></div></td>
             <td width="57%"><label>
			 <?php if($_REQUEST['itemamount']!=0 && $_REQUEST['itemamount']!='')
		$itemamount=$_REQUEST['itemamount'];
		else
		$itemamount=0;
	?>
 <input name="itemamount"  type="text"  id="itemamount" size="30"  value="<?php echo $itemamount ?>"   onfocus="calculate_BasicAmount()"/>
			   <input type="hidden" name="hnet" id="hnet" />
			   
             </label></td>
           </tr>
           <tr>
             <td bgcolor="#999999"><div align="center"><b><font color="#FFFFFF">Total Tax Amount</font></b></div></td>
             <td>
			  <?php if($_REQUEST['tax_chargeamount']!=0 && $_REQUEST['tax_chargeamount']!='')
		$tax_chargeamount=$_REQUEST['tax_chargeamount'];
		else
		$tax_chargeamount=0;
	?>
			 
			 <input name="tax_chargeamount" type="text" id="tax_chargeamount" size="30"  readonly="true"   value="<?php echo $tax_chargeamount ?>" onblur="calculate_TotalTaxAmount()" />			  </td>
           </tr>
		   
		   <tr>
    <td>
	<?php if($_REQUEST['percent_inclusivecharge']=="SUR")
			$psur="selected";
			else
			$poct="selected";
			
	?>
<input name="percent_inclusivecharge" id="percent_inclusivecharge" type="radio"  value="SUR" onclick="cal_surcharges('SUR')" <?php echo $psur;?>/>SUR</td>
			 <td>   <input name="percent_inclusivecharge" id="percent_inclusivecharge" type="radio"  value="OCT" onclick="cal_surcharges('OCT')" <?php echo $poct?>/>OCT		   </td>
          </tr>
<tr>
<td >&nbsp;Percent
<input name="hidden_percent_inclusivecharge" id="hidden_percent_inclusivecharge" type="hidden"  value="" />
<input name="percent_inclusive" type="text" id="percent_inclusive" size="5" value="<?php echo $_REQUEST['percent_inclusive'] ?>" onfocus="cal_surcharges1();"  maxlength="2" /> %</td>
<td>
<?php if($_REQUEST['tax_suroct_value']!=0 && $_REQUEST['tax_suroct_value']!='')
		$tax_suroct_value=$_REQUEST['tax_suroct_value'];
		else
		$tax_suroct_value=0;
	?>
<input name="tax_suroct_value" type="text" id="tax_suroct_value" size="30" value="<?php  echo $tax_suroct_value?>"  readonly="true" /></td>
</tr>
								
	<tr>
    <td bgcolor="#999999"><div align="center"><b><font color="#FFFFFF">Total Charges</font></b></div></td>
    <td>
	<?php if($_REQUEST['chargeamount']!=0 && $_REQUEST['chargeamount']!='')
		$chargeamount=$_REQUEST['chargeamount'];
		else
		$chargeamount=0;
	?>
<input name="chargeamount" type="text" id="chargeamount" size="30"  onblur="Completetotal(this.value)" readonly="true" value="<?php  echo $chargeamount?>"  />	</td>
       </tr>
           <tr>
             <td bgcolor="#999999"><div align="center"><strong><font color="#FFFFFF">Grand Total </font></strong></div></td>
             <td>
			 <?php if($_REQUEST['grandtotal']!=0 && $_REQUEST['grandtotal']!='')
		$grandtotal=$_REQUEST['grandtotal'];
		else
		$grandtotal=0;
	?>
			 <input name="grandtotal" type="text" id="grandtotal" size="30" value="<?php echo $grandtotal; ?>"  readonly="true"  /></td>
           </tr>
         </table></td>
    </tr>
  </table>
</form>
<?php
include('includes/footer.inc');
?>