PXCAERR ;ISL/dee - Sends a mail bulletin when there is an error in PXKERROR stored in file 839.01 ;12/17/96
;;1.0;PCE PATIENT CARE ENCOUNTER;**5,14**;Aug 12, 1996
Q
;
PXKERROR(PXCAGLB) ;Take care of any error messages from PXK.
;There are error messages so store them in the error file
;and send a mail bulletin.
; Variables
; PXCAEIEN Pointer to the entry in the error file for this entry
; (839.01)
; PXCAERR Contians the variable name of either the
; error array i.e. PXKERROR( ... )
; or the PXCA array i.e. PXCA( ... )
N PXCAEIEN,PXCAERR,PXCANOW,DLAYGO,%,PXCADATA
D NOW^%DTC
K DIC,DD,DO
S (X,PXCANOW)=%
S DIC="^PX(839.01,"
S DIC(0)="L",DLAYGO=839.01
S DIC("DR")=".02////"_PXCAPAT_$S($G(PXCAVSIT)>0:";.03////"_PXCAVSIT,1:"")
D FILE^DICN
I +Y>0 D
. S PXCAEIEN=+Y
. S ^PX(839.01,PXCAEIEN,1,0)="^839.011A^^0"
. S ^PX(839.01,PXCAEIEN,2,0)="^839.012A^^0"
. ;Save the PXKERROR array.
. S PXCAERR="PXKERROR"
. F S PXCAERR=$Q(@PXCAERR) Q:PXCAERR="" D
.. K DIC,DD,DO
.. S X=PXCAERR
.. S DIC="^PX(839.01,"_PXCAEIEN_",1,"
.. S DIC(0)="L",DLAYGO=839.01
.. S PXCADATA=$TR(@PXCAERR,"^","~")
.. S DIC("DR")="101////^S X=PXCADATA"
.. D FILE^DICN
. ;Save the PXCA array.
. S PXCAERR="PXCA"
. F S PXCAERR=$Q(@PXCAERR) Q:PXCAERR="" D
.. K DIC,DD,DO
.. S X=PXCAERR
.. S DIC="^PX(839.01,"_PXCAEIEN_",2,"
.. S DIC(0)="L",DLAYGO=839.01
.. S PXCADATA=$TR(@PXCAERR,"^","~")
.. S DIC("DR")="201////^S X=PXCADATA"
.. D FILE^DICN
D ERRMAIL(PXCAEIEN,PXCANOW)
S PXCA("WARNING","ENCOUNTER",0,0,0)="There are ""PXKERROR""s in in the ""PCE DEVICE INTERFACE MODULE ERRORS"" file in entry number "_PXCAEIEN_"^"_PXCAEIEN
I $D(PXKERROR("VISIT"))#2 S PXCASTAT=-1
E S PXCASTAT=-2
Q
;
ERRMAIL(PXCAEIEN,PXCANOW) ;
N XMDUZ,XMTEXT,XMY,XMB
S XMDUZ="PCE's Data Capture Interface."
S XMB="PXCA PCE ERROR BULLETIN"
S XMB(1)=$P($G(^DPT($P(PXCA("ENCOUNTER"),"^",2),0)),"^",1) ;Patient
S XMB(2)=$$DATE($P(PXCA("ENCOUNTER"),"^",1)) ;Appointment Date/Time
S XMB(3)=PXCAEIEN ;Error number (IEN in error file)
S XMB(4)=$$DATE(PXCANOW) ;Error Date/Time
D ^XMB
Q
;
DATE(Y) ;
D DD^%DT
Q $P(Y,"@")_" at "_$P(Y,"@",2)
PXCAERR ;ISL/dee - Sends a mail bulletin when there is an error in PXKERROR stored in file 839.01 ;12/17/96
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**5,14**;Aug 12, 1996
+2 QUIT
+3 ;
PXKERROR(PXCAGLB) ;Take care of any error messages from PXK.
+1 ;There are error messages so store them in the error file
+2 ;and send a mail bulletin.
+3 ; Variables
+4 ; PXCAEIEN Pointer to the entry in the error file for this entry
+5 ; (839.01)
+6 ; PXCAERR Contians the variable name of either the
+7 ; error array i.e. PXKERROR( ... )
+8 ; or the PXCA array i.e. PXCA( ... )
+9 NEW PXCAEIEN,PXCAERR,PXCANOW,DLAYGO,%,PXCADATA
+10 DO NOW^%DTC
+11 KILL DIC,DD,DO
+12 SET (X,PXCANOW)=%
+13 SET DIC="^PX(839.01,"
+14 SET DIC(0)="L"
SET DLAYGO=839.01
+15 SET DIC("DR")=".02////"_PXCAPAT_$SELECT($GET(PXCAVSIT)>0:";.03////"_PXCAVSIT,1:"")
+16 DO FILE^DICN
+17 IF +Y>0
Begin DoDot:1
+18 SET PXCAEIEN=+Y
+19 SET ^PX(839.01,PXCAEIEN,1,0)="^839.011A^^0"
+20 SET ^PX(839.01,PXCAEIEN,2,0)="^839.012A^^0"
+21 ;Save the PXKERROR array.
+22 SET PXCAERR="PXKERROR"
+23 FOR
SET PXCAERR=$QUERY(@PXCAERR)
IF PXCAERR=""
QUIT
Begin DoDot:2
+24 KILL DIC,DD,DO
+25 SET X=PXCAERR
+26 SET DIC="^PX(839.01,"_PXCAEIEN_",1,"
+27 SET DIC(0)="L"
SET DLAYGO=839.01
+28 SET PXCADATA=$TRANSLATE(@PXCAERR,"^","~")
+29 SET DIC("DR")="101////^S X=PXCADATA"
+30 DO FILE^DICN
End DoDot:2
+31 ;Save the PXCA array.
+32 SET PXCAERR="PXCA"
+33 FOR
SET PXCAERR=$QUERY(@PXCAERR)
IF PXCAERR=""
QUIT
Begin DoDot:2
+34 KILL DIC,DD,DO
+35 SET X=PXCAERR
+36 SET DIC="^PX(839.01,"_PXCAEIEN_",2,"
+37 SET DIC(0)="L"
SET DLAYGO=839.01
+38 SET PXCADATA=$TRANSLATE(@PXCAERR,"^","~")
+39 SET DIC("DR")="201////^S X=PXCADATA"
+40 DO FILE^DICN
End DoDot:2
End DoDot:1
+41 DO ERRMAIL(PXCAEIEN,PXCANOW)
+42 SET PXCA("WARNING","ENCOUNTER",0,0,0)="There are ""PXKERROR""s in in the ""PCE DEVICE INTERFACE MODULE ERRORS"" file in entry number "_PXCAEIEN_"^"_PXCAEIEN
+43 IF $DATA(PXKERROR("VISIT"))#2
SET PXCASTAT=-1
+44 IF '$TEST
SET PXCASTAT=-2
+45 QUIT
+46 ;
ERRMAIL(PXCAEIEN,PXCANOW) ;
+1 NEW XMDUZ,XMTEXT,XMY,XMB
+2 SET XMDUZ="PCE's Data Capture Interface."
+3 SET XMB="PXCA PCE ERROR BULLETIN"
+4 ;Patient
SET XMB(1)=$PIECE($GET(^DPT($PIECE(PXCA("ENCOUNTER"),"^",2),0)),"^",1)
+5 ;Appointment Date/Time
SET XMB(2)=$$DATE($PIECE(PXCA("ENCOUNTER"),"^",1))
+6 ;Error number (IEN in error file)
SET XMB(3)=PXCAEIEN
+7 ;Error Date/Time
SET XMB(4)=$$DATE(PXCANOW)
+8 DO ^XMB
+9 QUIT
+10 ;
DATE(Y) ;
+1 DO DD^%DT
+2 QUIT $PIECE(Y,"@")_" at "_$PIECE(Y,"@",2)