<link rel="stylesheet" href="css/new_mxerp.css">
<?php session_name('CAKEPHP'); session_start();
$PageSecurity = 2;
include('includes/SQL_CommonFunctions.inc');
include('includes/DefinePOClass.php');
$title = _('Import Bill Book');
$PageName ='Import Bill Book';
if($_REQUEST['Update']!='')
{
	$itemarray=array();
	$itemarray=$_REQUEST['rowId'];
	$itemIds=implode(",",$itemarray);
	
	
	 $insert="update  import_billbook set
							site='".$_REQUEST['site']."',   
							vendor='".$_REQUEST['vendor']."',  
							mrnNo='".$_REQUEST['mrnNo']."',  
							mrnDate='".FormatDateForSQL($_REQUEST['mrnDate'])."',  
							billPrefix='".$_REQUEST['billPrefix']."',  
							billDigit='".$_REQUEST['billDigit']."',  
							billNo='".$_REQUEST['billPrefix']."-".$_REQUEST['billDigit']."',  
							billDate='".FormatDateForSQL($_REQUEST['billDate'])."',  
							basicAmount='".$_REQUEST['basicAmount']."',  
							exciseDutyPerc='".$_REQUEST['exciseDutyPerc']."',  
							exciseDutyVal='".$_REQUEST['exciseDutyVal']."',  
							eduCessPerc='".$_REQUEST['eduCessPerc']."',  
							eduCessVal='".$_REQUEST['eduCessVal']."',  
							sheCessPerc='".$_REQUEST['sheCessPerc']."',  
							sheCessVal='".$_REQUEST['sheCessVal']."',  
							taxableAmount='".$_REQUEST['taxableAmount']."',  
							taxName='".$_REQUEST['taxName']."',  
							totalTaxAmount='".$_REQUEST['totalTaxAmount']."',  
							customDuty='".$_REQUEST['customDuty']."',  
							surchargePerc='".$_REQUEST['surchargePerc']."',  
							surchargeAmt='".$_REQUEST['surchargeAmt']."',  
							totalCharges='".$_REQUEST['totalCharges']."', 
							grandTotal='".$_REQUEST['grandTotal']."',
							remarks='".$_REQUEST['remarks']."',  
							ledger='".$_REQUEST['ledger']."'
							where id='".$_REQUEST['id']."'";
	 $result=DB_query($insert,$db);

$update_sql="Update addmrn set mrnstatus='closed' where id='".$_REQUEST['mrnNo']."'";
$update_result=DB_query($update_sql,$db);
prnMsg( _('Record updated Successfully'),'success');
echo "<script>location.href='index.php?route=ImportBillBookList&modid=".$_REQUEST['modid']."&frmid=".$_REQUEST['frmid']."'</script>";
}
?>
<script language="javascript" type="text/javascript">
function ImportOrderList(str)
{
	var site=document.getElementById("site").value;
	if (str.length==0)
  {
  document.getElementById("POLIST").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("POLIST").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ImportOrders.php?vendor="+str+"&site="+site,true);
xmlhttp.send();
}
function getOrderDate(str)
{
	if (str.length==0)
  {
  document.getElementById("podate").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("podate").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ImportOrders.php?orderNo="+str,true);
xmlhttp.send();
}
function getOrderDetails(str)
{
	location.replace("index.php?route=ImportBillBook&modid=<?php echo $_REQUEST['modid'];?>&frmid=<?php echo $_REQUEST['frmid'];?>&orderNo="+str);
}
function generateBillNo(str)
{
	if (str.length==0)
  {
  document.getElementById("billid").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("billid").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ImportSite.php?billsite="+str,true);
xmlhttp.send();
}

function calc_basicamt()
{     
	var total_basic=0;
	var cnt=document.getElementById("count").value
	for(var j=0;j<cnt;j++)
	{
		var netrate=document.getElementById("subTotal_"+j).value;
		if(netrate==''){netrate='0';}
		total_basic=parseFloat(total_basic)+parseFloat(netrate);
	}
	
	document.getElementById("basicAmount").value=total_basic.toFixed(2);
}
function cal_Excise_Duty()
{ 
	var excise_rate=document.getElementById("exciseDutyPerc").value;
	var basic_value=document.getElementById("basicAmount").value;	
	var excise_value=basic_value*(excise_rate/100);
	document.getElementById("exciseDutyVal").value=excise_value.toFixed(2);
	
}
function cal_Edu_Cess()
{
	var eduCessPerc=document.getElementById("eduCessPerc").value;
	var excise_val=document.getElementById("exciseDutyVal").value;
	var educess_value=excise_val*(eduCessPerc/100);
	document.getElementById("eduCessVal").value=educess_value.toFixed(2);	
}
function cal_SHE_Cess(str)
{
	var sheCessPerc=document.getElementById("sheCessPerc").value;
	var excise_val=document.getElementById("exciseDutyVal").value;
	var shecess_value=excise_val*(sheCessPerc/100);
	document.getElementById("sheCessVal").value=shecess_value.toFixed(2);	
}
function calc_taxable_amount()
{
	var basic_value=document.getElementById("basicAmount").value;
	var excise=document.getElementById("exciseDutyVal").value;
	var edu=document.getElementById("eduCessVal").value;
	var she=document.getElementById("sheCessVal").value;
	var final_taxable=parseFloat(basic_value)+parseFloat(excise)+parseFloat(edu)+parseFloat(she);
	document.getElementById("taxableAmount").value=final_taxable.toFixed(2);
}
function calc_tax_amount()
{
	var taxable=document.getElementById("taxable_amt").value;
	var taxval=document.getElementById("taxvalue").value;
	var final=taxable*(taxval/100);
	document.getElementById("tot_tax_amount").value=final.toFixed(2);
}
function get_charge(str)
{
	document.getElementById("hidden_suroct").value=str
}

function tax_rate(str)
{
var taxable=document.getElementById("taxableAmount").value;
if (str.length==0)
  {
  document.getElementById("taxVal").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("taxVal").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","get_tax_val.php?taxname="+str+"&taxable="+taxable,true);
xmlhttp.send();
}

function cal_suroct(str)
{
	var total_tax=document.getElementById("tot_tax_amount").value;
	var final_sur=total_tax*(str/100);
	document.getElementById("sur_oct_amt").value=final_sur.toFixed(2);
}
function cal_grandtotal()
{
	var Totaltaxable=document.getElementById("taxableAmount").value;
	var Totaltaxamount=document.getElementById("totalTaxAmount").value;
	var customDuty=document.getElementById("customDuty").value;
	var suramt=document.getElementById("surchargeAmt").value;
	var TotalCharge=document.getElementById("totalCharges").value;
	
	var grand_tot=parseFloat(Totaltaxable)+parseFloat(Totaltaxamount)+parseFloat(customDuty)+parseFloat(suramt)+parseFloat(TotalCharge);
	document.getElementById("grandTotal").value=grand_tot.toFixed(2); /*Math.round(*/
}
function generatePO(str)
{
	if (str.length==0)
  {
  document.getElementById("POID").innerHTML="";
  return;
  }
if (window.XMLHttpRequest)
  {// code for IE7+, Firefox, Chrome, Opera, Safari
  xmlhttp=new XMLHttpRequest();
  }
else
  {// code for IE6, IE5
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
xmlhttp.onreadystatechange=function()
  {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
    {
    document.getElementById("POID").innerHTML=xmlhttp.responseText;
    }
  }
xmlhttp.open("GET","ImportSite.php?site="+str,true);
xmlhttp.send();
}
function calculateSurcharge()
{
	var totalTaxAmount=document.getElementById("totalTaxAmount").value;
	var surchargePerc=document.getElementById("surchargePerc").value;
	var result=totalTaxAmount*(surchargePerc/100);
	document.getElementById("surchargeAmt").value=result.toFixed(2);
}
</script>


<div class="body_contain">
<div class="tab_div">

<h1>Edit Import Purchase Bill</h1>
<?php
$sql="select * from import_billbook where id='".$_REQUEST['id']."'";
$query=DB_query($sql,$db);
$result=DB_fetch_array($query);

?>
<form  action="" method="post">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
	  <tr class="row1">
        <td class="tabledata1">Branch</td>
		<td>
		<select name="site" id="site" style="width:110px" onchange="generateBillNo(this.value)">
		<option value="0">Select</option>
		<?php
		$site_sql=DB_query("Select loccode,locationname from locations where CompanyId='".$_SESSION['ACGCompanyId']."' and loccode='".$_SESSION['AssignedBranch']."'",$db);
		while($site_row=DB_fetch_array($site_sql))
		{
		$t='';
		if($site_row['loccode']==$result['site'])
		{
		$t="selected";	
		}	
			?>
		<option value="<?php echo $site_row['loccode'];?>"<?php echo $t; ?>><?php echo $site_row['locationname'];?></option>
		<?php 
		}
		?>
		  </select>		</td>
        <td class="tabledata1">Import MRN No. </td>
		<td id="POLIST">
		<?php $sql1="Select id,MRNNo from addmrn where OrderFromSite='".$_REQUEST['site']."' and ReceivedFrom='".$_REQUEST['vendor']."' and Type='IMPO'";
$result1=DB_query($sql1,$db);
?>
<select name="mrnNo" id="mrnNo" style="width:110px" onchange="getOrderDate(this.value)">
<option value="0">Select</option>
<?php 
while($myrow=DB_fetch_array($result1))
{
	$tt='';
	if($myrow['id']==$result['mrnNo'])
	{
	$tt="selected";	
	}
	?>
<option value="<?php echo $myrow['id'];?>"<?php echo$tt;  ?>><?php echo $myrow['MRNNo'];?></option>
<?php 	
}
?>
</select>
		</td>
      </tr>
      <tr class="row1">
        <td class="tabledata1">Vendor</td>
		<td>
		<select name="vendor" style="width:110px" onchange="ImportOrderList(this.value)">
		<option value="0">Select</option>
		<?php 
		$vendor_sql=DB_query("Select vendor_code,vendor_name from suppliers",$db);
		while($vendor_row=DB_fetch_array($vendor_sql))
		{
		$tvendor='';
		if($vendor_row['vendor_code']==$result['vendor'])
		{
		$tvendor="selected";	
		}
			?>
		<option value="<?php echo $vendor_row['vendor_code'];?>"<?php echo $tvendor; ?>><?php echo $vendor_row['vendor_name'];?></option>
		<?php 
		}
		?>
        </select></td>
		<td class="tabledata1">Import MRN Date </td>
		<td id="podate"><input type="text" name="mrnDate" id="mrnDate" value="<?php echo $result['mrnDate'];?>" /></td>
      </tr>
      <tr class="row1">
        <td class="tabledata1">Bill Book No.  </td>
        <td id="billid"><input name="billPrefix" type="text" id="billPrefix" value="<?php echo $result['billPrefix'];?>" size="7" />
-
  <input name="billDigit" type="text" id="billDigit" value="<?php echo $result['billDigit'];?>" size="5" /></td>
        <td class="tabledata1">Bill Book Date </td>
        <?php if(isset($_REQUEST['billDate'])){$billDate=$result['billDate'];}else{$billDate=date('d/m/Y');}?>
	    <td><input type="text" name="billDate" id="billDate" value="<?php echo $billDate;?>" class="datepicker" /></td>
      </tr>
      <tr class="row1"></tr>
  </table>
  




<?php 
$height="150px";
?>

<div style="overflow:auto; width:810px ; height:<?php echo $height;?>"  >
  <table width="100%" border="1" cellspacing="0" cellpadding="3">
    <tr>
      <td class="tabledata">Item Code </td>
      <td class="tabledata">Item Name </td>
      <td class="tabledata">Description</td>
      <td class="tabledata">Item No. </td>
      <td class="tabledata">Make</td>
      <td class="tabledata">Color</td>
      <td class="tabledata">Grade</td>
	  <td class="tabledata">Size</td>
	  <td class="tabledata">GSM</td>
	   <td class="tabledata">Quantity</td>
      <td class="tabledata">Rate</td>
	   <td class="tabledata">Currency</td>
      <td class="tabledata">Discount Type</td>
      <td class="tabledata">Discount</td>
      <td class="tabledata">Discount Amount</td>
      <td class="tabledata">Sub Total </td>
      <td class="tabledata">Flexo Offset</td>
      <td class="tabledata">Od</td>
      <td class="tabledata">Length</td>
      <td class="tabledata">Width</td>
      <td class="tabledata">Unit</td>
      <td class="tabledata">Serial No.</td>
      <td class="tabledata">Orignal/Local</td>
      <td class="tabledata">Type</td>
      <td class="tabledata">Shade</td>
      <td class="tabledata">Running Meter/Roll</td>
      <td class="tabledata">Volume</td>
      <td class="tabledata">Teeth</td>
      <td class="tabledata">Bcm</td>
      <td class="tabledata">Ups</td>
      <td class="tabledata">Quality</td>
      </tr>
    <?php 
	
		$detailsSQL=DB_query("select * from addmrnqty where issue_id='".$result['mrnNo']."'",$db);
		$i=0;
		while($detailsRow=DB_fetch_array($detailsSQL))
  		{
	
			$Query=DB_query("select * from item_master where StockID='".$detailsRow['itemcode']."'",$db);
  			$Query_row=DB_fetch_array($Query);
			
			$_REQUEST['quantity'][$i]=$detailsRow['reciveqty'];
			$_REQUEST['rate'][$i]=$detailsRow['itemprice'];
			$_REQUEST['currency'][$i]=$detailsRow['currency'];
			$_REQUEST['discountType'][$i]=$detailsRow['disc_type'];
			$_REQUEST['discount'][$i]=$detailsRow['discount'];
			$_REQUEST['discountAmt'][$i]=$detailsRow['discount_amount'];
			$_REQUEST['subTotal'][$i]=$detailsRow['val_after_disc'];
                

  ?>
<tr bgcolor="#c1c1c1">
      <td><?php echo $detailsRow['itemcode'];?><input type="hidden" name="rowId[<?php echo $i;?>]" id="rowId_<?php echo $i;?>" value="<?php echo $detailsRow['id'];?>" /></td>
      <td><?php echo $Query_row['item_name'];?></td>
      <td><?php echo $Query_row['item_desc'];?></td>
      <td><?php echo $Query_row['item_no'];?></td>
     <td>
	 <?php 
		$makename=$s->getField('product_manufacture','id',$detailsRow['Make'],'manufacturer');
		echo $makename;?></td>
      <td>
	 <?php 
	$colorname=$s->getField('product_color','id',$detailsRow['Color'],'color');
	echo $colorname;
	?>
	</td>
      <td><?php
	$gradername=$s->getField('product_grade','id',$detailsRow['Gread'],'grade');
	echo $gradername;
?>
</td>
<td><?php 
	$sizename=$s->getField('size_master','id',$detailsRow['size'],'name');
	echo $sizename;
?>
</td>
<td><?php
	$gsmname=$s->getField('gsm','id',$detailsRow['gsm'],'gsm');
	echo $gsmname;
?>
</td>
	 <td><input type="text" name="quantity[<?php echo $i;?>]" id="quantity_<?php echo $i;?>" value="<?php echo $_REQUEST['quantity'][$i];?>" /></td>
      <td><input type="text" name="rate[<?php echo $i;?>]" id="rate_<?php echo $i;?>" value="<?php echo $_REQUEST['rate'][$i];?>" /></td>
	   <td>
	   <?php 
	   $currSql=DB_query("Select * from currency_master where id='".$_REQUEST['currency'][$i]."'",$db);
	   $currRow=DB_fetch_array($currSql);
	   echo $currRow['currency']." - ".$currRow['abbreviation'];
	   ?>
	   </td>
      <td>
	  <?php echo $_REQUEST['discountType'][$i];?>
	  </td>
      <td><input type="text" name="discount[<?php echo $i;?>]" id="discount_<?php echo $i;?>" value="<?php echo $_REQUEST['discount'][$i];?>" onblur="DiscountAmount(this.value,<?php echo $i;?>)" ></td>
      <td><input type="text" name="discountAmt[<?php echo $i;?>]" id="discountAmt_<?php echo $i;?>" value="<?php echo $_REQUEST['discountAmt'][$i];?>" /></td>
      <td><input type="text" name="subTotal[<?php echo $i;?>]" id="subTotal_<?php echo $i;?>" value="<?php echo $_REQUEST['subTotal'][$i];?>" /></td>
	  <td><?php echo $Query_row['flexo_offset'];?></td>
      <td><?php echo $Query_row['od'];?></td>
      <td><?php echo $Query_row['length'];?></td>
      <td><?php echo $Query_row['width'];?></td>
      <td><?php $unit=$s->getField('unitsofmeasure','unitid',$Query_row['unit'],'unitname'); echo $unit;?></td>
      <td><?php echo $Query_row['serial_no'];?></td>
      <td><?php echo $Query_row['orig_local'];?></td>
      <td><?php echo $Query_row['type_name'];?></td>
      <td><?php echo $Query_row['shade'];?></td>
      <td><?php echo $Query_row['running_roll'];?></td>
      <td><?php echo $Query_row['volume'];?></td>
      <td><?php echo $Query_row['teeth'];?></td>
      <td><?php echo $Query_row['bcm'];?></td>
      <td><?php echo $Query_row['ups'];?></td>
       <td><?php echo $Query_row['quality'];?></td>
    </tr>
    <?php $i++;} ?>
	<input type="hidden" name="count" id="count" value="<?php echo $i;?>" />
  </table>
</div>
<br />
<table width="100%">
<tr>
<td width="50%" valign="top">
<table width="100%" border="1" cellpadding="3">
<tr>
<td class="tabledata">REMARKS</td>
<td><textarea name="remarks" style="width:50%" ><?php echo $result['remarks'];?></textarea></td>
</tr>
<tr>
<td class="tabledata">LEDGER</td>
<td>
<select name="ledger" id="ledger" style="width:50%">
		<?php 
		$ledger_sql=DB_query("Select AccountsID,AccountName from accountledger",$db);
		while($ledger_row=DB_fetch_array($ledger_sql))
		{			
		$tledger='';
		if($ledger_row['AccountsID']==$result['ledger'])
		{
		$tledger="selected";	
		}	
		?>
		<option value="<?php echo $ledger_row['AccountsID']; ?>"<?php echo $tledger; ?>><?php echo $ledger_row['AccountName']; ?></option>
		<?php } ?>
		</select>
</td>
</tr>
</table>
</td>
<td width="20%"  valign="top">
<?php 
$SQL=DB_query("Select * from import_billbook where id ='".$_REQUEST['id']."'",$db);
$Myrow=DB_fetch_array($SQL);
?>
<table width="100%" cellpadding="3" cellspacing="0" border="1" align="right">
			<tr>
			<td class="tabledata">Basic Amount</td>
			<td><input name="basicAmount" id="basicAmount" type="text"  style="width:127px;" onfocus="calc_basicamt()" value="<?php echo $Myrow['basicAmount'];?>"></td>
			</tr>
			<tr>
              <td class="tabledata">Excise Duty </td>
			  <td><input name="exciseDutyPerc" type="text" id="exciseDutyPerc" value="<?php echo $Myrow['exciseDutyPerc'];?>" size="3" /><input name="exciseDutyVal" id="exciseDutyVal" type="text" value="<?php echo $Myrow['exciseDutyVal'];?>" size="15" onfocus="cal_Excise_Duty()"></td>
    </tr>
			<tr>
              <td class="tabledata">Edu Cess </td>
			  <td><input name="eduCessPerc" type="text" id="eduCessPerc" value="<?php echo $Myrow['eduCessPerc'];?>" size="3" /><input name="eduCessVal" id="eduCessVal" type="text" value="<?php echo $Myrow['eduCessVal'];?>" size="15" onfocus="cal_Edu_Cess()"></td>
    </tr>
			<tr>
			<td class="tabledata">She Cess </td>
	        <td><input name="sheCessPerc" type="text" id="sheCessPerc" value="<?php echo $Myrow['sheCessPerc'];?>" size="3" /><input name="sheCessVal" id="sheCessVal" type="text" value="<?php echo $Myrow['sheCessVal'];?>" size="15" onfocus="cal_SHE_Cess()"></td>
			</tr>
			<tr>
			<td class="tabledata">Taxable Amount </td>
			<td><input name="taxableAmount" id="taxableAmount" type="text" value="<?php echo $Myrow['taxableAmount'];?>"  style="width:127px;" onfocus="calc_taxable_amount()"></td>
			</tr>
			<tr>
              <td class="tabledata">Tax Name </td>
			  <?php
				$Taxsql='select salestax_id,tax_code from sales_tax_master';
				$Taxresult=DB_query($Taxsql,$db);
     	?>
              <td>
		<select id="taxName" name="taxName" onchange="tax_rate(this.value)" style="width:127px">
		<option value="0">Select</option>
        <?php 
			while($Taxmyrow=DB_fetch_array($Taxresult)){
			?>
           <option  value="<?php echo $Taxmyrow['salestax_id']; ?>"<?php echo ($Myrow['taxName']==$Taxmyrow['salestax_id']?'selected':'')?>><?php echo $Taxmyrow['tax_code']; ?></option>
                  <?php } ?>
              </select></td>
	    </tr>
			<tr>
              <td class="tabledata">Total Tax Amount </td>
			  <td id="taxVal"><input name="totalTaxAmount" id="totalTaxAmount" value="<?php echo $Myrow['totalTaxAmount'];?>" type="text"  style="width:127px;"></td>
    </tr>
			<tr>
			  <td class="tabledata">Custom Duty </td>
              <td><input name="customDuty" id="customDuty" type="text" value="<?php echo $Myrow['customDuty'];?>"  style="width:127px;"></td>
			</tr>
			<tr>
		  <td class="tabledata">Surcharge</td>
			<td> <input name="surchargePerc" id="surchargePerc" type="text" value="<?php echo $Myrow['surchargePerc'];?>"  style="width:115px;">
			  %			  </td>
			</tr>
			<tr>
			<td class="tabledata">Surcharge Amount </td>
			<td><input name="surchargeAmt" id="surchargeAmt" type="text"  value="<?php echo $Myrow['surchargeAmt'];?>"  style="width:127px;" onfocus="calculateSurcharge()"></td>
			</tr>
			<tr>   
		<td class="tabledata">Freight</td>
		<td><input name="totalCharges" id="totalCharges" type="text" value="<?php echo $Myrow['totalCharges'];?>" style="width:127px;"></td>
			</tr>
		<tr><td class="tabledata">Grand Total</td>
		<td><input name="grandTotal" id="grandTotal" type="text"  style="width:127px;" value="<?php echo $Myrow['grandTotal'];?>" onfocus="cal_grandtotal()"></td>
		</tr>
	  </table>
</td></tr>
</table>
<p align="center"><input type="submit" name="Update" value="Update" /></p>
</form>
</div></div>
