Build Sql Query We have a Sql Table Having Three Columns Viz
Name_of_ffice , Month , Amount
Name_Of_Office Month Amount
DivisionBhopal 04 125
DivisionBhopal 05 50
DivisionBhopal 06 100
DivisionBhopal 10 125
DivisionSagar 04 600
DivisionSagar 05 520
DivisionSagar 06 400
DivisionSagar 10 100
FINANCIAL Year Month Should We Taken For Calculation . By the Formula Always Start sum From April to Selected Month Suppose User will Select Month June (from dropdown) Calculation Should be Performed Like this
Name_Of_Office Sum Upto Previous Month Present Month Total Amount
DivisionBhopa April + May June April + May+ June
DivisionSagar April + May June April + May+ June
Here we will not add oct Amount because Selected Month is June we want data till june
For June Month Data Should look like
Name_Of_Office Sum Upto Previous Month Present Month Total Amount
DivisionBhopal 175 100 275
DivisionSagar 1120 400 1520
For October Month Data Should look like (If User Select December)
Name_Of_Office Sum Upto Previous Month Present Month Total Amount
DivisionBhopal 275 125 400
Divisionsagar 1520 100 1620