How to auto update purchase price and sales price?

How to auto update purchase price and sales price?

Hi
I need a custom function to update the purchase price of an item whenever a bill with an updated price is received (price different from the system price) and also the sales prices as 1.35 times the new purchase price.I found one but it does not updatte the item price.