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

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

initial load of WorldVistAEHR

File size: 3.3 KB
RevLine 
[613]1DIFGB ;SFISC/XAK-STORE FILEGRAM TEMPLATE ;5/23/96 11:16
2 ;;22.0;VA FileMan;;Mar 30, 1999
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4PUT ;
5 W !,"STORE ",$S($D(DIAR):"ARCHIVE",$D(DIAX):"EXTRACT",1:"FILEGRAM")_" LOGIC IN TEMPLATE: "
6 R X:DTIME S:'$T DTOUT=1,X="" G Q:U[X
7 S DIC="^DIPT(",D="F"_DK
8 S DIC("S")="S %=^(0) I $P(%,U,8)="_$S($D(DIAX):2,1:1)_",$P(%,U,4)=DK!'$L($P(%,U,4))"_$P(" F DW=1:1:$L($P(%,U,3)) I DUZ(0)[$E($P(%,U,3),DW) Q",U,DUZ(0)'="@"&L)
9 S DIC(0)="ELZSQI",DIC("S")="I Y'<1 "_DIC("S"),Y=-1,DLAYGO=0 D IX^DIC:X]"" K DIC,DLAYGO G:Y<0 PUT:X'[U,Q
10 S S=$O(^DIPT(+Y,0))]""
11 I S W $C(7),!,"TEMPLATE ALREADY STORED THERE...." D W:DUZ(0)'="@" G PUT:'$T W " OK TO REPLACE" S %=0 D YN^DICN W ! G PUT:%-1 D PURGE
12 S ^DIPT(+Y,0)=$P(Y,U,2)_U_DT_U_DUZ(0)_U_DK_U_DUZ_U_DUZ(0)_U_DT,^DIPT("F"_DK,$P(Y,U,2),+Y)=1
13 I '$D(DIAX) S ^DIPT("FG",$P(Y,U,2),+Y)="",$P(^DIPT(+Y,0),U,8)=1
14 E S $P(^DIPT(+Y,0),U,8,9)=2_U_DIAXFNO
15 S Y=+Y,%X=""
16 F %=1:1 S %X=$O(^UTILITY("DIFG",$J,%X)) Q:%X="" S ^DIPT(Y,1,%,0)=^(%X) D FLD
17 S:%-1 ^DIPT(Y,1,0)="^.41^"_(%-1)_U_(%-1)
18 I '$D(DIAX) S ^DIPT(Y,"F",2)="S DIFGT="""_$P(^DIPT(+Y,0),U)_""",DIFGBFN="_DK_" D FG^DIFGB;X"
19Q K ^UTILITY("DIFG",$J),DIFG Q
20 ;
21PURGE L +^DIPT(+Y)
22 S %Y=0 F %X=0:0 S %Y=$O(^DIPT(+Y,%Y)) Q:%Y="" K:%Y'="%D" ^DIPT(+Y,%Y)
23 L -^DIPT(+Y)
24 Q
25 ;
26W S %=$P(^DIPT(+Y,0),U,6) F X=1:1:$L(%) I DUZ(0)[$E(%,X) Q
27 Q
28 ;
29FLD S %Y=""
30 F S=1:1 S %Y=$O(^UTILITY("DIFG",$J,%X,%Y)) Q:%Y="" S ^DIPT(Y,1,%,"F",S,0)=^(%Y)
31 S:S-1 ^DIPT(Y,1,%,"F",0)="^.411^"_(S-1)_U_(S-1) Q
32 ;
33TEM ;
34 S X=$E(X,2,99),DIC="^DIPT(",DIC(0)="SQEM",D="FG" I X["?"!($D(DIAX)) S D="F"_DK
35 S DIC("S")="I $P(^(0),U,4)="_DK_",$P(^(0),U,8)="_$S($D(DIAX):2,1:1)_$S($D(DIAX):",$P(^(0),U,9)=DIAXFNO",1:"")
36 D IX^DIC S X="" Q:Y<0
37EN ;
38 K DIR S DA=+Y
39 S DIR(0)="Y",DIR("A")="WANT TO EDIT '"_$P(Y,U,2)_"' TEMPLATE"
40 D ^DIR K DIR S:'Y!$D(DTOUT) X=U Q:'Y D DIE I '$D(DA) S DC=0 Q
41 S DC(1)=0,DC(0)=DA K DA D GET
42 S DJ=0,X="" ;D EN^DIFGA,PUT:X'=U
43 Q
44GET S DC(1)=$O(^DIPT(DC(0),1,+DC(1))),DC=0 Q:+DC(1)'=DC(1)
45 S %=^(DC(1),0),X=+% Q:'X S DC=1
46 I DL>1,$P(%,U,2)'>DL F J=$P(%,U,2):1:DL S DC=DC+1,DC(DC)=""
47 I $D(DIAX),$P(%,U,4)>2 S $P(DC(1),U,3)=$O(^DD(+$P(%,U,9),0,"NM",""))
48 I $P(%,U,5)]"" S DC=DC+1,DC(DC)=$P(%,U,5)
49 F J=0:0 S J=$O(^DIPT(DC(0),1,+DC(1),"F",J)) Q:+J'=J S %=^(J,0),DIAXZ=$P(%,U,2,9),%=+%,%=$S($D(^DD(X,%,0)):$P(^(0),U),1:%) S:'% DC=DC+1,DC(DC)=%_U_DIAXZ
50 S DC=$S($D(DC(2)):2,1:0)
51 Q
52DIE N DL,DK,DI
53 S DIE="^DIPT(",DR=".01;3;6" D ^DIE K DIE,DR S X=""
54 Q
55FG ;Entry from Print template
56 K ^UTILITY($J,"W")
57 S DIFG("FE")=D0,DIFG("FUNC")="L",DIFG("FGR")="^UTILITY(""DIFG"",$J,"
58 I 'DIFGT S DIC="^DIPT(",D="FG",DIC("S")="I $P(^(0),U,4)="_DIFGBFN,DIC(0)="O",X=DIFGT K DIFGBFN D IX^DIC S:+Y DIFGT=+Y I Y'>0 K DIFG,DIFGT G Q
59 I $G(DIAR)=4 S DIFG("FGR")="^DIAR(1.11,DIARC,""D""," I DIARF=DIARF2,$D(^DIC(+DIARF,0,"GL")) S D1=^("GL"),@(D1_"D0,-9)")=DIARC
60 I $G(DIARP)]"",+DIARP'=+DIFGT S DIFGT=DIARP,^DIPT(DIARP,"F",2)="S DIFGT="_DIARP_" D FG^DIFGB;X"
61 N DI,D0 D START^DIFGG
62 I $D(DIARD) S DIARD=DIARD+1 W:(DIARD#50=0) !,DIARD," RECORDS PROCESSED"
63 I $G(DIAR)=4 S ^DIAR(1.11,DIARC,"D",0)="^1.113^"_DILC_U_DILC Q
64 S DIWL=1,DIWR=IOM-1,DIWF="NW"
65 F D1=0:0 S D1=$O(^UTILITY("DIFG",$J,D1)) Q:D1'>0 S X=^(D1,0) D ^DIWP Q:'DN
66 D:DN ^DIWW G Q
67WR F D1=0:0 S D1=$O(^DIAR(1.11,DIARC,"D",D1)) Q:D1'>0 S X=^(D1,0) W X
68 G Q
Note: See TracBrowser for help on using the repository browser.