BGOVTM ; IHS/BAO/TMD - Manage V ACTIVITY TIME ;09-Apr-2012 14:19;DU
;;1.1;BGO COMPONENTS;**1,3,11**;Mar 20, 2007;Build 3
; Get visit activity time
; INP = Visit IEN ^ User IEN
; .RET = Activity Time IEN ^ Activity Time ^ Travel minutes
GET(RET,INP) ;EP
N VIEN,UIEN,ACTTM,TRVTM,X
S VIEN=+$G(INP)
I 'VIEN S RET=$$ERR^BGOUTL(1002) Q
S UIEN=$P(INP,U,2)
I 'UIEN S RET=$$ERR^BGOUTL(1102) Q
I '$D(^VA(200,UIEN,0)) S RET=$$ERR^BGOUTL(1103) Q
S (ACTTM,TRVTM)=0
S X=0
F S X=$O(^AUPNVTM("AD",VIEN,X)) Q:'X I $P($G(^AUPNVTM(X,12)),U,4)=UIEN D Q
.S ACTTM=$P($G(^AUPNVTM(X,0)),U),TRVTM=$P($G(^(0)),U,4)
S RET=+X_U_ACTTM_U_TRVTM
Q
; Add/edit V ACTIVITY file
; INP = V File IEN [1] ^ Visit IEN [2] ^ Provider IEN [3] ^ Activity Time [4] ^ Travel Minutes [5]
SET(RET,INP) ;EP
N VIEN,PRVIEN,VFIEN,VFNEW,FNUM,TYPE,TRVTM,FDA
S RET="",FNUM=$$FNUM
S VFIEN=+INP
S VFNEW='VFIEN
I VFIEN,'$D(^AUPNVTM(VFIEN,0)) S RET=$$ERR^BGOUTL(1104) Q
S VIEN=$P(INP,U,2)
S RET=$$CHKVISIT^BGOUTL(VIEN)
Q:RET
S PRVIEN=+$P(INP,U,3)
I 'PRVIEN S RET=$$ERR^BGOUTL(1027) Q
I VFIEN,$P($G(^AUPNVTM(VFIEN,12)),U,4)'=PRVIEN S RET=$$ERR^BGOUTL(1105) Q
S TYPE=+$P(INP,U,4)
S TRVTM=$P(INP,U,5)
I 'VFIEN D Q:'VFIEN
.D VFNEW^BGOUTL2(.RET,FNUM,TYPE,VIEN)
.S:RET>0 VFIEN=RET,RET=""
S FDA=$NA(FDA(FNUM,VFIEN_","))
S @FDA@(.01)=TYPE
S @FDA@(.04)=TRVTM
S @FDA@(1201)="N"
S @FDA@(1204)="`"_PRVIEN
;Patch 11 Set date entered
I VFNEW D
.S @FDA@(1216)="N"
.S @FDA@(1217)="`"_DUZ
;Patch 11 Set last modified
S @FDA@(1218)="N"
S @FDA@(1219)="`"_DUZ
S RET=$$UPDATE^BGOUTL(.FDA,"E")
I RET,VFNEW,$$DELETE^BGOUTL(FNUM,VFIEN)
D:'RET VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
S:'RET RET=VFIEN
Q
; Delete an activity time entry
DEL(RET,VFIEN) ;EP
D VFDEL^BGOUTL2(.RET,$$FNUM,VFIEN)
Q
; Return V File #
FNUM() Q 9000010.19
BGOVTM ; IHS/BAO/TMD - Manage V ACTIVITY TIME ;09-Apr-2012 14:19;DU
+1 ;;1.1;BGO COMPONENTS;**1,3,11**;Mar 20, 2007;Build 3
+2 ; Get visit activity time
+3 ; INP = Visit IEN ^ User IEN
+4 ; .RET = Activity Time IEN ^ Activity Time ^ Travel minutes
GET(RET,INP) ;EP
+1 NEW VIEN,UIEN,ACTTM,TRVTM,X
+2 SET VIEN=+$GET(INP)
+3 IF 'VIEN
SET RET=$$ERR^BGOUTL(1002)
QUIT
+4 SET UIEN=$PIECE(INP,U,2)
+5 IF 'UIEN
SET RET=$$ERR^BGOUTL(1102)
QUIT
+6 IF '$DATA(^VA(200,UIEN,0))
SET RET=$$ERR^BGOUTL(1103)
QUIT
+7 SET (ACTTM,TRVTM)=0
+8 SET X=0
+9 FOR
SET X=$ORDER(^AUPNVTM("AD",VIEN,X))
IF 'X
QUIT
IF $PIECE($GET(^AUPNVTM(X,12)),U,4)=UIEN
Begin DoDot:1
+10 SET ACTTM=$PIECE($GET(^AUPNVTM(X,0)),U)
SET TRVTM=$PIECE($GET(^(0)),U,4)
End DoDot:1
QUIT
+11 SET RET=+X_U_ACTTM_U_TRVTM
+12 QUIT
+13 ; Add/edit V ACTIVITY file
+14 ; INP = V File IEN [1] ^ Visit IEN [2] ^ Provider IEN [3] ^ Activity Time [4] ^ Travel Minutes [5]
SET(RET,INP) ;EP
+1 NEW VIEN,PRVIEN,VFIEN,VFNEW,FNUM,TYPE,TRVTM,FDA
+2 SET RET=""
SET FNUM=$$FNUM
+3 SET VFIEN=+INP
+4 SET VFNEW='VFIEN
+5 IF VFIEN
IF '$DATA(^AUPNVTM(VFIEN,0))
SET RET=$$ERR^BGOUTL(1104)
QUIT
+6 SET VIEN=$PIECE(INP,U,2)
+7 SET RET=$$CHKVISIT^BGOUTL(VIEN)
+8 IF RET
QUIT
+9 SET PRVIEN=+$PIECE(INP,U,3)
+10 IF 'PRVIEN
SET RET=$$ERR^BGOUTL(1027)
QUIT
+11 IF VFIEN
IF $PIECE($GET(^AUPNVTM(VFIEN,12)),U,4)'=PRVIEN
SET RET=$$ERR^BGOUTL(1105)
QUIT
+12 SET TYPE=+$PIECE(INP,U,4)
+13 SET TRVTM=$PIECE(INP,U,5)
+14 IF 'VFIEN
Begin DoDot:1
+15 DO VFNEW^BGOUTL2(.RET,FNUM,TYPE,VIEN)
+16 IF RET>0
SET VFIEN=RET
SET RET=""
End DoDot:1
IF 'VFIEN
QUIT
+17 SET FDA=$NAME(FDA(FNUM,VFIEN_","))
+18 SET @FDA@(.01)=TYPE
+19 SET @FDA@(.04)=TRVTM
+20 SET @FDA@(1201)="N"
+21 SET @FDA@(1204)="`"_PRVIEN
+22 ;Patch 11 Set date entered
+23 IF VFNEW
Begin DoDot:1
+24 SET @FDA@(1216)="N"
+25 SET @FDA@(1217)="`"_DUZ
End DoDot:1
+26 ;Patch 11 Set last modified
+27 SET @FDA@(1218)="N"
+28 SET @FDA@(1219)="`"_DUZ
+29 SET RET=$$UPDATE^BGOUTL(.FDA,"E")
+30 IF RET
IF VFNEW
IF $$DELETE^BGOUTL(FNUM,VFIEN)
+31 IF 'RET
DO VFEVT^BGOUTL2(FNUM,VFIEN,'VFNEW)
+32 IF 'RET
SET RET=VFIEN
+33 QUIT
+34 ; Delete an activity time entry
DEL(RET,VFIEN) ;EP
+1 DO VFDEL^BGOUTL2(.RET,$$FNUM,VFIEN)
+2 QUIT
+3 ; Return V File #
FNUM() QUIT 9000010.19