<?php 
if(isset($_POST['refs'])){

extract($_POST);
$custid=$refs/253/253;
require 'connection.php';
$bal=0;
$drtotl=0;
$crtotl=0;

// Start Checking Date TODAY
if($dt==1){
$today=date('Y-m-d', strtotime('-0 days'));
$datess=date('Y-m-d', strtotime('-30 days'));
// Account Name
 $qry = "SELECT * from groupreg where groupid = '$custid'";
  $run_qry = mysqli_query($connect, $qry);
  $row=mysqli_fetch_array($run_qry);
  $accnames=$row['groupname'];
  
?>

<tr>
  <td colspan="5" style=" text-align: center; color: blue; font-size: 16px;">Group Name:</td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo $accnames; ?></td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo 'From: '.$today; ?></td>
</tr>
<!-- <tr>
  <td colspan="4" style=" text-align: center; color: blue;">*******Opening Balance*******</td>
  <td colspan="1" style=" text-align: center; color: blue;"><?php //echo $rowlgropning['opbal']; ?></td>
  
</tr> -->
<tr>
  <td style=" text-align: center; color: white; background-color: #131797;">Acc.Name</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Opp.Bal</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Debit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Credit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Balance</td>
</tr>
   <?php

  $sr = 1;
    $crTotal = 0;
    $dbTotal = 0;
    $clstoal = 0;

        $qry = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as clsBal,ledger.accid,accname from ledger inner join accreg on ledger.accid = accreg.accid where ledger.dated <= '$today' and accreg.groupid='$custid' group by ledger.accid";
        $run_qry = mysqli_query($connect, $qry) or die(mysqli_error($connect));
        while($row = mysqli_fetch_array($run_qry)){
          $clsBal = $row['clsBal'];
          $acId = $row['accid'];
          // finding opening balanacing
          $qry1 = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as opBal from ledger where dated < '$from' and accid = '$acId'";
          $run_qry1 = mysqli_query($connect, $qry1) or die(mysqli_error($connect));
          $row1 = mysqli_fetch_array($run_qry1);
          // end op balance
          // finding debit,credit
          $qry2 = "SELECT sum(ifnull(debit,0)) as drBal, sum(ifnull(credit,0)) as crBal from ledger where dated >= '$from' and dated <= '$to' and accid = '$acId'";
          $run_qry2 = mysqli_query($connect, $qry2) or die(mysqli_error($connect));
          $row2 = mysqli_fetch_array($run_qry2);
          $dbTotal = $dbTotal + $row2["drBal"];
          $crTotal = $crTotal + $row2["crBal"];
          $clstoal=$clstoal + $clsBal;
          if($sr%2==0){
            $rowclr='cyan';
          }
          else{
            $rowclr='white';

          }
      //Numbers are right-aligned so we give 'R' after new line parameter

      //Numbers are right-aligned so we give 'R' after new line parameter

// **********************************
?>

    <tr>

  <td colspan="1" style=" text-align: left; color: black; background-color: <?php echo $rowclr; ?>; "><?php echo $row["accname"]; ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row1["opBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["drBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["crBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr ?>;"><?php echo round($row["clsBal"],3); ?></td>
</tr>

 
<?php
  $sr++;

}

?>
   <tr>

 <td colspan="2" style=" text-align: center; color: white; background-color: #131797;">
<label style="color: black; background-color: cyan;">Debit </label>
<label>/</label>
<label style="color: black; background-color: yellow;">Credit </label>
<label>/</label>
<label style="color: black; background-color: white;">Balance </label>
  </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
   <label style="color: black; background-color: cyan;"><?php echo $dbTotal; ?></label>
    </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: yellow;"><?php echo $crTotal; ?></label>
  </td>
  
  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: white;">
      <?php echo $clstoal; ?></label></td>
</tr>
 
<?php
}

// End Checking Date Option TODAY

// Start Checking Date YESTERDAY
if($dt==2){
$yesterday=date('Y-m-d', strtotime('-1 days'));
$datess=date('Y-m-d', strtotime('-30 days'));
// Account Name
 $qry = "SELECT * from groupreg where groupid = '$custid'";
  $run_qry = mysqli_query($connect, $qry);
  $row=mysqli_fetch_array($run_qry);
  $accnames=$row['groupname'];
  
?>

<tr>
  <td colspan="5" style=" text-align: center; color: blue; font-size: 16px;">Group Name:</td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo $accnames; ?></td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo 'From: '.$yesterday; ?></td>
</tr>
<!-- <tr>
  <td colspan="4" style=" text-align: center; color: blue;">*******Opening Balance*******</td>
  <td colspan="1" style=" text-align: center; color: blue;"><?php //echo $rowlgropning['opbal']; ?></td>
  
</tr> -->
<tr>
  <td style=" text-align: center; color: white; background-color: #131797;">Acc.Name</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Opp.Bal</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Debit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Credit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Balance</td>
</tr>
   <?php

  $sr = 1;
    $crTotal = 0;
    $dbTotal = 0;
    $clstoal = 0;

        $qry = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as clsBal,ledger.accid,accname from ledger inner join accreg on ledger.accid = accreg.accid where  accreg.groupid='$custid' group by ledger.accid";
        $run_qry = mysqli_query($connect, $qry) or die(mysqli_error($connect));
        while($row = mysqli_fetch_array($run_qry)){
          $clsBal = $row['clsBal'];
          $acId = $row['accid'];
          // finding opening balanacing
          $qry1 = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as opBal from ledger where dated < '$yesterday' and accid = '$acId'";
          $run_qry1 = mysqli_query($connect, $qry1) or die(mysqli_error($connect));
          $row1 = mysqli_fetch_array($run_qry1);
          // end op balance
          // finding debit,credit
          $qry2 = "SELECT sum(ifnull(debit,0)) as drBal, sum(ifnull(credit,0)) as crBal from ledger where dated >= '$yesterday' and accid = '$acId'";
          $run_qry2 = mysqli_query($connect, $qry2) or die(mysqli_error($connect));
          $row2 = mysqli_fetch_array($run_qry2);
          $dbTotal = $dbTotal + $row2["drBal"];
          $crTotal = $crTotal + $row2["crBal"];
          $clstoal=$clstoal + $clsBal;
          if($sr%2==0){
            $rowclr='cyan';
          }
          else{
            $rowclr='white';

          }
      //Numbers are right-aligned so we give 'R' after new line parameter

      //Numbers are right-aligned so we give 'R' after new line parameter

// **********************************
?>

    <tr>


  <td colspan="1" style=" text-align: left; color: black; background-color: <?php echo $rowclr; ?>; "><?php echo $row["accname"]; ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row1["opBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["drBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["crBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr ?>;"><?php echo round($row["clsBal"],3); ?></td>
</tr>

 
<?php
  $sr++;

}

?>

  <tr>

 <td colspan="2" style=" text-align: center; color: white; background-color: #131797;">
<label style="color: black; background-color: cyan;">Debit </label>
<label>/</label>
<label style="color: black; background-color: yellow;">Credit </label>
<label>/</label>
<label style="color: black; background-color: white;">Balance </label>
  </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
   <label style="color: black; background-color: cyan;"><?php echo $dbTotal; ?></label>
    </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: yellow;"><?php echo $crTotal; ?></label>
  </td>
  
  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: white;">
      <?php echo $clstoal; ?></label></td>
</tr>
  
<?php
}
// End Checking Date Option YESTERDAY



// Start Checking Date LAST 7 DAYS
if($dt==3){
 $sevenday=date('Y-m-d', strtotime('-7 days'));

$datess=date('Y-m-d', strtotime('-30 days'));
// Account Name
 $qry = "SELECT * from groupreg where groupid = '$custid'";
  $run_qry = mysqli_query($connect, $qry);
  $row=mysqli_fetch_array($run_qry);
  $accnames=$row['groupname'];
  
?>

<tr>
  <td colspan="5" style=" text-align: center; color: blue; font-size: 16px;">Group Name:</td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo $accnames; ?></td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo 'From: '.$sevenday; ?></td>
</tr>
<!-- <tr>
  <td colspan="4" style=" text-align: center; color: blue;">*******Opening Balance*******</td>
  <td colspan="1" style=" text-align: center; color: blue;"><?php //echo $rowlgropning['opbal']; ?></td>
  
</tr> -->
<tr>
  <td style=" text-align: center; color: white; background-color: #131797;">Acc.Name</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Opp.Bal</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Debit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Credit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Balance</td>
</tr>
   <?php

  $sr = 1;
    $crTotal = 0;
    $dbTotal = 0;
    $clstoal = 0;

        $qry = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as clsBal,ledger.accid,accname from ledger inner join accreg on ledger.accid = accreg.accid where accreg.groupid='$custid' group by ledger.accid";
        $run_qry = mysqli_query($connect, $qry) or die(mysqli_error($connect));
        while($row = mysqli_fetch_array($run_qry)){
          $clsBal = $row['clsBal'];
          $acId = $row['accid'];
          // finding opening balanacing
          $qry1 = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as opBal from ledger where dated < '$sevenday' and accid = '$acId'";
          $run_qry1 = mysqli_query($connect, $qry1) or die(mysqli_error($connect));
          $row1 = mysqli_fetch_array($run_qry1);
          // end op balance
          // finding debit,credit
          $qry2 = "SELECT sum(ifnull(debit,0)) as drBal, sum(ifnull(credit,0)) as crBal from ledger where dated >= '$sevenday' and accid = '$acId'";
          $run_qry2 = mysqli_query($connect, $qry2) or die(mysqli_error($connect));
          $row2 = mysqli_fetch_array($run_qry2);
          $dbTotal = $dbTotal + $row2["drBal"];
          $crTotal = $crTotal + $row2["crBal"];
          $clstoal=$clstoal + $clsBal;
          if($sr%2==0){
            $rowclr='cyan';
          }
          else{
            $rowclr='white';

          }
      //Numbers are right-aligned so we give 'R' after new line parameter

      //Numbers are right-aligned so we give 'R' after new line parameter

// **********************************
?>

    <tr>

  <td colspan="1" style=" text-align: left; color: black; background-color: <?php echo $rowclr; ?>; "><?php echo $row["accname"]; ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row1["opBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["drBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["crBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr ?>;"><?php echo round($row["clsBal"],3); ?></td>
</tr>

 
<?php
  $sr++;

}

?>
   <tr>
  
 <td colspan="2" style=" text-align: center; color: white; background-color: #131797;">
<label style="color: black; background-color: cyan;">Debit </label>
<label>/</label>
<label style="color: black; background-color: yellow;">Credit </label>
<label>/</label>
<label style="color: black; background-color: white;">Balance </label>
  </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
   <label style="color: black; background-color: cyan;"><?php echo $dbTotal; ?></label>
    </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: yellow;"><?php echo $crTotal; ?></label>
  </td>
  
  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: white;">
      <?php echo $clstoal; ?></label></td>
</tr>
<?php
}
// End Checking Date Option LAST 7 DAYS



// Start Checking Date THIS MONTH
if($dt==4){

    date_default_timezone_set("Asia/Karachi");
  
     $d = date("d");
      $m = date('m');
      $y = date("Y");
     $thismonth = $y.'-'.$m.'-1';

// Account Name
 $qry = "SELECT * from groupreg where groupid = '$custid'";
  $run_qry = mysqli_query($connect, $qry);
  $row=mysqli_fetch_array($run_qry);
  $accnames=$row['groupname'];
  
?>

<tr>
  <td colspan="5" style=" text-align: center; color: blue; font-size: 16px;">Group Name:</td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo $accnames; ?></td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo 'From: '.$thismonth; ?></td>
</tr>
<!-- <tr>
  <td colspan="4" style=" text-align: center; color: blue;">*******Opening Balance*******</td>
  <td colspan="1" style=" text-align: center; color: blue;"><?php //echo $rowlgropning['opbal']; ?></td>
  
</tr> -->
<tr>
  <td style=" text-align: center; color: white; background-color: #131797;">Acc.Name</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Opp.Bal</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Debit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Credit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Balance</td>
</tr>
   <?php

  $sr = 1;
    $crTotal = 0;
    $dbTotal = 0;
    $clstoal = 0;

        $qry = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as clsBal,ledger.accid,accname from ledger inner join accreg on ledger.accid = accreg.accid where  accreg.groupid='$custid' group by ledger.accid";
        $run_qry = mysqli_query($connect, $qry) or die(mysqli_error($connect));
        while($row = mysqli_fetch_array($run_qry)){
          $clsBal = $row['clsBal'];
          $acId = $row['accid'];
          // finding opening balanacing
          $qry1 = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as opBal from ledger where dated < '$thismonth' and accid = '$acId'";
          $run_qry1 = mysqli_query($connect, $qry1) or die(mysqli_error($connect));
          $row1 = mysqli_fetch_array($run_qry1);
          // end op balance
          // finding debit,credit
          $qry2 = "SELECT sum(ifnull(debit,0)) as drBal, sum(ifnull(credit,0)) as crBal from ledger where dated >= '$thismonth' and accid = '$acId'";
          $run_qry2 = mysqli_query($connect, $qry2) or die(mysqli_error($connect));
          $row2 = mysqli_fetch_array($run_qry2);
          $dbTotal = $dbTotal + $row2["drBal"];
          $crTotal = $crTotal + $row2["crBal"];
          $clstoal=$clstoal + $clsBal;
          if($sr%2==0){
            $rowclr='cyan';
          }
          else{
            $rowclr='white';

          }
      //Numbers are right-aligned so we give 'R' after new line parameter

      //Numbers are right-aligned so we give 'R' after new line parameter

// **********************************
?>

    <tr>


  <td colspan="1" style=" text-align: left; color: black; background-color: <?php echo $rowclr; ?>; "><?php echo $row["accname"]; ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row1["opBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["drBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["crBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr ?>;"><?php echo round($row["clsBal"],3); ?></td>
</tr>

 
<?php
  $sr++;

}

?>
   <tr>
  
 <td colspan="2" style=" text-align: center; color: white; background-color: #131797;">
<label style="color: black; background-color: cyan;">Debit </label>
<label>/</label>
<label style="color: black; background-color: yellow;">Credit </label>
<label>/</label>
<label style="color: black; background-color: white;">Balance </label>
  </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
   <label style="color: black; background-color: cyan;"><?php echo $dbTotal; ?></label>
    </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: yellow;"><?php echo $crTotal; ?></label>
  </td>
  
  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: white;">
      <?php echo $clstoal; ?></label></td>
</tr>
<?php
}
// End Checking Date Option THIS MONTH



// Start Checking Date THIS MONTH
if($dt==5){

    date_default_timezone_set("Asia/Karachi");
  
     $d = date("d");
      $m = date('m')-1;
      $y = date("Y");
     $lastmonth = $y.'-'.$m.'-1';

// Account Name
 $qry = "SELECT * from groupreg where groupid = '$custid'";
  $run_qry = mysqli_query($connect, $qry);
  $row=mysqli_fetch_array($run_qry);
  $accnames=$row['groupname'];
  
?>

<tr>
  <td colspan="5" style=" text-align: center; color: blue; font-size: 16px;">Group Name:</td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo $accnames; ?></td>
</tr>
<tr>
  <td colspan="5" style=" text-align: center; color: red; font-size: 20px;"><?php echo 'From: '.$lastmonth; ?></td>
</tr>
<!-- <tr>
  <td colspan="4" style=" text-align: center; color: blue;">*******Opening Balance*******</td>
  <td colspan="1" style=" text-align: center; color: blue;"><?php //echo $rowlgropning['opbal']; ?></td>
  
</tr> -->
<tr>
  <td style=" text-align: center; color: white; background-color: #131797;">Acc.Name</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Opp.Bal</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Debit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Credit</td>
  <td style=" text-align: center; color: white; background-color: #131797;">Balance</td>
</tr>
   <?php

  $sr = 1;
    $crTotal = 0;
    $dbTotal = 0;
    $clstoal = 0;

        $qry = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as clsBal,ledger.accid,accname from ledger inner join accreg on ledger.accid = accreg.accid where accreg.groupid='$custid' group by ledger.accid";
        $run_qry = mysqli_query($connect, $qry) or die(mysqli_error($connect));
        while($row = mysqli_fetch_array($run_qry)){
          $clsBal = $row['clsBal'];
          $acId = $row['accid'];
          // finding opening balanacing
          $qry1 = "SELECT sum(ifnull(debit,0))-sum(ifnull(credit,0)) as opBal from ledger where dated < '$lastmonth' and accid = '$acId'";
          $run_qry1 = mysqli_query($connect, $qry1) or die(mysqli_error($connect));
          $row1 = mysqli_fetch_array($run_qry1);
          // end op balance
          // finding debit,credit
          $qry2 = "SELECT sum(ifnull(debit,0)) as drBal, sum(ifnull(credit,0)) as crBal from ledger where dated >= '$lastmonth' and accid = '$acId'";
          $run_qry2 = mysqli_query($connect, $qry2) or die(mysqli_error($connect));
          $row2 = mysqli_fetch_array($run_qry2);
          $dbTotal = $dbTotal + $row2["drBal"];
          $crTotal = $crTotal + $row2["crBal"];
          $clstoal=$clstoal + $clsBal;
          if($sr%2==0){
            $rowclr='cyan';
          }
          else{
            $rowclr='white';

          }
      //Numbers are right-aligned so we give 'R' after new line parameter

      //Numbers are right-aligned so we give 'R' after new line parameter

// **********************************
?>

    <tr>
 

  <td colspan="1" style=" text-align: left; color: black; background-color: <?php echo $rowclr; ?>; "><?php echo $row["accname"]; ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row1["opBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["drBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr; ?>;"><?php echo round($row2["crBal"],3); ?></td>
  <td style=" text-align: center; color: black; background-color: <?php echo $rowclr ?>;"><?php echo round($row["clsBal"],3); ?></td>
</tr>

 
<?php
  $sr++;

}

?>
   <tr>
  
 <td colspan="2" style=" text-align: center; color: white; background-color: #131797;">
<label style="color: black; background-color: cyan;">Debit </label>
<label>/</label>
<label style="color: black; background-color: yellow;">Credit </label>
<label>/</label>
<label style="color: black; background-color: white;">Balance </label>
  </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
   <label style="color: black; background-color: cyan;"><?php echo $dbTotal; ?></label>
    </td>

  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: yellow;"><?php echo $crTotal; ?></label>
  </td>
  
  <td colspan="1" style=" text-align: center; color: black; background-color: #131797;">
    <label style="color: black; background-color: white;">
      <?php echo $clstoal; ?></label></td>
</tr>

<?php
}
// End Checking Date Option THIS MONTH
}
// }

?>
