This simple app can calculate the number of boxes (small and large) that need to be used for each resource in order to have the resources needed to upgrade. Take a screenshot of the upgrade screen in game (Ant Legion), then use this app to view the screenshot, and put in the number of resources you have versus what you need in the top input fields.
Then input the number of each type of box (small and large) you have and press calculate. This will display which number of which box type for which resource needs to be fulfilled.