<?php
/* Smarty version 3.1.30, created on 2021-10-24 14:42:23
  from "/home/rexbeenc/public_html/templates/summary.tpl" */

/* @var Smarty_Internal_Template $_smarty_tpl */
if ($_smarty_tpl->_decodeProperties($_smarty_tpl, array (
  'version' => '3.1.30',
  'unifunc' => 'content_61752377f051b6_11432607',
  'has_nocache_code' => false,
  'file_dependency' => 
  array (
    '12999604d00ad7a5cdfff4d27e97e0294bfbdc39' => 
    array (
      0 => '/home/rexbeenc/public_html/templates/summary.tpl',
      1 => 1624020603,
      2 => 'file',
    ),
  ),
  'includes' => 
  array (
    'file:./main.tpl' => 1,
  ),
),false)) {
function content_61752377f051b6_11432607 (Smarty_Internal_Template $_smarty_tpl) {
$_smarty_tpl->_loadInheritance();
$_smarty_tpl->inheritance->init($_smarty_tpl, true);
?>

<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_118006960861752377ea3741_84686667', 'head');
?>

<?php 
$_smarty_tpl->inheritance->instanceBlock($_smarty_tpl, 'Block_208451393861752377f02ec4_45884996', 'body');
$_smarty_tpl->inheritance->endChild();
$_smarty_tpl->_subTemplateRender("file:./main.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), 2, false);
}
/* {block 'head'} */
class Block_118006960861752377ea3741_84686667 extends Smarty_Internal_Block
{
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

<?php echo '<script'; ?>
 type="text/javascript">
function getAmt(amountObj)
{
  var row      = $(amountObj).parents('.itemRow'); 
  var kg       = row.find('.kg').val() != '' ? row.find('.kg').val() : 0;
  var rate     = $('.rate').val() != '' ? $('.rate').val() : 0;
  var kgrs     = row.find('.kgrs').val() != '' ? row.find('.kgrs').val() : 0;
  var totalAmt = row.find('.totalAmt').val() != '' ? row.find('.totalAmt').val() : 0;
  var dd   	   = 0;
  var aa       =  parseFloat(kg) * parseFloat(rate);
  row.find('.kgrs').val(aa.toFixed(2));
  
  if(kg > 0  && totalAmt < 0)
  {
	  var xx = Math.abs(totalAmt);
	  dd =  parseFloat(kgrs) - parseFloat(xx);
	  row.find('.finalAmt').val(dd.toFixed(2));
  }
  else if(kg < 0  && totalAmt > 0)
  {
	  var xx = Math.abs(kgrs);
	  dd =  parseFloat(xx) - parseFloat(totalAmt);
	  row.find('.finalAmt').val(dd.toFixed(2));
  }
  else
  {
    var xx = Math.abs(kgrs);
    var yy = Math.abs(totalAmt);
    dd =  parseFloat(xx) + parseFloat(totalAmt);
	row.find('.finalAmt').val(dd.toFixed(2));
  }
  
  
}
<?php echo '</script'; ?>
>
<?php
}
}
/* {/block 'head'} */
/* {block 'body'} */
class Block_208451393861752377f02ec4_45884996 extends Smarty_Internal_Block
{
public function callBlock(Smarty_Internal_Template $_smarty_tpl) {
?>

<form action="summary.php" method="POST">
<table align="center" border="2" width="70%"> 
	<h2 align="center">Client Summary</h2>
<thead>
<center>
  <input type="text" class="rate" placeholder="Enter Rate" onBlur="getAmt();">
</center>
	<tr>
		<th class="table1">Party Name</th>
		<th class="table1">Fine</th>
		<th class="table1">Amount</th>
		<th class="table1">Silver Rs</th>
		<th class="table1">Final Amount</th>
    </tr>
</thead>
</tbody>
<?php
$_from = $_smarty_tpl->smarty->ext->_foreach->init($_smarty_tpl, $_smarty_tpl->tpl_vars['pendingArray']->value, 'onerow');
if ($_from !== null) {
foreach ($_from as $_smarty_tpl->tpl_vars['onerow']->value) {
?>
  <tr class="itemRow">
	<input type="hidden" name="partyId" value="<?php echo $_smarty_tpl->tpl_vars['onerow']->value['partyId'];?>
">
  	<td class="table1" align="center"><?php echo $_smarty_tpl->tpl_vars['onerow']->value['partyName'];?>
</td>
    <td class="table1" align="center">
		<input type="text" class="kg" value="<?php echo sprintf("%.3f",$_smarty_tpl->tpl_vars['onerow']->value['kg']);?>
" style="width:100px;" onBlur="getAmt(this);"">
	</td>
	<td class="table1" align="center"> 
	  <input type="text" value="<?php echo sprintf("%.3f",$_smarty_tpl->tpl_vars['onerow']->value['totalAmt']);?>
" class="totalAmt">
	</td>
	<td class="table1" align="center">
		<input type="text" class="kgrs" style="width:100px;" onBlur="getAmt(this);" readonly>
	</td>
	<td class="table1" align="center">
		<input type="text" class="finalAmt" style="width:100px;" onBlur="getAmt(this);">
	</td>
		

  </tr>
<?php
}
}
$_smarty_tpl->smarty->ext->_foreach->restore($_smarty_tpl);
?>

</tbody>
</table>
<br><br><br>
<table align="center" border="1" width="30%">
  <tr>
    <td>Final Weight :- <?php echo sprintf("%.3f",$_smarty_tpl->tpl_vars['kg']->value);?>
</td>
  </tr>
  <tr>
     <td>Total Amount :- <?php echo sprintf("%.3f",$_smarty_tpl->tpl_vars['totalAmt']->value);?>
</td>
  </tr>
  
</table>
</form>
<?php
}
}
/* {/block 'body'} */
}
