source: WorldVistAEHR/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCSTL8.m@ 1005

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

revised back to 6/30/08 version

File size: 4.6 KB
Line 
1GMRCSTL8 ;SLC/JFR - Totals format for CPM ; 4/05/05 10:39
2 ;;3.0;CONSULT/REQUEST TRACKING;**41**;DEC 27, 1997
3 ; This routine invokes IA #875, #2638
4 ; This routine invokes IA #10035,#44, #10040
5 ;
6 ; portions copied from GMRCSTL1 & GMRCSTL2
7 ;
8 Q ; can't start here
9 ;
10PRTTOT(GEN,INDEX,NAME,ARRN) ; totals for printed report
11 N COUNT
12 S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
13 I GEN=2 D
14 . S COUNT=COUNT+1
15 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=""
16 . S COUNT=COUNT+1
17 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" GROUPER: "_NAME_" Totals:"
18 I GEN=1 D
19 . I ^TMP("GMRCTOT",$J,1,INDEX,"T")=0 D Q ;collect zero servs for summ
20 .. Q:$P(^GMR(123.5,INDEX,0),U,2)=1
21 .. S ^TMP("GMRCTOT",$J,0,NAME)=""
22 . S COUNT=COUNT+1
23 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" "
24 . S COUNT=COUNT+1
25 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="SERVICE: "_NAME
26 . S COUNT=COUNT+1
27 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Service:"_$J(^TMP("GMRCTOT",$J,1,INDEX,"T"),30,0)
28 I GEN=2,^TMP("GMRCTOT",$J,2,INDEX,"T")>0 D
29 . S COUNT=COUNT+1
30 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Grouper:"_$J(^TMP("GMRCTOT",$J,2,INDEX,"T"),30,0)
31 I $G(^TMP("GMRCTOT",$J,GEN,INDEX,"T"))>0 D
32 . S COUNT=COUNT+1
33 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Pending Resolution: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"P"),21,0)
34 . S COUNT=COUNT+1
35 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests completed: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"C"),30,0)
36 . S COUNT=COUNT+1
37 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests completed with Results: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"R"),17,0)
38 . N GMRCPCT
39 . I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 S GMRCPCT="N/A"
40 . I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
41 . S COUNT=COUNT+1
42 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of total requests completed: "_$S(+GMRCPCT'=GMRCPCT:$J(GMRCPCT,16),1:($J(GMRCPCT,19,2)_"%"))
43 . K GMRCPCT
44 . I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S GMRCPCT="N/A"
45 . I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
46 . S COUNT=COUNT+1
47 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of total completed requests with results: "_$S(+GMRCPCT'=GMRCPCT:GMRCPCT,1:($J(GMRCPCT,6,2)_"%"))
48 Q
49 ;
50DELTOT(GEN,INDEX,NAME,ARRN) ; format for delimited
51 ;
52 I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 Q
53 N STRING,COUNT
54 S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
55 S STRING=$S(GEN=2:"GROUPER: ",1:"")_NAME_";"
56 S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"T")_";"
57 S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"P")_";"
58 S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"C")_";"
59 S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"R")_";"
60 D ;get % completed
61 . N GMRCPCT
62 . S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
63 . S STRING=STRING_$J(GMRCPCT,0,2)_";"
64 . Q
65 D ; get % completed w/results
66 . I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S STRING=STRING_"N/A;" Q
67 . N GMRCPCT
68 . S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
69 . S STRING=STRING_$J(GMRCPCT,0,2)
70 . Q
71 S COUNT=COUNT+1
72 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=STRING
73 Q
74 ;
75ONESTAT(ARRN,SVCN,STAT,DT1,DT2) ;Process one status
76 ; Input -- ARRN "CP" - to be printed
77 ; "DEL" - in delimited format
78 ; SVCN = node in ^TMP("GMRCLIST,$J
79 ; STAT = status being worked on
80 ; DT1 = starting date
81 ; DT2 = ending date
82 ;
83 ; Output - None
84 ;
85 N GMRCPT,GMRCXDT,TEMP,GMRCSVC,GMRCSVCG,GMRCSVCP
86 S GMRCSVC=$P(^TMP("GMRCSLIST",$J,SVCN),"^",1)
87 S GMRCSVCP=$P(^TMP("GMRCSLIST",$J,SVCN),"^",2)
88 S GMRCSVCG=$P(^TMP("GMRCSLIST",$J,SVCN),"^",3)
89 S GMRCXDT=$S(DT1="ALL":0,1:9999999-DT2-.6)
90 F S GMRCXDT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT)) Q:GMRCXDT=""!(GMRCXDT>(9999999-DT1)) D
91 .S GMRCPT=0
92 .;Loop for one consult at a time
93 .F S GMRCPT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)) Q:GMRCPT="" D
94 .. N PROS
95 ..; Check for bad "AE" x-ref
96 ..I '$D(^GMR(123,GMRCPT,0)) D Q
97 ...K ^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)
98 .. I $$TESTPAT^VADPT(+$P(^GMR(123,GMRCPT,0),U,2)) Q ; exclude test pats
99 .. D I $G(PROS) Q
100 ... N SVC S SVC=$P(^GMR(123,GMRCPT,0),U,5)
101 ... I +$G(^GMR(123.5,SVC,"INT")) S PROS=1 ; exclude PROS consults
102 .. I $P($G(^GMR(123,GMRCPT,12)),U,5)="P" Q ; exclude IFC placer
103 ..; Add to totals
104 ..; for all status for this service
105 ..S ^TMP("GMRCTOT",$J,1,GMRCSVC,"T")=^TMP("GMRCTOT",$J,1,GMRCSVC,"T")+1
106 ..; pending for this service
107 ..S:",3,4,5,6,8,9,11,99,"[(","_STAT_",") ^TMP("GMRCTOT",$J,1,GMRCSVC,"P")=^TMP("GMRCTOT",$J,1,GMRCSVC,"P")+1
108 .. I STAT=2 D
109 ... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"C")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"C"))+1
110 ... Q:'$O(^GMR(123,+$G(GMRCPT),50,0)) ; Q if no results
111 ... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"R")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"R"))+1
112 Q
113 ;
Note: See TracBrowser for help on using the repository browser.