Foreign exchange gains losses

I do not understand the meaning of this ( foreign exchange gains losses )

The foreign exchange rate which should be created

Price on the date of receipt of foreign money or what

Let me use an example that might make it clear - I will use USD and EUR but you can substitute the currencies and the result will be the same

My base currency is EUR - so my accounts are all reported in EUR

I have a customer in the US - I sell items to him and invoice him in USD. He pays in USD
Assume that the exchange rates are as follows
10 July 2020 : 1 EUR = 1.1295 USD
On 10 July I invoice him for $ 12,000 which using the exchange rate on the the 10 July is recorded as € 10,624.17 as a credit entry in my Sales and a debit entry in my Account Receivables

23 July 2020: 1 EUR = 1.1597 USD
My Sales Account balance does not change - after all I recorded the sale using the exchange rate on the day of the sale
But the amount I am due is still $ 12,000 but this is now worth only € 10,347.50 because the EUR strengthened against the USD - from 1.1295 to 1.1597
The difference of € 276.67 is recorded as a Foreign Exchange Loss

If the EUR had weakened against the USD, I would have had a Foreign Exchange Gain.

When the customer pays me I will record his payment as $ 12,000 and whatever amount of euros I receive - again the difference between what I receive and the initial amount of 10,624.17 will be posted as a Foreign Exchange Gain/Loss

In Manager, I would enter two exchange rates - one for the day of the sale and another for the balance sheet date - which could month end, daily whatever you need for your reporting requirements.