<?php
 $jannhif='';
 $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(NHIF) FROM payment where Month ='January' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $jannhif=$row['sum(NHIF)'];
    }
    }else
    {
    $jannhif='0';
    }
    
    //February
    $febnhif='';
    
    $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(NHIF) FROM payment where Month ='February' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $febnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $febnhif='0';
    }
    
    //March
    $marnhif='';
    
    $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(NHIF) FROM payment where Month ='March' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $marnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $marnhif='0';
    }
    
     //April
    $aprnhif='';
    
    $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(NHIF) as NHIFapril FROM payment where Month ='April' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $aprnhif=$row['NHIFapril'];
    }
    }else
    {
    $aprnhif='0';
    }
    
     //May
    $maynhif='';
    
    $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(NHIF) FROM payment where Month ='May' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $maynhif=$row['sum(NHIF)'];
    }
    }else
    {
    $maynhif='0';
    }
 
       //June
    $junnhif='';
    
    $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(NHIF) FROM payment where Month ='June' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $junnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $junnhif='0';
    }
    
     //July
    $julynhif='';
    
    $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(NHIF) FROM payment where Month ='July' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $julynhif=$row['sum(NHIF)'];
    }
    }else
    {
    $julynhif='0';
    }
    
    
     //August
    $augnhif='';
    
    $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(NHIF) FROM payment where Month ='August' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $augnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $augnhif='0';
    }
    
    
    //September
    $sepnhif='';
    
    $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(NHIF) FROM payment where Month ='September' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $sepnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $sepnhif='0';
    }
    
    
    //October
    $octnhif='';
    
    $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(NHIF) FROM payment where Month ='October' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $octnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $octnhif='0';
    }
    
    
    //November
    $novnhif='';
    
    $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(NHIF) FROM payment where Month ='November' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $novnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $novnhif='0';
    }
    
    
    
    //December
    $decnhif='';
    
    $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(NHIF) FROM payment where Month ='December' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $decnhif=$row['sum(NHIF)'];
    }
    }else
    {
    $decnhif='0';
    }
    
    ?>