How to restrict the transaction if budget is not defined on the particular project and chart of account combination?

I have created a budget based on the project. I want to restrict any transaction which doesn’t have budget.
For e.g.-

I have given budget for Project A for expense account 1, 2 and 3.

Now if someone tries to post any expense with Project B and account 1 (which doesn’t have a budget) then the system should restrict the transaction.

PS: It is just an example I have 15 projects and 200 expense heads.