{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 getAmount()
{
	var finalAmt = $('.finalAmt').val() ? $('.finalAmt').val() : 0;
	var brokrage = $('.brokrage').val() ? $('.brokrage').val() : 0;
	var TotAmt   = $('.TotAmt').val() ? $('.TotAmt').val() : 0;
	
	if(finalAmt < 0)
	{
	  grossAmt = Math.abs(finalAmt);
	  TotAmt  = (parseFloat(grossAmt) + parseFloat(brokrage));
	  $('.TotAmt').val(TotAmt.toFixed(0));
	}
	else
	{
	  grossAmt = Math.abs(finalAmt);
	  TotAmt  = (parseFloat(grossAmt) - parseFloat(brokrage));
	  $('.TotAmt').val(TotAmt.toFixed(0));
	}
}
</script>
<style>
td{
  text-align: center;
  font-weight: bold;
}
.td{
 border: none;
  
}
</style>
{/block}
{block name=body}
<form name="partyForm"action="{$smarty.server.PHP_SELF}" method="POST">
<h1 align="center"><font size="5px">Mcx List</font></h1>
<table align="center" width="70%">
	<tr>
		<td>
			<select name="partyId">
				<option value="">Select Name</option>
				{html_options values=$clientArray.partyId output=$clientArray.partyName selected=$partyId}
			</select>
		</td>
		<td>From</td>
			<td>{html_select_date prefix="to" start_year="-3" end_year="+1" field_order="DMY" day_value_format="%02d"}</td>
		<td>To</td>
			<td>{html_select_date prefix="from" start_year="-3" end_year="+1" field_order="DMY" day_value_format="%02d"}</td>
		<td><input type="submit" name="submit" value="Submit"></td>
	</tr>
</h1>
<table cellpadding="3" cellspacing="0" border="" align="center" width=95%>
  <tr>
 
	<td align="center">
		<table cellspacing="10">
			<tr><td colspan="7" align="center">Buy</td></tr>
			<tr>
				<td>Edit</td>
				<td>Delete</td>
				<td>Party Name</td>
				<td>Date</td>
				<td>Rate</td>
				<td>K.G.</td>
				<td>Total Amount</td>
			</tr>
  
		  {section name="sec1" loop=$javakDetail}
		   <tr style="color:Green;">
			<td><a href="mcxentry.php?mcxId={$javakDetail[sec1].mcxId}"><img src="img/edit.png"></a></td>
			<td><a href="mcxdelete.php?mcxId={$javakDetail[sec1].mcxId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
			 <td>{$javakDetail[sec1].partyName}</td>
			 <td>{$javakDetail[sec1].transDate}</td>
			 <td>{$javakDetail[sec1].rate}</td>
			 <td>{$javakDetail[sec1].kg}</td>
			 <td>{$javakDetail[sec1].a}</td>
		  </tr>
		  {/section}
		</table>
	</td>
	<td>
		<table cellspacing="10">
			<tr><td colspan="7" align="center">Sell</td></tr>
			<tr>
				<td>Edit</td>
				<td>Delete</td>
				<td>Party Name</td>
				<td>Date</td>
				<td>Rate</td>
				<td>K.G.</td>
				<td>Total Amount</td>
			</tr>
  
		  {section name="sec" loop=$clientDetail}
		   <tr style="color:red;">
		   <td><a href="mcxentry.php?mcxId={$clientDetail[sec].mcxId}"><img src="img/edit.png"></a></td>
		   <td><a href="mcxdelete.php?mcxId={$clientDetail[sec].mcxId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
			 <td>{$clientDetail[sec].partyName}</td>
			 <td>{$clientDetail[sec].transDate}</td>
			 <td>{$clientDetail[sec].rate}</td>
			 <td>{$clientDetail[sec].kg}</td>
			 <td>{$clientDetail[sec].a}</td>
		  </tr>
		  {/section}
		</table>
	</td>
</table>
	<br/>
	<table cellspacing="14" align="center" border="1">
		<tr>
		 <!-- {if $totalAmt > 0} -->
			<!-- <td style="color:green;">{$finalRasAmt}</td> -->
		<!-- {else} -->
			<!-- <td style="color:red;">{$finalRasAmt}</td> -->
		<!-- {/if}  -->
			<td class="td">Total Kg : </td>
			<td class="td">{$finalKg}</td>
		</tr> 
		<tr> 
			<td class="td">Total Amount : </td>
			<td class="td">{$finalAmt}</td>
		</tr>
	</table>
	<br/>
	<table align="center" width="70">
		<tr> 
			<td>Kg </td>
			<td><input type="text" value="{$mcxKg}" class="mcxKg"></td>
			<td>Amount </td>
			<td><input type="text" value="{$finalAmt}" class="finalAmt" onkeyup="getAmount();"> </td>
			<td>Brokrage </td>
			<td><input type="text" class="brokrage" onkeyup="getAmount();"></td>
			<td>Total Amount </td>
			<td><input type="text" class="TotAmt"></td>
		</tr>
	</table>
</form>
{/block}