Even though you have attached the referral you still need to tick yes on 'Include referral to Medicare Billing'. This can be found in Preferences > Invoices > Include referral to Medicare Billing.
Please Click here for additional info: Attach a Referral to invoice