<?php
 $jansala='';
 $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(Net) FROM payment where Month ='January' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $jansala=$row['sum(Net)'];
    }
    }else
    {
    $jansala='0';
    }
    
    //February
    $febsala='';
    
    $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(Net) FROM payment where Month ='February' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $febsala=$row['sum(Net)'];
    }
    }else
    {
    $febsala='0';
    }
    
    //March
    $marsala='';
    
    $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(Net) FROM payment where Month ='March' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $marsala=$row['sum(Net)'];
    }
    }else
    {
    $marsala='0';
    }
    
     //April
    $aprsala='';
    
    $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(Net) as netapril FROM payment where Month ='April' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $aprsala=$row['netapril'];
    }
    }else
    {
    $aprsala='0';
    }
    
     //May
    $maysala='';
    
    $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(Net) FROM payment where Month ='May' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $maysala=$row['sum(Net)'];
    }
    }else
    {
    $maysala='0';
    }
 
       //June
    $junsala='';
    
    $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(Net) FROM payment where Month ='June' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $junsala=$row['sum(Net)'];
    }
    }else
    {
    $junsala='0';
    }
    
     //July
    $julysala='';
    
    $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(Net) FROM payment where Month ='July' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $julysala=$row['sum(Net)'];
    }
    }else
    {
    $julysala='0';
    }
    
    
     //August
    $augsala='';
    
    $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(Net) FROM payment where Month ='August' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $augsala=$row['sum(Net)'];
    }
    }else
    {
    $augsala='0';
    }
    
    
    //September
    $sepsala='';
    
    $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(Net) FROM payment where Month ='September' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $sepsala=$row['sum(Net)'];
    }
    }else
    {
    $sepsala='0';
    }
    
    
    //October
    $octsala='';
    
    $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(Net) FROM payment where Month ='October' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $octsala=$row['sum(Net)'];
    }
    }else
    {
    $octsala='0';
    }
    
    
    //November
    $novsala='';
    
    $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(Net) FROM payment where Month ='November' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $novsala=$row['sum(Net)'];
    }
    }else
    {
    $novsala='0';
    }
    
    
    
    //December
    $decsala='';
    
    $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(Net) FROM payment where Month ='December' AND Year='$yr' AND Approved='Yes'");
    while($row = $result->fetch_assoc()) 
    {
    $decsala=$row['sum(Net)'];
    }
    }else
    {
    $decsala='0';
    }
    
    ?>