8bcc7211-1685-46ec-8cd2-63014e795148SQLData Source=MYPRACTICE01\MP;Initial Catalog=MPNetMD1; user ID =sa;password=aliehsMP111inStringtruetrueStartDate (YYYY-MM-DD)StringtrueEndDate (YYYY-MM-DD)true8.5in0.25cmtrue2.5cm2.5cm2.5cm4bfa4064-d4a8-4aa6-9ae5-18c251d6d02d21cmStartdateSystem.StringEnddateSystem.StringYearSystem.Int32WEEKSTARTDATESystem.StringWEEKNUMBERSystem.Int32COUNTSystem.Int32NameSystem.StringPractitionerTypeSystem.StringMPNetSELECT @StartDate AS Startdate, @EndDate AS Enddate, YEAR(Appointment.AppointStartDate) AS Year, CONVERT(VARCHAR(10), DATEADD(DD,
2 - DATEPART(DW, Appointment.AppointStartDate), Appointment.AppointStartDate), 103) AS WEEKSTARTDATE, DATEPART(WW,
Appointment.AppointStartDate) AS WEEKNUMBER, COUNT(DATEPART(WW, Appointment.AppointStartDate)) AS COUNT,
Person.FirstName + ' ' + Person.LastName AS Name, zStaticData_1.Description AS PractitionerType
FROM Appointment INNER JOIN
Person ON Appointment.WithGUID = Person.PartyGUID LEFT OUTER JOIN
lookupngnet.dbo.zStaticData ON Appointment.AppointTypeID = lookupngnet.dbo.zStaticData.StaticDataID LEFT OUTER JOIN
lookupngnet.dbo.zStaticData AS zStaticData_1 ON Person.OccupationID = zStaticData_1.StaticDataID
WHERE (Appointment.AppointStartDate >= @StartDate + ' 00:00:00.000') AND (Appointment.AppointEndDate <= @EndDate + ' 23:00:00.000') AND
(Appointment.RemovedDate IS NULL) AND (Appointment.SeenTime IS NOT NULL) AND (Appointment.RefGUID IS NOT NULL) AND
(Appointment.RefGUID <> '00000000-0000-0000-0000-000000000000')
GROUP BY YEAR(Appointment.AppointStartDate), CONVERT(VARCHAR(10), DATEADD(DD, 2 - DATEPART(DW, Appointment.AppointStartDate),
Appointment.AppointStartDate), 103), DATEPART(WW, Appointment.AppointStartDate), Person.FirstName + ' ' + Person.LastName,
zStaticData_1.Description
HAVING (YEAR(Appointment.AppointStartDate) > 1990)
ORDER BY WEEKNUMBER, Name=Parameters!StartDate.Value=Parameters!EndDate.Value20cm1cm