Invoice repair logic (additional partial implementation)