To link a document, you must first create the project. Then, generate a document and, in Edit mode, from the More Information tab, click on the Projects field, and select the one you need.
.
Once you link the documents, the program will start calculating the profitability.