Calculate service periods / recurring invoicing

Hello everybody,

I am using Dolibarr (version 15.0.). I want to use the module contracts, create an invoice template out of it for yearly recurring invoices for services. On the recurring invoices the service period needs to be printed.

On the contract I set the contract start date (in the contract line).

My idea is now

  1. to create a calculated extra / custom field in invoices that takes the day and month (DD/MM) from the contract start date and save it in the invoice template belonging to that contract

  2. to take the calculated extra field’s value and calculated a start date DD/MM/YYYY and an end date out of it (and then print it on the PDF invoice).

Example:
start date of the contract is: 20.03.2022
first service period of the 1st invoice is: 20.03.2022 - 19.03.2023
second service period of the 2nd invoice is: 20.03.2023 - 19.03.2024
… and so on
(invoices created automatically with recurring invoices feature)

Does anyone know the code I have to put in the extra fields to achieve the desired result?

Kind regards and thank you!

I don’t think you can succeed from the extrafield, you have to create an ad-hoc module