<style>
td{font-family:"courier new";}
</style>
<?
include("test.php");
$arg=explode("/",$cde);
$sql="select * from leave where name='$arg[0]' and df='$arg[1]'";
//print $sql;
/*
$link=mysqli_connect("localhost.localdomain","root");
mysqli_select_db("alpdb") or die ("<h3> Error:Database could not be connected-".mysqli_error());
*/
include("opendb.php");
$result=mysqli_query($db,$sql) or die(mysqli_error());
$row=mysqli_fetch_row($result);
//print "<br>code:$row[0], name:$row[1], Kind:$row[2]";
$lv="";
 switch($row[2])
 {
  case 'EL':
    $lv="Earned";
    break;
  case 'CTD':
    $lv="Commuted";
    break;
  case 'HP':
    $lv="Half Pay";
    break;
  case 'CL':
    $lv="Casual";
    break;
  case 'LLP':
    $lv="Loss of pay";
    break;
  case 'LOD':
  case 'lod':
    $lv="Leave on Duety";
    break;
 }

$sql2="select * from esta where code='$row[1]'";
$result2=mysqli_query($db,$sql2) or die(mysqli_error());
$row2=mysqli_fetch_array($result2);

?>
<table width=555>
<tr><td colspan=2>
<center>THE KOZHIKODE DIST.CO-OPERATIVE RUBBER MARKETING SOCIETY Ltd., CALICUT</center>
</td></tr>
<tr><td>No.62-1624/02</td><td align=right>Date:<?print date("d-m-Y",time())?></td></tr>
<tr><td colspan=2>
Sir,
<blockquote>Sub: Leave granted-reporting of-req</blockquote>
<p align=justify>
This is to inform you that <b><?print strtoupper($row2[name]." ".$row2[desp])?> </b>is granted <?print $lv?> leave for <?print (int)$row[3]?> days from <b><?print datetoHtml($row[4])?></b> to <b><?print datetoHtml($row[5])?></b>  with permission to prefix <?print $pref?> to <?print $prefto?>  and to suffix <?print $suf?> to <?print $sufto?>. A copy of order No.M/62-1624/02 Dt. <?print date("d-m-Y",time())?> of sanction of leave is enclosed herewith.  I certify that <?print strtoupper($lv." Leave")?> from <?print datetoHtml($row[4])?> to <?print datetoHtml($row[5])?> is admissible under rule 84/83/78/88 PART 1.K.S.R. and that the amount paid to him/her towards leave salary will be refunded if the same is found excess as per leave rules and service conditions and that the leave granted in the service book.  The other details required are as follows.
</tr></td>
<tr><td>1. Post Held</td><td>: <?print strtoupper($row2[desp])?></td></tr>
<tr><td>2. Pay Scale of pay </td><td>: <?print $row2[pp]?>  (Rs.<?print $row2[spaymin]."-". $row2[spaymax]?>)</td></tr>
<tr><td>3. House rent allowance, conveyance
        allowance and other compensatory <br>
        allowance in the present post</td><td valign=top>: DA : Rs.<?print strtoupper($row2[da])?> <br>
: HRA: Rs.<?print strtoupper($row2[hra])?><br>: CCA : Rs.<?print strtoupper($row2[cca])?>
</tr></td>
<tr><td>4. Ground on which leave is applied for</td><td>: <?print strtoupper($row[7])?></td></tr>
<tr><td>5. Date of return from last leave and <br>
the nature and period of last leave</td>
<td>: 
<?
$sql3="select * from leave where name='$arg[0]' and df<'$arg[1]' order by df";
$result3=mysqli_query($db,$sql3) ;
$row3=mysqli_fetch_row($result3) ;
$a=datetoHtml($row3[5]);
$b=$row3[2];
$c=(int)$row3[3];
$d=datetoHtml($row3[4]);
?>
<?print $a. " ".$b." ".$c?> DAYS FROM <br>: 
<?print $d?>
</td></tr>
<tr><td>6. Leave at credit on the date of <br>
commencement of leave now applied for </td><td>: HPL : <?print $hpl?><br> : EL: <?print $el?></td></tr>

<tr><td>7. Leave alary admissible as per rule <br> and the period</td>
<td>: Pay: Rs.<?print $row2[pp]?><br>  DA : Rs.<?print strtoupper($row2[da])?> <br>
  HRA: Rs.<?print strtoupper($row2[hra])?><br> CCA : Rs.<?print strtoupper($row2[cca])?>
</tr></td>
<tr><td align=right colspan=2>(From <?print datetoHtml($row[4])?> to <?print datetoHtml($row[5])?>)
<br>
Rejoined duty on <?print datetoHtml($row[6])?> <br>
Yours Faithfully, <br>&nbsp;<br>&nbsp;<br>&nbsp;<br>MANAGING DIRECTOR </tr></td>
</table>
