{extends file="./main.tpl"}
{block name=head}
<script type="text/javascript">
function finalkg()
{
  var ckg = $('.ckg').val() ? $('.ckg').val() : 0;
  var cvkg = $('.cvkg').val() ? $('.cvkg').val() : 0;
  var finalKg = $('.finalKg').val() ? $('.finalKg').val() : 0;
  
  var finalans = (parseFloat(ckg) + parseFloat(cvkg) + parseFloat(finalKg));
  $('.finalans').val(finalans.toFixed(2));
}

function finalRs()
{
  var ckg = $('.ckg').val() ? $('.ckg').val() : 0;
  var cvkg = $('.cvkg').val() ? $('.cvkg').val() : 0;
  var finalKg = $('.finalKg').val() ? $('.finalKg').val() : 0;
  
  var finalans = (parseFloat(ckg) + parseFloat(cvkg) + parseFloat(finalKg));
  $('.finalans').val(finalans.toFixed(2));
}

function finalRs()
{
  var camt = $('.camt').val() ? $('.camt').val() : 0;
  var vAmt = $('.vAmt').val() ? $('.vAmt').val() : 0;
  var finalrate = $('.finalrate').val() ? $('.finalrate').val() : 0;
  
  var finaltotal = (parseFloat(camt) + parseFloat(vAmt) + parseFloat(finalrate));
  $('.finaltot').val(finaltotal.toFixed(2));
 
}

function finalmcxRs()
{
  var mcxrs = $('.mcxrs').val() ? $('.mcxrs').val() : 0;
  var finalKg = $('.finalKg').val() ? $('.finalKg').val() : 0;
  var finalans = 0;
  
  finalans = (parseFloat(finalKg) *  parseFloat(mcxrs));
  $('.finalrate').val(finalans.toFixed(2));
}


function finalKgFiger()
{
  var finalans = $('.finalans').val() ? $('.finalans').val() : 0;
  var rojmelKg = $('.rojmelKg').val() ? $('.rojmelKg').val() : 0;
  var finalKgFiger = 0;
  
  finalKgFiger = (parseFloat(finalans) +  parseFloat(rojmelKg));
  $('.totalFianlkg').val(finalKgFiger.toFixed(2));
}

function finalRsFiger()
{
  var finaltot = $('.finaltot').val() ? $('.finaltot').val() : 0;
  var rojmelRs = $('.rojmelRs').val() ? $('.rojmelRs').val() : 0;
  var finalRsFiger = 0;
  
  finalRsFiger = (parseFloat(finaltot) +  parseFloat(rojmelRs));
  $('.totalFianlFiger').val(finalRsFiger.toFixed(2));
}

function rojmelFiger()
{
  var totalFianlkg = $('.totalFianlkg').val() ? $('.totalFianlkg').val() : 0;
  var kgAmt = $('.kgAmt').val() ? $('.kgAmt').val() : 0;
  var kgFiger = 0;
  
  kgFiger = (parseFloat(totalFianlkg) * parseFloat(kgAmt));
  $('.mcxAmt').val(kgFiger.toFixed(2));
}

function FinalRatekg()
{
  var mcxAmt = $('.mcxAmt').val() ? $('.mcxAmt').val() : 0;
  var rate = $('.rate').val() ? $('.rate').val() : 0;
  var totalFianlFiger = $('.totalFianlFiger').val() ? $('.totalFianlFiger').val() : 0;
  var figer = 0;
  
  figer = (parseFloat(totalFianlFiger) + parseFloat(mcxAmt) + parseFloat(rate));
  $('.totalFiger').val(figer.toFixed(2));
}
function deletechecked()
{
	var answer = confirm("Delete Selected Recored ?")
	var answer1 = confirm("Are You Sure ?")
	var answer2 = confirm("Final Delete Request...?")
	if (answer && answer1 && answer2)
	{
	  document.messages.submit();
	}
	return false;
}
</script>
<style>
input[type="text"] {
    width: 130px;
}
</style>
{/block}
{block name=body}
<form action="all2.php" method="Post">
<h2 align="center"><input type="submit" value="Master Delete" name="Delete" onclick="return deletechecked();"></h2>
</form>
<table align="center" width="40%" border="1">
<tr>
  <td>Client</td>  
  <td><input type="text" class="ckg" value="{$kg}" onBlur="finalkg();"></td> 
  <td colspan="2" align="right"><input type="text" class="camt" value="{$totalAmt}" onBlur="finalRs();"></td> 
</tr>
<tr>
  <td>Vepari</td>
   <td><input type="text" class="cvkg" value="{$vkg}" onBlur="finalkg();"></td> 
   <td colspan="2" align="right"><input type="text" class="vAmt" value="{$vtotalAmt}" onBlur="finalRs();"></td> 
</tr>
<tr>
  <td>Mcx</td>
  <td><input type="text" value="{$finalKg}" class="finalKg" onBlur="finalmcxRs();"></td> 
  <td><input type="text" class="mcxrs" onBlur="finalmcxRs();"></td> 
  <td><input type="text" class="finalrate"  onBlur="finalRs();"></td> 
</tr>
</table>
<br><br> 
<table align="center" width="40%" border="1">
<tr>
  <td>Final Kg</td>
  <td><input type="text" class="finalans" onblur="finalKgFiger();"></td> 
  <td align="right"><input type="text" class="finaltot" onblur="finalRsFiger();"></td> 
</tr>
<tr>
  <td>Rojmel</td>
  <td><input type="text" value="{$netFine}" class="rojmelKg" onblur="finalKgFiger();"></td> 
  <td align="right"><input value="{$rojmelAmt}" type="text" class="rojmelRs" onblur="finalRsFiger();"></td> 
</tr>
</table>
<br><br><br>
<table align="center" width="40%" border="1">
<tr>
  <td>Final Figer</td>
  <td><input type="text"  class="totalFianlkg"></td> 
  <td align="right"><input class="totalFianlFiger" type="text"></td> 
</tr>
<tr>
  <td></td>
  <td><input type="text" class="kgAmt" onBlur="rojmelFiger();"></td>
  <td align="right"><input type="text" class="mcxAmt" onblur="FinalRatekg();"></td>
</tr>
<tr>
  <td></td>
  <td align="center">Rate Per Kg</td>
  <td align="right"><input type="text" class="rate" onblur="FinalRatekg();"></td>
</tr>
<tr>
  <td></td>
  <td align="center">Final Figer After Rate</td>
  <td align="right"><input type="text" class="totalFiger"></td>
</tr>
</table>
{/block}