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

AGEDMCD1.m

Go to the documentation of this file.
AGEDMCD1 ; IHS/ASDS/TPF - NEW EDIT/DISP MCD SCREEN - CODE OVERFLOW ;    
 ;;7.1;PATIENT REGISTRATION;**1,2**;JAN 31, 2007
 ;
HDR ;EP - CALLED BY AGEDMCD
 S AGPAT=$P($G(^DPT(DFN,0)),U)
 S AGCHRT=$S($D(^AUPNPAT(DFN,41,DUZ(2),0)):$P($G(^AUPNPAT(DFN,41,DUZ(2),0)),U,2),1:"xxxxx")
 S AG("AUPN")=""
 S:$D(^AUPNPAT(DFN,0)) AG("AUPN")=^(0)
 S AGLINE("-")=$TR($J(" ",78)," ","-")
 S AGLINE("EQ")=$TR($J(" ",78)," ","=")
 S $P(AGLINE("PGLN"),"=",81)=""
 W $$S^AGVDF("IOF"),!
 S ROUTID=$P($T(+1)," ")
 S SUBS=$P($G(AGSELECT),U,11)
 D PROGVIEW^AGUTILS(DUZ,SUBS)
 W "IHS REGISTRATION ",$S($D(AGSEENLY):"VIEW SCREEN",1:"EDITOR")
 W ?36,"MEDICAID"
 W ?80-$L($P($G(^DIC(4,DUZ(2),0)),U)),$P($G(^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 ELIG STAT
 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")
 W !,?3,"NUMBER",?22,"(updated)",?39,"ELIG DATE",?53,"COVERAGE",?64,"ELIG END"
 W !,AGLINE("-")
 S DA=DFN
 K AG("EDIT")
 Q
GETDATES(WD0) ;EP - GET THE DTS USING LIST^DIC
 S FLAGS=""
 S FIELDS=";.01I;.02I;.03I"
 D LIST^DIC(9000004.11,","_WD0_",",FIELDS,FLAGS,"*",,,,,,"RESULT","ERROR")
 D DATESORT(.RESULT)
 Q
DATESHOW(RESULT) ;
 N REC
 S REC=0
 F  S REC=$O(RESULT("DILIST","ID",REC)) Q:'REC  D
 . I REC'=1 W !
 . S Y=RESULT("DILIST","ID",REC,.01) X ^DD("DD")
 . W ?39,Y
 . W ?59,RESULT("DILIST","ID",REC,.03)
 . S Y=RESULT("DILIST","ID",REC,.02) X ^DD("DD")
 . W ?71,Y
 . W ?79,$S($$ISACTIVE^AGINS(RESULT("DILIST","ID",REC,.01),RESULT("DILIST","ID",REC,.02)):"A",1:"I")
DATESORT(RESULT) ;EP - TAKE LIST RETURNED BY FILE^DIC AND SORT IT
 ;BASED ON SPECS
 N DATESORT,SPECSUB,EFFDT,ENDDT,CVG
 S REC=0
 F  S REC=$O(RESULT("DILIST","ID",REC)) Q:'REC  D
 .S ENDDT=RESULT("DILIST","ID",REC,.02)
 .S EFFDT=RESULT("DILIST","ID",REC,.01)
 .S CVG=RESULT("DILIST","ID",REC,.03)
 .S SPECSUB=$S(ENDDT="":"O",1:"T")  ;O=OPEN ENDED, T=TERM DATE
 .I SPECSUB="O" S DATESORT(SPECSUB,EFFDT)=ENDDT_U_CVG
 .E  S DATESORT(SPECSUB,-ENDDT)=EFFDT_U_CVG
 S DEFEDDT=$O(DATESORT("O",""))  ;GET DEFAULT EDIT DT. FIRST ONE IN DISP
 I DEFEDDT="" S DEFEDDT=$O(DATESORT("T","")) S:DEFEDDT'="" DEFEDDT=$P(DATESORT("T",DEFEDDT),U)
 D SHOWNEW(.DATESORT)
 Q
SHOWNEW(DATESORT) ;EP
 N SPECSUB,DATE,DATE1,CVG,EFFDT,ENDDT,REC
 S SPECSUB=""
 S REC=1
 I '$D(DATESORT("O")) F  S SPECSUB=$O(DATESORT(SPECSUB)) Q:SPECSUB=""  D ALLTERM Q
 F  S SPECSUB=$O(DATESORT(SPECSUB)) Q:SPECSUB=""  D
 .S DATE=""
 .F  S DATE=$O(DATESORT(SPECSUB,DATE)) Q:DATE=""  D
 ..S DATE1=$P(DATESORT(SPECSUB,DATE),U)
 ..S CVG=$P(DATESORT(SPECSUB,DATE),U,2)
 ..I SPECSUB="O" S EFFDT=DATE,ENDDT=""
 ..E  S EFFDT=DATE1,ENDDT=-DATE
 ..I REC'=1 W !
 ..S Y=EFFDT X ^DD("DD")
 ..W ?39,Y
 ..W ?57,CVG
 ..S Y=ENDDT X ^DD("DD")
 ..W ?64,Y
 ..W ?79,$S($$ISACTIVE^AGINS(EFFDT,ENDDT):"A",1:"I")
 ..S REC=REC+1
 Q
ALLTERM ;EP
 S DATE=""
 F  S DATE=$O(DATESORT(SPECSUB,DATE),-1) Q:DATE=""  D
 .S DATE1=$P(DATESORT(SPECSUB,DATE),U)
 .S CVG=$P(DATESORT(SPECSUB,DATE),U,2)
 .I SPECSUB="O" S EFFDT=DATE,ENDDT=""
 .E  S EFFDT=DATE1,ENDDT=-DATE
 .I REC'=1 W !
 .S Y=EFFDT X ^DD("DD")
 .W ?39,Y
 .W ?57,CVG
 .S Y=ENDDT X ^DD("DD")
 .W ?64,Y
 .W ?79,$S($$ISACTIVE^AGINS(EFFDT,ENDDT):"A",1:"I")
 .S REC=REC+1
 Q