source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDWLROS.m@ 767

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

initial load of WorldVistAEHR

File size: 5.1 KB
Line 
1SDWLROS ;;IOFO BAY PINES/TEH - WAIT LIST OVERDUE REPORT-SUMMARY;06/12/2002 ; 20 Aug 2002 2:10 PM
2 ;;5.3;scheduling;**263,414**;AUG 13 1993
3 ;
4 ;
5 ;******************************************************************
6 ; CHANGE LOG
7 ;
8 ; DATE PATCH DESCRIPTION
9 ; ---- ----- -----------
10 ;
11 ;
12 ;
13 ;
14EN ;
15 D INIT
16 I $$S^%ZTLOAD G END
17 D HD
18 D SORT
19 I $$S^%ZTLOAD G END
20 D PRT
21 I $$S^%ZTLOAD G END
22 D PRT1
23 K ^TMP("SDWLROS",$J)
24 Q
25INIT ;Initialize variables
26 ;
27 I $D(CT1) S SDWLCT1=CT1
28 I $D(CT2) S SDWLCT2=CT2
29 I $D(FORM) S SDWLFORM=FORM
30 I $D(INS) S SDWLINS=INS
31 S SDWLPG=0
32 I $D(ZTSAVE) D
33 .F SDWLI="CT1","CT2","FORM","INS" S SDWL="SDWL"_SDWLI,@SDWL=$G(ZTSAVE(SDWLI))
34 I SDWLINS="ALL" S SDWLIN("ALL")=""
35 S SDWLTXP=$P(SDWLCT1,U,3),SDWLF=$P(SDWLCT1,U,2)
36 I SDWLINS'="ALL" F SDWLI=1:1 S SDWLIN=$P($P(SDWLINS,";",SDWLI),U,1) Q:SDWLIN="" S SDWLIN(SDWLIN)=""
37 I SDWLCT2'="ALL" F SDWLI=1:1 S SDWLCL=$P($P(SDWLCT2,";",SDWLI),U,1) Q:SDWLCL="" S SDWLCT2(SDWLCL)=""
38 D NOW^%DTC S Y=% D DD^%DT S SDWLDTP=Y
39 Q
40SORT ;Sort Records
41 K ^TMP("SDWLROS",$J)
42 S SDWLDA=0 F S SDWLDA=$O(^SDWL(409.3,SDWLDA)) Q:SDWLDA<1 D
43 .S SDWLX=$G(^SDWL(409.3,SDWLDA,0)),SDWLERR=0,SDWLDFN=+SDWLX I 'SDWLDFN Q
44 .;-Check for Institution Sort
45 .I SDWLINS'="ALL" D
46 ..I '$D(SDWLIN(+$P(SDWLX,U,3))) S SDWLERR=1 Q
47 .I $P(SDWLX,U,16)'<DT,$P(SDWLX,U,16)'=DT S SDWLERR=2
48 .S SDWLAPDT=$P(SDWLX,U,16),SDWLOPDT=$P(SDWLX,U,2) S X1=DT,X2=SDWLAPDT D ^%DTC S SDWLDWT=+X
49 .S SDWLTYP=$P(SDWLCT1,U,1),SDWLTYPE=$S(SDWLTYP="C":+$P(SDWLX,U,9),1:+$P(SDWLX,U,8)) I SDWLTYPE=""!('SDWLTYPE) S SDWLERR=7 Q
50 .S SDWLF=$P(SDWLCT1,U,2)
51 .I SDWLCT2'="ALL" D
52 ..I '$D(SDWLCT2(SDWLTYPE)) S SDWLERR=3
53 .I SDWLTYP="" S SDWLERR=4 Q
54 .I $P(SDWLX,U,17)["C" S SDWLERR=6 Q
55 .Q:SDWLERR D
56 ..S SDWLSCC=2,DFN=SDWLDFN D ELIG^VADPT I $D(VAEL(3)) S SDWLSCN=$P(VAEL(3),U,2) I SDWLSCN>49 S SDWLSCC=1
57 ..S:'$D(^TMP("SDWLROS",$J,"A",+$P(SDWLX,U,3),SDWLTYPE)) ^(SDWLTYPE)=0
58 ..S ^TMP("SDWLROS",$J,"A",+$P(SDWLX,U,3),SDWLTYPE)=^(SDWLTYPE)+1
59 ..S:'$D(^TMP("SDWLROS",$J,"B",+$P(SDWLX,U,3),SDWLTYPE,SDWLDFN)) ^(SDWLDFN)=0 S ^TMP("SDWLROS",$J,"B",+$P(SDWLX,U,3),SDWLTYPE,SDWLDFN)=^(SDWLDFN)+1
60 ..S:'$D(^TMP("SDWLROS",$J,"C",SDWLSCC,+$P(SDWLX,U,3),SDWLTYPE)) ^TMP("SDWLROS",$J,"C",SDWLSCC,+$P(SDWLX,U,3),SDWLTYPE)=0
61 ..S ^TMP("SDWLROS",$J,"C",SDWLSCC,+$P(SDWLX,U,3),SDWLTYPE)=^(SDWLTYPE)+1
62 ..S ^TMP("SDWLROS",$J,"D",SDWLSCC,+$P(SDWLX,U,3),SDWLTYPE,SDWLDWT,SDWLDA)=""
63 Q
64PRT ;
65 S SDWLIN=0 F S SDWLIN=$O(^TMP("SDWLROS",$J,"A",SDWLIN)) Q:SDWLIN="" W !,"Institution: ",$P($G(^DIC(4,SDWLIN,0)),U,1),! D
66 .D PRA
67 Q
68PRA ;
69 S SDWLSC=0,(SDWLX,SDWLXT,SDWLXTT)=0 F S SDWLSC=$O(^TMP("SDWLROS",$J,"A",SDWLIN,SDWLSC)) Q:SDWLSC="" D
70 .S SDWLX=$G(^TMP("SDWLROS",$J,"A",SDWLIN,SDWLSC)),SDWLXT=SDWLXT+SDWLX W !,$$EXTERNAL^DILFD(SDWLF,.01,,$P(^SDWL(SDWLF,SDWLSC,0),U,1)),?30,SDWLX
71 .S SDWLDFNX=0 F S SDWLDFNX=$O(^TMP("SDWLROS",$J,"B",SDWLIN,SDWLSC,SDWLDFNX)) Q:SDWLDFNX="" S SDWLXTT=SDWLXTT+1
72 W !,?20,"Total #: ",SDWLXT
73 ;W !,?4,"Total # Unique Patients: ",SDWLXTT,!!
74 I $D(SDWLSPT),$Y>IOSL S DIR(0)="E" D ^DIR I X="^" Q
75 Q
76PRT1 ;
77 D HD,HD1
78 S SDWLSCC=0 F S SDWLSCC=$O(^TMP("SDWLROS",$J,"D",SDWLSCC)) Q:SDWLSCC="" Q:$$S^%ZTLOAD D I $D(DUOUT) Q
79 .W !,"******* ",SDWLSCC," *******",!
80 .S SDWLINS=0 F S SDWLINS=$O(^TMP("SDWLROS",$J,"D",SDWLSCC,SDWLINS)) Q:SDWLINS="" D W ! I $D(DUOUT) Q
81 ..W !,$P($G(^DIC(4,SDWLINS,0)),U,1),!
82 ..S SDWLSC=0 F S SDWLSC=$O(^TMP("SDWLROS",$J,"D",SDWLSCC,SDWLINS,SDWLSC)) Q:SDWLSC="" D I $D(DUOUT) Q
83 ...W !,$$EXTERNAL^DILFD(SDWLF,.01,,$P(^SDWL(SDWLF,SDWLSC,0),U,1))
84 ...S SDWLWT="" F S SDWLWT=$O(^TMP("SDWLROS",$J,"D",SDWLSCC,SDWLINS,SDWLSC,SDWLWT)) Q:SDWLWT="" D I $D(DUOUT) Q
85 ....S SDWLDA=0 F S SDWLDA=$O(^TMP("SDWLROS",$J,"D",SDWLSCC,SDWLINS,SDWLSC,SDWLWT,SDWLDA)) Q:SDWLDA="" D I $D(DUOUT) Q
86 .....S X=$G(^SDWL(409.3,SDWLDA,0)),SDWLODT=$P(X,U,2),SDWLDDT=$P(X,U,16) D
87 ......S DFN=+X D 1^VADPT,DEM^VADPT
88 ......W !,VA("BID"),?6,$E(VADM(1),1,25),?32,$E(SDWLODT,4,5),"/",$E(SDWLODT,6,7),"/",($E(SDWLODT,1,3)+1700)
89 ......W ?47,$E(SDWLDDT,4,5),"/",$E(SDWLDDT,6,7),"/",($E(SDWLDDT,1,3)+1700),?60,$J(SDWLWT,5) K VA,VADM
90 ......I $D(SDWLSPT),$Y>(IOSL+3) S DIR(0)="E" D ^DIR I X="^" S DUOUT=1 Q
91 ......I $Y>(IOSL+3) D HD,HD1
92 .W !
93 Q
94LINE ;Draw Line
95 W !,"_______________________________________________________________________________"
96 Q
97HD ;Header
98 W:$D(IOF) @IOF W !,SDWLDTP,?80-$L("Appointment Wait List Overdue Report")\2,"Appointment Wait List Overdue Report"
99 S Y=DT D DD^%DT S SDWLPD=Y W ?59,SDWLPD S SDWLPG=SDWLPG+1 W ?72,"Page: ",SDWLPG
100 W !!,?30,"Institution: " I SDWLINS="ALL" D
101 .W ?45,SDWLINS
102 F I=1:1 S X=$P($P(SDWLINS,";",I),"^",2) Q:X="" W:I>1 ! W ?45,X
103 S X=$P(SDWLCT1,U,1)
104 W !?27,"Report Category: ",$S($P(SDWLCT1,U,1)="C":"CLINIC",1:"SPECIALTY") I X="ALL" W " ALL"
105 I X'="ALL" D
106 .F I=1:1 S X=$P($P(SDWLCT2,";",I),"^",2) Q:X="" W !,?45,$$EXTERNAL^DILFD(SDWLF,.01,,X)
107 S X=$G(SDWLFORM) W !,?28,"Output Format: ",$S(SDWLFORM="S":"Summary",1:"Detailed")
108 Q
109HD1 ;
110 W !!,"Name",?30,"Date Entered",?45,"Date Desired",?60,"# of Days Waiting",!!
111 Q
112END K X1,X2,SDWLAPDT,CT,CT1,CT2,I,OPEN,INS,FORM,VADM Q
Note: See TracBrowser for help on using the repository browser.