BQIRGHOF ;VNGT/HS/ALA - Set HMS Turn off Date ; 16 Jul 2008 5:41 PM
;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
;
GET(DATA,FAKE) ; EP - BQI GET HMS TURN OFF DATE
;
NEW UID,II,DATE,TDATE,BKMHIV,FLAG
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIRGHOF",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIRGHOF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S BKMHIV=$$HIVIEN^BKMIXX3()
S TDATE=$$GET1^DIQ(90450,BKMHIV_",",.08,"I")\1
S FLAG=$$GET1^DIQ(90450,BKMHIV_",",30,"I")
I FLAG S BMXSEC="HMS has already been turned off." Q
;I TDATE'="",DT>TDATE S BMXSEC="HMS has already been turned off." Q
S DATE=$$FMTE^BQIUL1(TDATE)
S @DATA@(II)="D00030TURN_OFF_DATE"_$C(30)
S II=II+1,@DATA@(II)=DATE_$C(30)
;
S II=II+1,@DATA@(II)=$C(31)
Q
;
ERR ;
D ^%ZTER
NEW Y,ERRDTM
S Y=$$NOW^XLFDT() X ^DD("DD") S ERRDTM=Y
S BMXSEC="Recording that an error occurred at "_ERRDTM
I $D(II),$D(DATA) S II=II+1,@DATA@(II)=$C(31)
Q
;
UPD(DATA,DATE) ; EP - BQI SET HMS TURN OFF DATE
NEW UID,II,INIEN,INDT,ERROR,RESULT,BKMHIV,EXDT,ERROR,BKMUPD
S UID=$S($G(ZTSK):"Z"_ZTSK,1:$J)
S DATA=$NA(^TMP("BQIRGHOF",UID))
K @DATA
;
S II=0
NEW $ESTACK,$ETRAP S $ETRAP="D ERR^BQIRGHOF D UNWIND^%ZTER" ; SAC 2006 2.2.3.3.2
;
S @DATA@(II)="I00010RESULT^T01024MSG"_$C(30)
S DATE=$$DATE^BQIUL1(DATE)
S BKMHIV=$$HIVIEN^BKMIXX3()
S EXDT=$$GET1^DIQ(90450,BKMHIV_",",.08,"I")\1
;
S INIEN=$O(^XPD(9.7,"B","HIV MANAGEMENT SYSTEM 2.0",""),-1)
S INDT=$P(^XPD(9.7,INIEN,0),U,3)\1
S INDT=$$FMADD^XLFDT(INDT,95) ; approximately 3 months from date of install
I DATE>INDT S RESULT="-1^Date cannot be greater than "_$$FMTE^BQIUL1(INDT) G DONE
I DATE'>DT S RESULT="-1^Date must be a future date" G DONE
S BKMUPD(90450,BKMHIV_",",.08)=DATE
D FILE^DIE("","BKMUPD","ERROR")
I '$D(ERROR) S RESULT="1^"
I $D(ERROR) S RESULT=-1_U_$G(ERROR("DIERR",1,"TEXT",1))
;
DONE ;
S II=II+1,@DATA@(II)=RESULT_$C(30)
S II=II+1,@DATA@(II)=$C(31)
Q
BQIRGHOF ;VNGT/HS/ALA - Set HMS Turn off Date ; 16 Jul 2008 5:41 PM
+1 ;;2.1;ICARE MANAGEMENT SYSTEM;;Feb 07, 2011
+2 ;
GET(DATA,FAKE) ; EP - BQI GET HMS TURN OFF DATE
+1 ;
+2 NEW UID,II,DATE,TDATE,BKMHIV,FLAG
+3 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+4 SET DATA=$NAME(^TMP("BQIRGHOF",UID))
+5 KILL @DATA
+6 ;
+7 SET II=0
+8 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIRGHOF D UNWIND^%ZTER"
+9 ;
+10 SET BKMHIV=$$HIVIEN^BKMIXX3()
+11 SET TDATE=$$GET1^DIQ(90450,BKMHIV_",",.08,"I")\1
+12 SET FLAG=$$GET1^DIQ(90450,BKMHIV_",",30,"I")
+13 IF FLAG
SET BMXSEC="HMS has already been turned off."
QUIT
+14 ;I TDATE'="",DT>TDATE S BMXSEC="HMS has already been turned off." Q
+15 SET DATE=$$FMTE^BQIUL1(TDATE)
+16 SET @DATA@(II)="D00030TURN_OFF_DATE"_$CHAR(30)
+17 SET II=II+1
SET @DATA@(II)=DATE_$CHAR(30)
+18 ;
+19 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+20 QUIT
+21 ;
ERR ;
+1 DO ^%ZTER
+2 NEW Y,ERRDTM
+3 SET Y=$$NOW^XLFDT()
XECUTE ^DD("DD")
SET ERRDTM=Y
+4 SET BMXSEC="Recording that an error occurred at "_ERRDTM
+5 IF $DATA(II)
IF $DATA(DATA)
SET II=II+1
SET @DATA@(II)=$CHAR(31)
+6 QUIT
+7 ;
UPD(DATA,DATE) ; EP - BQI SET HMS TURN OFF DATE
+1 NEW UID,II,INIEN,INDT,ERROR,RESULT,BKMHIV,EXDT,ERROR,BKMUPD
+2 SET UID=$SELECT($GET(ZTSK):"Z"_ZTSK,1:$JOB)
+3 SET DATA=$NAME(^TMP("BQIRGHOF",UID))
+4 KILL @DATA
+5 ;
+6 SET II=0
+7 ; SAC 2006 2.2.3.3.2
NEW $ESTACK,$ETRAP
SET $ETRAP="D ERR^BQIRGHOF D UNWIND^%ZTER"
+8 ;
+9 SET @DATA@(II)="I00010RESULT^T01024MSG"_$CHAR(30)
+10 SET DATE=$$DATE^BQIUL1(DATE)
+11 SET BKMHIV=$$HIVIEN^BKMIXX3()
+12 SET EXDT=$$GET1^DIQ(90450,BKMHIV_",",.08,"I")\1
+13 ;
+14 SET INIEN=$ORDER(^XPD(9.7,"B","HIV MANAGEMENT SYSTEM 2.0",""),-1)
+15 SET INDT=$PIECE(^XPD(9.7,INIEN,0),U,3)\1
+16 ; approximately 3 months from date of install
SET INDT=$$FMADD^XLFDT(INDT,95)
+17 IF DATE>INDT
SET RESULT="-1^Date cannot be greater than "_$$FMTE^BQIUL1(INDT)
GOTO DONE
+18 IF DATE'>DT
SET RESULT="-1^Date must be a future date"
GOTO DONE
+19 SET BKMUPD(90450,BKMHIV_",",.08)=DATE
+20 DO FILE^DIE("","BKMUPD","ERROR")
+21 IF '$DATA(ERROR)
SET RESULT="1^"
+22 IF $DATA(ERROR)
SET RESULT=-1_U_$GET(ERROR("DIERR",1,"TEXT",1))
+23 ;
DONE ;
+1 SET II=II+1
SET @DATA@(II)=RESULT_$CHAR(30)
+2 SET II=II+1
SET @DATA@(II)=$CHAR(31)
+3 QUIT