How to check Sale profit and loss/Sale item profit and loss as per the changing purchase price of products on web?

Please go to Settings>>Preferences>>Document>>Purchases>>Update Product details>>Select Purchase price>>Save and Update.
With these settings, the purchase price will be updated in the product details while creating a purchase and stock in on confirmation.

Please go to Reports>>Profit and Loss Report>>Sale P&L Report/Sale Item P&L Report>>Click on Settings button showing on the right side>>Select Purchase Price at Sale>>Check Profit and Loss.