{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;
	}
}
</script>
<style>
td{
  text-align: center;
  font-weight: bold;
  
}
.td{
  cellpadding:20px;
  cellspacing:20px;
  
}
</style>
{/block}
{block name=body}
<form name="partyForm"action="{$smarty.server.PHP_SELF}" method="POST">
<input type="hidden" name="partyId" value="{$partyId}">
<h1 align="center"><font size="5px">Client List</font>&nbsp;&nbsp;<a href="clientPdf.php?partyId={$partyId}&todate={$toDate}&fromDate={$fromDate}" target="_blank" style="text-decoration:none;"><font size="3px;">Print</font></a>
<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></h1>
<table cellpadding="3" cellspacing="0"  align="center" width=90%>
   <tr>
    <!-- <td>Open Fine : {$openingAmt}</td>
	<td>Open Amount : {$openingFine}</td>-->
    <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"}</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="98%" border="1" align="center">
<tr>
	<td>
		<table cellspacing="14">
			<tr><td colspan="14" align="center">Buy</td></tr>
			<tr>
				<td>Delete</td>
				<td>Edit</td>
				<td>Acc Type</td>
				<td>Sell Type</td>
				<td>Particular</td>
				<td>Date</td>
				<td>Rate</td>
				<td>K.G.</td>
				<td>Total Amount</td>
			</tr>
			{section name="sec" loop=$clientDetail}
			<tr>
				{if $clientDetail[sec].rojmelId == 0}
				<td><a href="clientdelete.php?clientId={$clientDetail[sec].clientId}" onclick="return confirm('DO You Want To Delete !!!!!')";><img src="img/delete.png"></a></td>
				<td><a href="client.php?clientId={$clientDetail[sec].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 $clientDetail[sec].sell_type == 'D'}
				<td>Direct</td>
			 {else}
				<td>Khata</td>
			{/if}
			{if $clientDetail[sec].cliTransType == 'J'}
			   <td>Sell</td>
			 {else}
			   <td>Buy</td>
			 {/if}
				<td>{$clientDetail[sec].particular}</td>
				<td>{$clientDetail[sec].cDate}</td>
				<td>{$clientDetail[sec].rate}</td>
				<td>{$clientDetail[sec].kg|string_format:"%.3f"}</td>
				<td>{$clientDetail[sec].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>Particular</td>
				<td>Date</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>Baki</td>
				{else if $clientDet[secnew].cliTransType == 'A' && $clientDet[secnew].is_opening == '1'}
					<td>Jama</td>
				{else if $clientDet[secnew].cliTransType == 'A' && $clientDet[secnew].is_opening == '0'}
					<td>Aavak</td>
				{else}
					<td>Javak</td>
				{/if}
				<td>{$clientDet[secnew].particular}</td>
				<td>{$clientDet[secnew].cDate}</td>
				<!-- <td>{$clientDet[secnew].rate}</td> -->
				<td>{$clientDet[secnew].kg|string_format:"%.3f"}</td>
				<td>{$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>
	{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}	