I Need little help on salary structure formula calculation

15000 * .12 if (gross_pay-HRA) > 15000 else (B+CA+MA+EDU+OA) * .12

Explanation-

1)If employee salary is 25000 Rs

, If his (gross-HRA)>=15000 System Should take 1800 Pf Value

2)If He took leave for 20 Days his (Basic-HRA) value will go below 15000 So system should take [else (B+CA+MA+EDU+OA) * .12]

how i can achieve that??