<?php
$months = array(1 => 'Jan.', 2 => 'Feb.', 3 => 'Mar.', 4 => 'Apr.', 5 => 'May', 6 => 'Jun.', 7 => 'Jul.', 8 => 'Aug.', 9 => 'Sep.', 10 => 'Oct.', 11 => 'Nov.', 12 => 'Dec.');
$months1 = array(1 => '01', 2 =>'02' , 3 =>'03', 4 => '04',5 =>'05', 6 =>'06', 7 =>'07', 8 => '08',9 => '09', 10 => '10', 11 => '11', 12 =>'12');
$current_month_data=ltrim(date('m', strtotime('0 month')), '0');
$year=date("Y"); 
?>
<table width="100%" border="0" cellspacing="1" cellpadding="2">
  <tr>
    <th>Month</th>
    <th>Year</th>
    <th>Loan Amount</th>
    <th>Paid Amount</th>
    <th>Bal. Amount</th>
  </tr>
  <?php
 
  $empid=$s->getField('empmaster','mst_www_userid',$_SESSION['UserID'],'id');
 for($i=1;$i<=$current_month_data;$i++)
{
//echo "Select * from master_process_salary where   payslip_month='".$i."'  and emp_id='".$empid."'";	
$sql_attendence=DB_query("Select * from loan_management  where  Month(loan_date)='".$months1['$i']."'  and emp_id='".$empid."'",$db);
  while($row_attendence=DB_fetch_array($sql_attendence))
  {
  ?>
    <tr bgcolor="#e7e7e7">
    <td style="padding-top:3px; padding-bottom:3px;"><?php echo $months[$i]; ?></td>
    <td><?php echo $num = cal_days_in_month(CAL_GREGORIAN, $i, $year); ?></td>
    <td><?php echo  $row_attendence['loan_amount']; ?></td>
    <td><?php echo $row_attendence['loan_amount'];?></td>
    <td><?php echo $row_attendence['loan_balance'];?>  </td>
  </tr>
  <?php } } ?>


</table>