Help on a Sql-Ledger quuery

jimbo456 wrote on Wednesday, December 07, 2005:

I have setup this query to get a result of everything paid to a provider. I do this in phpPgAdmin.

SELECT DISTINCT(invnumber),customer_id, transdate, paid FROM ar, employee WHERE employee_id = ‘10153’ AND paid!=‘0’ ORDER BY customer_id

It seems to be right but it is not giving me the patient name just the id.

The ar table uses customer_id and the customer table uses name.

Can anyone clue me in on how to get the patient names into this result? Is my logic correct on pulling all the claims paid to date for a provider?

Jim Proctor

sunsetsystems wrote on Wednesday, December 07, 2005:

It looks like you are joining the employee table but not referencing it.  You probably want to join the customer table instead, on a condition like "customer.id = ar.customer_id".

But did you know there’s already a cash receipts report?  Click “Reports” from the Billing page to see it.  Or you might look in interface/billing/sl_receipts_report.php to check your logic against what you see there.

– Rod
www.sunsetsystems.com