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

AGEDBED.m

Go to the documentation of this file.
AGEDBED ; IHS/ASDS/TPF - EDIT/DISPLAY BENEFITS COORDINATOR - PATIENT APPLICATIONS SCREEN ;    
 ;;7.1;PATIENT REGISTRATION;;AUG 25,2005
 ;
 ;AD0 AND AD1 WILL BE THE IENS NEEDED TO DISP THE 'PATIENT'S APPLICATIONS'
 ;WHICH WAS CHOSEN FROM THE BENEFIT CASE SCREEN (^AGEDBEB)
 ;CASEPTR IS THE BACKWARD PTR TO THE 'DATE ASSIGNED' SUBSCRIPT FOR THE CASE
 ;THIS PAT. APPLICATION IS ASSOCIATED WITH.
EN(AD0,AD1,NEWENTRY,CASEPTR) ;EP -
 ;IF ITS A NEW ENTRY THEN DISP THE SCREEN,DISP A MESSAGE AND THEN
 ;CALL THE EDITS TO FLDS APPROPRIATE FOR ADDING A NEW ENTRY
 ;BELOW ASKS SEQUENCE OF QUESTIONS AS REQUESTED BY BUSINESS GROUP
 S EXIT=0
 I NEWENTRY D  Q:EXIT  S NEWENTRY=0
 .D DRAW,WMSG,NEWENTRY I $G(Y)<0 W !,"No entry made" H 2 S EXIT=1 Q
 .D APPTYPE
 .D APPSTAT
 .D APPPERS
VAR D DRAW
 W !,AGLINE("EQ")
 K DIR
 I '$D(AGSEENLY) D
 .S DIR("A")="Change which item (1-"_AG("N")_") OR Add <A>pplication Submission information"
 I $D(AGSEENLY) D
 .S DIR("A")="Enter item number to view"
 .S DIR="LO^4:"_AG("N")
 D READ^AGED1
 I $D(AGSEENLY),(+Y'>0) Q
 I $D(AGSEENLY),((Y<5)!(Y>AG("N"))) W !,"Enter a number between 5 and "_AG("N") H 2 G VAR
 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"))
 G END:$D(DLOUT)!(Y["N")!$D(DUOUT),VAR:$D(AG("ERR"))
 Q:$D(DFOUT)!$D(DTOUT)
 ;DO RTNS TO ADD ENTRY
 I $G(Y)="A" D @$S(Y="A":"EN^AGEDBEE("_AD0_","_AD1_","""",1)",1:"EN^AGEDBEE("_AD0_","_AD1_","""",1)") G VAR
 I $D(DQOUT)!(+Y<1)!(+Y>AG("N")),('$D(CHOICES(+Y))) W !!,"You must enter a number from 1 to ",AG("N"),!,"or 'A' to add application submission information." H 3 G VAR
 ;DEPENDING ON USER'S CHOICE ITEM MAY BE AN EDIT ON THIS SCREEN OR
 ;IT MAY BE A PATIENT APPLICATION SUBMISSION WHICH IS ON ^AGEDBEE
 I $D(CHOICES(+Y)) S DORTN="EN^AGEDBEE",PARAM1=$P(CHOICES(+Y),U,2),PARAM2=$P(CHOICES(+Y),U,3),PARAM3=$P(CHOICES(+Y),U,4) S DORTN=DORTN_"("_PARAM1_","_PARAM2_","_PARAM3_","_"0)" D @DORTN G VAR
 I $D(Y) D
 .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(^AUPNAPPS(AD0,11,AD1)) D CLEAN(AD0) Q  ;THEY HAVE DELETED THE DT APP. OBTAINED DT
 ;                                      THEY CHOSE TO ENTER THIS SCREEN. IT IS GONE
 ;                                      SO RETURN TO PREVIOUS SCREEN
 D CLEAN(AD0)
 D UPDATE1^AGED(DUZ(2),DFN,3,"")
 K AGI,AGY
 G VAR
CLEAN(AD0) ;CLEAN EMPTY RECORD. IF NO APPLICATION DATES 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(^AUPNAPPS(AD0,11,0))="" D
 .D CLEANZER(AD0)
 .W !,"RECORD DELETED!" H 3
 Q
CLEANZER(AD0) ;EP
 K DIK,DA
 S DIK="^AUPNAPPS(",DA=AD0 D ^DIK
 Q
END ;CLEAN UP THE VARS USED
 K DLOUT,DTOUT,DFOUT,DQOUT,DA,DIC,DR,AGSCRN,Y,ADA,WDA,ADT,WDT,ADFN,WDFN,REC,NEWENTRY
 Q
DRAW ;EP
 K CHOICES
 S AG("PG")="5BED"
 S ROUTID=$P($T(+1)," ")
 D ^AGED
 D GETAW
 Q
GETAW ;DISP
 K AG("C")
 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)="-" D CAPPARSE(CAPTION) Q  ;PARSE OUT CAP
 . S DIC=$P(AGSCRN,U,3)    ;FILE OR SUBFILE #
 . S DR=$P(AGSCRN,U,4)      ;FLD #
 . S SKIPEXEC=$P(AGSCRN,"|",6)  ;SKIP LOGIC. IF THIS IS TRUE WE
 . ;                             DON'T DEAL WITH THIS FLD AT ALL
 . I SKIPEXEC'="" X SKIPEXEC Q:$T
 . 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),"|",1)   ;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 @NEWLINE
 . W ITEMNUM
 . W $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 DISP ONLY THE CAPS
 .I 'NEWENTRY D
 .. S D0=AD0
 .. I DIC'["." S D0=D0_","
 .. E  S D0=AD1_","_D0_","
 .. ;LOOP TO HANDLE MULTIPLE DR'S FOR ONE CAP
 .. N PIECE
 .. S VDR=DR
 .. F PIECE=1:1 S DR=$P(VDR,";",PIECE) Q:DR=""  D
 ... I $P(PREEXEC,";",PIECE)'="" X $P(PREEXEC,";",PIECE)
 ... I $P(EXECUTE,";",PIECE)="" 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
 ..;LIST DATES OF SUBMITTED APPLICATIONS
 .. I DIC["9000045.1101"  D
 ... S ITEM=4   ;PREVIOUS SECTION'S ITEMS END AT 4
 ... S VD0=AD0
 ... S VD1=AD1
 ... I $G(VD1)="" S VD1="NOSUB"
 ... I '$D(^AUPNAPPS(VD0,11,VD1,1)) W !,"NO SUBMISSIONS MADE" Q
 ... S VD2=0
 ... F  S VD2=$O(^AUPNAPPS(VD0,11,VD1,1,VD2)) Q:'VD2  D
 .... S ITEM=ITEM+1
 .... S CHOICES(ITEM)=DIC_U_VD0_U_VD1_U_VD2
 .... S D0=VD2_","_VD1_","_VD0_","
 .... W !,ITEM_"."
 .... N PIECE
 .... F PIECE=1:1 S DR=$P(VDR,";",PIECE) Q:DR=""  D 
 ..... I $P(PREEXEC,";",PIECE)'="" X $P(PREEXEC,";",PIECE)
 ..... I $P(EXECUTE,";",PIECE)="" D
 ...... W $S(DR=.04!(DR=.03):$E($$GET1^DIQ(DIC,D0,DR),1,20),1:$$GET1^DIQ(DIC,D0,DR))
 ..... I $P(EXECUTE,";",PIECE)'="" X $P(EXECUTE,";",PIECE)
 ..... I $P(POSTEXEC,";",PIECE)'="" X $P(POSTEXEC,";",PIECE)
 ....K PIECE
 S AG("N")=$G(ITEM)
 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
CAPPARSE(CAPTION) ;EP - PARSE OUT THE CAP
 N LBRACKET,RBRACKET
 S LBRACKET="[",RBRACKET="]"
 I CAPTION'[LBRACKET W !,$E(CAPTION,2,199) Q  ;- DENOTES SIMPLE SECTION
 ;PARSE OUT AND INSERT FLD VALUES
 S FIELDS=$L(CAPTION,LBRACKET)
 W !,$E($P(CAPTION,LBRACKET),2,199)
 F PIECE=1:1:FIELDS D
 .S FIELD=$P($P(CAPTION,LBRACKET,PIECE),RBRACKET)
 .W $$GET1^DIQ($P(FIELD,";"),AD1_","_AD0_",",$P(FIELD,";",2))
 W $P(CAPTION,RBRACKET,2)
 K LBRACKET,RBRACKET
 Q
WMSG ;DISP THIS MSG IF THERE IS NO AUTHORIZATION DT FOUND
 W !,"WHEN WAS THE PATIENT'S APPLICATION OBTAINED?"
 Q
 ;;;;;;;;;;;;;;;;;;;;;;;;;
 ; EDIT AUTHORIZATION FLDS
 ;;;;;;;;;;;;;;;;;;;;;;;;;
NEWENTRY ;NEW ENTRY
 W !!
 K DIC,DIE,DR,DA
 S DIC="^AUPNAPPS("
 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 AD0=+Y
 S NEWENTRY=0
NEWAPPDT ;
 K DIC,DIE,DR,DA
 S DA(1)=AD0
 S DIC="^AUPNAPPS("_DA(1)_",11,"
 S DIC(0)="ALMEQ"
 S DIC("S")="I $P(^(0),U,5)=CASEPTR"
 K DD,DO
 D ^DIC
 Q:+Y<0
 S AD1=+Y
 D STUFCASE(AD0,AD1,CASEPTR)
 Q
STUFCASE(AD0,AD1,CASEPTR) ;EP
 K DIC,DIR,DR,DA,DIR
 S DA(1)=AD0
 S DA=AD1
 S DIE="^AUPNAPPS("_DA(1)_",11,"
 S DR=".05////^S X=CASEPTR"
 D ^DIE
 Q
EDAPPDT ;EDIT DATE APPLICATION OBTAINED
 K DIC,DR,DIE,DA,DD,DO,DIR
 S DA(1)=AD0
 S DA=AD1
 S DIE="^AUPNAPPS("_DA(1)_",11,"
 S DR=".01"
 S DR(1,"9000045.1101")=".01R"
 W !,"DELETING APPLICATIONS DATA IS PROHIBITED!"
 W !,"ENTER 'E ENTERED IN ERROR' INTO 'Overall Status' field item #2"
 W !,"TO CLOSE THIS APPLICATION."
 D ^DIE
 K DIC,DR,DIE,DA
 Q
APPSTAT ;EP - EDIT OVERALL STATUS
 K DIC,DR,DIE,DA,DD,DO
 S DA(1)=AD0
 S DA=AD1
 S DIE="^AUPNAPPS("_DA(1)_",11,"
 S DR=.04
 D ^DIE
 K DIC,DR,DIE,DA
 Q
APPTYPE ;EP - EDIT APPPLICATION TYPE
 K DIC,DR,DIE,DA,DD,DO
 S DA(1)=AD0
 S DA=AD1
 S DIE="^AUPNAPPS("_DA(1)_",11,"
 S DR=".02"
 S DIE("NO^")=""
 D ^DIE
 K DIC,DR,DIE,DA
 Q
APPPERS ;EDIT PERSON RECEIVING
 K DIC,DR,DIE,DA,DD,DO
 S DA(1)=AD0
 S DA=AD1
 S DIE="^AUPNAPPS("_DA(1)_",11,"
 S DR=.03
 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 NUMBER 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 ";"
 ; 6      SKIPEXEC   EXECUTE CODE TO SKIP ENTIRE FLD
 ;
1 ;
 ;;--APPLICATIONS DATA--------------------------------------------------------------
 ;;Date Obtained^?0^9000045.11^.01^!^1^EDAPPDT
 ;;Overall Status^?0^9000045.11^.04^!^2^APPSTAT|||||
 ;;Type^?0^9000045.11^.02^!^3^APPTYPE
 ;;Person Receiving Application^?0^9000045.11^.03^!^4^APPPERS
 ;;-
 ;;-================================================================================
 ;;--APPLICATION SUBMISSION DATA----------------------------------------------------
 ;;-DATE SUBMITTED    SUB. BY                   SUB. VIA    REASON
 ;;---------------------------------------------------------------------------------
 ;;^?0^9000045.1101^.01;.04;.02;.03^?0^^APDTSUB||;W ?18;W ?44;W ?56
 ;;*END*
 Q