Basically I have a table made like this.
where "giorni" field is the maximum amount of days that can be used within that given contract(This is the definition table of various contracts)
dataInizioContratto = Contract start date
dataFineContratto = Contract end date
%progressivo= contract ID
giorni = days
I also have a table made like this:
durata ticket: ticket duration
data inizio ticket: ticket start date
data fine ticket: ticket end date
I have to fill the contracts usage with these tickets (all contracts are filled up exept the last one wich is still not full)
I need the part of code to create another ID field in the second table wich describes in wich contract the contract will be put in.
The main problem is that 2 couples of contracts are overlapped and in that case i need to first fill the first, then the second contract.
(do not notice the null lines please)
Thank you