source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGPTR4.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1DGPTR4 ;ALB/JDS/MJK/MTC/ADL - ALB/BOK PTF TRANSMISSION ; 1/31/05 11:54am
2 ;;5.3;Registration;**338,423,415,510,565,645,729**;Aug 13, 1993;Build 59
3701 ; -- setup 701 transaction
4 S Y=$S(T1:"C",1:"N")_"701"_DGHEAD,DGDDX=$P(+DG70,".")_" ",Y=Y_$E(DGDDX,4,5)_$E(DGDDX,6,7)_$E(DGDDX,2,3)_$E($P(+DG70,".",2)_"0000",1,4)
5 S X=DG70
6 ;replace specialty pointer (ien) with ptf code (alpha-numeric)
7 N DGARRX,DGARRY ;DG729
8 S DGARRX=$$TSDATA^DGACT(42.4,$P(X,U,2),.DGARRY)
9 S $P(X,U,2)=$G(DGARRY(7))
10 S (L,Z)=2 D ENTER0 K DGDDX
11 S X=DG70 I "467"[($P(X,U,3)\1) S Y=Y_$P(X,U,3)_" " G J
12 S L=1 F Z=3:1:5 D ENTER
13 S Y=Y_$S($D(^DIC(45.6,+$P(X,U,6),0)):$P(^(0),U,2),1:" "),L=3,Z=12 D ENTER S Y=Y_$E($P(X,U,13)_" ",1,3)
14J S L=3,Z=8 D ENTER0
15 S Y=Y_"X"_$J($P(DG70,U,9),1)
16 S DGPTDAT=$$GETDATE^ICDGTDRG(J)
17 S DGPTTMP=$$ICDDX^ICDCODE(+$P(DG70,U,10),DGPTDAT) S DGXLS=$S(+DGPTTMP>0&($P(DGPTTMP,U,10)):$P(DGPTTMP,U,2),1:""),Y=Y_$S(DGXLS[".":$J($P(DGXLS,".",1),3)_$E($P(DGXLS,".",2)_" ",1,3),1:$J(DGXLS,6))_" "
18 S L=$P(DG70,U,16,24)_U_DG71 S DG702=""
19 F K=1:1:12 S DGPTTMP=$$ICDDX^ICDCODE(+$P(L,U,K),DGPTDAT) I +DGPTTMP>0&($P(DGPTTMP,U,10)) S DG702=DG702_$P(DGPTTMP,U,2)_U
20 S Y=Y_$S(DG702']"":"X",1:" ")
21 ; -- get phy cdr @ d/c
22 S X="",Z=+$O(^DGPT(J,535,"AM",DG70-.0000001)) I $D(^DGPT(J,535,+$O(^(Z,0)),0)) S X=^(0)
23 ; -- set phy cdr
24 S Z=$P(X,U,16) D CDR
25 ; -- set phy spec
26 ;replace specialty pointer (ien) with ptf code (alpha-numeric)
27 N DGARRX,DGARRY ;DG729
28 S DGARRX=$$TSDATA^DGACT(42.4,$P(X,U,2),.DGARRY)
29 S $P(X,U,2)=$G(DGARRY(7))
30 S L=2,Z=2 D ENTER0
31 S X=$S($P(DG3,U)="Y":$$RTEN($P(DG3,U,2)),1:"0"),L=3,Z=1 D ENTER0
32 ;-- additional ptf questions
33 S DGAUX=$S($D(^DGPT(J,300)):^(300),1:"")
34 D ADDQUES
35 K DGAUX,DGDRUG
36 ;-- sc,ao,ir,ec questions
37 S X=DG70
38 ;-- sc
39 S Y=Y_$E($P(DG70,U,25)_" ")
40 ;-- ao
41 S Y=Y_$E($P(DG70,U,26)_" ")
42 ;-- ir
43 S Y=Y_$E($P(DG70,U,27)_" ")
44 ;-- ec
45 S Y=Y_$E($P(DG70,U,28)_" ")
46 ;-- mst
47 S Y=Y_$E($P(DG70,U,29)_" ")
48 ;-- Head/Neck CA
49 S Y=Y_$E($P(DG70,U,30)_" ")
50 D ETHNIC
51 D RACE
52 ;Combat vet
53 S Y=Y_$E($P(DG70,U,31)_" ")
54 D FILL
55 I T1 F K=41:1:55,65:1:73 S Y=$E(Y,1,K-1)_" "_$E(Y,K+1,125)
56 I T1 D CEN^DGPTR1 S:'DGERR ^XMB(3.9,DGXMZ,2,DGCNT,0)=Y,DGCNT=DGCNT+1 Q
57 I 'T1 D SAVE
58702 ;
59 Q:DG702']""
60 S Y="N702"_$E(Y,5,40)
61 F K=1:1:12 S F=$P(DG702,U,K),F=$P(F,".",1)_$E($P(F,".",2)_" ",1,3),F=F_$E(" ",1,7-$L(F)),Y=Y_F
62 D FILL
63 I 'DGERR S ^XMB(3.9,DGXMZ,2,DGCNT,0)=Y,DGCNT=DGCNT+1
64 I DGERR'>0 S DGACNT=DGACNT+1,^TMP("AEDIT",$J,$E(Y,1,4),DGACNT)=Y
65 S DG702=$P(DG702,U,6,9)
66 Q
67 ;
68ENTER S Y=Y_$J($P(X,U,Z),L)
69 Q
70 ;
71ENTER0 S Y=Y_$S($P(X,U,Z)]"":$E("00000",$L($P(X,U,Z))+1,L)_$P(X,U,Z),1:$J($P(X,U,Z),L))
72 Q
73 ;
74SAVE D START^DGPTR1 S:'DGERR ^XMB(3.9,DGXMZ,2,DGCNT,0)=Y,DGCNT=DGCNT+1
75 I DGERR'>0 S DGACNT=DGACNT+1,^TMP("AEDIT",$J,$E(Y,1,4),DGACNT)=Y
76Q Q
77 ;
78FILL F K=$L(Y):1:124 S Y=Y_" "
79 Q
80 ;
81CDR S Y=Y_$E($P(Z,".")_"0000",1,4)_$E($P(Z,".",2)_"00",1,2)
82 Q
83ADDQUES ;-- additional PTF questions load records for trans 501/701
84 N DGADDQ
85 F DGADDQ=2,3,4 D ;null results if discharge>inactive date. DG/729
86 . I +$P($G(^DIC(45.88,DGADDQ,0)),U,3) S $P(DGAUX,U,DGADDQ)=$S((+$G(^DGPT(J,70))<$P(^DIC(45.88,DGADDQ,0),U,3)):$P(DGAUX,U,DGADDQ),1:"")
87 S DGDRUG=$S($D(^DIC(45.61,+$P(DGAUX,U,4),0)):$P(^(0),U,2),1:" ")
88 S Y=Y_$E($P(DGAUX,U,3)_" ")_$E($P(DGAUX,U,2)_" ")_$J($P(DGDRUG,U),4)
89 S Y=Y_$E($P(DGAUX,U,5)_" ")
90 S DGT=0,X=$P(DGAUX,U,6) I X]"" S DGT=1,Z=1,L=2 D ENTER0
91 I 'DGT S Y=Y_" "
92 S DGT=0,X=$P(DGAUX,U,7) I X]"" S DGT=1,Z=1,L=2 D ENTER0
93 I 'DGT S Y=Y_" "
94 Q
95RTEN(X) ; This function will round X to the nearest mulitple of ten.
96 ; 0-4 ->DOWN; 5-9->UP
97 Q (X\10)*10+$S(X#10>4:10,1:0)
98ETHNIC ;-- Ethnicity (use first active value)
99 N NODE,NUM,ETHNIC,I,X
100 S ETHNIC=""
101 S I=0
102 S NUM=1
103 F S I=+$O(DG06(I)) Q:'I D Q:NUM>1
104 .S NODE=$G(DG06(I,0))
105 .Q:('NODE)!('$D(^DIC(10.2,+NODE,0)))
106 .Q:$$INACTIVE^DGUTL4(+NODE)
107 .S X=$$PTR2CODE^DGUTL4(+NODE,2,4)
108 .S ETHNIC=$S(X="":" ",1:X)
109 .S X=$$PTR2CODE^DGUTL4(+$P(NODE,"^",2),3,4)
110 .S ETHNIC=ETHNIC_$S(X="":" ",1:X)
111 .S NUM=NUM+1
112 S Y=Y_$S(ETHNIC="":" ",1:ETHNIC)
113 Q
114RACE ;-- Race (use first 6 active values)
115 N NODE,NUM,RACE,I,X
116 S RACE=""
117 S I=0
118 S NUM=1
119 F S I=+$O(DG02(I)) Q:'I D Q:NUM>6
120 .S NODE=$G(DG02(I,0))
121 .Q:('NODE)!('$D(^DIC(10,+NODE,0)))
122 .Q:$$INACTIVE^DGUTL4(+NODE)
123 .S X=$$PTR2CODE^DGUTL4(+NODE,1,4)
124 .S RACE=RACE_$S(X="":" ",1:X)
125 .S X=$$PTR2CODE^DGUTL4(+$P(NODE,"^",2),3,4)
126 .S RACE=RACE_$S(X="":" ",1:X)
127 .S NUM=NUM+1
128 S X="" S $P(X," ",12)=""
129 S RACE=$S(RACE="":" ",1:RACE)_X
130 S Y=Y_$E(RACE,1,12)
131 Q
Note: See TracBrowser for help on using the repository browser.