EASECDP0 ;ALB/LBD Dependent Driver (con't) ;20 AUG 2001
;;1.0;ENROLLMENT APPLICATION SYSTEM;**5**;Mar 15, 2001
;NOTE: This routine was modified from DGDEP0 for LTC co-pay
;
RETDEP ;Return printable data of dependents
Q:'$D(DGDEP("DGDEP",$J))
N ACT,ACTIVE,CNT,CNTR,DEP,DGII,DGX,EDATE,INCOME,INCPER,MORE,NAME,RELATE
F DGII=0:0 S DGII=$O(DGDEP(DGII)) Q:'DGII K DGDEP(DGII) ; clear dependent array
S RELATE=0,CNT=1
;
F S RELATE=$O(DGDEP("DGDEP",$J,RELATE)) Q:'RELATE D
.;
.S MORE=0
.F S MORE=$O(DGDEP("DGDEP",$J,RELATE,MORE)) Q:'MORE S DEP=DGDEP("DGDEP",$J,RELATE,MORE) D S CNT=CNT+1,DGCNT=CNT-1
..;
..S $P(DGDEP(CNT),U,2)=$P($G(^DG(408.11,RELATE,0)),U)
..S NAME=$P(DEP,U),$P(DGDEP(CNT),U)=$P(DEP,U)
..S $P(DGDEP(CNT),U,3)=$S($P(DEP,U,2)="M":"Male",$P(DEP,U,2)="F":"Female",1:"Unknown"),$P(DGDEP(CNT),U,20)=$P(DEP,U,20)
..S $P(DGDEP(CNT),U,21)=$P(DEP,U,21),$P(DGDEP(CNT),U,22)=$P(DEP,U,22)
..N Y S Y=$P(DEP,U,3) D DD^%DT S $P(DGDEP(CNT),U,4)=Y
..I $P(DEP,U,9) S $P(DGDEP(CNT),U,5)=$E($P(DEP,U,9),1,3)_"-"_$E($P(DEP,U,9),4,5)_"-"_$E($P(DEP,U,9),6,9)
..;
..S INCOME=$P(DGDEP("DGDEP",$J,RELATE,MORE),U,21)
..S INCPER=$P(DGDEP("DGDEP",$J,RELATE,MORE),U,22)
..I RELATE=1 D SELF("",NAME,RELATE,"",DGDEP(1),$G(DGMTI),CNT)
..S ACT=$O(DGDEP("DGDEP",$J,RELATE,MORE,"")) Q:'ACT S ACT=DGDEP("DGDEP",$J,RELATE,MORE,+ACT)
..I RELATE=1 D SELF(INCPER,NAME,RELATE,ACT,DGDEP(1),$G(DGMTI),CNT)
..I RELATE=2 D DEP(INCPER,NAME,RELATE,ACT,DGDEP(CNT),$G(DGMTI),$G(DGMTACT),CNT)
..I RELATE>2 D DEP(INCPER,NAME,RELATE,ACT,DGDEP(CNT),$G(DGMTI),$G(DGMTACT),CNT)
..S EDATE="",CNTR=0
..F S EDATE=$O(DGDEP("DGDEP",$J,RELATE,MORE,EDATE)) Q:EDATE']"" S ACTIVE=DGDEP("DGDEP",$J,RELATE,MORE,EDATE) D
...;
...N Y S Y=+ACTIVE D DD^%DT S DGDEP(CNT,EDATE)=Y
...S $P(DGDEP(CNT,EDATE),U,2)=$S($P(ACTIVE,U,2)=1:"Active",1:"Inactive")
...S $P(DGDEP(CNT,EDATE),U,3)=$P(ACTIVE,U,3)
K DGDEP("DGDEP",$J)
Q
;
SELF(INCPER,NAME,RELATE,ACT,DGDEP,DGMTI,CNT) ;
I $G(DGMTI),$G(DGMTACT)="VEW" G SELFQ
I $G(DGMTI) D ADD^EASECDP2(DFN,DGDEP,DGMTI)
SELFQ I INCPER D SELF^EASECDP3(INCPER,NAME,RELATE,ACT,$G(DGMTI),CNT)
Q
;
DEP(INCPER,NAME,RELATE,ACT,DGDEP,DGMTI,DGMTACT,CNT) ;
;
I $G(DGMTI),$G(DGMTACT)="VEW" G DEP1
I $G(DGMTI),$P(ACT,U,2),$G(DGMTACT)="ADD",'$G(DGREMOVE) D ADD^EASECDP2(DFN,DGDEP,DGMTI)
DEP1 I RELATE=2 D SELF^EASECDP3(INCPER,NAME,RELATE,ACT,$G(DGMTI),CNT) G DEPQ
I INCPER D CHILD^EASECDP3(INCPER,NAME,RELATE,ACT,$G(DGMTI),$G(DGMTACT),CNT)
DEPQ Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HEASECDP0 2505 printed Dec 13, 2024@01:53:52 Page 2
EASECDP0 ;ALB/LBD Dependent Driver (con't) ;20 AUG 2001
+1 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**5**;Mar 15, 2001
+2 ;NOTE: This routine was modified from DGDEP0 for LTC co-pay
+3 ;
RETDEP ;Return printable data of dependents
+1 if '$DATA(DGDEP("DGDEP",$JOB))
QUIT
+2 NEW ACT,ACTIVE,CNT,CNTR,DEP,DGII,DGX,EDATE,INCOME,INCPER,MORE,NAME,RELATE
+3 ; clear dependent array
FOR DGII=0:0
SET DGII=$ORDER(DGDEP(DGII))
if 'DGII
QUIT
KILL DGDEP(DGII)
+4 SET RELATE=0
SET CNT=1
+5 ;
+6 FOR
SET RELATE=$ORDER(DGDEP("DGDEP",$JOB,RELATE))
if 'RELATE
QUIT
Begin DoDot:1
+7 ;
+8 SET MORE=0
+9 FOR
SET MORE=$ORDER(DGDEP("DGDEP",$JOB,RELATE,MORE))
if 'MORE
QUIT
SET DEP=DGDEP("DGDEP",$JOB,RELATE,MORE)
Begin DoDot:2
+10 ;
+11 SET $PIECE(DGDEP(CNT),U,2)=$PIECE($GET(^DG(408.11,RELATE,0)),U)
+12 SET NAME=$PIECE(DEP,U)
SET $PIECE(DGDEP(CNT),U)=$PIECE(DEP,U)
+13 SET $PIECE(DGDEP(CNT),U,3)=$SELECT($PIECE(DEP,U,2)="M":"Male",$PIECE(DEP,U,2)="F":"Female",1:"Unknown")
SET $PIECE(DGDEP(CNT),U,20)=$PIECE(DEP,U,20)
+14 SET $PIECE(DGDEP(CNT),U,21)=$PIECE(DEP,U,21)
SET $PIECE(DGDEP(CNT),U,22)=$PIECE(DEP,U,22)
+15 NEW Y
SET Y=$PIECE(DEP,U,3)
DO DD^%DT
SET $PIECE(DGDEP(CNT),U,4)=Y
+16 IF $PIECE(DEP,U,9)
SET $PIECE(DGDEP(CNT),U,5)=$EXTRACT($PIECE(DEP,U,9),1,3)_"-"_$EXTRACT($PIECE(DEP,U,9),4,5)_"-"_$EXTRACT($PIECE(DEP,U,9),6,9)
+17 ;
+18 SET INCOME=$PIECE(DGDEP("DGDEP",$JOB,RELATE,MORE),U,21)
+19 SET INCPER=$PIECE(DGDEP("DGDEP",$JOB,RELATE,MORE),U,22)
+20 IF RELATE=1
DO SELF("",NAME,RELATE,"",DGDEP(1),$GET(DGMTI),CNT)
+21 SET ACT=$ORDER(DGDEP("DGDEP",$JOB,RELATE,MORE,""))
if 'ACT
QUIT
SET ACT=DGDEP("DGDEP",$JOB,RELATE,MORE,+ACT)
+22 IF RELATE=1
DO SELF(INCPER,NAME,RELATE,ACT,DGDEP(1),$GET(DGMTI),CNT)
+23 IF RELATE=2
DO DEP(INCPER,NAME,RELATE,ACT,DGDEP(CNT),$GET(DGMTI),$GET(DGMTACT),CNT)
+24 IF RELATE>2
DO DEP(INCPER,NAME,RELATE,ACT,DGDEP(CNT),$GET(DGMTI),$GET(DGMTACT),CNT)
+25 SET EDATE=""
SET CNTR=0
+26 FOR
SET EDATE=$ORDER(DGDEP("DGDEP",$JOB,RELATE,MORE,EDATE))
if EDATE']""
QUIT
SET ACTIVE=DGDEP("DGDEP",$JOB,RELATE,MORE,EDATE)
Begin DoDot:3
+27 ;
+28 NEW Y
SET Y=+ACTIVE
DO DD^%DT
SET DGDEP(CNT,EDATE)=Y
+29 SET $PIECE(DGDEP(CNT,EDATE),U,2)=$SELECT($PIECE(ACTIVE,U,2)=1:"Active",1:"Inactive")
+30 SET $PIECE(DGDEP(CNT,EDATE),U,3)=$PIECE(ACTIVE,U,3)
End DoDot:3
End DoDot:2
SET CNT=CNT+1
SET DGCNT=CNT-1
End DoDot:1
+31 KILL DGDEP("DGDEP",$JOB)
+32 QUIT
+33 ;
SELF(INCPER,NAME,RELATE,ACT,DGDEP,DGMTI,CNT) ;
+1 IF $GET(DGMTI)
IF $GET(DGMTACT)="VEW"
GOTO SELFQ
+2 IF $GET(DGMTI)
DO ADD^EASECDP2(DFN,DGDEP,DGMTI)
SELFQ IF INCPER
DO SELF^EASECDP3(INCPER,NAME,RELATE,ACT,$GET(DGMTI),CNT)
+1 QUIT
+2 ;
DEP(INCPER,NAME,RELATE,ACT,DGDEP,DGMTI,DGMTACT,CNT) ;
+1 ;
+2 IF $GET(DGMTI)
IF $GET(DGMTACT)="VEW"
GOTO DEP1
+3 IF $GET(DGMTI)
IF $PIECE(ACT,U,2)
IF $GET(DGMTACT)="ADD"
IF '$GET(DGREMOVE)
DO ADD^EASECDP2(DFN,DGDEP,DGMTI)
DEP1 IF RELATE=2
DO SELF^EASECDP3(INCPER,NAME,RELATE,ACT,$GET(DGMTI),CNT)
GOTO DEPQ
+1 IF INCPER
DO CHILD^EASECDP3(INCPER,NAME,RELATE,ACT,$GET(DGMTI),$GET(DGMTACT),CNT)
DEPQ QUIT