For now, we use today as default payment date but when recording past events (like with a statement, it may not be the best default behavior.
The biggest challenge is that the payment recorded may be in a closed period so we could no more register the tax for this period.
My proposal would be to use the greatest date (but before today) of the payment lines on the invoice and if the period linked is closed, we fallback to today. And we still allow to force a specific date with the
This design will be a little bit less performant as it will require to make a period search for each date involved (on statement posting, it could be one per line).