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

IBTRH5D.m

Go to the documentation of this file.
  1. IBTRH5D ;ALB/FA - HCSR Create 278 Request ;12-AUG-2014
  1. ;;2.0;INTEGRATED BILLING;**517,592**;21-MAR-94;Build 58
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;;
  1. ; Contains Functions used in creating a 278 request from a
  1. ; selected entry in the HCSR Response worklist
  1. ;
  1. ; -------------------------- Entry Points --------------------------------
  1. ; SELAPI - Allows the user to see a quick view of the currently entered
  1. ; Additional Patient Information lines and either pick one to
  1. ; edit, enter a new one or skip.
  1. ; SELDX - Allows the user to see a quick view of the currently entered
  1. ; Diagnoses and either pick one to edit, enter a new one or
  1. ; skip.
  1. ; SELPD - Allows the user to see a quick view of the currently entered
  1. ; Patient Event Provider Data Lines and either pick one to
  1. ; edit, enter a new one or skip.
  1. ;-----------------------------------------------------------------------------
  1. ;
  1. SELAPI(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Additional Patient
  1. ; Information multiples and allows them to select one to edit or enter a new
  1. ; one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit template
  1. ; IBNEW - 1 if creating a new entry
  1. N AIDATA,CNT,ENTNUM,FDA,IEN,H1,H2,L1,L2,MAX,RETIEN,RTYPE,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Additional Patient Information"
  1. ;
  1. ; First check for an empty Additional Patient Information Line to delete
  1. D DELAPI(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Additional Patient Information lines to
  1. ; display
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,11,0)),"^",4) ; Total # of API Lines
  1. S MAX=$S(XX<10:"",1:"Additional Patient Information Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,11,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S YY=$$GET1^DIQ(356.2211,IEN_","_DA_",",.01) ; Report Type Desc
  1. . S YY=$E(YY,1,28)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,30)
  1. . S YY=$$GET1^DIQ(356.2211,IEN_","_DA_",",.02) ; Delivery Method
  1. . S YY=$E(YY,1,20)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,23)
  1. . S YY=$$GET1^DIQ(356.2211,IEN_","_DA_",",.03) ; Attachment #
  1. . S YY=$E(YY,1,22)
  1. . S XX=XX_$$LJ^XLFSTR(YY,22)
  1. . S AIDATA(CNT)=IEN_"^"_XX
  1. ;
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . W !!,"No Additional Patient Information is currently on file.",!
  1. . S XX=$$ASKNEW("Add Additional Patient Information","NO")
  1. . Q:XX<0
  1. . S RTYPE=$$RTYPE(IBTRIEN) ; Get the .01 value
  1. . I RTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1,XX=RTYPE
  1. . S FDA(356.2211,"+1,"_IBTRIEN_",",.01)=RTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. ;
  1. ; Next display all of the current Additional Patient Information
  1. S H1="# Report Type Delivery Method Attachment Control #"
  1. S H2="-- ---------------------------- --------------------- ----------------------"
  1. S L1="The following Additional Patient Information is currently on file."
  1. S L2="Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT(.AIDATA,H1,H2,L1,L2,MAX,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(AIDATA(XX),U)
  1. . D DELAPI(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S RTYPE=$$RTYPE(IBTRIEN) ; Get the .01 value
  1. . I RTYPE="" S XX=-1 Q ; None entered
  1. . S IBNEW=1
  1. . S XX=RTYPE
  1. . S FDA(356.2211,"+1,"_IBTRIEN_",",.01)=RTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(AIDATA(XX),"^",1)
  1. ;
  1. DELAPI(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Additional Patient Information Line and didn't enter any data for it. Also
  1. ; checks to see if user selected to delete a specified line. If so, the
  1. ; Additional Patient Information line with no data (or selected) is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Additional Patient Information line is deleted (Potentially)
  1. N APIIEN,DA,DIK,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),11,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S APIIEN=+$P($G(^IBT(356.22,IBTRIEN,11,0)),"^",3) ; Last Multiple IEN
  1. Q:'APIIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,11,APIIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(1)=IBTRIEN,DA=APIIEN
  1. S DIK="^IBT(356.22,DA(1),11,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. RTYPE(IBTRIEN) ; Prompts the user to enter the .01 (Report Type) field of the
  1. ; Additional Patient Information multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: IEN of the selected Report Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(1)=IBTRIEN
  1. S DIR(0)="356.2211,.01",DIR("A")=" Report Type"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. SELPD(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Provider Data
  1. ; multiples and allows them to select one to edit or enter a new one.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IBTRBRF - 1 if this display is being used from the brief template
  1. ; 0 or undefined otherwise
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit template
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,ENTNUM,FDA,IEN,H1,H2,L1,L2,MAX,PDDATA,PTYPE,RETIEN,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Provider Data Information"
  1. ;
  1. ; First check for an empty Provider Data Line to delete
  1. D DELPD(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Provider Data Information lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,13,0)),"^",4) ; # of Multiples
  1. S MAX=$S(XX<14:"",1:"Provider Data Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,13,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S YY=$$GET1^DIQ(356.2213,IEN_","_DA_",",.01) ; Prov Type Desc
  1. . S YY=$E(YY,1,30)_" "
  1. . S XX=XX_$$LJ^XLFSTR(YY,32)
  1. . ;
  1. . ; IBTRBRF is defined in IB CREATE 278 REQUEST SHORT input template
  1. . I $G(IBTRBRF)'=1 D
  1. . . S YY=$$GET1^DIQ(356.2213,IEN_","_DA_",",.02) ; Person/Non-Person
  1. . . S XX=XX_$$LJ^XLFSTR(YY,12)
  1. . S YY=$$GET1^DIQ(356.2213,IEN_","_DA_",",.03)
  1. . S XX=XX_$$LJ^XLFSTR(YY,"28T")
  1. . S PDDATA(CNT)=IEN_"^"_XX
  1. ;
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. .I $G(IBTRBRF)'=1 D
  1. ..W !!,"No Provider Data Information is currently on file.",!
  1. ..S XX=$$ASKNEW("Add Provider Data Information")
  1. ..Q
  1. .I $G(IBTRBRF)=1 S XX=0
  1. .Q:XX<0
  1. .S PTYPE=$$PTYPE(IBTRIEN) ; Get the .01 value
  1. .I PTYPE="" S XX=-1 Q ; None entered
  1. .S IBNEW=1,XX=PTYPE
  1. .S FDA(356.2213,"+1,"_IBTRIEN_",",.01)=PTYPE
  1. .D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. .Q
  1. ;
  1. ; Next display all of the current Provider Data lines
  1. S H1="# Provider Type "
  1. I $G(IBTRBRF)'=1 S H1=H1_" Per/Non"
  1. S H1=H1_" Provider"
  1. S H2="-- ------------------------------"
  1. I $G(IBTRBRF)'=1 S H2=H2_" ----------"
  1. S H2=H2_" ------------------------------"
  1. S L1="The following Provider Data Information is currently on file."
  1. S L2="Enter the # of an entry to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT(.PDDATA,H1,H2,L1,L2,MAX,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(PDDATA(XX),U)
  1. . D DELPD(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S PTYPE=$$PTYPE(IBTRIEN) ; Get the .01 value
  1. . I PTYPE="" S XX=-1 Q ; None entered
  1. . S XX=PTYPE
  1. . S IBNEW=1
  1. . S FDA(356.2213,"+1,"_IBTRIEN_",",.01)=PTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(PDDATA(XX),"^",1)
  1. ;
  1. DELPD(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Provider Data Line and didn't enter any data for it or selected a line to
  1. ; be deleted. If so, the empty or selected Provider Data line is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Provider Data line is deleted (Potentially)
  1. N PDIEN,DA,DIK,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),13,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S PDIEN=+$P($G(^IBT(356.22,IBTRIEN,13,0)),"^",3) ; Last Multiple IEN
  1. Q:'PDIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,13,PDIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(1)=IBTRIEN,DA=PDIEN
  1. S DIK="^IBT(356.22,DA(1),13,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. PTYPE(IBTRIEN) ; Prompts the user to enter the .01 (Provider Type) field of the
  1. ; Provider Data multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: IEN of the selected Provider Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(1)=IBTRIEN
  1. S DIR(0)="356.2213,.01",DIR("A")=" Provider Type"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. SELDX(IBTRIEN) ;EP
  1. ; Called from within Input template IB CREATE 278 REQUEST
  1. ; Provides the user with a quick view of currently entered Diagnoses and
  1. ; allows them to select one to edit or enter a new diagnosis.
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IBTRBRF - 1 if this display is being used from the brief template
  1. ; 0 or undefined other otherwise
  1. ; Returns: Value of the .01 field of the multiple to edit
  1. ; "" if creating a new multiple, -2 to exit template
  1. ; -3 if a if a line was deleted
  1. ; IBNEW=1 when creating a new entry
  1. N CNT,DXDATA,DXTYPE,ENTNUM,FDA,IEN,H1,H2,L1,L2,MAX,RETIEN,SECT,X,XX,Y,YY
  1. S IBNEW=0,SECT="Diagnosis Information"
  1. ;
  1. ; First check for an empty Diagnosis Line to delete
  1. D DELDX(IBTRIEN)
  1. ;
  1. ; Next create an array of all current Diagnoses lines
  1. S XX=+$P($G(^IBT(356.22,IBTRIEN,3,0)),"^",4) ; Total # of Dx Lines
  1. S MAX=$S(XX<12:"",1:"Diagnosis Lines")
  1. S IEN=0,CNT=0
  1. F D Q:+IEN=0
  1. . S IEN=$O(^IBT(356.22,IBTRIEN,3,IEN))
  1. . Q:+IEN=0
  1. . S CNT=CNT+1
  1. . S XX=$$LJ^XLFSTR(CNT,4) ; Selection #
  1. . S YY=$$GET1^DIQ(356.223,IEN_","_DA_",",.01,"I") ; Diagnosis Type
  1. . S YY=$$GET1^DIQ(356.006,YY_",",.01)
  1. . S XX=XX_$$LJ^XLFSTR(YY,7)
  1. . S YY=$$GET1^DIQ(356.223,IEN_","_DA_",",.02) ; Diagnosis
  1. . S XX=XX_$$LJ^XLFSTR(YY,11)
  1. . I $G(IBTRBRF)'=1 D
  1. . . S YY=$$GET1^DIQ(356.223,IEN_","_DA_",",.03) ; Date Known
  1. . . S XX=XX_$$LJ^XLFSTR(YY,14)
  1. . S DXDATA(CNT)=IEN_"^"_XX
  1. ;
  1. ; Creating 1st Diagnosis Line?
  1. I 'CNT D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. .I $G(IBTRBRF)'=1 D
  1. ..W !!,"No Diagnosis Information is currently on file.",!
  1. ..S XX=$$ASKNEW("Add a new Diagnosis")
  1. ..Q
  1. .I $G(IBTRBRF)=1 S XX=0
  1. .Q:XX<0
  1. .S DXTYPE=$$DXTYPE(IBTRIEN) ; Get the .01 value
  1. .I DXTYPE="" S XX=-1 Q ; None entered
  1. .S IBNEW=1,XX=DXTYPE
  1. .S FDA(356.223,"+1,"_IBTRIEN_",",.01)=DXTYPE
  1. .D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. .Q
  1. ;
  1. ; Next display all of the current Diagnoses and let the user select one
  1. S H1="# Type Diagnosis"
  1. I $G(IBTRBRF)'=1 S H1=H1_" Date DX Known"
  1. S H2="-- ----- ---------"
  1. I $G(IBTRBRF)'=1 S H2=H2_" -------------"
  1. S L1="The following Diagnoses are currently on file."
  1. S L2="Enter the # of a Diagnosis to edit, 'NEW' to add one or press Return to skip."
  1. S XX=$$SELENT(.DXDATA,H1,H2,L1,L2,MAX,"",SECT)
  1. I XX?1"D".N D Q -3
  1. . S (XX,ENTNUM)=$P(XX,"D",2)
  1. . S XX=$P(DXDATA(XX),U)
  1. . D DELDX(IBTRIEN,XX)
  1. . W !,"Entry #",ENTNUM," has been deleted."
  1. I XX<0 Q XX
  1. I XX=0 D Q $S($O(RETIEN(0)):RETIEN($O(RETIEN(0))),1:XX)
  1. . S DXTYPE=$$DXTYPE(IBTRIEN) ; Get the .01 value
  1. . I DXTYPE="" S XX=-1 Q ; None entered
  1. . S XX=DXTYPE
  1. . S IBNEW=1
  1. . S FDA(356.223,"+1,"_IBTRIEN_",",.01)=DXTYPE
  1. . D UPDATE^DIE("","FDA","RETIEN") ; File the new line
  1. Q $P(DXDATA(XX),"^",1)
  1. ;
  1. DXTYPE(IBTRIEN) ; Prompts the user to enter the .01 (Diagnosis Type) field of
  1. ; the diagnosis multiple
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; Returns: IEN of the selected Diagnosis Type or "" of not entered
  1. N DA,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DA(1)=IBTRIEN,DA=$P($G(^IBT(356.22,IBTRIEN,3,0)),"^",3)+1
  1. S DIR(0)="356.223,.01",DIR("A")=" Diagnosis Qualifier"
  1. D ^DIR
  1. Q:$D(DIRUT) ""
  1. Q $P(Y,"^",1)
  1. ;
  1. DELDX(IBTRIEN,IEN) ; Checks to see if the user entered 'NEW' to create a new
  1. ; Diagnosis Line and didn't enter any data for it or selected a multiple to
  1. ; to be deleted. If so, the empty or selected multiple is deleted
  1. ; Input: IBTRIEN - IEN of the 356.22 entry being edited
  1. ; IEN - Optional, IEN of the multiple to be deleted if passed
  1. ; defaults to ""
  1. ; Output: Empty or selected Diagnosis line is deleted (Potentially)
  1. N DA,DIK,DXIEN,X,XX,Y
  1. S:'$D(IEN) IEN=""
  1. I IEN'="" D Q
  1. . S DA(1)=IBTRIEN,DA=IEN
  1. . S DIK="^IBT(356.22,DA(1),3,"
  1. . D ^DIK ; Delete the multiple
  1. ;
  1. S DXIEN=+$P($G(^IBT(356.22,IBTRIEN,3,0)),"^",3) ; Last Multiple IEN
  1. Q:'DXIEN
  1. S XX=$G(^IBT(356.22,IBTRIEN,3,DXIEN,0))
  1. S $P(XX,"^",1)="" ; Remove .01 field
  1. Q:$TR(XX,"^","")'="" ; 0 node data exists
  1. S DA(1)=IBTRIEN,DA=DXIEN
  1. S DIK="^IBT(356.22,DA(1),3,"
  1. D ^DIK ; Delete the multiple
  1. Q
  1. ;
  1. ASKNEW(PROMPT,DEFAULT) ;EP
  1. ; Ask if user wants to create a new entry
  1. ; Input: PROMPT - Yes/No question to ask the user
  1. ; DEFALT - Default Answer
  1. ; Optional, if not passed, set to 'YES'
  1. ; Returns: 0 - User wants to add a new Entry
  1. ; -1 - User doesn't want to add a new entry
  1. ; -2 - User wants to exit template
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,XX,Y
  1. S:'$D(DEFAULT) DEFAULT="YES"
  1. S XX=$P(PROMPT,"Add ",2)
  1. S DIR("?")="Select NO to skip this section. Select YES to enter "_XX_"."
  1. S DIR(0)="Y",DIR("A")=PROMPT,DIR("B")=DEFAULT
  1. A1 ;
  1. D ^DIR
  1. I Y?1"^"1.E D JUMPERR^IBTRH5H G A1
  1. Q:$D(DUOUT) -2 ; User Pressed ^
  1. Q:$D(DTOUT) -1 ; User timed out
  1. I Y=0 Q -1
  1. Q 1
  1. ;
  1. SELENT(ARRAY,H1,H2,L1,L2,MAX,INDENT,SECT) ; Select an entry to add/edit from a list
  1. ; Input: ARRAY() - Array of multiple lines to be displayed
  1. ; H1 - 1st line of Header Information
  1. ; H2 - 2nd line of Header Information
  1. ; L1 - 1st line of DIR display
  1. ; L2 - Selection line text
  1. ; MAX - Multiple Description
  1. ; If passed, entering a new line is not allowed
  1. ; Optional, defaults to "" if not passed
  1. ; INDENT - 1 to indent 2 spaces
  1. ; Optional, defaults to 0
  1. ; SECT - Section Header
  1. ; Returns: # - User wants to edit Entry #
  1. ; 0 - User wants to Add a new Entry
  1. ; -1 - User wants to skip this section
  1. ; -2 - User wants to exit template
  1. N DEL,DIR,DIROUT,DIRUT,DOK,DTOUT,DUOUT,IX,LN,X,XX,Y,YY
  1. S:'$D(MAX) MAX=""
  1. S:'$D(INDENT) INDENT=0
  1. S:'$D(SECT) SECT=""
  1. S DIR(0)="FO",LN=0
  1. S LN=LN+1,DIR("A",LN)=L1
  1. S LN=LN+1,DIR("A",LN)=" "
  1. S LN=LN+1,DIR("A",LN)=H1
  1. S LN=LN+1,DIR("A",LN)=H2
  1. S IX=""
  1. F D Q:IX=""
  1. . S IX=$O(ARRAY(IX))
  1. . Q:IX=""
  1. . S LN=LN+1,DIR("A",LN)=$P(ARRAY(IX),"^",2)
  1. S LN=LN+1,DIR("A",LN)=" "
  1. S LN=LN+1,DIR("A",LN)=L2
  1. S DIR("A")=$S(INDENT:" ",1:"")_"Selection #"
  1. W !!
  1. SELE1 ;
  1. ;S XX="Select NO to skip this section. Select YES to enter "_SECT_"."
  1. S XX="To delete an entry from the list, select D followed by the "
  1. S XX=XX_"number of the entry you wish to delete."
  1. S DIR("?")=XX
  1. D ^DIR
  1. S DOK=1
  1. S Y=$$UP^XLFSTR(Y) ; Convert to Upper
  1. I Y?1"D".N D Q:DOK Y
  1. . S XX=$P(Y,"D",2)
  1. . I XX>0,XX'>CNT,XX?.N Q ; Selected Entry to delete
  1. . S DOK=0
  1. . D SELERR(INDENT)
  1. G:'DOK SELE1
  1. I Y?1"^"1.E D JUMPERR^IBTRH5H G SELE1
  1. I $D(DUOUT) Q -2 ; User pressed ^
  1. I $D(DTOUT) Q -1 ; User timed out
  1. I Y="" Q -1 ; User pressed return
  1. S XX=$$UP^XLFSTR(Y)
  1. S YY=$S((XX="NEW")!(XX="N")!(XX="NE"):1,1:0) ; User wants to enter a new one
  1. I MAX'="",YY D G SELE1
  1. . W *7,!!,$S(INDENT:" ",1:"")
  1. . W "The maximum Number of "_MAX_" have already been entered.",!
  1. . ;JWS;IB*2.0*592
  1. . I +CNT>21 R !!,"Press <ENTER> to continue",X:30
  1. Q:YY 0 ; Creating a new one
  1. I XX>0,XX'>CNT,XX?.N Q XX ; Selected Entry
  1. D SELERR(INDENT)
  1. G SELE1
  1. ;
  1. SELERR(INDENT) ; Multiple Selection error
  1. ; Input: INDENT - 1 to indent error message display
  1. W !!,*7,$S(INDENT:" ",1:"")
  1. W "Enter a number from 1-",CNT,". Enter NEW to enter a new entry."
  1. W !,$S(INDENT:" ",1:"")
  1. W "To delete an entry from the list, select D followed by the "
  1. W !,$S(INDENT:" ",1:"")
  1. W "number of the entry you wish to remove. Press return to skip selection."
  1. W !!
  1. Q