Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: EASECDP4

EASECDP4.m

Go to the documentation of this file.
EASECDP4 ;ALB/LBD - Dependents Utilities (con't) ;19 AUG 2001
 ;;1.0;ENROLLMENT APPLICATION SYSTEM;**5,7**;Mar 15, 2001
 ; NOTE: This routine was modified from DGDEP4 for LTC Copay
 ;
EN ; Spouse Demographics
 N BEG,CNT,END,FLAG,QUIT,DGERR S CNT=0
 I $G(DGMTI),$G(DGMTACT)="VEW" W !,"Cannot edit when viewing a LTC copay test." H 2 G ENQ
 I '$D(DGMTI),$G(DGRPV)=1 W !,"Not while viewing" H 2 G ENQ
 F  S CNT=$O(DGDEP(CNT)) Q:'CNT  D
 .I $P(DGDEP(CNT),U,2)="SPOUSE" S FLAG=$G(FLAG)+1
 I '$G(FLAG) W !,"There is no spouse to choose from." H 2 G ENQ
 I $G(FLAG)>1 D  G:'$G(DGERR) EN1
 .S BEG=2,END=FLAG+1 D SEL^DGDEPU Q:$G(DGERR)
 .S DGREL("S")=$P(DGDEP(DGW),U,20)_U_$P(^DGPR(408.12,+$P(DGDEP(DGW),U,20),0),U,3)
 I $G(DGERR) G ENQ
 I '$G(DGREL("S")) S DGREL("S")=$P(DGDEP(2),U,20)_U_$P(^DGPR(408.12,+$P(DGDEP(2),U,20),0),U,3)
EN1 S DGPRI=$P(DGDEP(1),U,20),DGIRI=$P(DGDEP(1),U,22) D SPOUSE1^EASECSC3
ENQ D INIT^EASECDEP
 Q
 ;
 ;
ADDEP ; Add a new dependent
 ;
 N DGANS
 S VALMBCK=""
 I $G(DGMTI),$G(DGMTACT)="VEW" W !,"Cannot edit when viewing a LTC copay test." H 2 G ADDEPQ
 I '$D(DGMTI),$G(DGRPV)=1 W !,"Not while viewing" H 2 G ADDEPQ
 S DIR(0)="S^S:Spouse;D:Dependent",DIR("A")="Do you want to add (S)pouse or (D)ependent"
 D ^DIR S DGANS=Y K DIR,Y I DGANS="D",$G(DGMTI) S DGANS="C"
 I $D(DIRUT) G ADDEPQ
 D GETREL^DGMTU11(DFN,"S",$S($G(DGMTD):DGMTD,1:DT))
 I DGANS="S",$G(DGREL("S")) W !,"An active spouse is currently on file.  Use the 'ES - Edit Spouse'",!,"action to edit." H 3 G ADDEPQ
 I DGANS="S",$G(DGMTI) S CNT=0 F  S CNT=$O(DGDEP(CNT)) Q:'CNT  I $P(DGDEP(CNT),U,2)="SPOUSE" D REMOVE^EASECDP2(DFN,DGDEP(CNT),DGMTI)
 D CLEAR^VALM1
 D ADD^EASECED(DFN,DGANS,$S($G(DGMTI):$P(^DGMT(408.31,DGMTI,0),U),1:DT))
 S PERSON=DGPRI
 I DGFL=-1!(DGFL=-2) G ADDEPQ
 D INIT^EASECDEP
 I $G(DGMTI) D
 .N CNT
 .S CNT=0
 .F  S CNT=$O(DGDEP(CNT)) Q:'CNT  I $P(DGDEP(CNT),U,20)=PERSON D
 ..D ADD^EASECDP2(DFN,DGDEP(CNT),DGMTI)
 ..D EDITD^EASECDP2(DFN,DGDEP(CNT),CNT,DGMTI)
ADDEPQ S VALMBCK="R"
 D INIT^EASECDEP
 K DGFL Q
 ;
EDITDEP ; Edit dependent demo
 ;
 S VALMBCK=""
 N DGSAVE1,DGSAVE2,DGMTD,DGBEG,I
 I $G(DGMTI),$G(DGMTACT)="VEW" W !,"Cannot edit when viewing a LTC copay test." H 2 G EDITDEPQ
 I '$D(DGMTI),$G(DGRPV)=1 W !,"Not while viewing" H 2 G EDITDEPQ
 S I=0 F  S I=$O(DGDEP(I)) Q:'I!($G(DGBEG))  I $P(DGDEP(I),U,2)'="SELF",$P(DGDEP(I),U,2)'="SPOUSE" S DGBEG=I
 S VALMBCK="",DGSAVE1=VALMBG,DGSAVE2=VALMLST,VALMBG=$S($G(DGBEG):DGBEG,1:0)
 S VALMLST=DGCNT D SEL^VALM2 S VALMBG=DGSAVE1,VALMLST=DGSAVE2 G EDITDEPQ:'$O(VALMY(0))
 N CTR S CTR=0 F  S CTR=$O(VALMY(CTR)) Q:'CTR  D
 .D EDITC(DFN,DGDEP(CTR),CTR,$G(DGMTI))
EDITDEPQ S VALMBCK="R"
 K DGDEP D INIT^EASECDEP
 Q
 ;
EDITC(DFN,DGDEP,DGW,DGMTI) ; Edit
 N DA,DR,DIE,DGMTDT,DEP,DGSAVE
 S DGMTDT=$S($G(DGMTI):$P(^DGMT(408.31,+DGMTI,0),U),1:DT)
 I $G(DGMTI),$G(DGMTACT)="VEW" W !,"Cannot edit when viewing a LTC copay test." H 2 G EDITCQ
 S DEP=$S($G(DGMTI):"C",1:"D"),DGSAVE=DGDEP
 D GETREL^DGMTU11(DFN,DEP,$S($G(DGMTDT):DGMTDT,1:DT),$G(DGMTI))
 S DGDEP=DGSAVE
 N CNTR
 S CNTR=0
 F  S CNTR=$O(DGREL(DEP,CNTR)) Q:'CNTR  I $P(DGDEP,U,20)=+DGREL(DEP,CNTR) D
 .D EDIT^EASECED(DGREL(DEP,CNTR),DEP)
EDITCQ ;
 K ^TMP("DGMTEP",$J)
 Q