Get every invoice and check total to pay, if it is 0 then change status on invoice to paid.
Then, the invoices that are paid, it will generate the inventory.