{extends file="./main.tpl"}
{block name=head}
<script type="text/javascript">
function myFunction()
{
	if(confirm("Are You Sure To Delete")== true)
	{
		return true;
	}
	else
	{
		return false;
	}
}	
function getAmt()
{

  var amount  = 0;
  

}	
$(function() {
	$(".mcxId").click(function() {
	if ($(this).is(":checked")) 
	{
		 var dataString = "mcxId=" +$(this).val();
			$.ajax({
			type: "POST",
			url: "updateStatusCheckedmcx.php",
			data: dataString,
			success:function(data)
			{}
		});
	}
	else
	{
		var dataString = "mcxId=" +$(this).val();
			$.ajax({
			type: "POST",
			url: "updateStatusUnCheckedmcx.php",
			data: dataString,
			success:function(data)
			{
			  
			}
		});
	}
  });
});		

function gettype()
{
	var dataString = "partyId=" +$(".partyId").val();
	$.ajax({
			type: "POST",
			url: "gettype.php",
			data: dataString,
			success:function(data)
			{
			  $(".type").val(data); 
			}
		});
}
function getsign()
{
  var type   		  = $('.type').val() != '' ? $('.type').val() : 0;
  var rojTransType    = $('.rojTransType').val() != '' ? $('.rojTransType').val() : 0;
  var rate    		  = $('.rate').val() != '' ? $('.rate').val() : 0;
  var fine    		  = $('.fine').val() != '' ? $('.fine').val() : 0;
  
  //if(type == 'C' && rojTransType =='A')
  //{
	amount = (parseFloat(rate) * parseFloat (fine));
	var result = amount * -1;
	$('.amount').val(result.toFixed(2));
 // }
  <!-- else if (type == 'V' && rojTransType =='J') -->
  <!-- { -->
	<!-- amount = (parseFloat(rate) * parseFloat (fine)); -->
	<!-- $('.amount').val('-' + amount.toFixed(2)); -->
  <!-- } -->
  <!-- else -->
  <!-- { -->
	<!-- amount = (parseFloat(rate) * parseFloat (fine)); -->
	<!-- $('.amount').val(amount.toFixed(2)); -->
  <!-- } -->
  
}							
</script>
<style>
td{
  border: none;
}
</style>
{/block}
{block name=body}
<form name="partyForm"action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="saudaId" value="{$saudaId}">
<input type="hidden" name="type" class="type" value="{$type}">
<h1 align="center"><font size="5px">Sauda Entry</font></h1>
<table cellpadding="3" cellspacing="0" border="" align="center" width=30%>
	<tr>
		<td align="left">Client Name</td>
		<td>
		  <select name="partyId" class="partyId" required onchange="gettype();">
			 <option value="">Select Party</option>
			{html_options values=$clientArray.partyId output=$clientArray.partyName selected=$partyId}
		  </select>
		</td>
	</tr>
	<tr>
	<td>Date</td>
	<td>
	   {html_select_date prefix="rdt" start_year="-1" end_year="+0"  day_value_format="%02d" field_order="DMY" time=$saudaDate}
	</td>
  </tr>
  <tr>
    <td>Cash Type</td>
    <td>
	  <select name="cash_type">
	    {html_options values=$cashValue output=$cashOutput selected=$cash_type}
	  </select>
	</td>
  </tr>
  <tr>
    <td>Type</td>
    <td>
	  <select name="rojTransType" class="rojTransType" onchange="getsign();">
	    {html_options values=$typeArrayValue output=$typeArrayOutput selected=$rojTransType}
	  </select>
	</td>
  </tr>
   <tr>
    <td>Branch</td>
    <td>
	  <select name="branch">
		<option value="0">Select Branch</option>
	    {html_options values=$branchInput output=$branchOutput selected=$branch}
	  </select>
	</td>
  </tr>
   <tr>
    <td>Direct / Khata</td>
    <td>
	  <select name="acc_type">
	    {html_options values=$sellTypeValue output=$sellTypOutput selected=$acc_type}
	  </select>
	</td>
  </tr>
  <tr>
    <td>Metal Type</td>
    <td>
	  <select name="metal_type">
	    {html_options values=$metalValue output=$metalOutput selected=$metal_type}
	  </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" value="{$rate}" class="rate" onkeyup="getsign();" onBlur="getsign();" onChange="getsign();"></td>
  </tr>
  <tr>
    <td>Fine</td>
	<td><input type="text" name="fine" value="{$fine}" class="fine" onkeyup="getsign();" onBlur="getsign();" onChange="getsign();"></td>
  </tr>
  <tr>
    <td>Amount</td>
	<td><input type="text" name="amount" value="{$amount}" class="amount"></td>
  </tr>
  <tr>
  	<td colspan="3" align="center"><input type="submit" value="Submit" name="submit" class="btn"></td>
  </tr>
</table>
</form>
{/block}