{extends file="./main.tpl"}
{block name=head}
<script type="text/javascript">
function finalRate()
{
  var kg        = $('.kg').val() != '' ? $('.kg').val() : 0;
  var rate      = $('.rate').val() != '' ? $('.rate').val() : 0;
  var cliTransType   = $('.cliTransType').val() != '' ? $('.cliTransType').val() : '';
  
  
    if(cliTransType == 'A')
	{
		totalAmt  = (parseFloat(rate) * parseFloat(kg));
		var result = totalAmt * -1;
		$('.totalAmt').val(result.toFixed(2));
	}
	else
	{
		totalAmt  = (parseFloat(rate) * parseFloat(kg));
		var result = totalAmt * -1;
		$('.totalAmt').val(result.toFixed(2));
	}
}
</script>
<style>
td{
  text-align: center;
  border: none;
}
</style>
{/block}
{block name=body}
<form name="partyForm"action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="clientId" value="{$clientId}">
<h1 align="center"><font size="5px">Client Entry</font></h1>
<table cellpadding="3" cellspacing="0" border="" align="center" width=50%>
   <tr>
   <td>Date
	{html_select_date prefix="cdt" start_year="-1" end_year="+0"  day_value_format="%02d" field_order="DMY" time=$cDate}
	</td>
    <td>Client Name
	  <select name="partyId" required autofocus>
	     <option value="">Select Party</option>
	    {html_options values=$clientArray.partyId output=$clientArray.partyName selected=$partyId}
	  </select>
	</td>
	</tr>
</table>
<br>
<table cellpadding="3" cellspacing="0" border="" align="center" width=30%>
	<!-- <tr> -->
		<!-- <td>Type</td> -->
		<!-- <td> -->
		  <!-- <select name="sell_type" required> -->
			 <!-- <option value="">Select Type</option> -->
			<!-- {html_options values=$sellTypeValue output=$sellTypOutput selected=$sell_type} -->
		  <!-- </select> -->
		<!-- </td> -->
	<!-- </tr> -->
	<!-- <tr> -->
		<!-- <td>Cash Type</td> -->
		<!-- <td> -->
		  <!-- <select name="cash_type"> -->
			<!-- {html_options values=$cashValue output=$cashOutput selected=$cashValue} -->
		  <!-- </select> -->
		<!-- </td> -->
	<!-- </tr> -->
	<tr>
		<td>Transaction Type</td>
		<td>
		  <select name="cliTransType" class="cliTransType" required>
			 <option value="">Transaction Type</option>
			{html_options values=$typeArrayValue output=$typeArrayOutput selected=$cliTransType}
		  </select>
		</td>
	</tr>
	<tr>
		<td>Particular</td>
		<td><input type="text" name="particular" value="{$particular}"></td>
	</tr>
	<tr>
		<td>Rate</td>
		<td><input type="text" name="rate" class="rate" onblur="finalRate();" onkeyup="finalRate(this);" value="{$rate}" size="8" required></td>
	</tr>
	<tr>
		<td>K.G.</td>
		<td><input type="text" name="kg" class="kg" value="{$kg}" size="4" onblur="finalRate();" onkeyup="finalRate(this);" required></td>
	</tr>
	<tr>
		<td>Total Amount</td>
		<td><input type="text" name="totalAmt" class="totalAmt" size="8" value="{$totalAmt}"></td>
	</tr>
  <tr>
  	<td colspan="3" align="center"><input type="submit" value="Submit" name="submit" class="btn"></td>
  </tr>
</table>
</form>
{/block}