Change in amount before save

Hi team,
My requirement is on sales order item table where i add two custom fields one is discount and one is premium item amount should calculate depending on these field if user put some value in the discount it should deduct from the rate then the rate after deduction gets multiply with qty and gives the amount.
and the same with premium it will be add on the rate and the gets multiply with qty and gives amount at sales order item.

I Achieved this after changes some code in the server side and it working but the amount is updating after save.
I need help in how we can update amount while changes the field values.

same as rate*qty=amount (reflects in initials at item table).

help me in this

Thanks in advance.