Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMRCSTLB

GMRCSTLB.m

Go to the documentation of this file.
  1. GMRCSTLB ;SLC/JFR,WAT - Totals format for LOCAL CSLT COMPL RATE ;25-Jul-2012 10:49;DU
  1. ;;3.0;CONSULT/REQUEST TRACKING;**67,1003**;DEC 27, 1997;Build 14
  1. ;;
  1. ;875 (file 100.01), 2638 (file 100.01), 3744 (VADPT)
  1. ; portions copied from GMRCSTL1 & GMRCSTL2
  1. ;
  1. Q ; can't start here
  1. ;
  1. PRTTOT(GEN,INDEX,NAME,ARRN) ; totals for printed report
  1. N COUNT,SVCUSG
  1. S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
  1. I GEN=2 D
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=""
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" GROUPER: "_NAME_" Totals:"
  1. I GEN=1 D
  1. . I ^TMP("GMRCTOT",$J,1,INDEX,"T")=0 D Q ;collect zero servs for summ
  1. .. Q:$P(^GMR(123.5,INDEX,0),U,2)=1
  1. .. S ^TMP("GMRCTOT",$J,0,NAME)=""
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)=" "
  1. . S COUNT=COUNT+1
  1. . S SVCUSG=$P(^GMR(123.5,INDEX,0),U,2),^TMP("GMRCR",$J,ARRN,COUNT,0)="SERVICE: "_NAME_$S($G(SVCUSG)=9:" <disabled>",1:"")
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Service:"_$J(^TMP("GMRCTOT",$J,1,INDEX,"T"),30,0)
  1. I GEN=2,^TMP("GMRCTOT",$J,2,INDEX,"T")>0 D
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests To Grouper:"_$J(^TMP("GMRCTOT",$J,2,INDEX,"T"),30,0)
  1. I $G(^TMP("GMRCTOT",$J,GEN,INDEX,"T"))>0 D
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Pending Resolution: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"P"),21,0)
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Completed: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"C"),30,0)
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Total Requests Completed with Results: "_$J(^TMP("GMRCTOT",$J,GEN,INDEX,"R"),17,0)
  1. . N GMRCPCT
  1. . I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 S GMRCPCT="N/A"
  1. . I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of Total Requests Completed: "_$S(+GMRCPCT'=GMRCPCT:$J(GMRCPCT,16),1:($J(GMRCPCT,19,2)_"%"))
  1. . K GMRCPCT
  1. . I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S GMRCPCT="N/A"
  1. . I '$D(GMRCPCT) S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
  1. . S COUNT=COUNT+1
  1. . S ^TMP("GMRCR",$J,ARRN,COUNT,0)="Percentage of Total Completed Requests with Results: "_$S(+GMRCPCT'=GMRCPCT:GMRCPCT,1:($J(GMRCPCT,6,2)_"%"))
  1. Q
  1. ;
  1. DELTOT(GEN,INDEX,NAME,ARRN) ; format for delimited
  1. ;
  1. I ^TMP("GMRCTOT",$J,GEN,INDEX,"T")=0 Q
  1. N STRING,COUNT,SVCUSG
  1. S COUNT=$O(^TMP("GMRCR",$J,ARRN," "),-1)
  1. S SVCUSG=$P(^GMR(123.5,INDEX,0),U,2),STRING=$S(GEN=2:"GROUPER: ",1:"")_NAME_$S($G(SVCUSG)=9:" <disabled>",1:"")_";"
  1. S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"T")_";"
  1. S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"P")_";"
  1. S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"C")_";"
  1. S STRING=STRING_^TMP("GMRCTOT",$J,GEN,INDEX,"R")_";"
  1. D ;get % completed
  1. . N GMRCPCT
  1. . S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"C")/^TMP("GMRCTOT",$J,GEN,INDEX,"T"))*100
  1. . S STRING=STRING_$J(GMRCPCT,0,2)_";"
  1. . Q
  1. D ; get % completed w/results
  1. . I ^TMP("GMRCTOT",$J,GEN,INDEX,"C")=0 S STRING=STRING_"N/A;" Q
  1. . N GMRCPCT
  1. . S GMRCPCT=(^TMP("GMRCTOT",$J,GEN,INDEX,"R")/^TMP("GMRCTOT",$J,GEN,INDEX,"C"))*100
  1. . S STRING=STRING_$J(GMRCPCT,0,2)
  1. . Q
  1. S COUNT=COUNT+1
  1. S ^TMP("GMRCR",$J,ARRN,COUNT,0)=STRING
  1. Q
  1. ;
  1. ONESTAT(ARRN,SVCN,STAT,DT1,DT2) ;Process one status
  1. ; Input -- ARRN "CP" - to be printed
  1. ; "DEL" - in delimited format
  1. ; SVCN = node in ^TMP("GMRCLIST,$J
  1. ; STAT = status being worked on
  1. ; DT1 = starting date
  1. ; DT2 = ending date
  1. ;
  1. ; Output - None
  1. ;
  1. N GMRCPT,GMRCXDT,TEMP,GMRCSVC,GMRCSVCG,GMRCSVCP
  1. S GMRCSVC=$P(^TMP("GMRCSLIST",$J,SVCN),"^",1)
  1. S GMRCSVCP=$P(^TMP("GMRCSLIST",$J,SVCN),"^",2)
  1. S GMRCSVCG=$P(^TMP("GMRCSLIST",$J,SVCN),"^",3)
  1. S GMRCXDT=$S(DT1="ALL":0,1:9999999-DT2-.6)
  1. F S GMRCXDT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT)) Q:GMRCXDT=""!(GMRCXDT>(9999999-DT1)) D
  1. .S GMRCPT=0
  1. .;Loop for one consult at a time
  1. .F S GMRCPT=$O(^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)) Q:GMRCPT="" D
  1. .. N PROS
  1. ..; Check for bad "AE" x-ref
  1. ..I '$D(^GMR(123,GMRCPT,0)) D Q
  1. ...K ^GMR(123,"AE",GMRCSVC,STAT,GMRCXDT,GMRCPT)
  1. .. I $$TESTPAT^VADPT(+$P(^GMR(123,GMRCPT,0),U,2))&(GMRTST="E") Q ;exclude test pats
  1. .. I '$$TESTPAT^VADPT(+$P(^GMR(123,GMRCPT,0),U,2))&(GMRTST="D") Q ;Only do test pts
  1. .. D I $G(PROS) Q
  1. ... N SVC S SVC=$P(^GMR(123,GMRCPT,0),U,5)
  1. ... I +$G(^GMR(123.5,SVC,"INT")) S PROS=1 ; exclude PROS consults
  1. .. I $P($G(^GMR(123,GMRCPT,12)),U,5)="P" Q ; exclude IFC placer
  1. ..; Add to totals
  1. ..; for all status for this service
  1. ..S ^TMP("GMRCTOT",$J,1,GMRCSVC,"T")=^TMP("GMRCTOT",$J,1,GMRCSVC,"T")+1
  1. ..; pending for this service
  1. ..S:",3,4,5,6,8,9,11,99,"[(","_STAT_",") ^TMP("GMRCTOT",$J,1,GMRCSVC,"P")=^TMP("GMRCTOT",$J,1,GMRCSVC,"P")+1
  1. .. I STAT=2 D
  1. ... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"C")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"C"))+1
  1. ... Q:'$O(^GMR(123,+$G(GMRCPT),50,0)) ; Q if no results
  1. ... S ^TMP("GMRCTOT",$J,1,GMRCSVC,"R")=+$G(^TMP("GMRCTOT",$J,1,GMRCSVC,"R"))+1
  1. Q
  1. ;