<?php

    
    
    
    
    
    
    
    
    
    
    
   
//Tution Fee
 $query=mysqli_query($con,"select Bank, (SELECT SUM(TuFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as julfee,(SELECT SUM(TuFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augfee,(SELECT SUM(TuFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as sepfee FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julfee=$row['julfee'];
 $aufee=$row['augfee'];
 $sefee=$row['sepfee'];
 $totjulyfee=$julfee+$aufee+$sefee;
}

//Motivation Fee

$query=mysqli_query($con,"select Bank, (SELECT SUM(MoFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as julmot,(SELECT SUM(MoFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augmot,(SELECT SUM(MoFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as sepmot FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julmot=$row['julmot'];
 $aumot=$row['augmot'];
 $semot=$row['sepmot'];
 $totjulymot=$julmot+$aumot+$semot;
}


//Uniform Fee
$query=mysqli_query($con,"select Bank, (SELECT SUM(UnFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as juluni,(SELECT SUM(UnFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as auguni,(SELECT SUM(UnFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as sepuni FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julun=$row['juluni'];
 $auuni=$row['auguni'];
 $seuni=$row['sepuni'];
 $totjulyuni=$julun+$auuni+$seuni;
}

//Transport Fee
$query3=mysqli_query($con,"select Bank, (SELECT SUM(TrFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as jultr,(SELECT SUM(TrFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augtr,(SELECT SUM(TrFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as septr FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query3))
{
 $jultra=$row['jultr'];
 $augtra=$row['augtr'];
 $septra=$row['septr'];
 $totjulytran=$jultra+$augtra+$septra;
}


//Textbooks Fee
$query3=mysqli_query($con,"select Bank, (SELECT SUM(BookFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as julbk,(SELECT SUM(BookFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augbk,(SELECT SUM(BookFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as sepbk FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query3))
{
 $julbuk=$row['julbk'];
 $augbuk=$row['augbk'];
 $sepbuk=$row['sepbk'];
 $totjulybook=$julbuk+$augbuk+$sepbuk;
}


//Assessment Books Fee
$query3=mysqli_query($con,"select Bank, (SELECT SUM(DiFee) from feestatement where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as juldi,(SELECT SUM(DiFee) from feestatement where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augdi,(SELECT SUM(DiFee) from feestatement where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as sepdi FROM feestatement where Year='$yr'");
while($row=mysqli_fetch_array($query3))
{
 $juldia=$row['juldi'];
 $augdia=$row['augdi'];
 $sepdia=$row['sepdi'];
 $totjulydiary=$juldia+$augdia+$sepdia;
}


//Tour Fee
$query5=mysqli_query($con,"select TourPayment.Bank as bn, (SELECT SUM(Amount) FROM TourPayment where Month='July' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as jultour,(SELECT SUM(Amount) from TourPayment where Month='August' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as augtour,(SELECT SUM(Amount) from TourPayment where Month='September' AND Year='$yr' AND Grad !='BABY CLASS' AND Grad !='PP1' AND Grad !='PP2') as septour FROM TourPayment where Year='$yr'");
while($row=mysqli_fetch_array($query5))
{
 $jultu=$row['jultour'];
 $augtu=$row['augtour'];
 $septu=$row['septour'];
 $totjulytour=$jultu+$augtu+$septu;
}


//Bus Income
$query6=mysqli_query($con,"select busincome.busid as bid, (SELECT SUM(cost) FROM busincome where Month='July') as julbus,(SELECT SUM(cost) from busincome where Month='August') as augbus,(SELECT SUM(cost) from busincome where Month='September') as sepbus FROM busincome where Year='$yr'");
while($row=mysqli_fetch_array($query6))
{
 $julbs=$row['julbus'];
 $augbs=$row['augbus'];
 $sepbs=$row['sepbus'];
 $totjulybus=$julbs+$augbs+$sepbs;
}

//Farm Income
$query7=mysqli_query($con,"select farminput.Bank as bk, (SELECT SUM(Amount) FROM farminput where Month='July') as julfam,(SELECT SUM(Amount) from farminput where Month='August') as augfam,(SELECT SUM(Amount) from farminput where Month='September') as sepfam FROM farminput where Year='$yr'");
while($row=mysqli_fetch_array($query7))
{
 $julfm=$row['julfam'];
 $augfm=$row['augfam'];
 $sepfm=$row['sepfam'];
 $totjulyfam=$julfm+$augfm+$sepfm;
}


$subtotalincome=$totjulyfam+$totjulybus+$totjulytour+$totjulydiary+$totjulybook+$totjulytran+$totjulyuni+$totjulymot+$totjulyfee;


//Nursery Fee Nursery ------------------------------------------------------------------------------------------------------------------
$query=mysqli_query($con,"select Bank, (SELECT SUM(TuFee) from feestatement where Month='July' AND Grad='BABY CLASS' AND Year='$yr') as julbafe,(SELECT SUM(TuFee) from feestatement where Month='August' AND Grad='BABY CLASS') as augbafe,(SELECT SUM(TuFee) from feestatement where Month='September' AND Grad='BABY CLASS') as sepbafe,(SELECT SUM(TuFee) from feestatement where Month='July' AND Grad='PP1' AND Year='$yr') as julPP1fe,(SELECT SUM(TuFee) from feestatement where Month='August' AND Grad='PP1' AND Year='$yr') as augPP1fe,(SELECT SUM(TuFee) from feestatement where Month='September' AND Grad='PP1' AND Year='$yr') as sepPP1fe,(SELECT SUM(TuFee) from feestatement where Month='September' AND Grad='PP2' AND Year='$yr') as sepPP2fe,(SELECT SUM(TuFee) from feestatement where Month='August' AND Grad='PP2' AND Year='$yr') as augPP2fe,(SELECT SUM(TuFee) from feestatement where Month='July' AND Grad='PP2' AND Year='$yr') as julPP2fe FROM feestatement where Year='$yr' ");
while($row=mysqli_fetch_array($query))
{
 $BFJ=$row['julbafe'];
 $BFA=$row['augbafe'];
 $BFS=$row['sepbafe'];

 $P1FJ=$row['julPP1fe'];
 $P1FA=$row['augPP1fe'];
 $P1FS=$row['sepPP1fe'];

 $P2FJ=$row['julPP2fe'];
 $P2FA=$row['augPP2fe'];
 $P2FS=$row['sepPP2fe'];
 
 $totjulyfeeN=$BFJ+$BFA+$BFS+$P1FJ+$P1FA+$P1FS+$P2FJ+$P2FA+$P2FS;
}

//Transport Nusery 
$query=mysqli_query($con,"select Bank, (SELECT SUM(TrFee) from feestatement where Month='July' AND Grad='BABY CLASS' AND Year='$yr') as julbatr,(SELECT SUM(TrFee) from feestatement where Month='August' AND Grad='BABY CLASS') as augbatr,(SELECT SUM(TrFee) from feestatement where Month='September' AND Grad='BABY CLASS') as sepbatr,(SELECT SUM(TrFee) from feestatement where Month='July' AND Grad='PP1' AND Year='$yr') as julPP1tr,(SELECT SUM(TrFee) from feestatement where Month='August' AND Grad='PP1' AND Year='$yr') as augPP1tr,(SELECT SUM(TrFee) from feestatement where Month='September' AND Grad='PP1' AND Year='$yr') as sepPP1tr,(SELECT SUM(TrFee) from feestatement where Month='September' AND Grad='PP2' AND Year='$yr') as sepPP2tr,(SELECT SUM(TrFee) from feestatement where Month='August' AND Grad='PP2' AND Year='$yr') as augPP2tr,(SELECT SUM(TrFee) from feestatement where Month='July' AND Grad='PP2' AND Year='$yr') as julPP2tr FROM feestatement where Year='$yr' ");
while($row=mysqli_fetch_array($query))
{
 $BTrJ=$row['julbatr'];
 $BTrA=$row['augbatr'];
 $BTrS=$row['sepbatr'];

 $P1TrJ=$row['julPP1tr'];
 $P1TrA=$row['augPP1tr'];
 $P1TrS=$row['sepPP1tr'];

 $P2TrJ=$row['julPP2tr'];
 $P2TrA=$row['augPP2tr'];
 $P2TrS=$row['sepPP2tr'];
 
 $jultrn=$BTrJ+$P1TrJ+$P2TrJ;
 $augtrn=$BTrA+$P1TrA+$P2TrA;
 $septrn=$BTrS+$P1TrS+$P2TrS;

$totjulytransN=$BTrJ+$BTrA+$BTrS+$P1TrJ+$P1TrA+$P1TrS+$P2TrJ+$P2TrA+$P2TrS;
}


//Graduation
$query=mysqli_query($con,"select Grad, (SELECT SUM(Amount) from Gradpayment where Month='July' AND Year='$yr' AND Grad='PP2') as jugradu, (SELECT SUM(Amount) from Gradpayment where Month='August' AND Year='$yr' AND Grad='PP2') as augrad,(SELECT SUM(Amount) from Gradpayment where Month='September' AND Year='$yr' AND Grad='PP2') as segrad FROM Gradpayment where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jgrad=$row['jugradu'];
 $agrad=$row['augrad'];
 $sgrad=$row['segrad'];
 $totjultosepgraduation=$jgrad+$agrad+$sgrad;
}

//Uniform Nursery
$query=mysqli_query($con,"select Bank, (SELECT SUM(UnFee) from feestatement where Month='July' AND Grad='BABY CLASS' AND Year='$yr') as julbaun,(SELECT SUM(UnFee) from feestatement where Month='August' AND Grad='BABY CLASS') as augbaun,(SELECT SUM(UnFee) from feestatement where Month='September' AND Grad='BABY CLASS') as sepbaun,(SELECT SUM(UnFee) from feestatement where Month='July' AND Grad='PP1' AND Year='$yr') as julPP1un,(SELECT SUM(UnFee) from feestatement where Month='August' AND Grad='PP1' AND Year='$yr') as augPP1un,(SELECT SUM(UnFee) from feestatement where Month='September' AND Grad='PP1' AND Year='$yr') as sepPP1un,(SELECT SUM(UnFee) from feestatement where Month='September' AND Grad='PP2' AND Year='$yr') as sepPP2un,(SELECT SUM(UnFee) from feestatement where Month='August' AND Grad='PP2' AND Year='$yr') as julPP2un,(SELECT SUM(UnFee) from feestatement where Month='July' AND Grad='PP2' AND Year='$yr') as julPP2un FROM feestatement where Year='$yr' ");
while($row=mysqli_fetch_array($query))
{
 $BUnJ=$row['julbaun'];
 $BUnA=$row['augbaun'];
 $BUnS=$row['sepbaun'];

 $P1UnJ=$row['julPP1un'];
 $P1UnA=$row['augPP1un'];
 $P1UnS=$row['sepPP1un'];

 $P2UnJ=$row['julPP2un'];
 $P2UnA=$row['julPP2un'];
 $P2UnS=$row['sepPP2un'];
 
 $juluniN=$BUnJ+$P1UnJ+$P2UnJ;
 $auguniN=$BUnA+$P1UnA+$P2UnA;
 $sepuniN=$BUnS+$P1UnS+$P2UnS;

$totjulyunifo=$BUnJ+$BUnA+$BUnS+$P1UnJ+$P1UnA+$P1UnS+$P2UnJ+$P2UnA+$P2UnS;
}


//Admission Nursery
$query=mysqli_query($con,"select Bank, (SELECT SUM(AdFee) from feestatement where Month='July' AND Grad='BABY CLASS' AND Year='$yr') as julbaad,(SELECT SUM(AdFee) from feestatement where Month='August' AND Grad='BABY CLASS') as augbaad,(SELECT SUM(AdFee) from feestatement where Month='September' AND Grad='BABY CLASS') as sepbaad,(SELECT SUM(AdFee) from feestatement where Month='July' AND Grad='PP1' AND Year='$yr') as julPP1ad,(SELECT SUM(AdFee) from feestatement where Month='August' AND Grad='PP1' AND Year='$yr') as augPP1ad,(SELECT SUM(AdFee) from feestatement where Month='September' AND Grad='PP1' AND Year='$yr') as sepPP1ad,(SELECT SUM(AdFee) from feestatement where Month='September' AND Grad='PP2' AND Year='$yr') as sepPP2ad,(SELECT SUM(AdFee) from feestatement where Month='August' AND Grad='PP2' AND Year='$yr') as augPP2ad,(SELECT SUM(AdFee) from feestatement where Month='July' AND Grad='PP2' AND Year='$yr') as julPP2ad FROM feestatement where Year='$yr' ");
while($row=mysqli_fetch_array($query))
{
 $BAdJ=$row['julbaad'];
 $BAdA=$row['augbaad'];
 $BAdS=$row['sepbaad'];

 $P1AdJ=$row['julPP1ad'];
 $P1AdA=$row['augPP1ad'];
 $P1AdS=$row['sepPP1ad'];

 $P2AdJ=$row['julPP2ad'];
 $P2AdA=$row['augPP2ad'];
 $P2AdS=$row['sepPP2ad'];

$juladmtot=$BAdJ+$P1AdJ+$P2AdJ;
$augadmtot=$BAdA+$P1AdA+$P2AdA;
$sepadmtot=$BAdS+$P1AdS+$P2AdS;

$TotJulyAdminssN=$BAdJ+$BAdA+$BAdS+$P1AdJ+$P1AdA+$P1AdS+$P2AdJ+$P2AdA+$P2AdS;
}


//Books
$query=mysqli_query($con,"select Bank, (SELECT SUM(BookFee) from feestatement where Month='July' AND Grad='BABY CLASS' AND Year='$yr') as julbabk,(SELECT SUM(BookFee) from feestatement where Month='August' AND Grad='BABY CLASS') as augbabk,(SELECT SUM(BookFee) from feestatement where Month='September' AND Grad='BABY CLASS') as sepbabk,(SELECT SUM(BookFee) from feestatement where Month='July' AND Grad='PP1' AND Year='$yr') as julPP1bk,(SELECT SUM(BookFee) from feestatement where Month='August' AND Grad='PP1' AND Year='$yr') as augPP1bk,(SELECT SUM(BookFee) from feestatement where Month='September' AND Grad='PP1' AND Year='$yr') as sepPP1Bk,(SELECT SUM(BookFee) from feestatement where Month='September' AND Grad='PP2' AND Year='$yr') as sepPP2bk,(SELECT SUM(BookFee) from feestatement where Month='August' AND Grad='PP2' AND Year='$yr') as augPP2bk,(SELECT SUM(BookFee) from feestatement where Month='July' AND Grad='PP2' AND Year='$yr') as julPP2bk FROM feestatement where Year='$yr' ");
while($row=mysqli_fetch_array($query))
{
 $BBkJ=$row['julbabk'];
 $BBkA=$row['augbabk'];
 $BBkS=$row['sepbabk'];

 $P1BkJ=$row['julPP1bk'];
 $P1BkA=$row['augPP1bk'];
 $P1BkS=$row['sepPP1Bk'];

 $P2BkJ=$row['julPP2bk'];
 $P2BkA=$row['augPP2bk'];
 $P2BkS=$row['sepPP2bk'];

$totbksjul=$BBkJ+$P1BkJ+$P2BkJ;
$totbksaug=$BBkA+$P1BkA+$P2BkA;
$totbkssep=$BBkS+$P1BkS+$P2BkS;

$Totbooksnursery=$BBkJ+$BBkA+$BBkS+$P1BkJ+$P1BkA+$P1BkS+$P2BkJ+$P2BkA+$P2BkS;
}


//Salaries
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='8') as julsala,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='8') as augsala,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='8')  as sepsala FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julsa=$row['julsala'];
 $augsa=$row['augsala'];
 $sepsa=$row['sepsala'];
 $totsalajuly=$julsa+$augsa+$sepsa;
}

//House Levy
$query=mysqli_query($con,"select Year, (SELECT SUM(HLevy) from payment where Month='July' AND Year='$yr') as julyhlev,(SELECT SUM(HLevy) from payment where Month='August' AND Year='$yr') as aughlev,(SELECT SUM(HLevy) from payment where Month='September' AND Year='$yr')  as sephlev FROM payment where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $juhlev=$row['julyhlev'];
 $auhlev=$row['aughlev'];
 $sehlev=$row['sephlev'];
 $tothlevyjuly=$juhlev+$auhlev+$sehlev;
}


//Budgeted Amount
$query1=mysqli_query($con,"select * from BudgetAmount where Year='$yr' AND Period='July-September'");
while($row=mysqli_fetch_array($query1))
{
 $tut=$row['Tut'];
 $uni=$row['Uni'];
 $tour=$row['Tour'];
 $tr=$row['Trans'];
}

//RMI
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='10') as julrmi,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='10') as augrmi,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='10') as seprmi FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julrmi=$row['julrmi'];
 $augrmi=$row['augrmi'];
 $seprmi=$row['seprmi'];
 $totrmiaug=$julrmi+$augrmi+$seprmi;
}


//Textbooks Expe
/////////implest
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='20') as jultex,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='20') as augtex,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='20') as septex FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jute=$row['jultex'];
 $aute=$row['augtex'];
 $sete=$row['septex'];
 $totjultextbooks=$jute+$aute+$sete;
}
///////Bank
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='20') as jultexi,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='20') as augtexi,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='20') as septexi FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jutx=$row['jultexi'];
 $autx=$row['augtexi'];
 $setx=$row['septexi'];
 $totjultexxs=$jutx+$autx+$setx;
}


//Meals & Boarding
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='33') as julmeal,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='33') as augmeal,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='33')  as sepmeal FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julm=$row['julmeal'];
 $augm=$row['augmeal'];
 $sepm=$row['sepmeal'];
 $totjulmeal=$julm+$augm+$sepm;
}

//Matters education
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='6') as julME,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='6') as augME,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='6') as sepME FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julme=$row['julME'];
 $augme=$row['augME'];
 $sepme=$row['sepME'];
 $totjulME=$julme+$augme+$sepme;
}


//Audit
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='32') as julau,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='32') as augau,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='32') as sepau FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julau=$row['julau'];
 $augau=$row['augau'];
 $sepau=$row['sepau'];
 $totjulau=$julau+$augau+$sepau;
}

$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='32') as julau,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='32') as augau,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='32') as sepau FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julau=$row['julau'];
 $augau=$row['augau'];
 $sepau=$row['sepau'];
 $totjulau=$julau+$augau+$sepau;
}

//Internet
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='16') as julint,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='16') as augint,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='16')  as sepint FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julint=$row['julint'];
 $augint=$row['augint'];
 $sepint=$row['sepint'];
 $totjulint=$julint+$augint+$sepint;
}

//Co-Curricular Activities
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='34') as julcoca,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='34') as augcoca,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='34') as septcoca FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jcoca=$row['julcoca'];
 $acoca=$row['augcoca'];
 $scoca=$row['septcoca'];
 $totjulcoca=$jcoca+$acoca+$scoca;
}

///////// Bank Co-Curricular Activities
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='34') as julcocaa,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='34') as augcocaa,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cat='34') as septcocaa FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jucoca=$row['julcocaa'];
 $agcoca=$row['augcocaa'];
 $secoca=$row['septcocaa'];
 $totjulcocali=$jucoca+$agcoca+$secoca;
}

//Electricity
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='13') as julele,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='13') as augele,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='13') as septele FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jele=$row['julele'];
 $aele=$row['augele'];
 $sele=$row['sepele'];
 $totjulelect=$jele+$aele+$sele;
}

///////////////////////////////////Water
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='28') as julwat,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='28') as augwat,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='28') as sepwat FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jwat=$row['julwat'];
 $augw=$row['augwat'];
 $sepw=$row['sepwat'];
 $totjulwater= $jwat+$augw+$sepw;
}

$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='28') as julwatt,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='28') as augwatt,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cat='28') as sepwatt FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jwatt=$row['julwatt'];
 $augww=$row['augwatt'];
 $sepww=$row['sepwatt'];
 $totjulwater= $jwat+$augw+$sepw;
}

$juwater=$jwat+$jwatt;
$augwater=$augww+$augw;
$sepwater=$sepww+$sepw;

$totalwater=$juwater+$augwater+$sepwater;


//Security
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='22') as julsec,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='22') as augsec,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cat='22') as sepsec FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $julsecu=$row['julsec'];
 $augsecu=$row['augsec'];
 $sepsecu=$row['sepsec'];
 $totsecu= $sepsecu+$augsecu+$julsecu;
}

//NHIF
$query=mysqli_query($con,"select Basic, (SELECT SUM(NHIF) from payment where Month='July') as julnhif,(SELECT SUM(NHIF) from payment where Month='August') as augnhif,(SELECT SUM(NHIF) from payment where Month='September' AND Approved='Yes') as sepnhif FROM payment where Year='$yr' AND Approved='Yes'");
while($row=mysqli_fetch_array($query))
{
 $junhi=$row['julnhif'];
 $aunhi=$row['augnhif'];
 $senhi=$row['sepnhif'];
 $totnhif=$junhi+$aunhi+$senhi;
}

//NSSF
$query=mysqli_query($con,"select Basic, (SELECT SUM(NSSF) from payment where Month='July' AND Year='$yr' AND Approved='Yes') as julnss,(SELECT SUM(NSSF) from payment where Month='August' AND Year='$yr' AND Approved='Yes') as augnss,(SELECT SUM(NSSF) from payment where Month='September' AND Year='$yr' AND Approved='Yes') as sepnss FROM payment where Year='$yr' AND Approved='Yes'");
while($row=mysqli_fetch_array($query))
{
 $junss=$row['julnss'];
 $aunss=$row['augnss'];
 $senss=$row['sepnss'];
 $totnssf=$junss+$aunss+$senss;
}


//NITA
$query=mysqli_query($con,"select Basic, (SELECT SUM(NITA) from payment where Month='July' AND Year='$yr' AND Approved='Yes') as julnit,(SELECT SUM(NITA) from payment where Month='August' AND Year='$yr' AND Approved='Yes') as augnit,(SELECT SUM(NITA) from payment where Month='September' AND Year='$yr' AND Approved='Yes') as sepnit FROM payment where Year='$yr' AND Approved='Yes'");
while($row=mysqli_fetch_array($query))
{
 $jnit=$row['julnit'];
 $anit=$row['augnit'];
 $snit=$row['sepnit'];
 $julyseptotnita=$jnit+$anit+$snit;
}

//PAYE
$query=mysqli_query($con,"select Basic, (SELECT SUM(Paye) from payment where Month='July') as julpy,(SELECT SUM(Paye) from payment where Month='August') as augpy,(SELECT SUM(Paye) from payment where Month='September') as seppy FROM payment where Year='$yr' AND Approved='Yes'");
while($row=mysqli_fetch_array($query))
{
 $jupy=$row['julpy'];
 $aupy=$row['augpy'];
 $sepy=$row['seppy'];
 $totpaye=$jupy+$aupy+$sepy;
}

//Matters Education
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='6') as julME,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='6') as augME,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='6') as sepME FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jME=$row['julME'];
 $aME=$row['augME'];
 $sME=$row['sepME'];
 $totjulsepME= $jME+$aME+$sME;
}


//Fuel
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='19') as julfue,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='19') as augfue,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='19') as sepfue FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jfue=$row['julfue'];
 $afue=$row['augfue'];
 $sfue=$row['sepfue'];
 $totjulsepfuel= $jfue+$afue+$sfue;
}

//Vehicles Maintenance
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='24') as julvm,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='24') as augvm,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='24') as sepvm FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jvm=$row['julvm'];
 $avm=$row['augvm'];
 $svm=$row['sepvm'];
 $totjulsepVM= $jvm+$avm+$svm;
}


//Cashual Payment
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='12') as julcp,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='12') as augcp,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='12') as sepcp FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jcp=$row['julcp'];
 $acp=$row['augcp'];
 $scp=$row['sepcp'];
 $totjulsepCP= $jcp+$acp+$scp;
}


//BOM
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='5') as julbom,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='5') as augbom,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='5') as sepbom FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jbom=$row['julbom'];
 $abom=$row['augbom'];
 $sbom=$row['sepbom'];
 $totjulsepBOM= $jbom+$abom+$sbom;
}


//Liturgical Activities
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='5') as julla,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='2') as augla,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='2') as sepla FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jla=$row['julla'];
 $ala=$row['augla'];
 $sla=$row['sepla'];
 $totjultosepLA= $jla+$ala+$sla;
}




//Remedials
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='23') as julrem ,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='23') as augrem ,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='23') as seprem FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jrem=$row['julrem'];
 $arem=$row['augrem'];
 $srem=$row['seprem '];
 $totjultosepREM=$jrem+$arem+$srem;
}

//New code after creating October to Dec
//Administration
$query=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='4') as juladm,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='4') as augadm,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='4') as sepadm FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $juad=$row['juladm'];
 $auad=$row['augadm'];
 $sead=$row['sepadm'];
 $totjulsepadm=$juad+$auad+$sead;
}

//////Bank
//Administration
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='4') as juladmi,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='4') as augadmi,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='4') as sepadmi FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $juadm=$row['juladmi'];
 $auadm=$row['augadmi'];
 $seadm=$row['sepadmi'];
 $totjulsepadmini=$juadm+$auadm+$seadm;
}

//Uniforms
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='17') as julunif,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='17') as augunif,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='17') as sepunif FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $junifo=$row['julunif'];
 $aunifo=$row['augunif'];
 $sunifo=$row['sepunif'];
 $totjulsepuniform=$junifo+$aunifo+$sunifo;
}

///////Bank uniform
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='17') as juluniff,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='17') as auguniff,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='17') as sepuniff FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $junifom=$row['juluniff'];
 $aunifom=$row['auguniff'];
 $sunifom=$row['sepuniff'];
 $totjulsepuniformm=$junifom+$aunifom+$sunifom;
}



//Charity
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='7') as julcha,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='7') as augcha,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='7') as sepcha FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $jcha=$row['julcha'];
 $acha=$row['augcha'];
 $scha=$row['sepcha'];
 $totjulsepcharity=$jcha+$acha+$scha;
}

///////Bank charity
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='7') as jucha,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='7') as auchaf,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='7') as secha FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $juch=$row['jucha'];
 $auch=$row['aucha'];
 $sech=$row['secha'];
 $totjulsepcha=$juch+$auch+$such;
}

//Staff Welfare
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='35') as julsw,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='35') as augsw,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='35') as sepsw FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $jsw=$row['julsw'];
 $asw=$row['augsw'];
 $ssw=$row['sepsw'];
 $totjulsepSW=$jsw+$asw+$ssw;
}

///////Staff Welfare Bank
$queryyy=mysqli_query($con,"select Mode, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='35') as jusw,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='35') as ausw,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='35') as sesw FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($queryyy))
{
 $juusw=$row['jusw'];
 $auusw=$row['ausw'];
 $seesw=$row['sesw'];
 $totjulseeeSW=$juusw+$auusw+$seesw;
}


//Motivation
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='36') as julmoot ,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='36') as augmoot,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='36') as sepmoot FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jemo=$row['julmoot'];
 $aemo=$row['augmoot'];
 $semo=$row['sepmoot'];
 $totjultosepEmoti=$jemo+$aemo+$semo;
}


////////Moti Bank
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='36') as julmooot ,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='36') as augmooot,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='36') as sepmooot FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jemoo=$row['julmooot'];
 $aemoo=$row['augmooot'];
 $semoo=$row['sepmooot'];
 $totjultosepEmotii=$jemoo+$aemoo+$semoo;
}


//Farm
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='9') as julfa ,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='9') as augfa,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='9') as sepfa FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jfa=$row['julfa'];
 $afa=$row['augfa'];
 $sfa=$row['sepfa'];
 $totjultosepfam=$jfa+$afa+$sfa;
}

//////Imprest Farm
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='9') as julyfa ,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='9') as augustfa,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='9') as septemberfa FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $juufa=$row['julyfa'];
 $aafa=$row['augustfa'];
 $ssfa=$row['septemberfa'];
 $totjultosepfamm=$juufa+$aafa+$ssfa;
}


//Pastoral Care
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='39') as julita ,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='39') as aulita,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='39') as selita FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jlita=$row['julita'];
 $alita=$row['aulita'];
 $slita=$row['selita'];
 $totjultoseplita=$jlita+$alita+$slita;
}

/////////Bank Pastoral Care
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='39') as julitaa,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='39') as aulitaa,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='39') as selitaa FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jlitaa=$row['julitaa'];
 $alitaa=$row['aulitaa'];
 $slitaa=$row['selitaa'];
 $totjultoseplitaa=$jlitaa+$alitaa+$slitaa;
}

///////Bank Liturgical
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='2') as jullita ,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='2') as auglita,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='2') as seplita FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jli=$row['jullita'];
 $ali=$row['auglita'];
 $sli=$row['seplita'];
 $totjultoseplitur=$jli+$ali+$sli;
}

//Tour
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='18') as jtuwa, (SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='18') as atuwa,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='18') as stuwa FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jutuwa=$row['jtuwa'];
 $autuwa=$row['atuwa'];
 $setuwa=$row['stuwa'];
 $totjultoseptuwa=$jutuwa+$autuwa+$setuwa;
}

///////Tour Imprest
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='18') as jtuwa, (SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='18') as atuwa,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='18') as stuwa FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jtua=$row['jtuwa'];
 $atua=$row['atuwa'];
 $stua=$row['stuwa'];
 $totjultoseptua=$jtua+$atua+$stua;
}

//Project Bank
$query=mysqli_query($con,"select Item, (SELECT SUM(Amount) from prodata where Month='July' AND Year='$yr') as jpro, (SELECT SUM(Amount) from prodata where Month='August' AND Year='$yr') as apro,(SELECT SUM(Amount) from prodata where Month='September' AND Year='$yr') as spro FROM prodata where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jproo=$row['jpro'];
 $aproo=$row['apro'];
 $sproo=$row['spro'];
 $totjultosepproo=$jproo+$aproo+$sproo;
}

//Project Imprest
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cate='11') as jpro, (SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cate='11') as apro,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cate='11') as spro FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $proj=$row['jpro'];
 $proa=$row['apro'];
 $pros=$row['spro'];
 $jultosepprotot=$proj+$proa+$pros;
}

//School Furniture
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='37') as julfun ,(SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='37') as augfun,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='37') as sepfun FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jfun=$row['julfun'];
 $afun=$row['augfun'];
 $sfun=$row['sepfun'];
 $totjultosepfun=$jfun+$afun+$sfun;
}

/////////////Sch Funiture Imprest
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Imprest2 where Month='July' AND Year='$yr' AND Cat='37') as jufun,(SELECT SUM(Amount) from Imprest2 where Month='August' AND Year='$yr' AND Cat='37') as aufun,(SELECT SUM(Amount) from Imprest2 where Month='September' AND Year='$yr' AND Cat='37') as sefun FROM Imprest2 where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $jfurn=$row['jufun'];
 $afurn=$row['aufun'];
 $sfurn=$row['sefun'];
 $totjultosepfurn=$jfurn+$afurn+$sfurn;
}


//Insurance
$query=mysqli_query($con,"select Particular, (SELECT SUM(Amount) from Expenses where Month='July' AND Year='$yr' AND Cat='38') as jinsu, (SELECT SUM(Amount) from Expenses where Month='August' AND Year='$yr' AND Cat='38') as ainsu,(SELECT SUM(Amount) from Expenses where Month='September' AND Year='$yr' AND Cat='38') as sinsu FROM Expenses where Year='$yr'");
while($row=mysqli_fetch_array($query))
{
 $juinsu=$row['jinsu'];
 $auinsu=$row['ainsu'];
 $seinsu=$row['sinsu'];
 $totjultosepinsu=$juinsu+$auinsu+$seinsu;
}





?>