240. Where, as a result of any order passed in appeal or other proceeding under this Act, refund of any amount becomes due to the assessee, the Assessing Officer shall, except as otherwise provided in this Act, refund the amount to the assessee without his having to make any claim in that behalf:
Provided that where, by the order aforesaid,—
(a) an assessment is set aside or cancelled and an order of fresh assessment is directed to be made, the refund, if any, shall become due only on the making of such fresh assessment;
(b) the assessment is annulled, the refund shall become due only of the amount, if any, of the tax paid in excess of the tax chargeable on the total income returned by the assessee.