A new invoice must be associated with a provider/practitioner and a patient.
If a patient is associated with referring practitioners, a best match among referring practitioners is picked.
Best match conditions:
- Letter date is today or older than today.
- No start date or (d.periodMonth && DateFunc.compare(d.startDateUtc, today) <= 0 && today <= DateFunc.addMonth(d.startDateUtc, d.periodMonth)) || (!d.periodMonth && DateFunc.compare(d.startDateUtc, today) <= 0)
If there are multiple best matches, the first one is picked. However, you may still click to pick one from the best matches list. If button is unavailable, this means there's only 1 best match or no best match at all.
1. Referring practitioners are defined along with referrals of a patient.
2. The newly created invoice has patient info and practitioner info which are copied from existing patient record and practitioner record. Such info may be modified when editing the invoice.