<?php
$peri=$pe.'-'.$yr;
///////////////CBC
//Tution Fee
 $query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(TuFee+BoFee+PeFee+Tablet) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberfee,
 (SELECT SUM(TuFee+BoFee+PeFee+Tablet) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as junfee , 
 (SELECT SUM(TuFee+BoFee+PeFee+Tablet) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberfee,
 (SELECT SUM(TuFee+BoFee+PeFee+Tablet) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augfee,
 (SELECT SUM(Amount) from BudgetAmount where ID='sfee' AND Period='$peri') as sfee FROM feestatement where Year='$yr'");
 
while($row=mysqli_fetch_array($query))
{
 $Septemberfee=$row['Septemberfee'];
 $junfee=$row['junfee'];
 $Novemberfee=$row['Novemberfee'];
 $augfee=$row['augfee'];
 $sfee=$row['sfee'];
 $totSeptemberfee=$Septemberfee+$junfee+$Novemberfee+$augfee;
}

//Motivation Fee
 $query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(MoFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septembermoti,
 (SELECT SUM(MoFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as junmoti,
 (SELECT SUM(MoFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novembermoti,
 (SELECT SUM(MoFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augmoti,
 (SELECT SUM(Amount) from BudgetAmount where ID='moti' AND Period='$peri') as moti FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septembermoti=$row['Septembermoti'];
 $junmoti=$row['junmoti'];
 $Novembermoti=$row['Novembermoti'];
 $augmoti=$row['augmoti'];
 $moti=$row['moti'];
 $totSeptembermoti=$Septembermoti+$junmoti+$Novembermoti+$augmoti;
}

//Admission Fee
 $query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(AdFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberadfe,
 (SELECT SUM(AdFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as junadfe,
 (SELECT SUM(AdFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberadfe,
 (SELECT SUM(AdFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augadfe,
 (SELECT SUM(Amount) from BudgetAmount where ID='adfee' AND Period='$peri') as adfee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septemberadfe=$row['Septemberadfe'];
 $junadfe=$row['junadfe'];
 $Novemberadfe=$row['Novemberadfe'];
 $augadfe=$row['augadfe'];
 $adfee=$row['adfee'];
 $totSeptemberadfee=$Septemberadfe+$junadfe+$Novemberadfe+$augadfe;
}

//Transport Fee
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(TrFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septembertra,
(SELECT SUM(TrFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as juntra,
(SELECT SUM(TrFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novembertra,
(SELECT SUM(TrFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augtra,
(SELECT SUM(Amount) from BudgetAmount where ID='trafee' AND Period='$peri') as trafee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septembertra=$row['Septembertra'];
$juntra=$row['juntra'];
$Novembertra=$row['Novembertra'];
$augtra=$row['augtra'];
$trafee=$row['trafee'];
$totSeptembertra=$Septembertra+$juntra+$Novembertra+$augtra;
}

//Uniform Fee
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(UnFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberuni,
(SELECT SUM(UnFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as jununi,
(SELECT SUM(UnFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberuni,
(SELECT SUM(UnFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as auguni,
(SELECT SUM(Amount) from BudgetAmount where ID='unifee' AND Period='$peri') as unifee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberuni=$row['Septemberuni'];
$jununi=$row['jununi'];
$Novemberuni=$row['Novemberuni'];
$auguni=$row['auguni'];
$unifee=$row['unifee'];
$totSeptemberuni=$Septemberuni+$jununi+$Novemberuni+$auguni;
}

//Diaries
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(DiFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberdia,
(SELECT SUM(DiFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as jundia,
(SELECT SUM(DiFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberdia,
(SELECT SUM(DiFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augdia,
(SELECT SUM(Amount) from BudgetAmount where ID='diafee' AND Period='$peri') as diafee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberdia=$row['Septemberdia'];
$jundia=$row['jundia'];
$Novemberdia=$row['Novemberdia'];
$augdia=$row['augdia'];
$diafee=$row['diafee'];
$totSeptemberdia=$Septemberdia+$jundia+$Novemberdia+$augdia;
}

//Books
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(BookFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberbkf,
(SELECT SUM(BookFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as junbkf,
(SELECT SUM(BookFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberbkf,
(SELECT SUM(BookFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augbkf,
(SELECT SUM(Amount) from BudgetAmount where ID='bks' AND Period='$peri') as bks FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberbkf=$row['Septemberbkf'];
$junbkf=$row['junbkf'];
$Novemberbkf=$row['Novemberbkf'];
$augbkf=$row['augbkf'];
$bks=$row['bks'];
$totSeptemberbkf=$Septemberbkf+$junbkf+$Novemberbkf+$augbkf;
}

//Developemnt
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(Dev) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septemberdev,
(SELECT SUM(Dev) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as jundev,
(SELECT SUM(Dev) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novemberdev,
(SELECT SUM(Dev) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augdev,
(SELECT SUM(Amount) from BudgetAmount where ID='dev' AND Period='$peri') as devfee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberdev=$row['Septemberdev'];
$jundev=$row['jundev'];
$Novemberdev=$row['Novemberdev'];
$augdev=$row['augdev'];
$devfee=$row['devfee'];
$totSeptemberdev=$Septemberdev+$jundev+$Novemberdev+$augdev;
}


/* Tablet
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(Tablet) from feestatement where Month='September' AND Year='$yr' AND Cate='Upper') as Septembertab,
(SELECT SUM(Tablet) from feestatement where Month='October' AND Year='$yr' AND Cate='Upper') as juntab,
(SELECT SUM(Tablet) from feestatement where Month='November' AND Year='$yr' AND Cate='Upper') as Novembertab,
(SELECT SUM(Tablet) from feestatement where Month='December' AND Year='$yr' AND Cate='Upper') as augtab,
(SELECT SUM(Amount) from BudgetAmount where ID='tab' AND Period='$peri') as tab FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septembertab=$row['Septembertab'];
$juntab=$row['juntab'];
$Novembertab=$row['Novembertab'];
$augtab=$row['augtab'];
$tab=$row['tab'];
$totSeptembertab=$Septembertab+$juntab+$Novembertab+$augtab;
} */

/////////////////////Sub Total CBC
$subtncbc=$totSeptemberfee+$totSeptembermoti+$totSeptemberadfee+$totSeptembertra+$totSeptemberuni+$totSeptemberdia+$totSeptemberbkf+$totSeptemberdev;

///////////////Nursery
//Tution Fee N
 $query=mysqli_query($con,"select feestatement.pid, 
 (SELECT SUM(TuFee+MoFee+PeFee+Tablet) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberfeen,
 (SELECT SUM(TuFee+MoFee+PeFee+Tablet) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as junfeen, 
 (SELECT SUM(TuFee+MoFee+PeFee+Tablet) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberfeen,
 (SELECT SUM(TuFee+MoFee+PeFee+Tablet) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augfeen,
 (SELECT SUM(Amount) from BudgetAmount where ID='tufeen' AND Period='$peri') as tufeen FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septemberfeen=$row['Septemberfeen'];
 $junfeen=$row['junfeen'];
 $Novemberfeen=$row['Novemberfeen'];
 $augfeen=$row['augfeen'];
 $tufeen=$row['tufeen'];
 $totSeptemberfeen=$Septemberfeen+$junfeen+$Novemberfeen+$augfeen;
}

//Admission Fee N
 $query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(AdFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberadfel,
 (SELECT SUM(AdFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as junadfel,
 (SELECT SUM(AdFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberadfel,
 (SELECT SUM(AdFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augadfel,
 (SELECT SUM(Amount) from BudgetAmount where ID='adfee2' AND Period='$peri') as adfee2 FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septemberadfel=$row['Septemberadfel'];
 $junadfel=$row['junadfel'];
 $Novemberadfel=$row['Novemberadfel'];
 $augadfel=$row['augadfel'];
 $adfee2=$row['adfee2'];
 $totSeptemberadfeel=$Septemberadfel+$junadfel+$Novemberadfel+$augadfel;
}

//Transport Fee N
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(TrFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septembertran,
(SELECT SUM(TrFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as juntran,
(SELECT SUM(TrFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novembertran,
(SELECT SUM(TrFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augtran,
 (SELECT SUM(Amount) from BudgetAmount where ID='trafeen' AND Period='$peri') as trafeen FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septembertran=$row['Septembertran'];
$juntran=$row['juntran'];
$Novembertran=$row['Novembertran'];
$augtran=$row['augtran'];
$trafeen=$row['trafeen'];
$totSeptembertran=$Septembertran+$juntran+$Novembertran+$augtran;
}

/* Motivation FeeN
 $query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(MoFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septembermotin,
 (SELECT SUM(MoFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as junmotin,
 (SELECT SUM(MoFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novembermotin,
 (SELECT SUM(MoFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augmotin,
 (SELECT SUM(Amount) from BudgetAmount where ID='moti2' AND Period='$peri') as moti2 FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septembermotin=$row['Septembermotin'];
 $junmotin=$row['junmotin'];
 $Novembermotin=$row['Novembermotin'];
 $augmotin=$row['augmotin'];
 $moti2=$row['moti2'];
 $totSeptembermotin=$Septembermotin+$junmotin+$Novembermotin+$augmotin;
} */

//Uniform FeeN
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(UnFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberunin,
(SELECT SUM(UnFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as jununin,
(SELECT SUM(UnFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberunin,
(SELECT SUM(UnFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augunin,
(SELECT SUM(Amount) from BudgetAmount where ID='unifeen' AND Period='$peri') as unifeen FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberunin=$row['Septemberunin'];
$jununin=$row['jununin'];
$Novemberunin=$row['Novemberunin'];
$augunin=$row['augunin'];
$unifeen=$row['unifeen'];
$totSeptemberunin=$Septemberunin+$jununin+$Novemberunin+$augunin;
}

//Diaries N
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(DiFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberdian,
(SELECT SUM(DiFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as jundian,
(SELECT SUM(DiFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberdian,
(SELECT SUM(DiFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augdian,
(SELECT SUM(Amount) from BudgetAmount where ID='diafeen' AND Period='$peri') as diafeen FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberdian=$row['Septemberdian'];
$jundian=$row['jundian'];
$Novemberdian=$row['Novemberdian'];
$augdian=$row['augdian'];
$diafeen=$row['diafeen'];
$totSeptemberdian=$Septemberdian+$jundian+$Novemberdian+$augdian;
}

//Books N
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(BookFee) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberbkfn,
(SELECT SUM(BookFee) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as junbkfn,
(SELECT SUM(BookFee) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberbkfn,
(SELECT SUM(BookFee) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augbkfn,
(SELECT SUM(Amount) from BudgetAmount where ID='boon' AND Period='$peri') as boon FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberbkfn=$row['Septemberbkfn'];
$junbkfn=$row['junbkfn'];
$Novemberbkfn=$row['Novemberbkfn'];
$augbkfn=$row['augbkfn'];
$boon=$row['boon'];
$totSeptemberbkfn=$Septemberbkfn+$junbkfn+$Novemberbkfn+$augbkfn;
}

//Developemnt N
$query=mysqli_query($con,"select feestatement.pid, (SELECT SUM(Dev) from feestatement where Month='September' AND Year='$yr' AND Cate='Lower') as Septemberdevn,
(SELECT SUM(Dev) from feestatement where Month='October' AND Year='$yr' AND Cate='Lower') as jundevn,
(SELECT SUM(Dev) from feestatement where Month='November' AND Year='$yr' AND Cate='Lower') as Novemberdevn,
(SELECT SUM(Dev) from feestatement where Month='December' AND Year='$yr' AND Cate='Lower') as augdevn,
(SELECT SUM(Amount) from BudgetAmount where ID='devn' AND Period='$peri') as devn FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
$Septemberdevn=$row['Septemberdevn'];
$jundevn=$row['jundevn'];
$Novemberdevn=$row['Novemberdevn'];
$augdevn=$row['augdevn'];
$devn=$row['devn'];
$totSeptemberdevn=$Septemberdevn+$jundevn+$Novemberdevn+$augdevn;
}

//Graduation PP2
 $query=mysqli_query($con,"select Gradpayment.pid, (SELECT SUM(Amount) from Gradpayment where Month='September' AND Year='$yr') as gradSeptember,
 (SELECT SUM(Amount) from Gradpayment where Month='October' AND Year='$yr') as gradjun,
 (SELECT SUM(Amount) from Gradpayment where Month='November' AND Year='$yr') as gradjul,
 (SELECT SUM(Amount) from Gradpayment where Month='December' AND Year='$yr') as gradaug,
 (SELECT SUM(Amount) from BudgetAmount where ID='grad' AND Period='$peri') as grad FROM Gradpayment where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $gSeptember=$row['gradSeptember'];
 $gjun=$row['gradjun'];
 $gjul=$row['gradjul'];
 $gaug=$row['gradaug'];
 $gradd=$row['grad'];
 $totgradSeptember=$gSeptember+$gjun+$gjul+$gaug;
}
/////////////////////Sub Total nursery
$subtn=$totSeptemberfeen+$totSeptemberadfeel+$totSeptembertran+$totSeptemberunin+$totSeptemberdian+$totSeptemberbkfn+$totSeptemberdevn+$totgradSeptember;


//Tourpayment
 $query=mysqli_query($con,"select TourPayment.pid, (SELECT SUM(Amount) from TourPayment where Month='September' AND Year='$yr') as Septembertour,
 (SELECT SUM(Amount) from TourPayment where Month='October' AND Year='$yr') as juntour,
 (SELECT SUM(Amount) from TourPayment where Month='November' AND Year='$yr') as Novembertour,
 (SELECT SUM(Amount) from TourPayment where Month='December' AND Year='$yr') as augtour,
 (SELECT SUM(Amount) from BudgetAmount where ID='tuwa' AND Period='$peri') as tuwa FROM TourPayment where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septembertour=$row['Septembertour'];
 $juntour=$row['juntour'];
 $Novembertour=$row['Novembertour'];
 $augtour=$row['augtour'];
 $tuwa=$row['tuwa'];
 $totSeptembertour=$Septembertour+$juntour+$Novembertour+$augtour;
}

//Bus Hire
 $query=mysqli_query($con,"select busincome.busid, (SELECT SUM(cost) from busincome where Month='September' AND Year='$yr') as Septemberbh,
 (SELECT SUM(cost) from busincome where Month='October' AND Year='$yr') as junbh,
 (SELECT SUM(cost) from busincome where Month='November' AND Year='$yr') as Novemberbh,
 (SELECT SUM(cost) from busincome where Month='December' AND Year='$yr') as augbh,
 (SELECT SUM(Amount) from BudgetAmount where ID='bus' AND Period='$peri') as bus FROM busincome where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septemberbh=$row['Septemberbh'];
 $junbh=$row['junbh'];
 $Novemberbh=$row['Novemberbh'];
 $augbh=$row['augbh'];
 $bus=$row['bus'];
 $totSeptemberbh=$Septemberbh+$junbh+$Novemberbh+$augbh;
}

//Farm Income
 $query=mysqli_query($con,"select farminput.item, (SELECT SUM(Amount) from farminput where Month='September' AND Year='$yr') as Septemberfam,
 (SELECT SUM(Amount) from farminput where Month='October' AND Year='$yr') as junfam,
 (SELECT SUM(Amount) from farminput where Month='November' AND Year='$yr') as Novemberfam,
 (SELECT SUM(Amount) from farminput where Month='December' AND Year='$yr') as augfam FROM farminput where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $Septemberfam=$row['Septemberfam'];
 $junfam=$row['junfam'];
 $Novemberfam=$row['Novemberfam'];
 $augfam=$row['augfam'];
 $totSeptemberfam=$Septemberfam+$junfam+$Novemberfam+$augfam;
}

$totincomeSeptemberaug=$subtncbc+$totSeptembertour+$totSeptemberbh+$totSeptemberfam+$subtn;


//EXPENSES ------------------------------------------------------------------------------------------------------------------
//Project Bank
$query=mysqli_query($con,"select Item, (SELECT SUM(Amount) from prodata where Month='September' AND Year='$yr') as mpro, 
(SELECT SUM(Amount) from prodata where Month='October' AND Year='$yr') as jupro,
(SELECT SUM(Amount) from prodata where Month='November' AND Year='$yr') as julpro,
(SELECT SUM(Amount) from prodata where Month='December' AND Year='$yr') as aupro FROM prodata where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $mpro=$row['mpro'];
 $jupro=$row['jupro'];
 $julpro=$row['julpro'];
 $aupro=$row['aupro'];
 $totSeptemberproject=$mpro+$jupro+$julpro+$aupro;
}

//Salaries
$query=mysqli_query($con,"select Staff_id, (SELECT SUM(Gross) from payment where Month='September' AND Year='$yr' AND Approved='Yes') as masala, 
(SELECT SUM(Gross) from payment where Month='October' AND Year='$yr' AND Approved='Yes') as jusala,
(SELECT SUM(Gross) from payment where Month='November' AND Year='$yr' AND Approved='Yes') as julsala,
(SELECT SUM(Gross) from payment where Month='December' AND Year='$yr' AND Approved='Yes') as ausala FROM payment where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $msala=$row['masala'];
 $jusala=$row['jusala'];
 $julsala=$row['julsala'];
 $ausala=$row['ausala'];
 $totSeptembersala=$msala+$jusala+$julsala+$ausala;
}


//Category Expenses
$query=mysqli_query($con,"select expenses.*,(SELECT SUM(Amount) FROM Expenses where Month='September' AND Year='$yr') as Septemberyexpe,
(SELECT SUM(Amount) FROM Imprest2 where Month='September' AND Year='$yr') as Septemberyexpe2,
(SELECT SUM(Amount) FROM Expenses where Month='October' AND Year='$yr') as Octoberexpe,
(SELECT SUM(Amount) FROM Imprest2 where Month='October' AND Year='$yr') as Octoberexpe2,

(SELECT SUM(Amount) FROM Expenses where Month='November' AND Year='$yr') as Novemberexpe,
(SELECT SUM(Amount) FROM Imprest2 where Month='November' AND Year='$yr') as Novemberexpe2,

(SELECT SUM(Amount) FROM Expenses where Month='December' AND Year='$yr') as augaexpe,
(SELECT SUM(Amount) FROM Imprest2 where Month='December' AND Year='$yr') as augaexpe2 from expenses ORDER BY Item DESC");
while($row=mysqli_fetch_array($query))
{
$totSeptembere=$row['Septemberyexpe']+$row['Septemberyexpe2'];
$totOctobere=$row['Octoberexpe']+$row['Octoberexpe2'];
$totNovembere=$row['Novemberexpe']+$row['Novemberexpe2'];
$totaugae=$row['augaexpe']+$row['augaexpe2'];
}

$totexpe=$totSeptembere+$totOctobere+$totNovembere+$totaugae;
$totalexpens=$totSeptemberproject+$totSeptembersala+$totexpe;

?>




