Index: WorldVistAEHR/trunk/r/HINQ-DVB--DVBA--DVBE--DVBC/DVBHCE8.m
===================================================================
--- WorldVistAEHR/trunk/r/HINQ-DVB--DVBA--DVBE--DVBC/DVBHCE8.m	(revision 613)
+++ WorldVistAEHR/trunk/r/HINQ-DVB--DVBA--DVBE--DVBC/DVBHCE8.m	(revision 623)
@@ -1,11 +1,6 @@
-DVBHCE8 ; ;12/13/08
+DVBHCE8 ; ;12/27/07
  D DE G BEGIN
-DE S DIE="^DPT(",DIC=DIE,DP=2,DL=1,DIEL=0,DU="" K DG,DE,DB Q:$O(^DPT(DA,""))=""
- I $D(^(.3)) S %Z=^(.3) S %=$P(%Z,U,1) S:%]"" DE(22)=% S %=$P(%Z,U,6) S:%]"" DE(15)=%
- I $D(^(.32)) S %Z=^(.32) S %=$P(%Z,U,3) S:%]"" DE(1)=%
- I $D(^(.36)) S %Z=^(.36) S %=$P(%Z,U,1) S:%]"" DE(25)=%
- I $D(^(.361)) S %Z=^(.361) S %=$P(%Z,U,1) S:%]"" DE(10)=% S %=$P(%Z,U,2) S:%]"" DE(12)=% S %=$P(%Z,U,5) S:%]"" DE(13)=%
- I $D(^("TYPE")) S %Z=^("TYPE") S %=$P(%Z,U,1) S:%]"" DE(20)=%
- I $D(^("VET")) S %Z=^("VET") S %=$P(%Z,U,1) S:%]"" DE(21)=%
+DE S DIE="^DPT(D0,""E"",",DIC=DIE,DP=2.0361,DL=2,DIEL=1,DU="" K DG,DE,DB Q:$O(^DPT(D0,"E",DA,""))=""
+ I $D(^(0)) S %Z=^(0) S %=$P(%Z,U,1) S:%]"" DE(1)=%
  K %Z Q
  ;
@@ -54,228 +49,34 @@
 NKEY W:'$D(ZTQUEUED) "??  Required key field" S X="?BAD" G QS
 KEYCHK() Q:$G(DE(DW,"KEY"))="" 1 Q @DE(DW,"KEY")
-BEGIN S DNM="DVBHCE8",DQ=1
-1 D:$D(DG)>9 F^DIE17,DE S DQ=1,DW=".32;3",DV="*P21'Xa",DU="",DLB="PERIOD OF SERVICE",DIFLD=.323
+BEGIN S DNM="DVBHCE8",DQ=1+D G B
+1 S DW="0;1",DV="M*P8'X#",DU="",DLB="ELIGIBILITY",DIFLD=.01
  S DE(DW)="C1^DVBHCE8"
- S DU="DIC(21,"
- G RE
+ S DU="DIC(8,"
+ G RE:'D S DQ=2 G 2
 C1 G C1S:$D(DE(1))[0 K DB
  S X=DE(1),DIC=DIE
- K ^DPT("APOS",$E(X,1,30),DA)
+ K ^DPT(DA(1),"E","B",$E(X,1,30),DA)
  S X=DE(1),DIC=DIE
- ;
+ K ^DPT("AEL",DA(1),+X)
  S X=DE(1),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
+ D E32^VADPT62
  S X=DE(1),DIC=DIE
- D EVENT^IVMPLOG(DA)
- S X=DE(1),DIIX=2_U_DIFLD D AUDIT^DIET
+ X "S DFN=DA(1) D EN^DGMTR K DGREQF"
+ S X=DE(1),DIC=DIE
+ D AUTOUPD^DGENA2(DA(1))
 C1S S X="" G:DG(DQ)=X C1F1 K DB
  S X=DG(DQ),DIC=DIE
- S ^DPT("APOS",$E(X,1,30),DA)=""
+ S ^DPT(DA(1),"E","B",$E(X,1,30),DA)=""
  S X=DG(DQ),DIC=DIE
- X ^DD(2,.323,1,2,1.3) I X S X=DIV S Y(1)=$S($D(^DPT(D0,"ODS")):^("ODS"),1:"") S X=$P(Y(1),U,1),X=X S DIU=X K Y X ^DD(2,.323,1,2,1.1) X ^DD(2,.323,1,2,1.4)
+ S ^DPT("AEL",DA(1),+X)=""
  S X=DG(DQ),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".323;" D AVAFC^VAFCDD01(DA)
+ D E31^VADPT62
  S X=DG(DQ),DIC=DIE
- D EVENT^IVMPLOG(DA)
- I $D(DE(1))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
+ X "S DFN=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E17 G A:$D(Y)[0,A:Y=U S X=Y,DIC(0)="F",DW=DQ G OUT^DIE17
-X9 S DVBSCR=1 D ^DVBHS5 S DVBJ2=1
- Q
-10 D:$D(DG)>9 F^DIE17,DE S DQ=10,DW=".361;1",DV="SX",DU="",DLB="ELIGIBILITY STATUS",DIFLD=.3611
- S DE(DW)="C10^DVBHCE8"
- S DU="P:PENDING VERIFICATION;R:PENDING RE-VERIFICATION;V:VERIFIED;"
- G RE
-C10 G C10S:$D(DE(10))[0 K DB
- S X=DE(10),DIC=DIE
- ;
- S X=DE(10),DIC=DIE
- ;
- S X=DE(10),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C10S S X="" G:DG(DQ)=X C10F1 K DB
- S X=DG(DQ),DIC=DIE
- K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.361)):^(.361),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y X ^DD(2,.3611,1,1,1.1) X ^DD(2,.3611,1,1,1.4)
- S X=DG(DQ),DIC=DIE
- K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.361)):^(.361),1:"") S X=$P(Y(1),U,2),X=X S DIU=X K Y S X=DIV S X=DT X ^DD(2,.3611,1,2,1.4)
- S X=DG(DQ),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C10F1 Q
-X10 D EK^DGLOCK Q:'$D(X)
- Q
- ;
-11 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=11 G A
-12 D:$D(DG)>9 F^DIE17,DE S DQ=12,DW=".361;2",DV="DX",DU="",DLB="ELIGIBILITY STATUS DATE",DIFLD=.3612
- S DE(DW)="C12^DVBHCE8"
- S X="TODAY"
- S Y=X
- G Y
-C12 G C12S:$D(DE(12))[0 K DB
- S X=DE(12),DIC=DIE
- ;
- S X=DE(12),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C12S S X="" G:DG(DQ)=X C12F1 K DB
- S X=DG(DQ),DIC=DIE
- K DIV S DIV=X,D0=DA,DIV(0)=D0 S Y(1)=$S($D(^DPT(D0,.361)):^(.361),1:"") S X=$P(Y(1),U,6),X=X S DIU=X K Y S X=DIV S X=$S(($D(DUZ)#2):DUZ,1:"") X ^DD(2,.3612,1,1,1.4)
- S X=DG(DQ),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C12F1 Q
-X12 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) D EK^DGLOCK
- Q
- ;
-13 D:$D(DG)>9 F^DIE17,DE S DQ=13,DW=".361;5",DV="FX",DU="",DLB="ELIGIBILITY VERIF. METHOD",DIFLD=.3615
- S DE(DW)="C13^DVBHCE8"
- S X="HINQ"
- S Y=X
- G Y
-C13 G C13S:$D(DE(13))[0 K DB
- S X=DE(13),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C13S S X="" G:DG(DQ)=X C13F1 K DB
- S X=DG(DQ),DIC=DIE
- D EVENT^IVMPLOG(DA)
-C13F1 Q
-X13 K:$L(X)>50!($L(X)<2) X I $D(X) D EK^DGLOCK
- I $D(X),X'?.ANP K X
- Q
- ;
-14 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=14 G A
-15 D:$D(DG)>9 F^DIE17,DE S DQ=15,DW=".3;6",DV="DX",DU="",DLB="MONETARY BEN. VERIFY DATE",DIFLD=.306
- S X="TODAY"
- S Y=X
- G Y
-X15 S %DT="E",%DT(0)=-DT D ^%DT K %DT S X=Y K:Y<1 X I $D(X) D EK^DGLOCK
- Q
- ;
-16 S D=0 K DE(1) ;361
- S DIFLD=361,DGO="^DVBHCE9",DC="3^2.0361IP^E^",DV="2.0361M*P8'X",DW="0;1",DOW="ELIGIBILITY",DLB="Select "_DOW S:D DC=DC_D
- S DU="DIC(8,"
- G RE:D I $D(DSC(2.0361))#2,$P(DSC(2.0361),"I $D(^UTILITY(",1)="" X DSC(2.0361) S D=$O(^(0)) S:D="" D=-1 G M16
- S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),$O(^(0))'="":$O(^(0)),1:-1)
-M16 I D>0 S DC=DC_D I $D(^DPT(DA,"E",+D,0)) S DE(16)=$P(^(0),U,1)
- G RE
-R16 D DE
- S D=$S($D(^DPT(DA,"E",0)):$P(^(0),U,3,4),1:1) G 16+1
- ;
-17 S DQ=18 ;@205
-18 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
-X18 I Z2'[2 S Y="@206"
- Q
-19 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=19 D X19 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
-X19 S DVBSCR=1 D ^DVBHS5 S DVBJ2=1
- Q
-20 S DW="TYPE;1",DV="P391'a",DU="",DLB="TYPE",DIFLD=391
- S DE(DW)="C20^DVBHCE8",DE(DW,"INDEX")=1
- S DU="DG(391,"
- G RE
-C20 G C20S:$D(DE(20))[0 K DB
- S X=DE(20),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF="391;" D AVAFC^VAFCDD01(DA)
- S X=DE(20),DIIX=2_U_DIFLD D AUDIT^DIET
-C20S S X="" G:DG(DQ)=X C20F1 K DB
- S X=DG(DQ),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF="391;" D AVAFC^VAFCDD01(DA)
- I $D(DE(20))'[0!(^DD(DP,DIFLD,"AUDIT")'="e") S X=DG(DQ),DIIX=3_U_DIFLD D AUDIT^DIET
-C20F1 N X,X1,X2 S DIXR=664 D C20X1(U) K X2 M X2=X D C20X1("O") K X1 M X1=X
- I $G(X(1))]"" D
- . K ^DPT("APTYPE",X,DA)
- K X M X=X2 I $G(X(1))]"" D
- . S ^DPT("APTYPE",X,DA)=""
- G C20F2
-C20X1(DION) K X
- S X(1)=$G(@DIEZTMP@("V",2,DIIENS,391,DION),$P($G(^DPT(DA,"TYPE")),U,1))
- S X=$G(X(1))
- Q
-C20F2 Q
-X20 Q
-21 D:$D(DG)>9 F^DIE17,DE S DQ=21,DW="VET;1",DV="SXa",DU="",DLB="VETERAN (Y/N)?",DIFLD=1901
- S DE(DW)="C21^DVBHCE8"
- S DU="Y:YES;N:NO;"
- G RE
-C21 G C21S:$D(DE(21))[0 K DB
- S X=DE(21),DIC=DIE
- S DFN=DA D EN^DGMTCOR K DGMTCOR
- S X=DE(21),DIC=DIE
- S DFN=DA D EN^DGRP7CC
- S X=DE(21),DIC=DIE
- ;
- S X=DE(21),DIC=DIE
- D AUTOUPD^DGENA2(DA)
- S X=DE(21),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF="1901;" D AVAFC^VAFCDD01(DA)
- S X=DE(21),DIC=DIE
- D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
- S X=DE(21),DIIX=2_U_DIFLD D AUDIT^DIET
-C21S S X="" G:DG(DQ)=X C21F1 K DB
- D ^DVBHCE10
-C21F1 Q
-X21 I $D(X) S:'$D(DPTX) DFN=DA D:'$D(^XUSEC("DG ELIGIBILITY",DUZ)) VAGE^DGLOCK:X="Y" I $D(X) D:$D(DFN) EV^DGLOCK
- Q
- ;
-22 D:$D(DG)>9 F^DIE17,DE S DQ=22,DW=".3;1",DV="SXa",DU="",DLB="SERVICE CONNECTED?",DIFLD=.301
- S DE(DW)="C22^DVBHCE8"
- S DU="Y:YES;N:NO;"
- G RE
-C22 G C22S:$D(DE(22))[0 K DB
- S X=DE(22),DIC=DIE
- ;
- S X=DE(22),DIC=DIE
- ;
- S X=DE(22),DIC=DIE
- D AUTOUPD^DGENA2(DA)
- S X=DE(22),DIC=DIE
- I ($T(AVAFC^VAFCDD01)'="") S VAFCF=".301;" D AVAFC^VAFCDD01(DA)
- S X=DE(22),DIC=DIE
- D:($T(ADGRU^DGRUDD01)'="") ADGRU^DGRUDD01(DA)
- S X=DE(22),DIIX=2_U_DIFLD D AUDIT^DIET
-C22S S X="" G:DG(DQ)=X C22F1 K DB
- D ^DVBHCE11
-C22F1 Q
-X22 S DFN=DA D EV^DGLOCK I $D(X),X="Y" D VET^DGLOCK
- Q
- ;
-23 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
-X23 I X="N" S Y="@2063"
- Q
-24 S DQ=25 ;@2063
-25 D:$D(DG)>9 F^DIE17,DE S DQ=25,DW=".36;1",DV="*P8'Xa",DU="",DLB="PRIMARY ELIGIBILITY CODE",DIFLD=.361
- S DE(DW)="C25^DVBHCE8"
- S DU="DIC(8,"
- G RE
-C25 G C25S:$D(DE(25))[0 K DB
- D ^DVBHCE12
-C25S S X="" G:DG(DQ)=X C25F1 K DB
- D ^DVBHCE13
-C25F1 Q
-X25 S DFN=DA D EV^DGLOCK I $D(X) D ECD^DGLOCK1
- Q
- ;
-26 S DQ=27 ;@206
-27 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=27 D X27 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
-X27 I Z2'[3 S Y="@104"
- Q
-28 D:$D(DG)>9 F^DIE17,DE S Y=U,DQ=28 D X28 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
-X28 S DVBSCR=1 D ^DVBHS5 S DVBJ2=1
- Q
-29 D:$D(DG)>9 F^DIE17 G ^DVBHCE14
+2 G 1^DIE17
