<?php
 $jannssf='';
 $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='January' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='January' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $jannssf=$row['sum(NSSF)'];
    }
    }else
    {
    $jannssf='0';
    }
    
    //February
    $febnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='February' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='February' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $febnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $febnssf='0';
    }
    
    //March
    $marnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='March' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='March' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $marnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $marnssf='0';
    }
    
     //April
    $aprnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='April' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT SUM(NSSF) as NSSFapril FROM payment where Month ='April' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $aprnssf=$row['NSSFapril'];
    }
    }else
    {
    $aprnssf='0';
    }
    
     //May
    $maynssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='May' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='May' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $maynssf=$row['sum(NSSF)'];
    }
    }else
    {
    $maynssf='0';
    }
 
       //June
    $junnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='June' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='June' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $junnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $junnssf='0';
    }
    
     //July
    $julynssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='July' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='July' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $julynssf=$row['sum(NSSF)'];
    }
    }else
    {
    $julynssf='0';
    }
    
    
     //August
    $augnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='August' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='August' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $augnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $augnssf='0';
    }
    
    
    //September
    $sepnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='September' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='September' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $sepnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $sepnssf='0';
    }
    
    
    //October
    $octnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='October' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='October' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $octnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $octnssf='0';
    }
    
    
    //November
    $novnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='November' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='November' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $novnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $novnssf='0';
    }
    
    
    
    //December
    $decnssf='';
    
    $sql = mysqli_query($con,"SELECT * FROM payment where Year='$yr' AND Month='December' AND Approved='Yes'");
    $num=mysqli_fetch_array($sql);
    if($num>0)
    {
    $result = mysqli_query($con,"SELECT sum(NSSF) FROM payment where Month ='December' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $decnssf=$row['sum(NSSF)'];
    }
    }else
    {
    $decnssf='0';
    }
    
    ?>