I want a function to be updated in solidity file I have

Job ID: 31973668

Budget: ₹1,500 – ₹12,500 INR

I have a solidity file, this is a crowdfunding smart contract, I want to update a function (even log data) .screen shot of the code of Function given .
This is a referral based crowdfunding program where user will refer users and thus a organisation tree will be created.
I want generation level in event log data.
New column in event log data No named “generation” who will show generation number.

For example ,Generation level is marked for user 10 in this image.
I this case payment will goes to user 1 and the generation level will 4 in event log data( the organisation tree chart in attachment)
I can share complete file after a brief discussion with developer.
If you have a good command over solidity please reply.