I have a tree and I want to work on collecting the amount from the sub-contract to the main contract in a cumulative manner

I have a tree and I want to work on collecting the amount from the sub-contract to the main contract in a cumulative manner