GMVER0 ;HOIFO/FT-VITALS ENTERED IN ERROR FOR A PATIENT ;10/25/02  10:26
 ;;5.0;GEN. MED. REC. - VITALS;**23**;Oct 31, 2002;Build 25
 ;
 ; This routine uses the following IAs:
 ; #10061 - ^VADPT calls        (supported)
 ; #10103 - ^XLFDT calls        (supported)
 ; #10104 - ^XLFSTR calls       (supported)
 ;
EN1(RESULT,GMVDATA) ; GMV ENTERED IN ERROR-PATIENT [RPC entry point]
 ; Queues a report to a printer
 ; GMVDATA=DFN^START DT^END DT^TYPE OF GRAPH^DEVICE^DEVICE IEN(#3.5)^
 ;         DATE/TIME TO PRINT REPORT
 ;
 
DFN,GMVBEG,GMVEND,GMVDEV,GMVIEN,GMVPDT
 
DFN=+$P(GMVDATA,"^",1),GMVBEG=$P(GMVDATA,"^",2),GMVEND=$P(GMVDATA,"^",3),GMVDEV=$P(GMVDATA,"^",5),GMVIEN=+$P(GMVDATA,"^",6),GMVPDT=$P(GMVDATA,"^",7)
 
ZTIO=GMVDEV ;device
 
ZTDTH=$S($G(GMVPDT)>0:GMVPDT,1:$$NOW^XLFDT()) ;date/time to print
 
(ZTSAVE("DFN"),ZTSAVE("GMVBEG"),ZTSAVE("GMVEND"))=""
 
ZTDESC="Entered in error vital/measurement report"
 
ZTRTN="START^GMVER0"
 
^%ZTLOAD
 
RESULT=$S($G(ZTSK)>0:"Report sent to device. Task #: "_ZTSK,1:"Unable to task the report.")
 
ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
 
^%ZISC
 
Q
START ; Start the report output
 
IO
 
S:$D(ZTQUEUEDZTREQ="@"
 
GMVPAGE=0
 
GMVDASH=$$REPEAT^XLFSTR("-",80) ;line of dashes
 
GMVNOW=$$NOW^XLFDT() ;current date/time
 
GMVNOW=$$FMTE^XLFDT(GMVNOW)
 
GMVRANGE=$$FMTE^XLFDT(GMVBEG)_"-"_$$FMTE^XLFDT(GMVEND;date range in
 ; external format (for header)
 
DEM^VADPT ;get patient demographic data
 
GMVNAME=VADM(1) ;patient name
 
GMVSSN=$P(VADM(2),"^",2) ;patient ssn
 
EN1^GMVER1(.GMVARRAY,DFN,GMVBEG,GMVEND;get entered-in-error data
 
HEADER
 
GMVNONE=$G(^TMP($J,"ERRORS",0))
 
I $L(GMVNONE)>0 !,GMVNONE KILL Q
 S 
GMVDATE=0
 
F  S GMVDATE=$O(^TMP($J,"ERRORS",GMVDATE)) Q:'GMVDATE  D
 
.GMVITY=0
 .
F  S GMVITY=$O(^TMP($J,"ERRORS",GMVDATE,GMVITY)) Q:'GMVITY  D
 
..GMVDA=0
 ..
F  S GMVDA=$O(^TMP($J,"ERRORS",GMVDATE,GMVITY,GMVDA)) Q:'GMVDA  D
 
...GMVLOOP=0
 ...
F  S GMVLOOP=$O(^TMP($J,"ERRORS",GMVDATE,GMVITY,GMVDA,GMVLOOP)) Q:'GMVLOOP  D
 
....GMVNODE=^TMP($J,"ERRORS",GMVDATE,GMVITY,GMVDA,GMVLOOP)
 ....
I $Y+6>IOSL HEADER
 
....!,GMVNODE
 
....GMVLOOP=4 !
 ....
Q
 
...Q
 
..Q
 
.Q
KILL ; Kill variables
 
KVAR^VADPT ;clean up VADPT variables
 
^TMP($J,"ERRORS")
 
GMVDASH,GMVNAME,GMVNOW,GMVPAGE,GMVSSN,X,Y
 
^%ZISC
 
Q
HEADER ; Report header
 
W:$Y>0 @IOF
 
GMVPAGE=GMVPAGE+1
 
!,GMVNOW,?22,"ENTERED IN ERROR VITAL/MEASUREMENT REPORT",?70,"PAGE: ",GMVPAGE
 
!?22,GMVRANGE
 
!?22,"Patient: ",GMVNAME,?$X+5,$E(GMVSSN,8,11)
 
!!,"Date Vit./Meas. taken",?58,"User who made error"
 
!,GMVDASH,!
 
Q