Filter projects when fetching timesheets for new invoice

When creating a new invoice that is based upon timesheet hours, after selecting the date range for the timesheets, the next dropdown is for the project the timesheets are associated with. The problem is ALL projects keep getting listed in this dropdown, even those that are set as “not active”, they are also listed in a random order & not ascending or descending order. If there are 100 projects to sift through, that makes it extremely difficult to get the correct project. Is there currently a method to filter out all the superfluos projects that have already been billed? Or maybe a method to filter by the Active / Not Active field in the project record?

You can override the project filter using the Overriding Link Query By Custom Script

Appreciate your input NCP but I have no clue where to start to fulfill the requirements to make this work:

The set_query method takes one of two formats: set_query(field_name, options_function()) for regular fields, or set_query(field_name, child_table_name, options_function()) for fields in child tables.

I looked at the Client Script Doctype but have no idea where to obtain the arguments needed to fill in the blanks.