By default invoice items are sorted based on the summarization criteria for example if the invoice is summarized by task and then by resource then the items are in task text order and the sub-items are in resource name order. You can now choose in the billing method invoice item type set-up to sort by other attributes such as sorting by code or ID or by the creation date, so that earlier tasks are listed first and later tasks second in the invoice