Not sure if the title exactly describes what I am trying to achieve, but here is what I'm working on.
I am trying to create a simple-ish application for one of my teams where they can track projects, enter associated time entries for each and then create invoices for those entries.
My setup is Customers table, Projects table, Time Entries table, and Invoices table.
Customers relates to Projects and Invoices (1 Customer can have many Projects and Invoices).
Projects relates to Time Entries and Invoices (1 Project can have many Time Entries and many Invoices).
Invoices relates to Time Entries (1 Invoice can have many Time Entries).
What I'd like to have happen is when a user goes to create a new Invoice, they would select a Customer and then a Project and then see a list of Time Entries where Customer and Project match AND the value in the Related Invoice field is blank (i.e. Time Entries that have not been previously invoices).
The thinking is that the user would then be able to select all the Time Entries they wanted to have included on the new Invoice and then the Related Invoice field for those Time Entries would be updated with the newly created Invoice.
Is something like this possible?