source: FOIAVistA/trunk/r/CONSULT_REQUEST_TRACKING-GMRC-GMRS-GMRT/GMRCSTL1.m@ 1754

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

initial load of FOIAVistA 6/30/08 version

File size: 3.3 KB
Line 
1GMRCSTL1 ;SLC/DCM,dee;MA - List Manager Format Routine - Get Active Consults by service - pending,active,scheduled,incomplete,etc. ;11/13/02 08:30
2 ;;3.0;CONSULT/REQUEST TRACKING;**7,21,22,29**;DEC 27, 1997
3 ; Patch #21 changed array GMRCTOT to ^TMP("GMRCTOT,$J)
4 ; This routine invokes IA #875, #2638
5 Q
6STATNAME(STATUS) ;Return the name for the status number
7 I STATUS<9 Q $S(STATUS=1:"Discont.",STATUS=2:"Completed",STATUS=3:"On Hold",STATUS=4:"Flagged",STATUS=5:"Pending",STATUS=6:"Active",STATUS=7:"Expired",STATUS=8:"Scheduled",1:"No Status")
8 E Q $S(STATUS=9:"Incomplete",STATUS=10:"Delayed",STATUS=11:"Unreleased",STATUS=12:"Discont/Ed",STATUS=13:"Cancelled",STATUS=14:"Lapsed",STATUS=15:"Renewed",1:"No Status")
9 Q
10 ;
11STATABBR(STATUS) ;Return the name for the status number
12 Q ^ORD(100.01,STATUS,.1)
13 ;
14LISTTOT(COUNT,GEN,INDEX,NAME,GROUPNAM,CONTROL,ARRN) ;
15 N LOOP,STATUS,STS,CTRLTEMP,GMRCTOTS
16 S CTRLTEMP=$S(CONTROL#2:"^",1:"")
17 I GEN=2 D
18 . S COUNT=COUNT+1
19 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP
20 . S COUNT=COUNT+1
21 . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_" GROUPER: "_NAME_" Totals:"
22 S GMRCTOTS=0
23 I $L(GMRCSTAT,",")=16 S GMRCTOTS=1 ;only incl. totals if all status
24 F LOOP=1:1:$L(GMRCSTAT,",") S STATUS=$P(GMRCSTAT,",",LOOP) I ^TMP("GMRCTOT",$J,GEN,INDEX,STATUS)>0 D
25 .S COUNT=COUNT+1
26 .S STS=$$STATNAME(STATUS)
27 .I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"To Service "_NAME_" Total Requests "_STS_$J(^TMP("GMRCTOT",$J,1,INDEX,STATUS),6,0)
28 .E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"To Grouper "_NAME_" Total Requests "_STS_$J(^TMP("GMRCTOT",$J,2,INDEX,STATUS),6,0)
29 ;If any printed are pending then print the total that are pending for all pending status.
30 I ^TMP("GMRCTOT",$J,GEN,INDEX,"P")>0 D
31 .S COUNT=COUNT+1
32 .I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests Pending Resolution To Service "_NAME_": "_$J(^TMP("GMRCTOT",$J,1,INDEX,"P"),6,0)
33 .E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests Pending Resolution To Grouper "_NAME_": "_$J(^TMP("GMRCTOT",$J,2,INDEX,"P"),6,0)
34 ; IF Consults
35 I ARRN="IFC" D
36 .N IRFN,VALSVC,VALTOT S IRFN=""
37 .F S IRFN=$O(^TMP("GMRCTOT",$J,GEN,INDEX,"F",IRFN)) Q:IRFN="" D
38 ..S COUNT=COUNT+1
39 ..I GMRCTOTS D
40 ...I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service "_$E(NAME,1,16)_" @ "_$E(IRFN,1,16)_": "_$J(^TMP("GMRCTOT",$J,1,INDEX,"F",IRFN),6,0)
41 ...E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests to Grouper "_$E(NAME,1,20)_" @ "_$E(IRFN,1,20)_": "_$J(^TMP("GMRCTOT",$J,2,INDEX,"F",IRFN),6,0)
42 ..I $P($G(GMRCST(GEN,INDEX,IRFN)),"^",2)>0 D
43 ...S COUNT=COUNT+1
44 ...S VALSVC=$P(GMRCST(GEN,INDEX,IRFN),"^")\$P(GMRCST(GEN,INDEX,IRFN),"^",2)
45 ...S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$S(GEN=1:"Service ",1:"Grouper ")_$E(NAME,1,20)_" @ "_$E(IRFN,1,20)_": "_$J(VALSVC,4,0)
46 .I $P($G(GMRCST(GEN,INDEX)),"^",2)>0 D
47 ..S COUNT=COUNT+1
48 ..S VALTOT=$P(GMRCST(GEN,INDEX),"^")\$P(GMRCST(GEN,INDEX),"^",2)
49 ..S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Mean Days Completed To "_$S(GEN=1:"Service ",1:"Grouper ")_$E(NAME,1,20)_": "_$J(VALTOT,4,0)
50 S COUNT=COUNT+1
51 I GMRCTOTS D
52 .I GEN=1 S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Service "_NAME_": "_$J(^TMP("GMRCTOT",$J,1,INDEX,"T"),6,0)
53 .E S ^TMP("GMRCR",$J,ARRN,COUNT,0)=CTRLTEMP_"Total Requests To Grouper "_NAME_": "_$J(^TMP("GMRCTOT",$J,2,INDEX,"T"),6,0)
54 Q
55 ;
Note: See TracBrowser for help on using the repository browser.