source: WorldVistAEHR/trunk/r/VA_FILEMAN-ARJT-DI-DD-DM-DT-%DT-%RCR/DIET.m@ 1474

Last change on this file since 1474 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 2.0 KB
RevLine 
[613]1DIET ;SFISC/XAK-DISPLAY INPUT TEMPLATE ALSO DOES AUDITING! ;22MAR2006
2 ;;22.0;VA FileMan;**69,49,104,129,147**;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 N DICMX
5 I '$D(^DIE(D0,0)) G EXIT
6 S DICMX="W X,!"
7EN ;
8 N DI,DIET,DIETS,D
9 S DIET=D0 D GET^DIETED("DIETS")
10 F D=0:0 S D=$O(DIETS(D)) Q:'D S X=DIETS(D) X DICMX Q:'$D(D)
11EXIT S X="" Q
12 ;
13 ;
14 ;
15AUD N DP,DG,DPS,DIEX,DIIX,DIANUM ; DI*22*49
16 S DIIX="3^.01^A",DP=+DO(2) D AUDIT:DP>0 Q
17AUDIT ;
18 N C,DIEDA,DIEF,%T,%F,%D,%,Y
19 I $D(^DD(DP,+$P(DIIX,U,2),"AX")) X ^("AX") Q:'$T
20 K % S DIEX=X D @+DIIX
21 K DIIX,DPS,DIEX
22 Q
233 ;
24 I $D(DG),$D(DIANUM($P(DIIX,U,2))) S Y=X,(DIEX(1),C)=$P(^DD(DP,+$P(DIIX,U,2),0),U,2) D Y^DIQ S @DIANUM($P(DIIX,U,2))=Y K DIANUM($P(DIIX,U,2)) G I
252 ;
26 S:$D(DP(1)) DPS=DP(1) S DIEDA="",DIEF="",%=1,DP(1)=DP,%F=+DP,X=DA
27 F C=1:1 Q:'$D(^DD(DP(1),0,"UP")) S %F=^("UP"),%=$O(^DD(%F,"SB",DP(1),0)) S:%="" %=-1 S DIEDA=DA(C)_","_DIEDA,DIEF=%_","_DIEF,DP(1)=%F
28 D ADD I $D(DG),+DIIX=2 S DIANUM($P(DIIX,U,2))="^DIA("_%F_","_+Y_",3)"
29 S (DIEX(1),C)=$P(^DD(DP,+$P(DIIX,U,2),0),U,2),Y=DIEX D Y^DIQ
30 S ^DIA(%F,"B",DIEDA_DA,%D)="",X=DIEX S:$D(DPS) DP(1)=DPS
31 S ^DIA(%F,%D,0)=DIEDA_DA_U_%T_U_DIEF_+$P(DIIX,U,2)_U_DUZ_U_$P(DIIX,U,3),^(+DIIX)=Y
32I I (DIEX(1)["D")!(DIEX(1)["P")!(DIEX(1)["V")!(DIEX(1)["S") S ^(DIIX+.1)=X_U_DIEX(1)
33 Q
34 ;
35ACCESSED(%F,REF) ;WILL FLAG ENTRY 'REF' IN FILE '%F' AS BEING ACCESSED BY CURRENT USER, CURRENT TIME, CURRENT OPTION
36 N Y,X,%T,%D
37 D:'$G(DT) DT^DICRW
38 Q:'%F!'REF S %F=+%F,(REF,X)=+REF Q:'$D(^DIC(%F))
39 D ADD ;COMES BACK WITH %T AND Y--THE AUDIT REF
40 S ^DIA(%F,Y,0)=REF_U_%T_U_.01_U_DUZ_U_U_"i"
41 S ^DIA(%F,"B",REF,Y)=""
42 Q
43 ;
44ADD S Y=$O(^DIA(%F,"A"),-1) I 'Y S ^DIA(%F,0)=$P(^DIC(%F,0),U)_" AUDIT^1.1I"
45 F Y=Y+1:1 I '$D(^(Y)) D LOCK^DILF("^DIA(%F,Y)") I Q:'$D(^(Y)) L -^DIA(%F,Y) ;**PATCH 147
46 S ^(Y,0)=X L -^DIA(%F,Y)
47 S %T=$G(XQY),%D=$S($D(XQORNOD)#2:XQORNOD,$D(HLORNOD)#2:HLORNOD,1:"") I %T!%D S ^DIA(%F,Y,4.1)=%T_U_%D
48 S $P(^(0),U,3,4)=Y_U_($P(^DIA(%F,0),U,4)+1)
49TIME S %D=Y,%T=$$HTFM^DILIBF($H)
50 S ^DIA(%F,"C",%T,Y)="",^DIA(%F,"D",DUZ,Y)=""
51 Q
Note: See TracBrowser for help on using the repository browser.