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

AGEDBEH.m

Go to the documentation of this file.
AGEDBEH ; IHS/ASDS/TPF - EDIT/DISPLAY BENEFITS COORDINATOR - SPEND DOWN INFORMATION SCREEN ;    
 ;;7.1;PATIENT REGISTRATION;**2**;JAN 31, 2007
 ;
 ;RD0 AND RD1 WILL BE THE IENS NEEDED TO DISP THE BEN COORD SPEND DOWN INFO WHICH WAS
 ;CHOSEN FROM THE BEN COORD CASE SCREEN (^AGEDBEB)
EN(RD0,RD1,NEWENTRY,CASEPTR) ;EP -
 ;IF ITS A NEW ENTRY THEN DISP THE SCREEN, DISP A MSG, THEN CALL
 ;THE EDITS TO FIELDS APPROPRIATE FOR ADDING A NEW ENTRY
 I NEWENTRY D DRAW,WMSG,NEWENTRY I $G(Y)<0 W !,"Entry not made." H 2 D END Q
 S NEWENTRY=0
 ;BELOW ASKS SEQUENCE OF QUESTIONS
 ;IF REQUESTED
 ;CASEPTR IS THE BACKWARD PTR TO THE 'DATE ASSIGNED' SUBSCRIPT FOR THE CASE
 ;THIS SPEND DOWN INFORMATION IS ASSOCIATED WITH.
 ;
VAR D DRAW
 W !,AGLINE("EQ")
 I $D(MYERRS("C","E")),(Y'?1N.N),(Y'="E") W !,"ERRORS ON THIS PAGE. PLEASE EDIT BEFORE EXITING!!" H 3 G VAR
 Q:Y=$G(AGOPT("ESCAPE"))
 K DIR
 I '$D(AGSEENLY) D
 .S DIR("A")="Change which item (1-"_AG("N")_") OR <A>dd a new Date Expense Requested"
 I $D(AGSEENLY) D
 .S DIR("A")="Press return to continue"
 D READ^AGED1
 I $D(AGSEENLY) Q
 G END:$D(DLOUT)!(Y["N")!$D(DUOUT),VAR:$D(AG("ERR"))
 Q:$D(DFOUT)!$D(DTOUT)
 ;DO RTN'S TO ADD ENTRY
 I $G(Y)="A" D ADDEXPRQ G VAR
 I $D(DQOUT)!(+Y<1)!(+Y>AG("N")) W !!,"You must enter a number from 1 to ",AG("N")," or enter <A> to add a new 'DATE EXPENSE REQUESTED'" H 3 G VAR
 Q:'$D(Y)
 S AGY=Y
 F AGI=1:1 S AG("SEL")=+$P(AGY,",",AGI) Q:AG("SEL")<1!(AG("SEL")>AG("N"))  D @($P(AG("C"),",",AG("SEL")))
 I AGY=1,'$D(^AUPNCHS(RD0,11,RD1)) D CLEAN(RD0) Q  ;THEY HAVE DELETED THE BEN. COORD. CASE DATE
 ;                                      THEY CHOSE TO ENTER THIS SCREEN. IT IS GONE
 ;                                      SO RETURN TO CLEANUP AND RETURN TO PREVIOUS SCREEN
 D CLEAN(RD0) I '$D(^AUPNCHS(RD0)) Q
 D UPDATE1^AGED(DUZ(2),DFN,3,"")
 K AGI,AGY
 G VAR
CLEAN(AD0) ;CLEAN EMPTY RECORD. IF NO SPEND DOWN REFERRED DTS HAVE BEEN
 ;ENTERED THEN THE RECORD IS MEANINGLESS
 ;
 ;CHECK HERE TO SEE IF ENTRIES HAVE ACTUALLY BEEN ENTERED. IF NOT
 ;CLEAR THE RECORD SINCE NOTHING REALLY EXISTS IN THIS RECORD
 I $O(^AUPNCHS(AD0,11,0))="" D
 .D CLEANZER(AD0)
 .W !,"RECORD DELETED!" H 3
 Q
CLEANZER(AD0) ;EP
 K DIK,DA
 S DIK="^AUPNCHS(",DA=AD0 D ^DIK
 Q
END ;CLEAN UP THE VARS
 K DLOUT,DTOUT,DFOUT,DQOUT,DA,DIC,DR,AGSCRN,Y,ADA,WDA,ADT,WDT,ADFN,WDFN,REC,NEWENTRY
 K CHOICES
 Q
DRAW ;EP
 K CHOICES
 S ROUTID=$P($T(+1)," ")
 S AG("PG")="5BEB"
 D ^AGED
 D GETAW
 Q
GETAW ;DISP
 K AG("C")
 S VD0=RD0
 F AG=1:1 D  Q:$G(AGSCRN)[("*END*")
 . S AGSCRN=$P($T(@1+AG),";;",2,15)
 . Q:AGSCRN[("*END*")
 . S CAPTION=$P(AGSCRN,U)  ;FLD CAP
 . I $E(CAPTION)="-" W !,$E(CAPTION,2,199) Q  ;- DENOTES SECTION
 . S DIC=$P(AGSCRN,U,3)    ;FILE OR SUBFILE #
 . S VDR=$P(AGSCRN,U,4)      ;FLD #
 . S NEWLINE=$P(AGSCRN,U,5)  ;NEWLINE OR INDENT
 . S CAPDENT=$P(AGSCRN,U,2)   ;CAP INDENT
 . S ITEMNUM=$P(AGSCRN,U,6)   ;ITEM #
 . S TAGCALL=$P($P(AGSCRN,U,7),"|")   ;TAG TO CALL TO EDIT THIS FLD
 . S EXECUTE=$P(AGSCRN,"|",2)      ;USE TO DISP FLD WHICH IS DEPENDENT ON ANOTHER FLD
 . S PREEXEC=$P(AGSCRN,"|",3)     ;PLACE CODE TO BE XECUTED PRIOR TO DISP OF THE FLD
 . S PRECAPEX=$P(AGSCRN,"|",4)   ;PLACE CODE TO EXECUTE BEF CAP/FLD LBL
 . S POSTEXEC=$P(AGSCRN,"|",5)    ;PLACE CODE HERE TO BE EXECUTED AFT DISP OF THE FLD
 . S:TAGCALL'="" $P(AG("C"),",",ITEMNUM)=TAGCALL   ;SELECTION STRING
 . W:ITEMNUM'=3 @NEWLINE
 . W:ITEMNUM'=3 ITEMNUM
 . W:ITEMNUM'=3 $S(ITEMNUM'="":". ",1:"")
 . I PRECAPEX="" W @CAPDENT,$S($G(CAPTION)'="":CAPTION_": ",$G(CAPTION)="":"",1:$P($G(^DD(DIC,DR,0)),U)_": ")
 . I PRECAPEX'="" X PRECAPEX I $T W @CAPDENT,$S($G(CAPTION)'="":CAPTION_": ",$G(CAPTION)="":"",1:$P($G(^DD(DIC,DR,0)),U)_": ")
 .;IF EDITING DISP DATA ONLY
 .;E DISPLAY ONLY THE CAPS
 .I 'NEWENTRY D
 .. S D0=RD0
 .. I DIC'["." S D0=D0_","
 .. E  S D0=RD1_","_D0_","
 .. ;LOOP TO HANDLE MULTIPLE DR'S FOR ONE CAP
 .. I DIC=9000047.11 D
 ... S D0=D0_","
 ... N PIECE
 ... F PIECE=1:1 S DR=$P(VDR,";",PIECE) Q:DR=""  D
 .... I $P(PREEXEC,";",PIECE)'="" X $P(PREEXEC,";",PIECE) Q:'$T
 .... I $P(EXECUTE,";",PIECE)="" D
 ..... W $$GET1^DIQ(DIC,D0,DR)
 .... I $P(EXECUTE,";",PIECE)'="" S D0=$TR(D0,",") X $P(EXECUTE,";",PIECE)
 .... I $P(POSTEXEC,";",PIECE)'="" X $P(POSTEXEC,";",PIECE)
 ...K PIECE
 ..I DIC=9000047.1101 D
 ... D SPDDOWN Q
 ... S D0=D0_","
 ... N PIECE
 ... F PIECE=1:1 S DR=$P(VDR,";",PIECE) Q:DR=""  D
 .... I $P(PREEXEC,";",PIECE)'="" X $P(PREEXEC,";",PIECE) Q:'$T
 .... I $P(EXECUTE,";",PIECE)="" D
 ..... I DR=.03 W $J($$GET1^DIQ(DIC,D0,DR),6,2)
 ..... E  W $$GET1^DIQ(DIC,D0,DR)
 .... I $P(EXECUTE,";",PIECE)'="" S D0=$TR(D0,",") X $P(EXECUTE,";",PIECE)
 .... I $P(POSTEXEC,";",PIECE)'="" X $P(POSTEXEC,";",PIECE)
 ...K PIECE
 S AG("N")=ITEMNUM-1
 W !,$G(AGLINE("-"))
 K MYERRS,MYVARS
 D FETCHERR^AGEDERR(AG("PG"),.MYERRS)
 S MYVARS("DFN")=DFN,MYVARS("FINDCALL")="",MYVARS("SELECTION")=$G(AGSELECT),MYVARS("SITE")=DUZ(2)
 D EDITCHEK^AGEDERR(.MYERRS,.MYVARS,1)
 D VERIF^AGUTILS
 Q
SPDDOWN ;EP
 S SPDDOWN=0
 F  S SPDDOWN=$O(^AUPNCHS(RD0,11,RD1,11,SPDDOWN)) Q:'$G(SPDDOWN)  D
 .S SPDDATA=$G(^AUPNCHS(RD0,11,RD1,11,SPDDOWN,0))
 .S CHOICES(ITEMNUM)=RD0_U_RD1_U_SPDDOWN
 .S Y=$P(SPDDATA,U) X ^DD("DD") S REQDT=Y
 .W !,ITEMNUM,".",?5,REQDT,?25,$J($P(SPDDATA,U,3),8,2),?45,$P(SPDDATA,U,2)
 .S $P(AG("C"),",",ITEMNUM)="EDEXPREQ"
 .S ITEMNUM=ITEMNUM+1
 Q
WMSG ;DISP THIS MSG IF THERE IS NO ENTRY FOUND IN SPEND DOWN INFORMATION FILE
 W !,"You must first enter a SPEND DOWN REFERRAL DATE"
 Q
 ;;;;;;;;;;;;;;;;;;;;;;;;
 ; EDIT SPEND DOWN REFERRAL FLDS
 ;;;;;;;;;;;;;;;;;;;;;;;;
NEWENTRY ;NEW ENTRY
 W !!
 K DIC,DIE,DR,DA
 S DIC="^AUPNCHS("
 S DIC(0)="L"
 S X="`"_DFN
 S DIC("S")="I $G(Y)'=TEMPDFN"
 S TEMPDFN=DFN
 D ^DIC
 S DFN=TEMPDFN
 Q:+Y'>0
 S RD0=+Y
 S NEWENTRY=0
NEWAPPDT ;
 K DIC,DIE,DR,DA
 S DA(1)=RD0
 S DIC="^AUPNCHS("_DA(1)_",11,"
 S DIC(0)="ALEMQ"
 S DIC("S")="I $P(^(0),U,5)=CASEPTR"
 K DD,DO
 D ^DIC
 Q:+Y'>0
 S RD1=+Y
 D STUFCASE(RD0,RD1,CASEPTR)
 D ADDEXPRQ
 Q
STUFCASE(RD0,RD1,CASEPTR) ;EP
 K DIC,DIE,DR,DA,DIR
 S DA(1)=RD0
 S DA=RD1
 S DIE="^AUPNCHS("_DA(1)_",11,"
 S DR=".05////^S X=CASEPTR"
 D ^DIE
 Q
EDREFDT ;EDIT THE DT REFERRED
 K DIC,DR,DIE,DA,DD,DO
 S DA=RD1
 S DA(1)=RD0
 S DIE="^AUPNCHS("_DA(1)_",11,"
 S DR=".01"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
EDACT ;EDIT THE ACTION TAKEN
 I '$O(^AUPNCHS(RD0,11,RD1,11,0)) D ADDEXPRQ
 K DIC,DR,DIE,DA,DD,DO
 S DA(2)=RD0
 S DA(1)=RD1
 S DA=RD2
 S DIE="^AUPNCHS("_DA(2)_",11,"_DA(1)_",11,"
 S DR=.02
 D ^DIE
 K DIC,DR,DIE,DA
 Q
EDSPDD ;EDIT SPEND DOWN
 I '$O(^AUPNCHS(RD0,11,RD1,11,0)) D ADDEXPRQ
 K DIC,DR,DIE,DA,DD,DO
 S DA(2)=RD0
 S DA(1)=RD1
 S DA=RD2
 S DIE="^AUPNCHS("_DA(2)_",11,"_DA(1)_",11,"
 S DR=.03
 D ^DIE
 K DIC,DR,DIE,DA
 Q
EDEXPREQ ;EDIT THE DT EXPENSE REQUESTED
 I '$O(^AUPNCHS(RD0,11,RD1,11,0)) D ADDEXPRQ
 K DIC,DR,DIE,DA,DD,DO
 I $D(CHOICES) D
 .S (DA(2),RD0)=$P(CHOICES(AGY),U)
 .S (DA(1),RD1)=$P(CHOICES(AGY),U,2)
 .S (DA,RD2)=$P(CHOICES(AGY),U,3)
 S DA=RD2
 S DIE="^AUPNCHS("_RD0_",11,"_RD1_",11,"
 S DR=.01
 D ^DIE
 K DIC,DR,DIE,DA
 D EDACT
 D EDSPDD
 Q
ADDEXPRQ ;EP - ADD DATE EXPENSE REQUESTED
 K DIC,DIE,DR,DA,DO,DD,DIQ
 S DA(2)=RD0
 S DA(1)=RD1
 S DIC="^AUPNCHS("_DA(2)_",11,"_DA(1)_",11,"
 S DIC(0)="ALE"
 K DD,DO
 D ^DIC
 Q:+Y'>0
 S RD2=+Y
 D EDACT
 D EDSPDD
 Q
EDREFTO ;EDIT THE REFERED TO FACILITY
 K DIC,DR,DIE,DA,DD,DO
 S DA=RD1
 S DA(1)=RD0
 S DIE="^AUPNCHS("_DA(1)_",11,"
 S DR=".02"
 D ^DIE
 K DIC,DR,DIE,DA
 Q
 ; ****************************************************************
 ; ON LINES BELOW:
 ; U "^" DELIMITED
 ; AGSCRN CONTAINS THE $TEXT OF EACH LINE BELOW STARTING AT TAG '1'
 ; PIECE  VAR       DESC
 ; -----  --------  -----------------------------------------------
 ; 1      CAPTION    FLD CAP ASSIGNED BY PROGRAMMER OVERRIDES FLD LBL IF POPULATED
 ; 2      CAPDENT    POSITION ON LINE TO DISP CAP
 ; 3      DIC        FILE OR SUBFILE #
 ; 4      DR         FLD # - THESE CAN BE SEPARATED BY ";" THIS ALLOWS
 ;                   MULTIPLE FLDS TO BE PRINTED WITH THE SAME CAP AS IN
 ;                   'CITY,STATE,ZIP'
 ; 5      NEWLINE    NEW LINE OR NOT (MUST BE EITHER A '!' OR '?#')
 ;                   USE THIS TO INDENT THE LINE
 ; 6      ITEMNUM    ITEM # ASSIGNMENT. USE THIS TO ASSIGN THE ITEM #
 ;                   USED TO ALLOW USER TO CHOOSE THIS FLD TO EDIT
 ; 7      TAGCALL    TAG TO CALL WHEN THIS FLD IS CHOSEN BY USER TO BE EDITED
 ;
 ; BAR "|" DELIMITED
 ; PIECE  VAR        DESC
 ; -----  --------   ----------------------------------------------
 ; 2      EXECUTE    EXECUTE CODE TO GET FLD THAT ANOTHER IS POINTING TO.
 ;                   EXECUTED AFT FLD PRINT. IF MUTLIPLE FLDS ARE PRINTED
 ;                   THEN MULTIPLE EXECUTE CODES CAN BE SEPARATED BY ";".
 ; 3      PREEXEC    EXECUTE CODE TO DO BEF FLD PRINTS. USE TO SCREEN OUT
 ;                   PRINTING A FLD VALUE. FOR MULTIPLES SEPARATE BY ";"
 ; 4      PRECAPEX   EXECUTE CODE TO DO BEF PRINTING THE CAP OR FLD LBL.
 ;                   USE TO SCREEN OUT PRINTING A CAP/FLD LBL
 ; 5      POSTEXEC   EXECUTE CODE TO DO AFT PRINTING THE FLD DATA
 ;                   FOR MULTIPLES SEPARATE BY ";"
 ;^?0^9000044.11^.01;.02;.03;.12;.07^!^^||W "REFERRED TO BEN. COORD.: ";W ?45,"to ";W ?72,"by ";W !?10,"Reason: ";W ?60,"Status: "
1 ;
 ;;-                 BENEFITS COORDINATION - SPEND DOWN INFORMATION DATA
 ;;----SPEND DOWN INFORMATION--------------------------------------------------------
 ;;Date Referred^?0^9000047.11^.01^!^1^EDREFDT
 ;;Facility Referred to^?0^9000047.11^.02^!^2^EDREFTO
 ;;-
 ;;----DATE EXPENSE REQ'D-----SPEND DOWN---------ACTION TAKEN----------------------
 ;;^?0^9000047.1101^.03^?0^3^
 ;;*END*
 ;;Spend Down^?0^9000047.1101^.03^!^3^EDSPDD
 ;;Date Expense Requested^?0^9000047.1101^.01^?40^4^EDEXPREQ
 ;;Action Taken^?0^9000047.1101^.02^!^5^EDACT
 ;;*END*