Dear Kiran,
As if you have hard coded logic with 102, you are getting wrong values. That 102 logic is only for one month and rest of months will give wrong values. That what we are suggesting you to choose some other approach.
Check my approach and revert back.
Best of Luck, Vijay