PXEDUMGR ;SLC/PKR - List Manager routines for Education Topics. ;06/20/2018
;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
;
;=========================================
ADD ;Add a new entry.
D CLEAR^VALM1
N DA,DIC,DLAYGO,DTOUT,DUOUT,NEW,TEXT,Y
S DIC="^AUTTEDT("
S DIC(0)="AEKLQ"
S DIC("A")="Enter a new Education Topic Name: "
S DLAYGO=9999999.09
D ^DIC
I ($D(DTOUT))!($D(DUOUT))!(Y=-1) S VALMBCK="R" Q
S NEW=$P(Y,U,3)
I 'NEW D G ADD
. S TEXT(1)=$P(Y,U,2)_" already exists, choose a different name or use the EDIT action to edit that entry."
. S TEXT(2)=""
. D EN^DDIOL(.TEXT)
. H 3
I NEW D
. S DA=$P(Y,U,1)
. D SMANEDIT^PXEDUSM(DA,1)
S VALMBCK="R"
Q
;
;=========================================
BLDLIST(NODE) ;Build of list of Education Topic file entries.
N IEN,DESC,NAME
K ^TMP(NODE,$J)
;Build the list in alphabetical order.
S NAME="",VALMCNT=0
F S NAME=$O(^AUTTEDT("B",NAME)) Q:NAME="" D
. S IEN=$O(^AUTTEDT("B",NAME,""))
. S VALMCNT=VALMCNT+1
. S ^TMP(NODE,$J,"SEL",VALMCNT)=IEN
. S ^TMP(NODE,$J,"IEN",IEN)=VALMCNT
. S DESC=$G(^AUTTEDT(IEN,201,1,0))
. S ^TMP(NODE,$J,VALMCNT,0)=$$FORMAT(VALMCNT,NAME,DESC)
. S ^TMP(NODE,$J,"IDX",VALMCNT,VALMCNT)=""
. S ^TMP(NODE,$J,"LINES",VALMCNT)=VALMCNT_U_VALMCNT
S ^TMP(NODE,$J,"VALMCNT")=VALMCNT
S ^TMP(NODE,$J,"NEDU")=VALMCNT
Q
;
;=========================================
CLOG(IEN) ;Display the change log.
D LMCLBROW^PXSINQ(9999999.09,"110*",IEN)
Q
;
;=========================================
CLOGS ;Display Change Log for a selected entry.
N IEN
;Get the entry
S IEN=+$$GETSEL("Display the change log for which education topic?")
S VALMBCK="R"
I IEN=0 S VALMBCK="R" Q
D CLOG(IEN)
S VALMBCK="R"
Q
;
;=========================================
COPY(IEN) ;Copy a selected entry to a new name.
D FULL^VALM1
D COPY^PXCOPY(9999999.09,IEN)
D BLDLIST^PXEDUMGR("PXEDUL")
S VALMBCK="R"
Q
;
;=========================================
COPYS ;Copy a selected entry.
N IEN
;Get the entry
S IEN=+$$GETSEL("Select education topic to copy")
I IEN=0 S VALMBCK="R" Q
D COPY(IEN)
Q
;
;=========================================
EDITS ;Edit a selected entry.
S VALMBCK="R"
N CLASS,IEN
;Get the entry
S IEN=+$$GETSEL("Select the education topic to edit")
I IEN=0 S VALMBCK="R" Q
D SMANEDIT^PXEDUSM(IEN,0)
Q
;
;=========================================
ENTRY ;Entry code
D INITMPG^PXEDUMGR
D BLDLIST^PXEDUMGR("PXEDUL")
D XQORM
Q
;
;=========================================
EXIT ;Exit code
D INITMPG^PXEDUMGR
D CLEAN^VALM10
D FULL^VALM1
S VALMBCK="Q"
Q
;
;=========================================
FORMAT(NUMBER,NAME,DESC) ;Format entry number, name, and first line of
;description for LM display.
N TEXT,TDESC,TNAME
S TNAME=$S($L(NAME)<56:NAME,1:$E(NAME,1,52)_"...")
S TEXT=$$RJ^XLFSTR(NUMBER,5," ")_" "_TNAME
S TDESC=$S(DESC="":"",$L(DESC)<17:DESC,1:$E(DESC,1,13)_"...")
I TDESC'="" S TEXT=TEXT_$$REPEAT^XLFSTR(" ",(63-$L(TEXT)))_TDESC
Q TEXT
;
;=========================================
GETSEL(TEXT) ;Get a single selection
N DIR,NEDU,X,Y
S NEDU=+$G(^TMP("PXEDUL",$J,"NEDU"))
I NEDU=0 Q 0
S DIR(0)="N^1:"_NEDU
S DIR("A")=TEXT
D ^DIR
Q +$G(^TMP("PXEDUL",$J,"SEL",+Y))
;
;=========================================
HELP ;Display help.
N DDS,DIR0,DONE,IND,TEXT
;DBIA #5746 covers kill and set of DDS. DDS needs to be set or the
;Browser will kill some ScreenMan variables.
S DDS=1,DONE=0
F IND=1:1 Q:DONE D
. S TEXT(IND)=$P($T(HTEXT+IND),";",3,99)
. I TEXT(IND)="**End Text**" K TEXT(IND) S DONE=1 Q
D BROWSE^DDBR("TEXT","NR","Education Topic Management Help")
S VALMBCK="R"
Q
;
;=========================================
HDR ; Header code
S VALMHDR(1)="Education Topic File Entries."
S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
Q
;
;=========================================
HTEXT ;Education Topic management help text.
;;Select one of the following actions:
;; ADD - add a new education topic.
;; EDIT - edit an education topic.
;; COPY - copy an existing education topic to a new education topic.
;; INQ - education topic inquiry.
;; CL - education topic change log display.
;;
;;You can select the action first and then the entry or choose the entry and then
;;the action.
;;
;;**End Text**
Q
;
;=========================================
INITMPG ;Initialize all the ^TMP globals.
K ^TMP("PXEDUL",$J)
Q
;
;=========================================
INQ(IEN) ;Education Topic inquiry.
S VALMBCK="R"
D BEDUINQ^PXEDUINQ(IEN)
Q
;
;=========================================
INQS ;Display inquiry for selected entries.
S VALMBCK="R"
N IEN
;Get the entry
S IEN=+$$GETSEL("Display inquiry for which education topic?")
I IEN=0 S VALMBCK="R" Q
D INQ(IEN)
S VALMBCK="R"
Q
;
;=========================================
ISMAPPED(IEN) ;Return 1 if the Education Topic has mapped codes.
I +$P($G(^AUTTEDT(IEN,210,0)),U,4)>0 Q 1
Q 0
;
;=========================================
PEXIT ; Protocol exit code
S VALMSG="+ Next Screen - Prev Screen ?? More Actions"
;Reset after page up/down etc
D XQORM
Q
;
;=========================================
START ;Main entry point for PX Education Topic Management
N VALMBCK,VALMSG,X
S X="IORESET"
D ENDR^%ZISS
D EN^VALM("PX EDUCATION TOPICS MANAGEMENT")
W IORESET
D KILL^%ZISS
Q
;
;=========================================
XQORM ;Set range for selection.
N NEDU
S NEDU=^TMP("PXEDUL",$J,"NEDU")
S XQORM("#")=$O(^ORD(101,"B","PX EDUCATION TOPICS SELECT ENTRY",0))_U_"1:"_NEDU
S XQORM("A")="Select Action: "
Q
;
;=========================================
XSEL ;Entry action for protocol PX EDUCATION TOPICS SELECT ENTRY.
N CLASS,EDITOK,IEN,SEL
S SEL=$P(XQORNOD(0),"=",2)
;Remove trailing ,
I $E(SEL,$L(SEL))="," S SEL=$E(SEL,1,$L(SEL)-1)
;Invalid selection
I SEL["," D Q
. W !,"Only one item number allowed." H 2
. S VALMBCK="R"
I ('SEL)!(SEL>VALMCNT)!('$D(@VALMAR@("SEL",SEL))) D Q
. W !,SEL_" is not a valid item number." H 2
. S VALMBCK="R"
;
;Get the IEN.
S IEN=^TMP("PXEDUL",$J,"SEL",SEL)
S CLASS=$P(^AUTTEDT(IEN,100),U,1)
;
;Full screen mode
D FULL^VALM1
;
;Action list.
N DIR,DIROUT,DIRUT,DTOUT,DUOUT,OPTION,X,Y
S DIR(0)="SBM"_U
S EDITOK=$S(CLASS'="N":1,1:($G(PXNAT)=1)&($G(DUZ(0))="@"))
I EDITOK S DIR(0)=DIR(0)_"EDIT:Edit;"
S DIR(0)=DIR(0)_"COPY:Copy;"
S DIR(0)=DIR(0)_"INQ:Inquire;"
S DIR(0)=DIR(0)_"CL:Change Log;"
S DIR("A")="Select Action: "
S DIR("B")=$S(CLASS="N":"INQ",1:"EDIT")
S DIR("?")="Select from the actions displayed."
D ^DIR
I $D(DIROUT)!$D(DIRUT) S VALMBCK="R" Q
I $D(DTOUT)!$D(DUOUT) S VALMBCK="R" Q
S OPTION=Y
D CLEAR^VALM1
;
I OPTION="COPY" D COPY^PXEDUMGR(IEN)
I OPTION="EDIT" D SMANEDIT^PXEDUSM(IEN,0)
I OPTION="INQ" D BEDUINQ^PXEDUINQ(IEN)
I OPTION="CL" D CLOG^PXEDUMGR(IEN)
S VALMBCK="R"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HPXEDUMGR 7102 printed Oct 16, 2024@18:29:24 Page 2
PXEDUMGR ;SLC/PKR - List Manager routines for Education Topics. ;06/20/2018
+1 ;;1.0;PCE PATIENT CARE ENCOUNTER;**211**;Aug 12, 1996;Build 454
+2 ;
+3 ;=========================================
ADD ;Add a new entry.
+1 DO CLEAR^VALM1
+2 NEW DA,DIC,DLAYGO,DTOUT,DUOUT,NEW,TEXT,Y
+3 SET DIC="^AUTTEDT("
+4 SET DIC(0)="AEKLQ"
+5 SET DIC("A")="Enter a new Education Topic Name: "
+6 SET DLAYGO=9999999.09
+7 DO ^DIC
+8 IF ($DATA(DTOUT))!($DATA(DUOUT))!(Y=-1)
SET VALMBCK="R"
QUIT
+9 SET NEW=$PIECE(Y,U,3)
+10 IF 'NEW
Begin DoDot:1
+11 SET TEXT(1)=$PIECE(Y,U,2)_" already exists, choose a different name or use the EDIT action to edit that entry."
+12 SET TEXT(2)=""
+13 DO EN^DDIOL(.TEXT)
+14 HANG 3
End DoDot:1
GOTO ADD
+15 IF NEW
Begin DoDot:1
+16 SET DA=$PIECE(Y,U,1)
+17 DO SMANEDIT^PXEDUSM(DA,1)
End DoDot:1
+18 SET VALMBCK="R"
+19 QUIT
+20 ;
+21 ;=========================================
BLDLIST(NODE) ;Build of list of Education Topic file entries.
+1 NEW IEN,DESC,NAME
+2 KILL ^TMP(NODE,$JOB)
+3 ;Build the list in alphabetical order.
+4 SET NAME=""
SET VALMCNT=0
+5 FOR
SET NAME=$ORDER(^AUTTEDT("B",NAME))
if NAME=""
QUIT
Begin DoDot:1
+6 SET IEN=$ORDER(^AUTTEDT("B",NAME,""))
+7 SET VALMCNT=VALMCNT+1
+8 SET ^TMP(NODE,$JOB,"SEL",VALMCNT)=IEN
+9 SET ^TMP(NODE,$JOB,"IEN",IEN)=VALMCNT
+10 SET DESC=$GET(^AUTTEDT(IEN,201,1,0))
+11 SET ^TMP(NODE,$JOB,VALMCNT,0)=$$FORMAT(VALMCNT,NAME,DESC)
+12 SET ^TMP(NODE,$JOB,"IDX",VALMCNT,VALMCNT)=""
+13 SET ^TMP(NODE,$JOB,"LINES",VALMCNT)=VALMCNT_U_VALMCNT
End DoDot:1
+14 SET ^TMP(NODE,$JOB,"VALMCNT")=VALMCNT
+15 SET ^TMP(NODE,$JOB,"NEDU")=VALMCNT
+16 QUIT
+17 ;
+18 ;=========================================
CLOG(IEN) ;Display the change log.
+1 DO LMCLBROW^PXSINQ(9999999.09,"110*",IEN)
+2 QUIT
+3 ;
+4 ;=========================================
CLOGS ;Display Change Log for a selected entry.
+1 NEW IEN
+2 ;Get the entry
+3 SET IEN=+$$GETSEL("Display the change log for which education topic?")
+4 SET VALMBCK="R"
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO CLOG(IEN)
+7 SET VALMBCK="R"
+8 QUIT
+9 ;
+10 ;=========================================
COPY(IEN) ;Copy a selected entry to a new name.
+1 DO FULL^VALM1
+2 DO COPY^PXCOPY(9999999.09,IEN)
+3 DO BLDLIST^PXEDUMGR("PXEDUL")
+4 SET VALMBCK="R"
+5 QUIT
+6 ;
+7 ;=========================================
COPYS ;Copy a selected entry.
+1 NEW IEN
+2 ;Get the entry
+3 SET IEN=+$$GETSEL("Select education topic to copy")
+4 IF IEN=0
SET VALMBCK="R"
QUIT
+5 DO COPY(IEN)
+6 QUIT
+7 ;
+8 ;=========================================
EDITS ;Edit a selected entry.
+1 SET VALMBCK="R"
+2 NEW CLASS,IEN
+3 ;Get the entry
+4 SET IEN=+$$GETSEL("Select the education topic to edit")
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO SMANEDIT^PXEDUSM(IEN,0)
+7 QUIT
+8 ;
+9 ;=========================================
ENTRY ;Entry code
+1 DO INITMPG^PXEDUMGR
+2 DO BLDLIST^PXEDUMGR("PXEDUL")
+3 DO XQORM
+4 QUIT
+5 ;
+6 ;=========================================
EXIT ;Exit code
+1 DO INITMPG^PXEDUMGR
+2 DO CLEAN^VALM10
+3 DO FULL^VALM1
+4 SET VALMBCK="Q"
+5 QUIT
+6 ;
+7 ;=========================================
FORMAT(NUMBER,NAME,DESC) ;Format entry number, name, and first line of
+1 ;description for LM display.
+2 NEW TEXT,TDESC,TNAME
+3 SET TNAME=$SELECT($LENGTH(NAME)<56:NAME,1:$EXTRACT(NAME,1,52)_"...")
+4 SET TEXT=$$RJ^XLFSTR(NUMBER,5," ")_" "_TNAME
+5 SET TDESC=$SELECT(DESC="":"",$LENGTH(DESC)<17:DESC,1:$EXTRACT(DESC,1,13)_"...")
+6 IF TDESC'=""
SET TEXT=TEXT_$$REPEAT^XLFSTR(" ",(63-$LENGTH(TEXT)))_TDESC
+7 QUIT TEXT
+8 ;
+9 ;=========================================
GETSEL(TEXT) ;Get a single selection
+1 NEW DIR,NEDU,X,Y
+2 SET NEDU=+$GET(^TMP("PXEDUL",$JOB,"NEDU"))
+3 IF NEDU=0
QUIT 0
+4 SET DIR(0)="N^1:"_NEDU
+5 SET DIR("A")=TEXT
+6 DO ^DIR
+7 QUIT +$GET(^TMP("PXEDUL",$JOB,"SEL",+Y))
+8 ;
+9 ;=========================================
HELP ;Display help.
+1 NEW DDS,DIR0,DONE,IND,TEXT
+2 ;DBIA #5746 covers kill and set of DDS. DDS needs to be set or the
+3 ;Browser will kill some ScreenMan variables.
+4 SET DDS=1
SET DONE=0
+5 FOR IND=1:1
if DONE
QUIT
Begin DoDot:1
+6 SET TEXT(IND)=$PIECE($TEXT(HTEXT+IND),";",3,99)
+7 IF TEXT(IND)="**End Text**"
KILL TEXT(IND)
SET DONE=1
QUIT
End DoDot:1
+8 DO BROWSE^DDBR("TEXT","NR","Education Topic Management Help")
+9 SET VALMBCK="R"
+10 QUIT
+11 ;
+12 ;=========================================
HDR ; Header code
+1 SET VALMHDR(1)="Education Topic File Entries."
+2 SET VALMSG="+ Next Screen - Prev Screen ?? More Actions"
+3 QUIT
+4 ;
+5 ;=========================================
HTEXT ;Education Topic management help text.
+1 ;;Select one of the following actions:
+2 ;; ADD - add a new education topic.
+3 ;; EDIT - edit an education topic.
+4 ;; COPY - copy an existing education topic to a new education topic.
+5 ;; INQ - education topic inquiry.
+6 ;; CL - education topic change log display.
+7 ;;
+8 ;;You can select the action first and then the entry or choose the entry and then
+9 ;;the action.
+10 ;;
+11 ;;**End Text**
+12 QUIT
+13 ;
+14 ;=========================================
INITMPG ;Initialize all the ^TMP globals.
+1 KILL ^TMP("PXEDUL",$JOB)
+2 QUIT
+3 ;
+4 ;=========================================
INQ(IEN) ;Education Topic inquiry.
+1 SET VALMBCK="R"
+2 DO BEDUINQ^PXEDUINQ(IEN)
+3 QUIT
+4 ;
+5 ;=========================================
INQS ;Display inquiry for selected entries.
+1 SET VALMBCK="R"
+2 NEW IEN
+3 ;Get the entry
+4 SET IEN=+$$GETSEL("Display inquiry for which education topic?")
+5 IF IEN=0
SET VALMBCK="R"
QUIT
+6 DO INQ(IEN)
+7 SET VALMBCK="R"
+8 QUIT
+9 ;
+10 ;=========================================
ISMAPPED(IEN) ;Return 1 if the Education Topic has mapped codes.
+1 IF +$PIECE($GET(^AUTTEDT(IEN,210,0)),U,4)>0
QUIT 1
+2 QUIT 0
+3 ;
+4 ;=========================================
PEXIT ; Protocol exit code
+1 SET VALMSG="+ Next Screen - Prev Screen ?? More Actions"
+2 ;Reset after page up/down etc
+3 DO XQORM
+4 QUIT
+5 ;
+6 ;=========================================
START ;Main entry point for PX Education Topic Management
+1 NEW VALMBCK,VALMSG,X
+2 SET X="IORESET"
+3 DO ENDR^%ZISS
+4 DO EN^VALM("PX EDUCATION TOPICS MANAGEMENT")
+5 WRITE IORESET
+6 DO KILL^%ZISS
+7 QUIT
+8 ;
+9 ;=========================================
XQORM ;Set range for selection.
+1 NEW NEDU
+2 SET NEDU=^TMP("PXEDUL",$JOB,"NEDU")
+3 SET XQORM("#")=$ORDER(^ORD(101,"B","PX EDUCATION TOPICS SELECT ENTRY",0))_U_"1:"_NEDU
+4 SET XQORM("A")="Select Action: "
+5 QUIT
+6 ;
+7 ;=========================================
XSEL ;Entry action for protocol PX EDUCATION TOPICS SELECT ENTRY.
+1 NEW CLASS,EDITOK,IEN,SEL
+2 SET SEL=$PIECE(XQORNOD(0),"=",2)
+3 ;Remove trailing ,
+4 IF $EXTRACT(SEL,$LENGTH(SEL))=","
SET SEL=$EXTRACT(SEL,1,$LENGTH(SEL)-1)
+5 ;Invalid selection
+6 IF SEL[","
Begin DoDot:1
+7 WRITE !,"Only one item number allowed."
HANG 2
+8 SET VALMBCK="R"
End DoDot:1
QUIT
+9 IF ('SEL)!(SEL>VALMCNT)!('$DATA(@VALMAR@("SEL",SEL)))
Begin DoDot:1
+10 WRITE !,SEL_" is not a valid item number."
HANG 2
+11 SET VALMBCK="R"
End DoDot:1
QUIT
+12 ;
+13 ;Get the IEN.
+14 SET IEN=^TMP("PXEDUL",$JOB,"SEL",SEL)
+15 SET CLASS=$PIECE(^AUTTEDT(IEN,100),U,1)
+16 ;
+17 ;Full screen mode
+18 DO FULL^VALM1
+19 ;
+20 ;Action list.
+21 NEW DIR,DIROUT,DIRUT,DTOUT,DUOUT,OPTION,X,Y
+22 SET DIR(0)="SBM"_U
+23 SET EDITOK=$SELECT(CLASS'="N":1,1:($GET(PXNAT)=1)&($GET(DUZ(0))="@"))
+24 IF EDITOK
SET DIR(0)=DIR(0)_"EDIT:Edit;"
+25 SET DIR(0)=DIR(0)_"COPY:Copy;"
+26 SET DIR(0)=DIR(0)_"INQ:Inquire;"
+27 SET DIR(0)=DIR(0)_"CL:Change Log;"
+28 SET DIR("A")="Select Action: "
+29 SET DIR("B")=$SELECT(CLASS="N":"INQ",1:"EDIT")
+30 SET DIR("?")="Select from the actions displayed."
+31 DO ^DIR
+32 IF $DATA(DIROUT)!$DATA(DIRUT)
SET VALMBCK="R"
QUIT
+33 IF $DATA(DTOUT)!$DATA(DUOUT)
SET VALMBCK="R"
QUIT
+34 SET OPTION=Y
+35 DO CLEAR^VALM1
+36 ;
+37 IF OPTION="COPY"
DO COPY^PXEDUMGR(IEN)
+38 IF OPTION="EDIT"
DO SMANEDIT^PXEDUSM(IEN,0)
+39 IF OPTION="INQ"
DO BEDUINQ^PXEDUINQ(IEN)
+40 IF OPTION="CL"
DO CLOG^PXEDUMGR(IEN)
+41 SET VALMBCK="R"
+42 QUIT
+43 ;