source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCRPI02A.m@ 1259

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1SCRPI02A ; ALB/SCK - Print IEMM Statistical Summary Report ; 6/26/97
2 ;;5.3;Scheduling;**66,143**;AUG 13, 1993
3 ;
4PRINT ; print Summary Report
5 ; Variables
6 ;
7 N DASH,DBLDASH,PAGE,SDIV,SDNAME,SDT,SCABORT,TOTALS,SDMSG,LINE
8 ;
9 K ^TMP("SCRPI ERRORS",$J)
10 I $G(SDBLT) D
11 . S IOM=80
12 S $P(DASH,"-",IOM-1)="",$P(DBLDASH,"=",IOM-1)=""
13 S PAGE=0
14 ;
15 I '$D(^TMP("SCRPI SUM",$J)) D G PRNQ
16 . D HDR1
17 . S X="No Incomplete Encounters found."
18 . D WRT(DBLDASH)
19 . D WRT(" "),WRT(X)
20 ;
21 I SDRTYP["S" D PRNTSUM
22 I SDRTYP["D" D PRNTDTL
23 ;
24 I $D(TOTALS) D
25 . D WRT(" "),WRT(" ")
26 . S X=" Total Encounters: "_(+$G(TOTALS("TOT"))++$G(TOTALS("DTOT"))) D WRT(X)
27 . S X=" Total Incomplete Encounters: "_(+$G(TOTALS("INC"))++$G(TOTALS("DINC"))) D WRT(X)
28 ;
29PRNQ ;
30 D:$G(SDBLT) SENDMSG
31 K ^TMP("SCRPI ERRS",$J)
32 Q
33 ;
34PRNTSUM ; Print encounter summary for each clinic
35 ; Variables
36 ;
37 N SDDCLN,SDIVN
38 ;
39 S SDIVN="" F S SDIVN=$O(^TMP("SCRPI SUM",$J,SDIVN)) Q:SDIVN']"" D Q:$G(SCABORT)
40 . D HDR1 Q:$G(SCABORT) D HDR2
41 . S SDDCLN="" F S SDDCLN=$O(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN)) Q:SDDCLN']"" D Q:$G(SCABORT)
42 .. D PRNTCLN(SDIVN,SDDCLN)
43 .. I '$G(SDBLT),$Y>(IOSL-5) D HDR1 Q:$G(SCABORT) D HDR2
44 Q
45 ;
46PRNTCLN(SDIVN,SDDCLN) ;
47 N INC,TOT,DINC,DTOT,XN,SDPER
48 ;
49 S INC=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,1)
50 S TOT=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,3)
51 S DINC=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,2)
52 S DTOT=+$P($G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0)),U,4)
53 Q:'INC
54 S X=SDDCLN
55 S X=X_$$SPACE^SCRPIUT1(33-$L(X))_$J(TOT+DTOT,6)
56 S XN=" ("_$S(DTOT]"":DTOT,1:0)_")"
57 S X=X_XN
58 S X=X_$$SPACE^SCRPIUT1(48-$L(X))_$J(INC+DINC,6)
59 S XN=" ("_$S(DINC]"":DINC,1:0)_")"
60 S X=X_XN
61 S SDPER=((INC+DINC)/(TOT+DTOT))*100
62 S X=X_$$SPACE^SCRPIUT1(65-$L(X))_$J(SDPER,6,1)_"%"
63 D WRT(X)
64 S TOTALS("INC")=+$G(TOTALS("INC"))+INC
65 S TOTALS("TOT")=+$G(TOTALS("TOT"))+TOT
66 S TOTALS("DINC")=+$G(TOTALS("DINC"))+DINC
67 S TOTALS("DTOT")=+$G(TOTALS("DTOT"))+DTOT
68 Q
69 ;
70PRNTDTL ; Print error details for each clinic
71 ; Variables
72 ;
73 N SDDCLN,SDIVN
74 ;
75 S SDIVN="" F S SDIVN=$O(^TMP("SCRPI SUM",$J,SDIVN)) Q:SDIVN']"" D Q:$G(SCABORT)
76 . S SDDCLN="" F S SDDCLN=$O(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN)) Q:SDDCLN']"" D Q:$G(SCABORT)
77 .. Q:'$P(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,0),U)
78 .. D HDR1 Q:$G(SCABORT) D HDR3
79 .. D PRNERRS(SDIVN,SDDCLN)
80 Q
81 ;
82PRNERRS(SDIVN,SDDCLN) ;
83 N SDER,SDEC,SDERC,SDPER,SDETOT
84 ;
85 K ^TMP("SCRPI ERRS",$J)
86 ;
87 S SDER=0 F S SDER=$O(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SDER)) Q:'SDER D
88 . S SDETOT=+$G(SDETOT)++$G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SDER,0))
89 ;
90 S SDER=0 F S SDER=$O(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SDER)) Q:'SDER D Q:$G(SCABORT)
91 . S SDERC=+$G(^TMP("SCRPI SUM",$J,SDIVN,SDDCLN,SDER,0))
92 . I +SDETOT>0 S SDPER=(SDERC/SDETOT)*100
93 . S ^TMP("SCRPI ERRS",$J,SDERC,SDER)=+SDPER
94 . I '$G(SDBLT),$Y>(IOSL-5) D HDR1 Q:$G(SCABORT) D HDR3
95 ;
96 S SDERC=999999 F S SDERC=$O(^TMP("SCRPI ERRS",$J,SDERC),-1) Q:'SDERC D Q:$G(SCABORT)
97 . S SDER="" F S SDER=$O(^TMP("SCRPI ERRS",$J,SDERC,SDER)) Q:'SDER D Q:$G(SCABORT)
98 .. S SDEC=$E($G(^SD(409.76,SDER,1)),1,52)
99 .. I $L($G(^SD(409.76,SDER,1)))>52 S SDEC=SDEC_"..."
100 .. W !,SDEC,?57,$J(SDERC,6),?70,$J(^TMP("SCRPI ERRS",$J,SDERC,SDER),6,1)_"%"
101 .. I '$G(SDBLT),$Y>(IOSL-5) D HDR1 Q:$G(SCABORT) D HDR3
102 D PRNTOT(SDIVN,SDDCLN)
103 Q
104 ;
105PRNTOT(SDIV,SDDCL) ;
106 I '$G(SDBLT),$Y>(IOSL-5) D HDR1 Q:$G(SCABORT) D HDR3
107 S INC=+$P($G(^TMP("SCRPI SUM",$J,SDIV,SDDCL,0)),U,1)
108 S TOT=+$P($G(^TMP("SCRPI SUM",$J,SDIV,SDDCL,0)),U,3)
109 S DINC=+$P($G(^TMP("SCRPI SUM",$J,SDIV,SDDCL,0)),U,2)
110 S DTOT=+$P($G(^TMP("SCRPI SUM",$J,SDIV,SDDCL,0)),U,4)
111 W !!!," Incomplete Encounters: ",$J(INC,6,0)
112 W !," Total Encounters: ",$J(TOT,6,0)
113 W !,"(Deleted) Incomplete Encounters: ",$J(DINC,6,0)
114 W !," (Deleted) Total Encounters: ",$J(DTOT,6,0)
115 ;
116 ;
117 Q
118 ;
119HDR1 ; Print report header
120 N SDL,X
121 ;
122 I $$S^%ZTLOAD S SCABORT=1 Q
123 I 'PAGE,IOST?1"C-".E W @IOF
124 I PAGE,IOST?1"C-".E D Q:$G(SCABORT)
125 . S DIR(0)="E" D ^DIR K DIR S SCABORT='+$G(Y)
126 . W @IOF
127 E D
128 . I '$G(SDBLT),PAGE W @IOF
129 ;
130 S PAGE=PAGE+1
131 I $G(SDBLT) D WRT(""),WRT("")
132 S X="Date: "_$$FDATE^VALM1($$DT^XLFDT)
133 S X=X_$$SPACE^SCRPIUT1(17-$L(X))_"Incomplete Encounter Mgmt Summary Error Report"
134 S X=X_$$SPACE^SCRPIUT1((79-$L(X))-$L("PAGE: "_PAGE))_"PAGE: "_PAGE
135 D WRT(X)
136 S X="Date Range: "_$$FMTE^XLFDT($P(SDDT,U))_" to "_$$FMTE^XLFDT($P(SDDT,U,2))
137 D CTR^SCRPIUT1(.X),WRT(X)
138 Q
139 ;
140HDR2 ;
141 N X
142 S X="Division: "_$S($G(SDIVN)]"":SDIVN,1:" ---")
143 D CTR^SCRPIUT1(.X),WRT(X)
144 S X="Clinic Summary - Incomplete Encounters"
145 D CTR^SCRPIUT1(.X),WRT(X)
146 D WRT(""),WRT("")
147 ;
148 S X="Clinic"_$$SPACE^SCRPIUT1(30)_"Encounters"_$$SPACE^SCRPIUT1(5)_"Incomplete"_$$SPACE^SCRPIUT1(5)_"Percentage"
149 D WRT(X),WRT(DBLDASH)
150 S X="Note: (nn) = Number of total encounters which are deleted encounters"
151 D CTR^SCRPIUT1(.X),WRT(X),WRT("")
152 Q
153 ;
154HDR3 ;
155 S X="Division: "_$S($G(SDIVN)]"":SDIVN,1:" ---")
156 D CTR^SCRPIUT1(.X),WRT(X)
157 S X="Clinic: "_$S($G(SDDCLN)]"":SDDCLN,1:" ---")
158 D CTR^SCRPIUT1(.X),WRT(X),WRT("")
159 S X=$$SPACE^SCRPIUT1(55)_"Number of"_$$SPACE^SCRPIUT1(8)_"Percent" D WRT(X)
160 S X="Error"_$$SPACE^SCRPIUT1(50)_"Occurrences"_$$SPACE^SCRPIUT1(5)_"of Total" D WRT(X)
161 D WRT(DBLDASH)
162 S X="< Errors in descending order of occurrence >" D CTR^SCRPIUT1(.X),WRT(X),WRT("")
163 Q
164 ;
165WRT(X) ; Write string to either output device or bulletin array
166 I $G(SDBLT) D
167 . S LINE=+$G(LINE)+1
168 . S SDMSG(LINE)=X
169 E D
170 . I $Y>(IOSL-5) D HDR1 Q:$G(SCABORT)
171 . W !,X
172 Q
173 ;
174SENDMSG ; Sends bulletin message
175 N XMB,XMDUZ,XMTEXT
176 ;
177 S XMB="SCDX INCOMPLETE ENCOUNTER MGMT"
178 S XMB(1)="IEMM Summary Report"
179 S XMDUZ="INCOMPLETE ENCOUNTER MANAGEMENT"
180 ;
181 S XMTEXT="SDMSG("
182 D ^XMB
183 Q
Note: See TracBrowser for help on using the repository browser.