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

AGED5.m

Go to the documentation of this file.
AGED5 ; IHS/ASDS/EFG -EDIT PAGE 5 (mcd) ;    
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
OPTION ;
 Q:AGOPT(4)'="Y"&$D(AGSEENLY)
 I AGOPT(4)'="Y" G END
VAR ;EP
 S AG("PG")=5
 I '$D(AGSEENLY)  D
 . I $D(AGADDINS),AGADDINS="E" G HDR
 . S AG("EDIT")="" D ADDNEW^AG5 Q
 Q:$D(DTOUT)!$D(DUOUT)!$D(DFOUT)!$D(DLOUT)
 I $D(AGDELETE) K AGDELETE Q
HDR ;
 I $P($G(^AUPNMCD(AGELPTR,0)),U,4)="" S AG("STPTR")="" D STATE^AG5 K AG("STPTR")
 W $$S^AGVDF("IOF"),!
 W "IHS REGISTRATION ",$S($D(AGSEENLY):"VIEW SCREEN",1:"EDITOR")
 W ?36,"MEDICAID"
 W ?80-$L($P(^DIC(4,DUZ(2),0),U)),$P(^DIC(4,DUZ(2),0),U)
 S AGLINE("-")=$TR($J(" ",80)," ","-")
 S AGLINE("EQ")=$TR($J(" ",80)," ","=")
 W !,AGLINE("EQ")
 W !,$E(AGPAT,1,23)
 W ?23,$$DTEST^AGUTILS(DFN)
 I $D(AGCHRT) W ?42,"HRN#:",AGCHRT
 ;GET ELIGIBILITY STATUS
 S AGELSTS=$P($G(^AUPNPAT(DFN,11)),U,12)
 W ?56,"(",$S(AGELSTS="C":"CHS & DIRECT",AGELSTS="I":"INELIGIBLE",AGELSTS="D":"DIRECT ONLY",AGELSTS="P":"PENDING VERIFICATION",1:"NONE"),")"
 W !,AGLINE("EQ")
 K AG("EDIT")
 K DIR,DA,D0,AG("MCD")
 G L2:$D(^AUPNMCD("AB",DFN))
 Q:$D(AGSEENLY)
 W !!
 S DIR("A")="Do you wish to add MEDICAID? (Y/N) NO// "
 D READ^AGED1
 K DIR
 G END:$D(DLOUT)!(Y["N")!$D(DUOUT),VAR:$D(AG("ERR"))
 G:$D(AG("ED"))&'$D(AGXTERN) @("^AGED"_AG("ED"))
 Q:$D(DTOUT)!$D(DFOUT)  I $D(DQOUT)!(Y'["Y") D YN^AG H 2 G VAR
 I '$D(^AUPNMCD("AB",DFN)) D
 . S AG("EDIT")=""
 . D ADDNEW^AG5
 . G VAR
L2 K AG("TOT")
 S (AG("TOT"),AG("STATE"))=0
 W !?3,"STATE   NUMBER"
 W ?27,"(updated)     ELIG DATE     COVERAGE     ELIG END"
 W !,AGLINE("-")
L3 S AG("STATE")=$P($G(^AUPNMCD(AGELPTR,0)),U,4)
 G L4:AG("STATE")=""
 S AG("TOT")=1
L3A W !,"1.",?4,$P($G(^DIC(5,AG("STATE"),0)),U,2),?9,$P($G(^AUPNMCD(AGELPTR,0)),U,3)
 I $D(^AUPNMCD(AGELPTR,0)),$P($G(^AUPNMCD(AGELPTR,0)),U,8)]"" D
 . S Y=$P($G(^AUPNMCD(AGELPTR,0)),U,8)
 . D DD^%DT
 . W ?25,"(",Y,")"
L3B S DIC=9000004.11,DA=AGELPTR
 F AG("I")=1:1 Q:$D(AG("LKERR"))  D
 .S DR=.01,AG("DRENT")=AG("I")
 .D ^AGDICLK
 .Q:$D(AG("LKERR"))
 .W ?37,"2. "
 .W:AG("I")>1 !
 .W ?40,AG("LKPRINT"),?58,$P(@AGL,U,3)
 .S DR=.02,AG("DRENT")=AG("I")
 .D ^AGDICLK
 .W:$D(AG("LKPRINT")) ?66,AG("LKPRINT")
 S DA=AGELPTR,DIC=9000004,DR=2101
 D ^AGDICLK
 W !!,"3. ","MEDICAID NAME: ",$G(AG("LKPRINT"))
 S DA=DFN,DIC=2,DR=.03
 D ^AGDICLK
 S AGDOB="UNKNOWN"
 I $D(AG("LKPRINT")),AG("LKPRINT")]"" S AGDOB=AG("LKPRINT")
 S DA=AGELPTR,DIC=9000004,DR=2102
 D ^AGDICLK
 I $D(AG("LKPRINT")),AG("LKPRINT")="" S AG("LKPRINT")=AGDOB
 I '$D(AG("LKPRINT")) S AG("LKPRINT")=AGDOB
 K AGDOB
 W ?44,"4. ","MED. DATE OF BIRTH: ",AG("LKPRINT")
 S DA=AGELPTR,DIC=9000004,DR=.14
 D ^AGDICLK
 W !,"5. ","PRIM CARE PROV: ",AG("LKPRINT")
 ;ADD GROUP NAME AND #
 W !,"6. ","GROUP NAME: ",?44,"GROUP NUMBER: "
 S DIQ="AG(",DIQ(0)="E"
 S DIC="^AUPNMCD(",DR=".11;.12"
 D EN^DIQ1
 K DIQ
 W !,"7. ","PLAN NAME: ",AG(9000004,DA,.11,"E")
 W !,"8. ","RATE CODE: ",AG(9000004,DA,.12,"E")
 S DIC=9000004
 S DA=AGELPTR,DR=.15
 D ^AGDICLK
 W !,"9. ","CC ON FILE: ",AG("LKPRINT")
 I $G(AG("LKPRINT"))'="" D
 .S DIC=9000004
 .S DA=AGELPTR,DR=.16
 .D ^AGDICLK
 .W ?28,"DATE: ",AG("LKPRINT")
 W !,AGLINE("-")
 D VERIF^AGUTILS
 W !,AGLINE("EQ")
L4 ;
 I $D(AGSEENLY) D ^DIR,READ^AGED1 G END
 I $D(^XUSEC("AGZMGR",DUZ))  D
 .S DIR("A")="ENTER ACTION (<E>dit Data,<D>elete):"
 I '$D(^XUSEC("AGZMGR",DUZ))  D
 .S DIR("A")="ENTER ACTION (<E>dit Data):"
 D READ
 I $D(^XUSEC("AGZMGR",DUZ))&(Y="D") G DELETE
 G:$D(AG("ED"))&'$D(AGXTERN) @("^AGED"_AG("ED"))
 G L6:Y?1"Y".E,END:$D(DLOUT)!(Y?1"N".E)!$D(DTOUT)!$D(DUOUT)!$D(DIROUT)
 Q:$D(DFOUT)!$D(AG("EDIT"))
 I Y?1U&("EA"[Y) G L6:Y="A",EDIT
 G L4:Y'="E"!(Y'="A")!(Y'="D")
 W *7 G VAR
L6 S AG("EDIT")=""
 G VAR
DELETE S:AG("TOT")=1 Y=1
 S DIR("A")="Are you sure you want to DELETE this record ? (Y/N) "
 S DIR(0)="Y"
 S DIR("B")="NO"
 D ^DIR
 I Y'=1 K DIR G END
 G DELETE1:AG("TOT")=1
DELETE1 S AG("SUBSCRPT")="MCD0",AGNXTSUB="MCD1"
 D NOW^%DTC
 S AGDTS=%
 I $D(^AGPATCH(AGDTS,DUZ(2),DFN,"MCD1")) D
 . F AGZ("I")=1:1 Q:AGNXTSUB=""  D
 .. S AG("SUBSCRPT")=AGNXTSUB
 .. S AGNXTSUB=$O(^AGPATCH(AGDTS,DUZ(2),DFN,AGNXTSUB))
 S AG("SUBSCRPT")="MCD"_($E(AG("SUBSCRPT"),4,6)+1)
 S DA=$O(^AUPNMCD(AGELPTR,11,0))
 S:'$D(^AGPATCH(AGDTS,DUZ(2),DFN)) ^(DFN)=""
 S ^AGPATCH(AGDTS,DUZ(2),DFN,AG("SUBSCRPT"))="MCAID^"_$P(^AUPNMCD(AGELPTR,0),U,3,4)
 I DA]"" D
 . S ^AGPATCH(AGDTS,DUZ(2),DFN,AG("SUBSCRPT"))=^AGPATCH(AGDTS,DUZ(2),DFN,AG("SUBSCRPT"))_U_^AUPNMCD(AGELPTR,11,DA,0)
 . S:$P(^AUPNMCD(AGELPTR,11,DA,0),U,2)="" $P(^AGPATCH(AGDTS,DUZ(2),DFN,AG("SUBSCRPT")),U,5)=DT
 K AGNXTSUB,AG("SUBSCRPT")
 S DA=AGELPTR,DR=".01///@",DIE="^AUPNMCD(" D ^DIE W !!!,"The account is deleted.",!,"Press RETURN to continue..." R X:DTIME
 S AGDELETE="" Q
EDIT ;
 K DIR
EDIT1 ;
 S AG("MCD")=AGELPTR
 S AG("STATE")=$P(^AUPNMCD(AG("MCD"),0),U,4)
 S AG("MNUM")=$P(^AUPNMCD(AG("MCD"),0),U,3)
 G EDIT^AGED51
END I $D(DTOUT) S AGTOUT=""
 K AG,DA,DIC,DR,DRENT,AG("DRENT1")
 K AGL,AG("LKDATA"),AG("LKERR"),AG("LKPRINT"),AGNUM,AG("STATE")
 K AG("MCD")
 K Y,AGDTS
 Q:$D(AGXTERN)
 I $D(DIROUT)!$D(DUOUT) K DIROUT,DUOUT Q
 Q
READ ;
 K DFOUT,DTOUT,DUOUT,DQOUT,DLOUT,DIROUT
 S DIR(0)="FO"
 D ^DIR
 Q:$D(DTOUT)
 S:Y="/.,"!(Y="^^") DFOUT=""
 S:Y="" DLOUT=""
 S:Y="^" (DUOUT,Y)=""
 S:Y?1"?".E!(Y["^") (DQOUT,Y)=""
 Q
UPDATE ;EP
 S DA=AG("MCD")
 S DR=".08///"_DT
 S DIE="^AUPNMCD("
 D ^DIE
 D UPDATE1^AGED(DUZ(2),DFN,5,DA)
 Q