source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBXSC33.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 9.0 KB
Line 
1IBXSC33 ; ;02/03/08
2 D DE G BEGIN
3DE S DIE="^DGCR(399,",DIC=DIE,DP=399,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DGCR(399,DA,""))=""
4 I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,21) S:%]"" DE(11)=%
5 I $D(^("M")) S %Z=^("M") S %=$P(%Z,U,11) S:%]"" DE(8)=% S %=$P(%Z,U,13) S:%]"" DE(1)=% S %=$P(%Z,U,14) S:%]"" DE(3)=%
6 I $D(^("M1")) S %Z=^("M1") S %=$P(%Z,U,2) S:%]"" DE(15)=% S %=$P(%Z,U,10) S:%]"" DE(16)=%
7 K %Z Q
8 ;
9W W !?DL+DL-2,DLB_": "
10 Q
11O D W W Y W:$X>45 !?9
12 I $L(Y)>19,'DV,DV'["I",(DV["F"!(DV["K")) G RW^DIR2
13 W:Y]"" "// " I 'DV,DV["I",$D(DE(DQ))#2 S X="" W " (No Editing)" Q
14TR R X:DTIME E S (DTOUT,X)=U W $C(7)
15 Q
16A K DQ(DQ) S DQ=DQ+1
17B G @DQ
18RE G PR:$D(DE(DQ)) D W,TR
19N I X="" G NKEY:$D(^DD("KEY","F",DP,DIFLD)),A:DV'["R",X:'DV,X:D'>0,A
20RD G QS:X?."?" I X["^" D D G ^DIE17
21 I X="@" D D G Z^DIE2
22 I X=" ",DV["d",DV'["P",$D(^DISV(DUZ,"DIE",DLB)) S X=^(DLB) I DV'["D",DV'["S" W " "_X
23T G M^DIE17:DV,^DIE3:DV["V",P:DV'["S" X:$D(^DD(DP,DIFLD,12.1)) ^(12.1) I X?.ANP D SET I 'DDER X:$D(DIC("S")) DIC("S") I W:'$D(DB(DQ)) " "_% G V
24 K DDER G X
25P I DV["P" S DIC=U_DU,DIC(0)=$E("EN",$D(DB(DQ))+1)_"M"_$E("L",DV'["'") S:DIC(0)["L" DLAYGO=+$P(DV,"P",2) G:DV["*" AST^DIED D NOSCR^DIED S X=+Y,DIC=DIE G X:X<0
26 G V:DV'["N" D D I $L($P(X,"."))>24 K X G Z
27 I $P(DQ(DQ),U,5)'["$",X?.1"-".N.1".".N,$P(DQ(DQ),U,5,99)["+X'=X" S X=+X
28V D @("X"_DQ) K YS
29Z K DIC("S"),DLAYGO I $D(X),X'=U D:$G(DE(DW,"INDEX")) SAVEVALS G:'$$KEYCHK UNIQFERR^DIE17 S DG(DW)=X S:DV["d" ^DISV(DUZ,"DIE",DLB)=X G A
30X W:'$D(ZTQUEUED) $C(7),"??" I $D(DB(DQ)) G Z^DIE17
31 S X="?BAD"
32QS S DZ=X D D,QQ^DIEQ G B
33D S D=DIFLD,DQ(DQ)=DLB_U_DV_U_DU_U_DW_U_$P($T(@("X"_DQ))," ",2,99) Q
34Y I '$D(DE(DQ)) D O G RD:"@"'[X,A:DV'["R"&(X="@"),X:X="@" S X=Y G N
35PR S DG=DV,Y=DE(DQ),X=DU I $D(DQ(DQ,2)) X DQ(DQ,2) G RP
36R I DG["P",@("$D(^"_X_"0))") S X=+$P(^(0),U,2) G RP:'$D(^(Y,0)) S Y=$P(^(0),U),X=$P(^DD(X,.01,0),U,3),DG=$P(^(0),U,2) G R
37 I DG["V",+Y,$P(Y,";",2)["(",$D(@(U_$P(Y,";",2)_"0)")) S X=+$P(^(0),U,2) G RP:'$D(^(+Y,0)) S Y=$P(^(0),U) I $D(^DD(+X,.01,0)) S DG=$P(^(0),U,2),X=$P(^(0),U,3) G R
38 X:DG["D" ^DD("DD") I DG["S" S %=$P($P(";"_X,";"_Y_":",2),";") S:%]"" Y=%
39RP D O I X="" S X=DE(DQ) G A:'DV,A:DC<2,N^DIE17
40I I DV'["I",DV'["#" G RD
41 D E^DIE0 G RD:$D(X),PR
42 Q
43SET N DIR S DIR(0)="SV"_$E("o",$D(DB(DQ)))_U_DU,DIR("V")=1
44 I $D(DB(DQ)),'$D(DIQUIET) N DIQUIET S DIQUIET=1
45 D ^DIR I 'DDER S %=Y(0),X=Y
46 Q
47SAVEVALS S @DIEZTMP@("V",DP,DIIENS,DIFLD,"O")=$G(DE(DQ)) S:$D(^("F"))[0 ^("F")=$G(DE(DQ))
48 I $D(DE(DW,"4/")) S @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")=""
49 E K @DIEZTMP@("V",DP,DIIENS,DIFLD,"4/")
50 Q
51NKEY W:'$D(ZTQUEUED) "?? Required key field" S X="?BAD" G QS
52KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
53BEGIN S DNM="IBXSC33",DQ=1
541 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW="M;13",DV="FOX",DU="",DLB="SECONDARY INSURANCE POLICY",DIFLD=113
55 S DQ(1,2)="S Y(0)=Y S Y=$$TRANS^IBCNS2($G(DA,D0),Y)"
56 S DE(DW)="C1^IBXSC33",DE(DW,"INDEX")=1
57 G RE
58C1 G C1S:$D(DE(1))[0 K DB
59 S X=DE(1),DIC=DIE
60 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M")):^("M"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(399,113,1,1,2.4)
61 S X=DE(1),DIC=DIE
62 D KIX^IBCNS2(DA,"I2")
63 S X=DE(1),DIC=DIE
64 X ^DD(399,113,1,3,2.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(399,113,1,3,2.4)
65C1S S X="" G:DG(DQ)=X C1F1 K DB
66 S X=DG(DQ),DIC=DIE
67 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M")):^("M"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y X ^DD(399,113,1,1,1.1) X ^DD(399,113,1,1,1.4)
68 S X=DG(DQ),DIC=DIE
69 D IX^IBCNS2(DA,"I2")
70 S X=DG(DQ),DIC=DIE
71 X ^DD(399,113,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X=DIV S X=$$BPP^IBCNS2(DA,1) X ^DD(399,113,1,3,1.4)
72C1F1 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
73 F DIXR=139 S DIEZRXR(399,DIXR)=""
74 Q
75X1 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>20!($L(X)<1) X D:$D(X) DD^IBCNS2(X,DA,2)
76 I $D(X),X'?.ANP K X
77 Q
78 ;
792 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=2 D X2 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
80X2 S:X="" Y="@998"
81 Q
823 D:$D(DG)>9 F^DIE17,DE S DQ=3,DW="M;14",DV="FOX",DU="",DLB="TERTIARY INSURANCE POLICY",DIFLD=114
83 S DQ(3,2)="S Y(0)=Y S Y=$$TRANS^IBCNS2($G(DA,D0),Y)"
84 S DE(DW)="C3^IBXSC33",DE(DW,"INDEX")=1
85 G RE
86C3 G C3S:$D(DE(3))[0 K DB
87 S X=DE(3),DIC=DIE
88 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M")):^("M"),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y S X="" X ^DD(399,114,1,1,2.4)
89 S X=DE(3),DIC=DIE
90 D KIX^IBCNS2(DA,"I3")
91 S X=DE(3),DIC=DIE
92 X ^DD(399,114,1,3,2.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(399,114,1,3,2.4)
93C3S S X="" G:DG(DQ)=X C3F1 K DB
94 S X=DG(DQ),DIC=DIE
95 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"M")):^("M"),1:"") S X=$P(Y(1),U,3),X=X S DIU=X K Y X ^DD(399,114,1,1,1.1) X ^DD(399,114,1,1,1.4)
96 S X=DG(DQ),DIC=DIE
97 D IX^IBCNS2(DA,"I3")
98 S X=DG(DQ),DIC=DIE
99 X ^DD(399,114,1,3,1.3) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X=DIV S X=$$BPP^IBCNS2(DA) X ^DD(399,114,1,3,1.4)
100C3F1 S DIEZRXR(399,DIIENS)=$$OREF^DILF($NA(@$$CREF^DILF(DIE)))
101 F DIXR=139 S DIEZRXR(399,DIXR)=""
102 Q
103X3 K:X[""""!($A(X)=45) X I $D(X) K:$L(X)>20!($L(X)<1) X D:$D(X) DD^IBCNS2(X,DA,3)
104 I $D(X),X'?.ANP K X
105 Q
106 ;
1074 S DQ=5 ;@998
1085 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=5 D X5 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
109X5 S Y="@31"
110 Q
1116 S DQ=7 ;@311
1127 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=7 D X7 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
113X7 D INST^IBCU
114 Q
1158 D:$D(DG)>9 F^DIE17,DE S DQ=8,DW="M;11",DV="RP4",DU="",DLB="RESPONSIBLE INSTITUTION",DIFLD=111
116 S DE(DW)="C8^IBXSC33"
117 S DU="DIC(4,"
118 G RE
119C8 G C8S:$D(DE(8))[0 K DB
120 S X=DE(8),DIC=DIE
121 D DEL^IBCU5
122 S X=DE(8),DIC=DIE
123 S DGRVRCAL=2
124C8S S X="" G:DG(DQ)=X C8F1 K DB
125 S X=DG(DQ),DIC=DIE
126 D MAILIN^IBCU5
127 S X=DG(DQ),DIC=DIE
128 S DGRVRCAL=1
129C8F1 Q
130X8 Q
1319 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=9 D X9 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
132X9 K DIC("DR"),DLAYGO
133 Q
13410 S DQ=11 ;@31
13511 D:$D(DG)>9 F^DIE17,DE S DQ=11,DW="0;21",DV="*S",DU="",DLB="CURRENT BILL PAYER SEQUENCE",DIFLD=.21
136 S DE(DW)="C11^IBXSC33"
137 S DU="P:PRIMARY INSURANCE;S:SECONDARY INSURANCE;T:TERTIARY INSURANCE;A:PATIENT;"
138 G RE
139C11 G C11S:$D(DE(11))[0 K DB
140 S X=DE(11),DIC=DIE
141 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DGCR(399,D0,"MP")):^("MP"),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,1,2.4)
142 S X=DE(11),DIC=DIE
143 K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(0)=X S X=('$$REQMRA^IBEFUNC(DA)&$$NEEDMRA^IBEFUNC(DA)) I X S X=DIV S Y(1)=$S($D(^DGCR(399,D0,"TX")):^("TX"),1:"") S X=$P(Y(1),U,5),X=X S DIU=X K Y S X="" X ^DD(399,.21,1,2,2.4)
144 S X=DE(11),DIC=DIE
145 ;
146C11S S X="" G:DG(DQ)=X C11F1 K DB
147 D ^IBXSC34
148C11F1 Q
149X11 Q
15012 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=12 D X12 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
151X12 S:IBDR20'["32" Y="@33"
152 Q
15313 S DQ=14 ;@3211
15414 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 D X14 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
155X14 I '$$SUPPPT^IBCEP7B(DA,1) S Y="@3212"
156 Q
15715 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW="M1;2",DV="FX",DU="",DLB="PRIMARY PROVIDER #",DIFLD=122
158 S DE(DW)="C15^IBXSC33"
159 S Y="@"
160 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
161 G RD
162C15 G C15S:$D(DE(15))[0 K DB
163 D ^IBXSC35
164C15S S X="" G:DG(DQ)=X C15F1 K DB
165 S X=DG(DQ),DIC=DIE
166 ;
167C15F1 Q
168X15 K:$L(X)>13!($L(X)<3)!($TR(X," ")="") X
169 I $D(X),X'?.ANP K X
170 Q
171 ;
17216 D:$D(DG)>9 F^DIE17,DE S DQ=16,DW="M1;10",DV="*P355.97'",DU="",DLB="PRIMARY ID QUALIFIER",DIFLD=128
173 S DU="IBE(355.97,"
174 S Y="@"
175 S X=Y,DB(DQ)=1 G:X="" N^DIE17:DV,A I $D(DE(DQ)),DV["I"!(DV["#") D E^DIE0 G A:'$D(X)
176 G RD
177X16 S DIC("S")="I $$BPS^IBCEPU(Y)!($$EPT^IBCEPU(Y))" D ^DIC K DIC S DIC=DIE,X=+Y K:Y<0 X
178 Q
179 ;
18017 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=17 D X17 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
181X17 W !,"No Billing Prov Secondary IDs will be sent for Primary Ins/Elect Plan Type."
182 Q
18318 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=18 D X18 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
184X18 S Y="@3221"
185 Q
18619 S DQ=20 ;@3212
18720 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=20 D X20 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
188X20 I '$$ATTREND^IBCEP7B(DA,1) S Y="@3213"
189 Q
19021 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=21 D X21 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
191X21 I $P($G(^DGCR(399,DA,"M1")),U,2)]"" S Y="@3213"
192 Q
19322 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=22 D X22 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
194X22 W !,"The Att/Rend ID will be sent as the primary ins. Billing Prov Sec ID."
195 Q
19623 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=23 D X23 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
197X23 S Y="@3221"
198 Q
19924 S DQ=25 ;@3213
20025 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=25 D X25 D:$D(DIEFIRE)#2 FIREREC^DIE17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
201X25 S IBPSDAT=$$GETID^IBCEP7B(DA,1),IBPSID=$P(IBPSDAT,U),IBPSQUAL=$P(IBPSDAT,U,2) I IBPSID="" S Y="@321"
202 Q
20326 D:$D(DG)>9 F^DIE17 G ^IBXSC36
Note: See TracBrowser for help on using the repository browser.