Sales Invoice/Received Payment not applied to project gross margin

I cannot get a received payment to show up in the billing section or gross margin of a project. The sales invoice and payment entry are both linked to the project. I can get project costs through purchase orders, but not a received payment. I must be doing something incorrect. Any suggestions?

In the Project, the values in the Total Billing Amount and Total Costing Amount is calculating based on the TImesheet created for that Project. It doesn’t update based on the Sales Invoice and Purchase Invoice created for that Project.

So how do I add a product that was sold to a project to the gross margin?