source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SCRPW60.m@ 1379

Last change on this file since 1379 was 628, checked in by George Lilly, 15 years ago

initial load of FOIAVistA 6/30/08 version

File size: 5.6 KB
Line 
1SCRPW60 ;BP-CIOFO/KEITH - Patient Appointment Statistics ; 19 Nov 98 10:34 AM
2 ;;5.3;Scheduling;**163**;AUG 13, 1993
3 ;Prompt for report parameters
4 D TITL^SCRPW50("Patient Appointment Statistics")
5 N SDDIV G:'$$DIVA^SCRPW17(.SDDIV) EXIT
6DTR ;Date range selection
7 D SUBT^SCRPW50("*** Date Range Selection ***")
8FDT W ! S %DT="AEX",%DT("A")="Beginning date: " D ^%DT G:X=U!($D(DTOUT)) EXIT G:X="" EXIT
9 G:Y<1 FDT S SDBDAY=Y X ^DD("DD") S SDPBDA=Y
10LDT W ! S %DT("A")=" Ending date: " D ^%DT G:X=U!($D(DTOUT)) EXIT G:X="" EXIT
11 I Y<SDBDAY W !!,$C(7),"Ending date must be after beginning date!" G LDT
12 G:Y<1 LDT S SDEDAY=Y_.9999 X ^DD("DD") S SDPEDA=Y
13TYP ;Report format selection
14 D SUBT^SCRPW50("*** Report Format Selection ***")
15 S SDQUIT=0,DIR(0)="S^AC:ALL CLINICS;SC:SELECTED CLINICS;RC:RANGE OF CLINICS;SS:SELECTED STOP CODES;RS:RANGE OF STOP CODES;CG:CLINIC GROUP"
16 W ! D ^DIR G:($D(DTOUT)!$D(DUOUT)) EXIT S SDF=Y I Y="SC" D SEL G:(SDQUIT!'$D(SDCL)) EXIT
17 I SDF="RC" D SRC S SDCL="",SDCL=$O(SDCL(SDCL)) G:SDCL="" EXIT S SDCL=$O(SDCL(SDCL)) G:SDCL="" EXIT
18 I SDF="SS" D SSS G:'$O(SDCL(0)) EXIT
19 I SDF="RS" D SRS G:'$O(SDCL(0)) EXIT
20 I SDF="CG" D SCG G:'$O(SDCL(0)) EXIT
21 K DIR S DIR(0)="Y",DIR("A")="Include list of patient names",DIR("B")="NO",DIR("?")="Specify if you would like to see a list of patient names for each clinic."
22 S SDOUT=0 W ! D ^DIR G:$D(DUOUT)!$D(DTOUT) EXIT S SDPL=Y I Y D G:SDOUT EXIT
23 .K DIR S DIR(0)="S^A:ALPHABETIC;D:DATE/TIME;T:TERMINAL DIGIT",DIR("A")="Within clinic, print patients in what order",DIR("B")="ALPHABETIC"
24 .D ^DIR I $D(DTOUT)!$D(DUOUT) S SDOUT=1 Q
25 .S SDPLO=Y Q
26 ;
27QUE N Z,ZTSAVE F Z="SDPL","SDPLO","SDDIV","SDDIV(","SDBDAY","SDEDAY","SDPBDA","SDPEDA","SDF","SDCL(" S ZTSAVE(Z)=""
28 W ! D EN^XUTMDEVQ("START^SCRPW60","Patient Appointment Statistics",.ZTSAVE)
29 G EXIT
30 ;
31START ;Initialize variables, gather information
32 K ^TMP("SCRPW",$J) S SDCOL=$S(IOM=80:0,1:26),SDOUT=0,SDMD="",SDMD=$O(SDDIV(SDMD)),SDMD=$O(SDDIV(SDMD)) S:$P(SDDIV,U,2)="ALL DIVISIONS" SDMD=1
33 D @(SDF_"^SCRPW61") G:SDOUT EXIT D CNT^SCRPW61 G:SDOUT EXIT
34 S SDPAGE=1,SDLINE="",$P(SDLINE,"-",(IOM+1))="",SDTLINE=$TR(SDLINE,"-","=") D NOW^%DTC S Y=% X ^DD("DD") S SDPNOW=$P(Y,":",1,2),SDT(1)="<*> PATIENT APPOINTMENT STATISTICS <*>"
35 S SDT(2)=$S(SDF="AC":"FOR ALL ACTIVE CLINICS",SDF="SC":"FOR SELECTED CLINICS",SDF="RC":"FOR RANGE OF ACTIVE CLINICS",SDF="SS":"FOR SELECTED STOP CODES",SDF="RS":"FOR RANGE OF STOP CODES",SDF="CG":"FOR CLINIC GROUP")
36 I SDF="RC" S SDCLN=$O(SDCL("")),SDECL=$O(SDCL(SDCLN)),SDT(3)=SDCLN_" TO "_SDECL
37 I SDF="RS" S SDBCS=$O(SDCL(0)),SDECS=$O(SDCL(SDBCS)) S:SDECS="" SDECS=SDBCS S SDT(2)=SDT(2)_": "_SDBCS_" TO "_SDECS
38 I SDF="CG" S SDI=$O(SDCL(0)),SDT(2)=SDT(2)_": "_SDCL(SDI)
39 ;Print report
40 D:$E(IOST)="C" DISP0^SCRPW23 I '$D(^TMP("SCRPW",$J)) S SDIV=0 D DHDR^SCRPW40(4,.SDT),HDR S SDX="No appointments found for the specified date range." W !!?(IOM-$L(SDX)\2),SDX D FOOT^SCRPW61 G EXIT
41 S SDIV="" F S SDIV=$O(SDDIV(SDIV)) Q:'SDIV S SDIV(SDDIV(SDIV))=SDIV
42 I 'SDDIV,$P(SDDIV,U,2)'="ALL DIVISIONS" S SDIV($P(SDDIV,U,2))=$$PRIM^VASITE()
43 I $P(SDDIV,U,2)="ALL DIVISIONS" S SDI=0 F S SDI=$O(^TMP("SCRPW",$J,SDI)) Q:'SDI S SDX=$P($G(^DG(40.8,SDI,0)),U) S:$L(SDX) SDIV(SDX)=SDI
44 S SDIVN="" F S SDIVN=$O(SDIV(SDIVN)) Q:SDIVN=""!SDOUT S SDIV=SDIV(SDIVN) D DPRT^SCRPW61(.SDIV)
45 S SDI=0,SDI=$O(^TMP("SCRPW",$J,SDI)),SDMD=$O(^TMP("SCRPW",$J,SDI))
46 G:SDOUT EXIT I SDMD S SDIV=0 D DPRT^SCRPW61(.SDIV)
47 I $E(IOST)="C",'SDOUT N DIR S DIR(0)="E" D ^DIR
48 ;
49EXIT K %,%DT,DFN,DIC,DIR,DTOUT,DUOUT,SDAC,SDAPP,SDBCS,SDBDAY,SDCG,SDCL,SDCL0,SDCLN,SDCOL,SDCP0,SDCSC,SDCTOT,SDDAY,SDDIV,SDECL,SDECS,SDEDAY,SDF
50 K SDH,SDI,SDIV,SDIVN,SDLINE,SDMD,SDORD,SDOUT,SDPAGE,SDPBDA,SDPEDA,SDPL,SDPLO,SDPNOW,SDTLINE,SDPTNA,SDQUIT,SDSSN,SDT,SDTOT,SDX,X,Y,Z
51 D END^SCRPW50 Q
52 ;
53SEL ;Pick selected clinics
54 W ! F D ASK Q:(SDQUIT!(X=""))
55 Q
56ASK K DIC S DIC(0)="AEMQ",DIC="^SC(",DIC("S")="I $P(^(0),U,3)=""C""" S:SDDIV DIC("S")=DIC("S")_",$D(SDDIV(+$P(^(0),U,15)))" D ^DIC
57 I ($D(DTOUT)!$D(DUOUT)) S SDQUIT=1
58 S:Y>0 SDCL(+Y)="" Q
59 ;
60SRC ;Select clinic range
61 W ! K DIC S DIC="^SC(",DIC(0)="AEMQ",DIC("S")="I $P(^(0),U,3)=""C"""_$S(SDDIV:",$D(SDDIV(+$P(^(0),U,15)))",1:""),DIC("A")="Select BEGINNING Clinic: " D ^DIC Q:($D(DTOUT)!$D(DUOUT)!(X="")) S SDCL($P(Y,U,2))=$P(Y,U)
62C2 W ! S DIC("A")="Select ENDING Clinic: " D ^DIC Q:($D(DTOUT)!$D(DUOUT)!(X="")) I $P(Y,U,2)]$O(SDCL("")) S SDCL($P(Y,U,2))=$P(Y,U) Q
63 W !!,$C(7),"Ending clinic must collate after beginning clinic!" G C2
64 ;
65SSS ;Pick selected Stop Codes
66 W ! K DIC S DIC="^DIC(40.7,",DIC(0)="AEMQZ",DIC("A")="Select Stop Code: "
67 F D ^DIC Q:$D(DTOUT)!$D(DUOUT) Q:Y<1 S SDCL($P(Y(0),U,2))=""
68 Q
69 ;
70SRS ;Select Stop Code range
71 W ! K DIC S DIC="^DIC(40.7,",DIC(0)="AEMZQ",DIC("A")="Select BEGINNING Stop Code: " D ^DIC Q:($D(DTOUT)!$D(DUOUT)) G:Y<1 SRS S SDCL=$P(Y(0),U,2),SDCL(SDCL)=""
72SRSE S DIC("A")="Select ENDING Stop Code: "
73 W ! D ^DIC I ($D(DTOUT)!$D(DUOUT)) K SDCL Q
74 G:Y<1 SRSE
75 I SDCL]$P(Y(0),U,2) W !!,$C(7),"Ending Stop Code must collate after beginning Stop Code!" G SRSE
76 S SDCL($P(Y(0),U,2))="" Q
77 ;
78SCG ;Select clinic group
79 W ! K DIC S DIC="^SD(409.67,",DIC(0)="AEMQ" D ^DIC Q:$D(DTOUT)!$D(DUOUT) Q:Y<1 S SDCL(+Y)=$P(Y,U,2) Q
80 ;
81HDR ;Print report header
82 I $E(IOST)="C",SDPAGE>1 N DIR S DIR(0)="E" D ^DIR S SDOUT=Y'=1 Q:SDOUT
83 D STOP^SCRPW61 Q:SDOUT
84 W:SDPAGE>1!($E(IOST)="C") $$XY^SCRPW50(IOF,1,0) W:$X $$XY^SCRPW50("",0,0) W SDLINE S X=0 F S X=$O(SDT(X)) Q:'X W !?(IOM-$L(SDT(X))\2),SDT(X)
85 W !,SDLINE,!,"For date range: ",SDPBDA," to ",SDPEDA,!,"Date printed: ",SDPNOW,?((IOM-6)-$L(SDPAGE)),"Page: ",SDPAGE
86 W !,SDLINE S X=0 F S X=$O(SDH(X)) Q:'X X SDH(X)
87 W !,SDLINE S SDPAGE=SDPAGE+1 Q
Note: See TracBrowser for help on using the repository browser.