find appointments assigned to a operatory

For users or potential users.
Post Reply
babysilvertooth
Posts: 129
Joined: Sat Jun 12, 2010 3:18 pm

find appointments assigned to a operatory

Post by babysilvertooth » Tue Jan 17, 2017 7:11 am

Tryign to hid an unused operatroy, but OD tells me there are appointments in the future tied to that op. HOw do I find out where they are?

Thanks

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: find appointments assigned to a operatory

Post by cmcgehee » Tue Jan 17, 2017 8:04 am

Query 848 will work for that. Just set the operatory name and VISIBLE up top.

Code: Select all

/*848 Scheduled appointments in specific operatory.*/
/*Query code written/modified:  01/17/2017*/
SET @OperatoryName='%%';/*To search for all Operatories, set OperatoryName='%%'*/
SET @OperatoryVisibility='HIDDEN';/*Accepted inputs are 'VISIBLE' or 'HIDDEN'.  All other inputs will default to 'HIDDEN'.*/
SELECT p.PatNum AS 'Pat#',p.LName, p.FName, DATE_FORMAT(ap.AptDateTime,'%m/%d/%Y - %h:%i %p') AS 'Appt Date/Time', op.OpName AS 'Operatory'
FROM appointment ap
INNER JOIN operatory op ON op.OperatoryNum=ap.Op
	AND (CASE WHEN @OperatoryVisibility LIKE '%HIDDEN%' THEN op.IsHidden=1 
		ELSE op.IsHidden=0 END)
	AND op.OpName LIKE @OperatoryName
INNER JOIN patient p ON p.PatNum=ap.PatNum
WHERE ap.AptStatus IN (1,4)
ORDER BY op.OpName, ap.AptDateTime;
Chris McGehee
Open Dental Software
http://www.opendental.com

babysilvertooth
Posts: 129
Joined: Sat Jun 12, 2010 3:18 pm

Re: find appointments assigned to a operatory

Post by babysilvertooth » Tue Jan 17, 2017 8:26 am

Thanks!

User avatar
cmcgehee
Posts: 711
Joined: Tue Aug 25, 2015 5:06 pm
Location: Salem, Oregon

Re: find appointments assigned to a operatory

Post by cmcgehee » Tue Jan 17, 2017 9:42 am

Glad to be of help!
Chris McGehee
Open Dental Software
http://www.opendental.com

Post Reply