DVBAXML ;ALB/GAK - CAPRI Exam Complete Email Driver ; 8/29/13 10:39am
;;2.7;AMIE;**186**;Apr 10, 1995;Build 21
;
;
FILEIN(MSG,EXAMIEN,DAS,XML) ;Entry point
;
;RPC: DVBA CAPRI EXAM XML
;
; Y Returns successful filing status or error message
; EXAMIEN is the IEN of the 2507 EXAM file entry #396.4
; DAS is the XML DAS Conformation message
; XML is the array list format of the template being stored
;
S MSG=""
I $G(EXAMIEN)="" S MSG="ERROR EXAM IEN IS MISSING" Q MSG
I $G(DAS)="" S MSG="ERROR DAS Conformation IS MISSING" Q MSG
I $D(XML)<10 S MSG="ERROR XML MESSAGE IS MISSING" Q MSG
;
N WPERR,ERRMSG,DVBAFDA,DVBAERR,DATTIM,Y,X,%,%H
;
S %H=$H
D YX^%DTC
S DATTIM=X_%
;
S DAS=$E(DAS,1,250)
;
;
D WP^DIE(396.4,EXAMIEN_",",72,"K","XML","WPERR")
I $D(WPERR) D Q MSG
. S ERRMSG=""
. S ERRMSG=$G(WPERR("DIERR",1,"TEXT",1))
. S MSG="ERROR XML MESSAGE DID NOT FILE "_ERRMSG
S MSG="SUCCESSFUL"
;
S DVBAFDA(396.4,EXAMIEN_",",73)=DAS
S DVBAFDA(396.4,EXAMIEN_",",74)=DATTIM
D FILE^DIE("","DVBAFDA","DVBAERR")
;
;
Q MSG
LINK(RV,EXAMIEN,TIUIEN) ;Link Exam TIU document
;
; RPC: DVBA CAPRI EXAM LINK TIU
;
; RV - return value; returns 1 if the exam has been successfully
; linked to the TIU Document; otherwise return 0^error message
; EXAMIEN - the exam ien in CAPRI TEMPLATES #396.17
; TIUIEN - the tiu ien in TIU DOCUMENT #8925
;
I +$G(EXAMIEN)=0 S RV="0"_U_"EXAM IEN IS REQUIRED" Q
I +$G(TIUIEN)=0 S RV="0"_U_"TIU IEN IS REQUIRED" Q
;
N FDAROOT,MSGROOT
;
S FDAROOT(396.17,EXAMIEN_",",23)="`"_TIUIEN
D FILE^DIE("E","FDAROOT","MSGROOT")
;
I $D(MSGROOT)=0 S RV="1"
E S RV="0"_U_"FAILED TO BUILD LINK FROM EXAM TO TIU"
Q
GETEXAM(RV,TIUIEN) ;Return TIU IEN
;
; RPC: DVBA CAPRI GET EXAM IEN
;
; RV - return value; returns a integer greater than zero if the exam
; can be found; otherwise return -1^error message
; TIUIEN - the tiu ien in TIU DOCUMENT #8925
;
I +$G(TIUIEN)=0 S RV="-1"_U_"TIU IEN IS REQUIRED" Q
;
S RV=$O(^DVB(396.17,"TIU",TIUIEN,0))
I +RV<=0 S RV="-1"_U_"TIU DOCUMENT NOT CROSS REFERENCED"
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDVBAXML 2145 printed Dec 13, 2024@01:42:52 Page 2
DVBAXML ;ALB/GAK - CAPRI Exam Complete Email Driver ; 8/29/13 10:39am
+1 ;;2.7;AMIE;**186**;Apr 10, 1995;Build 21
+2 ;
+3 ;
FILEIN(MSG,EXAMIEN,DAS,XML) ;Entry point
+1 ;
+2 ;RPC: DVBA CAPRI EXAM XML
+3 ;
+4 ; Y Returns successful filing status or error message
+5 ; EXAMIEN is the IEN of the 2507 EXAM file entry #396.4
+6 ; DAS is the XML DAS Conformation message
+7 ; XML is the array list format of the template being stored
+8 ;
+9 SET MSG=""
+10 IF $GET(EXAMIEN)=""
SET MSG="ERROR EXAM IEN IS MISSING"
QUIT MSG
+11 IF $GET(DAS)=""
SET MSG="ERROR DAS Conformation IS MISSING"
QUIT MSG
+12 IF $DATA(XML)<10
SET MSG="ERROR XML MESSAGE IS MISSING"
QUIT MSG
+13 ;
+14 NEW WPERR,ERRMSG,DVBAFDA,DVBAERR,DATTIM,Y,X,%,%H
+15 ;
+16 SET %H=$HOROLOG
+17 DO YX^%DTC
+18 SET DATTIM=X_%
+19 ;
+20 SET DAS=$EXTRACT(DAS,1,250)
+21 ;
+22 ;
+23 DO WP^DIE(396.4,EXAMIEN_",",72,"K","XML","WPERR")
+24 IF $DATA(WPERR)
Begin DoDot:1
+25 SET ERRMSG=""
+26 SET ERRMSG=$GET(WPERR("DIERR",1,"TEXT",1))
+27 SET MSG="ERROR XML MESSAGE DID NOT FILE "_ERRMSG
End DoDot:1
QUIT MSG
+28 SET MSG="SUCCESSFUL"
+29 ;
+30 SET DVBAFDA(396.4,EXAMIEN_",",73)=DAS
+31 SET DVBAFDA(396.4,EXAMIEN_",",74)=DATTIM
+32 DO FILE^DIE("","DVBAFDA","DVBAERR")
+33 ;
+34 ;
+35 QUIT MSG
LINK(RV,EXAMIEN,TIUIEN) ;Link Exam TIU document
+1 ;
+2 ; RPC: DVBA CAPRI EXAM LINK TIU
+3 ;
+4 ; RV - return value; returns 1 if the exam has been successfully
+5 ; linked to the TIU Document; otherwise return 0^error message
+6 ; EXAMIEN - the exam ien in CAPRI TEMPLATES #396.17
+7 ; TIUIEN - the tiu ien in TIU DOCUMENT #8925
+8 ;
+9 IF +$GET(EXAMIEN)=0
SET RV="0"_U_"EXAM IEN IS REQUIRED"
QUIT
+10 IF +$GET(TIUIEN)=0
SET RV="0"_U_"TIU IEN IS REQUIRED"
QUIT
+11 ;
+12 NEW FDAROOT,MSGROOT
+13 ;
+14 SET FDAROOT(396.17,EXAMIEN_",",23)="`"_TIUIEN
+15 DO FILE^DIE("E","FDAROOT","MSGROOT")
+16 ;
+17 IF $DATA(MSGROOT)=0
SET RV="1"
+18 IF '$TEST
SET RV="0"_U_"FAILED TO BUILD LINK FROM EXAM TO TIU"
+19 QUIT
GETEXAM(RV,TIUIEN) ;Return TIU IEN
+1 ;
+2 ; RPC: DVBA CAPRI GET EXAM IEN
+3 ;
+4 ; RV - return value; returns a integer greater than zero if the exam
+5 ; can be found; otherwise return -1^error message
+6 ; TIUIEN - the tiu ien in TIU DOCUMENT #8925
+7 ;
+8 IF +$GET(TIUIEN)=0
SET RV="-1"_U_"TIU IEN IS REQUIRED"
QUIT
+9 ;
+10 SET RV=$ORDER(^DVB(396.17,"TIU",TIUIEN,0))
+11 IF +RV<=0
SET RV="-1"_U_"TIU DOCUMENT NOT CROSS REFERENCED"
+12 QUIT