{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() {
	$(".saudaId").click(function() {
	if ($(this).is(":checked")) 
	{
		 var dataString = "saudaId=" +$(this).val();
			$.ajax({
			type: "POST",
			url: "updateStatusCheckedmcx.php",
			data: dataString,
			success:function(data)
			{}
		});
	}
	else
	{
		var dataString = "saudaId=" +$(this).val();
			$.ajax({
			type: "POST",
			url: "updateStatusUnCheckedmcx.php",
			data: dataString,
			success:function(data)
			{
			  
			}
		});
	}
  });
});
</script>
<style>
td{
  text-align: center;
  font-weight: bold;
  vertical-align: super;
  
}
</style>
{/block}
{block name=body}
<form name="partyForm"action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="partyId" value="{$partyId}">
<table cellpadding="1" cellspacing="0"  align="center" width=90%>
   <tr>
    <td colspan="2">Client Name
	  <select name="partyId" autofocus>
	     <option value="0">Select Party</option>
	    {html_options values=$clientArray.partyId output=$clientArray.partyName selected=$partyId}
	  </select>
	</td>
	<th>From</th>
  <td>{html_select_date prefix="to" start_year="-3" end_year="+1" field_order="DMY" day_value_format="%02d" time=$weeklyDate}</td>
  <th>To</th>
  <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>
</table>
<br/>
<table cellspacing="0"  width="90%" border="1" align="center">
  <tr>
    <td>
	  <table class="table" cellspacing="3" width="95%" align="center">
	    <tr><td colspan="9" align="center">Buy</td></tr>
	    <tr>
		  <td>&nbsp;</td>
		  <td>&nbsp;</td>
		  <!-- <td valign="top">Type</td> -->
		  <td valign="top">Party Name</td>
		  <td valign="top">Branch</td>
		  <td valign="top">Metal Type</td>
		  <td valign="top">Date</td>
		  <td valign="top">Particular</td>
		  <td valign="top">Cash Type</td>
		  <td valign="top">Rate</td>
		  <td valign="top">Fine</td>
		  <td valign="top">Amount</td>
			
		</tr>
		  {section name="sec" loop=$rojmelArray}
		  <tr style="color:green;">
			 <td><a href="saudadelete.php?saudaId={$rojmelArray[sec].saudaId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
			 <td><a href="sauda.php?saudaId={$rojmelArray[sec].saudaId}"><img src="img/edit.png"></a></td>
			 <!-- {if $rojmelArray[sec].acc_type == 'D'} -->
				<!-- <td>Direct</td> -->
			  <!-- {else} -->
				<!-- <td>Khata</td> -->
			  <!-- {/if} -->
			 <td nowrap>{$rojmelArray[sec].partyName}</td>
			 <td nowrap>{$rojmelArray[sec].branch}</td>
			 <td nowrap>{$rojmelArray[sec].metal_type}</td>
			 <td nowrap>{$rojmelArray[sec].saudaDate}</td>
			 <td nowrap>{$rojmelArray[sec].particular}</td>
			 {if $rojmelArray[sec].cash_type == 'R'}
			 <td nowrap>RTGS</td>
			 {else}
			 <td nowrap>Cash</td>
			 {/if}
			 <td nowrap>{$rojmelArray[sec].rate}</td>
			 <td nowrap>{$rojmelArray[sec].fine|number_format:3}</td>
			 <td nowrap>{$rojmelArray[sec].amount|number_format:2}</td>
			 {if $rojmelArray[sec].mcxcheckStatus == 1}
			 <td><input type="checkbox" value="{$rojmelArray[sec].saudaId}" class="saudaId" checked></td>
			 {else}
			 <td><input type="checkbox" value="{$rojmelArray[sec].saudaId}" class="saudaId"></td>
			 {/if}
		  {/section}
	  </table>
	  <td align="center">Sell
	  <table class="table" cellspacing="3" width="95%" align="center">
			<tr>
			  <td>&nbsp;</td>
		      <td>&nbsp;</td>
			  <!-- <td>Type</td> -->
			  <td>Party Name</td>
			  <td>Branch</td>
			  <td>Metal Type</td>
			  <td>Date</td>
			  <td>Particular</td>
			  <td valign="top">Cash Type</td>
			  <td valign="top">Rate</td>
			  <td>Fine</td>
			  <td>Amount</td>
			</tr>
			  {section name="sec1" loop=$javakArray}
			   <tr style="color:red;">
			     <td><a href="saudadelete.php?saudaId={$javakArray[sec1].saudaId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
			     <td><a href="sauda.php?saudaId={$javakArray[sec1].saudaId}"><img src="img/edit.png"></a></td>
				 <!-- {if $javakArray[sec1].acc_type == 'D'} -->
					<!-- <td>Direct</td> -->
				  <!-- {else} -->
					<!-- <td>Khata</td> -->
				  <!-- {/if} -->
				 <td nowrap>{$javakArray[sec1].partyName}</td>
				 <td nowrap>{$javakArray[sec1].branch}</td>
				 <td nowrap>{$javakArray[sec1].metal_type}</td>
				 <td nowrap>{$javakArray[sec1].saudaDate}</td>
				 <td nowrap>{$javakArray[sec1].particular}</td>
				 {if $javakArray[sec1].cash_type == 'R'}
				 <td nowrap>RTGS</td>
				 {else}
				 <td nowrap>Cash</td>
				{/if}
				 <td nowrap>{$javakArray[sec1].rate}</td>
				 <td nowrap>{$javakArray[sec1].fine|number_format:3}</td>
				 <td nowrap>{$javakArray[sec1].amount|string_format:"%.0f"}</td>
				 {if $javakArray[sec1].mcxcheckStatus == 1}
				 <td><input type="checkbox" value="{$javakArray[sec1].saudaId}" class="saudaId" checked></td>
				 {else}
				 <td><input type="checkbox" value="{$javakArray[sec1].saudaId}" class="saudaId"></td>
				 {/if}
			  </tr>
			  {/section}
		   </table>
		</td>
	</tr>
</table>
<table cellspacing="0"  width="95%" border="1" align="center">
<tr>
	<td>
		<a href="clientPdf.php?partyId={$partyId}&todate={$toDate}&fromDate={$fromDate}" target="_blank" style="text-decoration:none;"><font size="3px;">Print</font></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
		<a href="cdeleteNew.php?partyId={$partyId}" onclick="return confirm('DO You Want To Submit !!!!!');" target="" style="text-decoration:none;"><font size="3px;">Delete</font></a>
	</td>
</table>
<table cellspacing="0"  width="95%" border="1" align="center">
<tr>
	<td>
		<table cellspacing="1">
			<tr><td colspan="9" align="center">Buy</td></tr>
			<tr>
				<td>Delete</td>
				<td>Edit</td>
				<td>Metal Type</td>
				<td>Date</td>
				<td>Acc Type</td>
				<td>Sell Type</td>
				<td>Particular</td>
				<td>Rate</td>
				<td>K.G.</td>
				<td>Total Amount</td>
			</tr>
			{section name="sec11" loop=$clientDetail}
			<tr>
				{if $clientDetail[sec11].rojmelId == 0}
				<td><a href="clientdelete.php?clientId={$clientDetail[sec11].clientId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
				<td><a href="sauda.php?saudaId={$clientDetail[sec11].saudaId}"><img src="img/edit.png"></a></td>
				{else}
				<td></td>
				<td></td>
				{/if}
				
			<!-- {if $clientDetail[sec].cliTransType == 'J' && $clientDetail[sec].rojmelId == 0} -->
			   <!-- <td> Buy </td> -->
			<!-- {else if $clientDetail[sec].cliTransType == 'A' && $clientDetail[sec].rojmelId == 0} -->
			   <!-- <td> Sell </td> -->
			<!-- {else if $clientDetail[sec].cliTransType == 'A' && $clientDetail[sec].rojmelId > 0} -->
				<!-- <td> Aavak </td> -->
			<!-- {else} -->
				<!-- <td> Javak </td>	 -->
			<!-- {/if} -->
			<td>{$clientDetail[sec11].metal_type}</td>
			<td nowrap>{$clientDetail[sec11].cDate}</td>
			{if $clientDetail[sec11].sell_type == 'D'}
				<td>Direct</td>
			 {else}
				<td>Khata</td>
			{/if}
			{if $clientDetail[sec11].cliTransType == 'J'}
			   <td>Sell</td>
			 {else}
			   <td>Buy</td>
			 {/if}
				<td>{$clientDetail[sec11].particular}</td>
				<td nowrap>{$clientDetail[sec11].rate}</td>
				<td nowrap>{$clientDetail[sec11].kg|string_format:"%.3f"}</td>
				<td nowrap>{$clientDetail[sec11].totalAmt|string_format:"%.0f"}</td>
			</tr>
		  {/section}
		</table>
	</td>
	<td>
		<table cellspacing="14">
			<tr><td colspan="14" align="center">Rojmel Entry</td></tr>
			<tr>
				<!-- <td>Delete</td> -->
				<!-- <td>Edit</td> -->
				<td>Type</td>
				<td>Date</td>
				<td>Particular</td>
				<td>Metal Type</td>
				<td>K.G.</td>
				<td>Total Amount</td>
			</tr>
			{section name="secnew" loop=$clientDet}
			<tr>
				<!-- {if $clientDet[secnew].rojmelId == 0} -->
				<!-- <td><a href="clientdelete.php?clientId={$clientDet[secnew].clientId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td> -->
				<!-- <td><a href="client.php?clientId={$clientDet[secnew].clientId}"><img src="img/edit.png"></a></td> -->
				<!-- {else} -->
				<!-- <td></td> -->
				<!-- <td></td> -->
				<!-- {/if} -->
			<!-- {if $clientDetail[sec].cliTransType == 'J' && $clientDetail[sec].rojmelId == 0} -->
			   <!-- <td> Buy </td> -->
			<!-- {else if $clientDetail[sec].cliTransType == 'A' && $clientDetail[sec].rojmelId == 0} -->
			   <!-- <td> Sell </td> -->
			<!-- {else if $clientDetail[sec].cliTransType == 'A' && $clientDetail[sec].rojmelId > 0} -->
				<!-- <td> Aavak </td> -->
			<!-- {else} -->
				<!-- <td> Javak </td>	 -->
			<!-- {/if} -->
				<!-- {if $clientDet[secnew].sell_type == 'D'} -->
				 <!-- <td>Direct</td> -->
				 <!-- {else} -->
				 <!-- <td>Khata</td> -->
				<!-- {/if} -->
				{if $clientDet[secnew].cliTransType == 'J' && $clientDet[secnew].is_opening == '1'}
					<td>Javak</td>
				{else if $clientDet[secnew].cliTransType == 'A' && $clientDet[secnew].is_opening == '1'}
					<td>Aavak</td>
				{else if $clientDet[secnew].cliTransType == 'A' && $clientDet[secnew].is_opening == '0'}
					<td>Aavak</td>
				{else}
					<td>Javak</td>
				{/if}
				<td nowrap>{$clientDet[secnew].cDate}</td>
				<td nowrap>{$clientDet[secnew].particular}</td>
				<td nowrap>{$clientDet[secnew].metal_type}</td>
				<!-- <td>{$clientDet[secnew].rate}</td> -->
				<td nowrap>{$clientDet[secnew].kg|string_format:"%.3f"}</td>
				<td nowrap>{$clientDet[secnew].totalAmt|string_format:"%.0f"}</td>
			</tr>
		  {/section}
		</table>
	</td>
</tr>
</table>
<br>
<!-- <table align="center" border=""> -->
<!-- <tr> -->
    <!-- <td>Buy Kg : &nbsp;&nbsp; 	{$clientTotalKg|string_format:"%.3f"}</td> -->
	<!-- <td>Buy Amount : &nbsp;&nbsp; {$clientTotalAmt|string_format:"%.0f"}</td> -->
<!-- </tr> -->
<!-- <tr> -->
    <!-- <td>Rojmel Kg : &nbsp;&nbsp; 	{$grossKg|string_format:"%.3f"}</td> -->
	<!-- <td>Rojmel Amount : &nbsp;&nbsp; {$grossAmt|string_format:"%.0f"}</td> -->
<!-- </tr> -->
<!-- </table> -->
<!-- <br> -->

<table align="center" border="">
<tr>
	<td> Final RTGS Amount : {$finalRtAmt|string_format:"%.0f"}</td>
	<td> Final CASH Amount : {$finalCAmt|string_format:"%.0f"}</td>
</tr>
<tr>
	<td> CHORSA : {$netChorsa|string_format:"%.3f"}</td>
	<td> SILI : {$netSili|string_format:"%.3f"}</td>
</tr>
</table>
<br>
<table align="center" border="">
<tr>
	{if $finalkg < 0}
      <td colspan="3" align="right" style="color:red;">Final Kg : &nbsp;&nbsp; 	{$finalKg|string_format:"%.3f"}</td>
	{else}
	  <td colspan="3" align="right" style="color:green;">Final Kg : &nbsp;&nbsp; {$finalKg|string_format:"%.3f"}</td>
	{/if}
</tr>
<tr>
	{if $finalkg < 0}
      <td colspan="3" align="right" style="color:red;">Final Amount : &nbsp;&nbsp; 	{$finalAmount|string_format:"%.0f"}</td>
	{else}
	  <td colspan="3" align="right" style="color:green;">Final Amount : &nbsp;&nbsp; 	{$finalAmount|string_format:"%.0f"}</td>
	{/if}
  </tr>
</table>

</form>
{/block}	