The following code changes the product prices on the selected document (document 40 in this example).

Price is converted equal to the purchase price:

Price is converted equal to the sale price: