Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBAAAUD

FBAAAUD.m

Go to the documentation of this file.
  1. FBAAAUD ;WCIOFO/SAB - FEE BASIS FILE 161.01 DATA AUDIT ;3/26/2014
  1. ;;3.5;FEE BASIS;**151**;JAN 30, 1995;Build 14
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. AUD(FBSET) ; audit of selected fields in sub-file 161.01
  1. ; called by set and kill logic of AUD mumps x-ref on sub-file 161.01
  1. ; input
  1. ; FBSET = 0 or 1, =true if set logic and =false if kill logic
  1. ; also variables from FileMan x-ref
  1. ; DA(1) = IEN of record in file 161
  1. ; DA = IEN of record in sub-file 161.01
  1. ; X1(#) = old values of cross-referenced fields
  1. ; X2(#) = new values of cross-referenced fields
  1. N FBDT,FBI,FBFDA,FBFIELDL
  1. ; list of cross-referenced fields in order number
  1. S FBFIELDL=".01^.02^.06^.07^.095"
  1. S FBDT=$$NOW^XLFDT()
  1. ;
  1. ; if kill logic and new value of .01 field null then record was deleted
  1. ; and no need to proceed since audit multiple is stored in record
  1. I 'FBSET,X2(1)="" Q
  1. ;
  1. ; if old and new field values are different then save change in audit
  1. ; loop thru audited fields
  1. F FBI=1:1:5 D
  1. . ; if kill logic and value was deleted then save audit
  1. . I 'FBSET,X1(FBI)'=X2(FBI),X2(FBI)="" D SAVE
  1. . ; if set logic and value was entered or changed then save audit
  1. . I FBSET,X1(FBI)'=X2(FBI),X2(FBI)'="" D SAVE
  1. Q
  1. ;
  1. SAVE ;
  1. N FBFDA,FBIENS
  1. S FBIENS="+1,"_DA_","_DA(1)_","
  1. S FBFDA(161.193,FBIENS,.01)=FBDT ; CHANGED DATE/TIME
  1. S FBFDA(161.193,FBIENS,1)=$P(FBFIELDL,"^",FBI) ; FIELD
  1. S FBFDA(161.193,FBIENS,2)=X1(FBI) ; OLD VALUE
  1. S FBFDA(161.193,FBIENS,3)=X2(FBI) ; NEW VALUE
  1. S FBFDA(161.193,FBIENS,4)=DUZ ; CHANGED BY
  1. D UPDATE^DIE("","FBFDA")
  1. Q
  1. ;
  1. OUTX ; output transform
  1. ; called by OLD VALUE and NEW VALUE fields in the DATA AUDIT multiple
  1. ; in the AUTHORIZATION multiple of the FEE BASIS PATIENT (#161) file.
  1. ; input
  1. ; Y = value to transform
  1. ; D0 = required internal entry number, top level
  1. ; D1 = optional internal entry number, one level below
  1. ; D2 = optional internal entry number, two levels below
  1. ; DIC = optional file/sub-file root
  1. ; output
  1. ; Y = external value for Y when available, else the input value
  1. ;
  1. Q:'$G(D0) ; must have at least one IEN
  1. Q:$G(Y)="" ; must have internal value to transform
  1. ;
  1. N FBFLD,FBNODE,FBY
  1. ;
  1. ; determine 0-node of entry in DATA AUDIT
  1. S FBNODE=""
  1. I $G(D2),$G(D1) S FBNODE="^FBAAA("_D0_",1,"_D1_",""LOG2"","_D2_",0)"
  1. I '$G(D2),$G(D1),$E($G(DIC))="^" S FBNODE=DIC_D0_",""LOG2"","_D1_",0)"
  1. I '$G(D2),'$G(D1),$E($G(DIC))="^" S FBNODE=DIC_D0_",0)"
  1. Q:FBNODE=""
  1. ;
  1. ; obtain value of FIELD
  1. S FBFLD=$P($G(@FBNODE),"^",2)
  1. Q:FBFLD=""
  1. ;
  1. ; obtain external value of Y for the field
  1. S FBY=$$EXTERNAL^DILFD(161.01,FBFLD,"",Y)
  1. S:FBY]"" Y=FBY ; return external value in Y
  1. Q
  1. ;
  1. ;FBAAAUD