Issue:
When looking at the customer billing screen there are flags to set the billing address as the primary billing for invoices.
Where are these fields held in the database?

Resolution:
The AR_Customer_Bill_Defaults holds the information related to these flags. The script below can be used to find the AR customer bill information that is related to these primary flags on the screen.
Run the select to get the information on which bill to is the primary bill to for a customer. You may see a 1 for the ID and N/A for the Name. This means the flag is not set.


--- This query will return the customer’s Primary billing information. If needed, additional fields can be added to the query. ---
select c.Customer_Number as 'Customer Number',c.Customer_Name as 'Customer Name'
,bd.Recurring_Customer_Bill_Id as 'Primary RMR ID',r.Business_Name as 'Primary RMR Bill Name'
,bd.Service_Customer_Bill_Id as 'Primary Service ID',s.Business_Name as 'Primary Service Bill Name'
,bd.Job_Customer_Bill_Id as 'Primary Job ID',j.Business_Name as 'Primary Job Bill Name'
,bd.Other_Customer_Bill_Id as 'Primary Other ID',o.Business_Name as 'Primary Other Bill Name'
from AR_Customer_Bill_Defaults bd
inner join AR_Customer c on c.Customer_Id =bd.Customer_Id
inner join AR_Customer_Bill r on r.Customer_Bill_Id =bd.Recurring_Customer_Bill_Id
inner join AR_Customer_Bill s on s.Customer_Bill_Id =bd.Service_Customer_Bill_Id
inner join AR_Customer_Bill j on j.Customer_Bill_Id =bd.Job_Customer_Bill_Id
inner join AR_Customer_Bill o on o.Customer_Bill_Id =bd.Other_Customer_Bill_Id
where c.Customer_Number ='21424'