source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDWLRQ1.m@ 841

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

initial load of WorldVistAEHR

File size: 5.8 KB
Line 
1SDWLRQ1 ;;IOFO BAY PINES/TEH - ADHOC WAIT LIST REPORT;06/12/2002 ; 20 Aug 2002 2:10 PM
2 ;;5.3;scheduling;**263,399,412,425,448**;AUG 13 1993
3 ;
4 ;
5 ;******************************************************************
6 ; CHANGE LOG
7 ;
8 ; DATE PATCH DESCRIPTION
9 ; ---- ----- -----------
10 ;
11 ;
12 ;
13 ;
14EN ;Header
15 N ZCODE,ZTDESC,ZTDTH,ZTIO,ZTQUEDED,ZTREQ,ZTRTN,ZTSAVE,ZTSK
16 D HD
17 S SDWLINST="",SDWLERR=0 K ^TMP("SDWLRQ1",$J),DIC,DIR,DR,DIE
181 D INS G END:$D(DUOUT)
192 D CAT G 1:SDWLERR,2:$D(DUOUT)
203 D DATE G 2:SDWLERR,END:$D(DUOUT)
214 D OPEN G 3:SDWLERR,3:$D(DUOUT)
225 D FORM G 4:SDWLERR,4:$D(DUOUT)
236 D DIS G EN:SDWLERR=1,END:SDWLERR=2
24 D QUE
25 Q
26INS ;Get Institution
27 N SDWLINST S SDWLINST=""
28 S SDWLERR=0,SDWLPROM="Select Institution ALL // "
29IN W ! S DIC(0)="QEMA",DIC("A")=SDWLPROM,DIC=4,DIC("S")="I $D(^SDWL(409.32,""C"",+Y))!($D(^SDWL(409.31,""E"",+Y)))!($D(^SCTM(404.51,""AINST"",+Y)))" D ^DIC I Y<0,'SDWLERR Q:$D(DUOUT) S Y="ALL"
30 G IN2:Y<0 Q:$D(DUOUT)
31 I Y<0 S SDWLINST=$S(Y="ALL":"ALL",Y="":"ALL",Y="all":"ALL",Y="All":"ALL",Y["A":"ALL",Y["a":"ALL")
32 I Y="All"!(Y="")!(Y="all")!(Y="ALL") S SDWLINST="ALL",^TMP("SDWLRQ1",$J,"INS")="ALL" G IN3
33 S SDWLINST=SDWLINST_Y_";",SDWLPROM="Another Institution: ",SDWLERR=1 G IN
34IN2 S ^TMP("SDWLRQ1",$J,"INS")=SDWLINST
35IN3 Q
36CAT ;Report category selection
37 K DIR,DIE,DR,DIC
38 W !!," *** Report Category Selection ***" S SDWLERR=0
39 S SDWLERR=0,SDWLCAT="",DIR(0)="SO^1:Clinic;2:Select Service/Specialty",DIR("L",1)=" 1. Clinic",DIR("L")=" 2. Service/Specialty"
40 D ^DIR
41 I X="^" S SDWLERR=1 W *7 Q
42 I X="" S SDWLERR=1 W *7 Q
43 S X=$S(X["C":"C",X["c":"C",X["S":"S",X["s":"S",X=1:"C",X=2:"S",1:"")
44 I X="" W *7," Invalid Selection." G CAT
45 W !!,"Select Category for Report Output",!
46 S SDWLX=$S(X="C":"Clinic: ALL// ",X="S":"Service/Specialty: ALL// ")
47 S SDWLF=$S(X["C":409.32,X["S":409.31,X["c":409.32,X["s":409.31)
48 S SDWLFD=$S(X="C":8,1:7)
49 S SDWLCTX=X
50 K DIR,DIC,DR
51 S ^TMP("SDWLRQ1",$J,"CT1")=SDWLCTX_"^"_SDWLF_"^"_SDWLFD,DIC("A")=SDWLX,SDWLE=0
52CT1 W ! S DIC(0)="QEMNZA",DIC=SDWLF D ^DIC I 'SDWLE,Y<1 S ^TMP("SDWLRQ1",$J,"CT2")="ALL" G CT3
53 I Y<0,'$D(^TMP("SDWLRQ1",$J,"CT1")) W !,"This Entry is Required." G CAT
54 G CT2:Y<0
55 S SDWLCAT=SDWLCAT_Y_";",DIC("A")="Another "_$P(SDWLX,":",1)_": ",SDWLE=1 G CT1
56CT2 G CT1:'$D(SDWLCAT) S ^TMP("SDWLRQ1",$J,"CT2")=SDWLCAT
57CT3 Q
58DATE ;Date range selection
59 K X,Y,%DT
60 S %=1 W !!,"Print Report for ALL dates? " D YN^DICN
61 I %=1 S ^TMP("SDWLRQ1",$J,"DATE")="ALL" G E1
62 Q:%=0
63 Q:%=-1
64 S SDWLERR=0 W ! S %DT="AE",%DT("A")="Start with Desired Appointment Date: " D ^%DT
65 I X["^" S SDWLERR=1 Q
66 G E1:Y<0 S SDWLBDT=Y
67 Q:$D(DUOUT)
68 S %DT(0)=SDWLBDT,%DT("A")="End with Desired Appointment Date: " D ^%DT G DATE:Y<1 S SDWLEDT=Y K %DT(0),%DT("A")
69 G DATE:$D(DUOUT)
70 I SDWLEDT<SDWLBDT W !,"Beginning Date must be greater than Ending Date." G DATE
71 S ^TMP("SDWLRQ1",$J,"DATE")=SDWLBDT_"^"_SDWLEDT Q
72E1 Q
73OPEN ;OPEN Wait List Entries
74 S %=1 W !!,"Do you want only 'OPEN' Wait List Entries " D YN^DICN
75 I %=0 W " Response must be 'YES' or 'NO'." G OPEN
76 I %=-1 S SDWLERR=1 W *7,"?? "
77 S ^TMP("SDWLRQ1",$J,"OPEN")=%
78 Q
79FORM ;Report Format
80 S SDWLERR=0,DIR(0)="SO^1:D:Detailed;S:Summary",DIR("L",2)=" D Detailed"
81 S DIR("L")=" S Summary",DIR("L",1)="Select One of the Following: "
82 D ^DIR
83 S SDWLFORM=$S(X["D":"D",X["d":"D",X["S":"S",X["s":"S",1:"")
84 I X="^" S DUOUT=1 Q
85 I SDWLFORM="" W *7,"Required!" G FORM
86 S ^TMP("SDWLRQ1",$J,"FORM")=SDWLFORM
87 Q
88DIS ;Display Parameters
89 S SDWLERR=0 W !!,?80-$L("*** Selected Report Parameters ***")\2,"*** Selected Report Parameters ***",!
90 F SDWLI="INS","CT1","CT2","DATE","FORM","OPEN" D
91 .S X="SDWL"_SDWLI,@X=$G(^TMP("SDWLRQ1",$J,SDWLI))
92 F SDWLTAG="IS","CT","DA","OP","PR" D @SDWLTAG
93 Q
94IS I SDWLINS'["ALL" D
95 .K SDWLY F I=1:1 S SDWLY=$P($P(SDWLINS,";",I),U,2) Q:SDWLY="" S SDWLY(I)=SDWLY
96 .W !,?20,"Institution: "
97 .I $D(SDWLY) S I="" F S I=$O(SDWLY(I)) Q:I="" W:I>1 !,?33 W SDWLY(I)
98 .K SDWLY
99 I SDWLINS["ALL" W !,?20,"Institution: ALL "
100 Q
101CT I SDWLCT2'["ALL" D
102 .S SDWLF=$P(SDWLCT1,U,2)
103 .K SDWLY F I=1:1 S SDWLY=$P($P(SDWLCT2,";",I),U,2) Q:SDWLY="" S SDWLY(I)=SDWLY
104 .W !,?16,"Report Category: " W $S(SDWLCT1["C":"Clinic",1:"Service Specialty"),!,?36 I @X="ALL" W "All "
105 .I $D(SDWLY) S I="" F S I=$O(SDWLY(I)) Q:I="" W:I>1 !,?35 W $$EXTERNAL^DILFD(SDWLF,.01,,SDWLY(I))
106 I SDWLCT2["ALL" W !,?16,"Report Category: " W $S(SDWLCT1["C":"Clinic",1:"Service Specialty"),!,?36 W "ALL "
107 Q
108DA W !,?13,"Date Desired Range: " S Y=$P(SDWLDATE,U,1) D DD^%DT S SDWLBD=Y S Y=$P(SDWLDATE,U,2) D DD^%DT S SDWLED=Y
109 W " ",SDWLBD
110 I SDWLED'="" W " to ",SDWLED
111 Q
112OP W !,?18,"Output Format: ",$S(SDWLFORM="D":" Detailed",1:" Summary")
113 Q
114PR I SDWLOPEN=1 W !,?25,"Printing 'OPEN' Entries Only."
115 E W !,?25,"Printing ALL Entries."
116 S %=1 W !!,"Are these Parameters Correct " D YN^DICN I %=2 S SDWLERR=1 W !," This Report will NOT be queued to print."
117 I SDWLERR S DIR(0)="E" D ^DIR I X["^" S SDWLERR=2
118 Q
119QUE ;Queue Report
120 N ZTQUEUED,POP
121 K %ZIS,IOP,IOC,ZTIO S %ZIS="MQ" D ^%ZIS G:POP QUE1
122 S ZTRTN=$S(SDWLFORM="D":"EN^SDWLRPT1",1:"EN^SDWLRPS1"),ZTDTH=$H,ZTDESC="WAIT LIST REPORT FORMAT 1"
123 S SDWLTASK="" F S SDWLTASK=$O(^TMP("SDWLRQ1",$J,SDWLTASK)) Q:SDWLTASK="" D
124 .S SDWLTK=$G(^TMP("SDWLRQ1",$J,SDWLTASK))
125 .S ZTSAVE(SDWLTASK)=SDWLTK
126 S ZTSAVE("SDWLF")="" ; SD*5.3*412
127 I $D(IO("Q")) K IO("Q") D ^%ZTLOAD W !,"REQUEST QUEUED" G END
128QUE1 S:$E(IOST,1,2)="C-" SDWLSPT=1 I $D(ZTRTN) U IO D @ZTRTN K SDWLSPT
129 ;
130END ;
131 K SDWLTASK,SDWLY,SDWLED,WDWLBD,SDWLOPEN,SDWLDATE,SDWLFORM,SDWLPRI,I
132 K DIR,DIC,DR,DIE,SDWLERR,SDWLF,SDWLX,SDLFD,SDWLCTX,SDWLDAT,SDWLPROM,SDWLINST,SDWLI,SDWLTAG,SDWLY
133 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
134 Q
135HD W:$D(IOF) @IOF W !,?80-$L("Appointment Wait List Report")\2,"Appointment Wait List Report"
136 Q
Note: See TracBrowser for help on using the repository browser.