change the inventory item’s last purchase price

Hi
We are using Microsoft Dynamics AX 2009. I have two questions as follows:

  1. Inventory item’s last purchase price is updated? At the time of invoicing or when?

  2. We want to change the inventory item’s last purchase price at the time of PO approval. So can anyone help us in writing this code and disabling the default code.

Best regards,
Ali