GMPLPRF1 ; SLC/MKB -- Problem List User Prefs cont ;;9-5-95 11:54am
;;2.0;Problem List;**3**;Aug 25, 1994
ADD ; -- add item(s) to view
N GMPLSEL,GMPLNO,IFN,NUM,CNUM,I,J S VALMBCK=$S(VALMCC:"",1:"R")
ADD1 S GMPLSEL=$$SELECT Q:GMPLSEL="^"
S GMPLNO=$L(GMPLSEL,","),I=$S(GMPLMODE="S":"service",1:"clinic")
I (^TMP("GMPLIST",$J,"VIEW",0)+GMPLNO-1)>60 D G ADD1
. W !!,"You may not have more than 60 "_I_"s included in your view!"
. W !,"Your view currently includes "_^TMP("GMPLIST",$J,"VIEW",0)_" "_I_$S(^TMP("GMPLIST",$J,"VIEW",0)'=1:"s",1:"")_"."
. W !,"Please select again, choosing no more than "_(60-^TMP("GMPLIST",$J,"VIEW",0))_" "_I_$S(^TMP("GMPLIST",$J,"VIEW",0)'=1:"s",1:"")_"."
ADD2 W !!,"Adding "_(GMPLNO-1)_" "_I_"(s) ..." K I
F I=1:1:GMPLNO S NUM=$P(GMPLSEL,",",I) I NUM D
. S IFN=^TMP("GMPLIST",$J,"IDX",NUM) W "."
. S TMP=$E($P(^TMP("GMPLIST",$J,NUM,0),U,1),1,44)_" Y",^TMP("GMPLIST",$J,NUM,0)=TMP
. S:'$D(^TMP("GMPLIST",$J,"VIEW",IFN)) ^TMP("GMPLIST",$J,"VIEW",IFN)="",^TMP("GMPLIST",$J,"VIEW",0)=^TMP("GMPLIST",$J,"VIEW",0)+1
. Q:GMPLMODE'="S" Q:'$D(^DIC(49,"ACHLD",IFN))
. I $$INCLCHLD(IFN) F J=0:0 S J=$O(^DIC(49,"ACHLD",IFN,J)) Q:J'>0 D
. . S CNUM=+$G(^TMP("GMPLIST",$J,"B",J)) W "."
. . I CNUM S TMP=$E(^TMP("GMPLIST",$J,CNUM,0),1,44)_" Y",^TMP("GMPLIST",$J,CNUM,0)=TMP S:'$D(^TMP("GMPLIST",$J,"VIEW",J)) ^TMP("GMPLIST",$J,"VIEW",J)="",^TMP("GMPLIST",$J,"VIEW",0)=^TMP("GMPLIST",$J,"VIEW",0)+1
S VALMBCK="R",VALMSG=$$MSG^GMPLPREF K VALMHDR
Q
;
REMOVE ; -- delete item(s) from view
N GMPLSEL,GMPLNO,IFN,NUM,CNUM,I,J S VALMBCK=$S(VALMCC:"",1:"R")
S GMPLSEL=$$SELECT Q:GMPLSEL="^"
S GMPLNO=$L(GMPLSEL,",")
W !!,"Removing "_(GMPLNO-1)_" "_$S(GMPLMODE="S":"service",1:"clinic")_"(s) ..."
F I=1:1:GMPLNO S NUM=$P(GMPLSEL,",",I) I NUM D
. S IFN=+^TMP("GMPLIST",$J,"IDX",NUM),^TMP("GMPLIST",$J,NUM,0)=$E(^TMP("GMPLIST",$J,NUM,0),1,44)
. S:$D(^TMP("GMPLIST",$J,"VIEW",IFN)) ^TMP("GMPLIST",$J,"VIEW",0)=^TMP("GMPLIST",$J,"VIEW",0)-1
. K ^TMP("GMPLIST",$J,"VIEW",IFN) W "."
. Q:GMPLMODE'="S" Q:'$D(^DIC(49,"ACHLD",IFN))
. I $$INCLCHLD(IFN) F J=0:0 S J=$O(^DIC(49,"ACHLD",IFN,J)) Q:J'>0 D
. . S CNUM=+$G(^TMP("GMPLIST",$J,"B",J)) W "."
. . I CNUM S ^TMP("GMPLIST",$J,CNUM,0)=$E(^TMP("GMPLIST",$J,CNUM,0),1,44) S:$D(^TMP("GMPLIST",$J,"VIEW",J)) ^TMP("GMPLIST",$J,"VIEW",0)=^TMP("GMPLIST",$J,"VIEW",0)-1 K ^TMP("GMPLIST",$J,"VIEW",J)
S VALMBCK="R",VALMSG=$$MSG^GMPLPREF K VALMHDR
Q
;
INCLCHLD(IFN) ; Returns 1 or 0, to include 'child' services in selection
N DIR,X,Y,NAME S NAME=$P($G(^DIC(49,IFN,0)),U),DIR("B")="YES"
S DIR(0)="Y",DIR("A")="Include all sub-services/sections of "_NAME
S DIR("?",1)="This service is a 'parent' to other services/sections,"
S DIR("?",2)="listed indented above; enter YES to include all of these"
S DIR("?")="as well in this action, or enter NO to exclude them."
D ^DIR S:$D(DTOUT) Y="^"
Q Y
;
SELECT() ; Select item(s) from list
N DIR,X,Y,MAX
S MAX=+$G(^TMP("GMPLIST",$J,0)) I MAX'>0 Q "^"
S DIR(0)="LAO^1:"_MAX
S DIR("A")="Select "_$S(GMPLMODE="S":"Service",1:"Clinic")
S:MAX>1 DIR("A")=DIR("A")_" (1-"_MAX_"): "
S:MAX'>1 DIR("A")=DIR("A")_": ",DIR("B")=1
S DIR("?")="Enter the display number of the "_$S(GMPLMODE="S":"service",1:"clinic")_"(s) you wish to select"
D ^DIR I $D(DTOUT)!(X="") S Y="^"
Q Y
;
DIFFRENT() ; -- Returns 1 if view has changed, else 0
N I,TEMP S TEMP=""
F I=0:0 S I=$O(^TMP("GMPLIST",$J,"VIEW",I)) Q:I'>0 S TEMP=TEMP_I_"/"
S:$L(TEMP) TEMP=GMPLMODE_"/"_TEMP
Q TEMP'=$P($G(^VA(200,DUZ,125)),U)
;
SAVE ; -- save new view in File #200/Field #125
N I,TEMP,TMP S TEMP=GMPLMODE,TMP=$P($G(^VA(200,DUZ,125)),U,2,999)
F I=0:0 S I=$O(^TMP("GMPLIST",$J,"VIEW",I)) Q:I'>0 S TEMP=TEMP_"/"_I
S:$L(TEMP)>1 TEMP=TEMP_"/"
S ^VA(200,DUZ,125)=TEMP_U_TMP,GMPSAVED=1
Q
;
SWITCH ; -- change preferred views (service <--> clinic)
N DIR,X,Y S Y=1,VALMBCK=$S(VALMCC:"",1:"R")
G SW1:'$L($G(GMPLVIEW)) ; no current view
S DIR(0)="Y",DIR("A")="Are you sure this is ok",DIR("B")="NO"
S DIR("?",1)="You may have only one preferred view at a time."
S DIR("?",2)="Enter YES to change how your preferred view is defined,"
S DIR("?")="or press <return> to keep the view you currently have."
W !!,">>> This action will clear your current view of problems by "
W $S(GMPLMODE="S":"service",1:"clinic")
W !?5,"and present a list of "_$S(GMPLMODE="S":"clinics",1:"services")
W " to replace it with.",! D ^DIR
SW1 I Y D
. S VALMBCK="R",GMPLVIEW="",GMPLMODE=$S(GMPLMODE="S":"C",1:"S")
. D @("GET"_GMPLMODE_"LIST^GMPLPREF") K VALMHDR
Q
;
DELETE ; -- delete preferred view (no view)
N DIR,X,Y S DIR(0)="Y",DIR("B")="NO",VALMBCK=$S(VALMCC:"",1:"R")
S DIR("A")="Are you sure you want to delete your preferred view"
S DIR("?",1)="Enter YES to remove your preferred view; the default view of Outpatient,",DIR("?",2)="including all active problems, will be used to display problem information.",DIR("?")="Enter NO to continue editing your current view."
D ^DIR I Y D
. W !!,"Deleting preferred view of "_$S(GMPLMODE="S":"services",1:"clinics")_" ..."
. K ^TMP("GMPLIST",$J,"VIEW") S ^TMP("GMPLIST",$J,"VIEW",0)=0,VALMBCK="Q",GMPLMODE=""
. D SAVE W " done."
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMPLPRF1 5257 printed Oct 16, 2024@18:30:59 Page 2
GMPLPRF1 ; SLC/MKB -- Problem List User Prefs cont ;;9-5-95 11:54am
+1 ;;2.0;Problem List;**3**;Aug 25, 1994
ADD ; -- add item(s) to view
+1 NEW GMPLSEL,GMPLNO,IFN,NUM,CNUM,I,J
SET VALMBCK=$SELECT(VALMCC:"",1:"R")
ADD1 SET GMPLSEL=$$SELECT
if GMPLSEL="^"
QUIT
+1 SET GMPLNO=$LENGTH(GMPLSEL,",")
SET I=$SELECT(GMPLMODE="S":"service",1:"clinic")
+2 IF (^TMP("GMPLIST",$JOB,"VIEW",0)+GMPLNO-1)>60
Begin DoDot:1
+3 WRITE !!,"You may not have more than 60 "_I_"s included in your view!"
+4 WRITE !,"Your view currently includes "_^TMP("GMPLIST",$JOB,"VIEW",0)_" "_I_$SELECT(^TMP("GMPLIST",$JOB,"VIEW",0)'=1:"s",1:"")_"."
+5 WRITE !,"Please select again, choosing no more than "_(60-^TMP("GMPLIST",$JOB,"VIEW",0))_" "_I_$SELECT(^TMP("GMPLIST",$JOB,"VIEW",0)'=1:"s",1:"")_"."
End DoDot:1
GOTO ADD1
ADD2 WRITE !!,"Adding "_(GMPLNO-1)_" "_I_"(s) ..."
KILL I
+1 FOR I=1:1:GMPLNO
SET NUM=$PIECE(GMPLSEL,",",I)
IF NUM
Begin DoDot:1
+2 SET IFN=^TMP("GMPLIST",$JOB,"IDX",NUM)
WRITE "."
+3 SET TMP=$EXTRACT($PIECE(^TMP("GMPLIST",$JOB,NUM,0),U,1),1,44)_" Y"
SET ^TMP("GMPLIST",$JOB,NUM,0)=TMP
+4 if '$DATA(^TMP("GMPLIST",$JOB,"VIEW",IFN))
SET ^TMP("GMPLIST",$JOB,"VIEW",IFN)=""
SET ^TMP("GMPLIST",$JOB,"VIEW",0)=^TMP("GMPLIST",$JOB,"VIEW",0)+1
+5 if GMPLMODE'="S"
QUIT
if '$DATA(^DIC(49,"ACHLD",IFN))
QUIT
+6 IF $$INCLCHLD(IFN)
FOR J=0:0
SET J=$ORDER(^DIC(49,"ACHLD",IFN,J))
if J'>0
QUIT
Begin DoDot:2
+7 SET CNUM=+$GET(^TMP("GMPLIST",$JOB,"B",J))
WRITE "."
+8 IF CNUM
SET TMP=$EXTRACT(^TMP("GMPLIST",$JOB,CNUM,0),1,44)_" Y"
SET ^TMP("GMPLIST",$JOB,CNUM,0)=TMP
if '$DATA(^TMP("GMPLIST",$JOB,"VIEW",J))
SET ^TMP("GMPLIST",$JOB,"VIEW",J)=""
SET ^TMP("GMPLIST",$JOB,"VIEW",0)=^TMP("GMPLIST",$JOB,"VIEW",0)+1
End DoDot:2
End DoDot:1
+9 SET VALMBCK="R"
SET VALMSG=$$MSG^GMPLPREF
KILL VALMHDR
+10 QUIT
+11 ;
REMOVE ; -- delete item(s) from view
+1 NEW GMPLSEL,GMPLNO,IFN,NUM,CNUM,I,J
SET VALMBCK=$SELECT(VALMCC:"",1:"R")
+2 SET GMPLSEL=$$SELECT
if GMPLSEL="^"
QUIT
+3 SET GMPLNO=$LENGTH(GMPLSEL,",")
+4 WRITE !!,"Removing "_(GMPLNO-1)_" "_$SELECT(GMPLMODE="S":"service",1:"clinic")_"(s) ..."
+5 FOR I=1:1:GMPLNO
SET NUM=$PIECE(GMPLSEL,",",I)
IF NUM
Begin DoDot:1
+6 SET IFN=+^TMP("GMPLIST",$JOB,"IDX",NUM)
SET ^TMP("GMPLIST",$JOB,NUM,0)=$EXTRACT(^TMP("GMPLIST",$JOB,NUM,0),1,44)
+7 if $DATA(^TMP("GMPLIST",$JOB,"VIEW",IFN))
SET ^TMP("GMPLIST",$JOB,"VIEW",0)=^TMP("GMPLIST",$JOB,"VIEW",0)-1
+8 KILL ^TMP("GMPLIST",$JOB,"VIEW",IFN)
WRITE "."
+9 if GMPLMODE'="S"
QUIT
if '$DATA(^DIC(49,"ACHLD",IFN))
QUIT
+10 IF $$INCLCHLD(IFN)
FOR J=0:0
SET J=$ORDER(^DIC(49,"ACHLD",IFN,J))
if J'>0
QUIT
Begin DoDot:2
+11 SET CNUM=+$GET(^TMP("GMPLIST",$JOB,"B",J))
WRITE "."
+12 IF CNUM
SET ^TMP("GMPLIST",$JOB,CNUM,0)=$EXTRACT(^TMP("GMPLIST",$JOB,CNUM,0),1,44)
if $DATA(^TMP("GMPLIST",$JOB,"VIEW",J))
SET ^TMP("GMPLIST",$JOB,"VIEW",0)=^TMP("GMPLIST",$JOB,"VIEW",0)-1
KILL ^TMP("GMPLIST",$JOB,"VIEW",J)
End DoDot:2
End DoDot:1
+13 SET VALMBCK="R"
SET VALMSG=$$MSG^GMPLPREF
KILL VALMHDR
+14 QUIT
+15 ;
INCLCHLD(IFN) ; Returns 1 or 0, to include 'child' services in selection
+1 NEW DIR,X,Y,NAME
SET NAME=$PIECE($GET(^DIC(49,IFN,0)),U)
SET DIR("B")="YES"
+2 SET DIR(0)="Y"
SET DIR("A")="Include all sub-services/sections of "_NAME
+3 SET DIR("?",1)="This service is a 'parent' to other services/sections,"
+4 SET DIR("?",2)="listed indented above; enter YES to include all of these"
+5 SET DIR("?")="as well in this action, or enter NO to exclude them."
+6 DO ^DIR
if $DATA(DTOUT)
SET Y="^"
+7 QUIT Y
+8 ;
SELECT() ; Select item(s) from list
+1 NEW DIR,X,Y,MAX
+2 SET MAX=+$GET(^TMP("GMPLIST",$JOB,0))
IF MAX'>0
QUIT "^"
+3 SET DIR(0)="LAO^1:"_MAX
+4 SET DIR("A")="Select "_$SELECT(GMPLMODE="S":"Service",1:"Clinic")
+5 if MAX>1
SET DIR("A")=DIR("A")_" (1-"_MAX_"): "
+6 if MAX'>1
SET DIR("A")=DIR("A")_": "
SET DIR("B")=1
+7 SET DIR("?")="Enter the display number of the "_$SELECT(GMPLMODE="S":"service",1:"clinic")_"(s) you wish to select"
+8 DO ^DIR
IF $DATA(DTOUT)!(X="")
SET Y="^"
+9 QUIT Y
+10 ;
DIFFRENT() ; -- Returns 1 if view has changed, else 0
+1 NEW I,TEMP
SET TEMP=""
+2 FOR I=0:0
SET I=$ORDER(^TMP("GMPLIST",$JOB,"VIEW",I))
if I'>0
QUIT
SET TEMP=TEMP_I_"/"
+3 if $LENGTH(TEMP)
SET TEMP=GMPLMODE_"/"_TEMP
+4 QUIT TEMP'=$PIECE($GET(^VA(200,DUZ,125)),U)
+5 ;
SAVE ; -- save new view in File #200/Field #125
+1 NEW I,TEMP,TMP
SET TEMP=GMPLMODE
SET TMP=$PIECE($GET(^VA(200,DUZ,125)),U,2,999)
+2 FOR I=0:0
SET I=$ORDER(^TMP("GMPLIST",$JOB,"VIEW",I))
if I'>0
QUIT
SET TEMP=TEMP_"/"_I
+3 if $LENGTH(TEMP)>1
SET TEMP=TEMP_"/"
+4 SET ^VA(200,DUZ,125)=TEMP_U_TMP
SET GMPSAVED=1
+5 QUIT
+6 ;
SWITCH ; -- change preferred views (service <--> clinic)
+1 NEW DIR,X,Y
SET Y=1
SET VALMBCK=$SELECT(VALMCC:"",1:"R")
+2 ; no current view
if '$LENGTH($GET(GMPLVIEW))
GOTO SW1
+3 SET DIR(0)="Y"
SET DIR("A")="Are you sure this is ok"
SET DIR("B")="NO"
+4 SET DIR("?",1)="You may have only one preferred view at a time."
+5 SET DIR("?",2)="Enter YES to change how your preferred view is defined,"
+6 SET DIR("?")="or press <return> to keep the view you currently have."
+7 WRITE !!,">>> This action will clear your current view of problems by "
+8 WRITE $SELECT(GMPLMODE="S":"service",1:"clinic")
+9 WRITE !?5,"and present a list of "_$SELECT(GMPLMODE="S":"clinics",1:"services")
+10 WRITE " to replace it with.",!
DO ^DIR
SW1 IF Y
Begin DoDot:1
+1 SET VALMBCK="R"
SET GMPLVIEW=""
SET GMPLMODE=$SELECT(GMPLMODE="S":"C",1:"S")
+2 DO @("GET"_GMPLMODE_"LIST^GMPLPREF")
KILL VALMHDR
End DoDot:1
+3 QUIT
+4 ;
DELETE ; -- delete preferred view (no view)
+1 NEW DIR,X,Y
SET DIR(0)="Y"
SET DIR("B")="NO"
SET VALMBCK=$SELECT(VALMCC:"",1:"R")
+2 SET DIR("A")="Are you sure you want to delete your preferred view"
+3 SET DIR("?",1)="Enter YES to remove your preferred view; the default view of Outpatient,"
SET DIR("?",2)="including all active problems, will be used to display problem information."
SET DIR("?")="Enter NO to continue editing your current view."
+4 DO ^DIR
IF Y
Begin DoDot:1
+5 WRITE !!,"Deleting preferred view of "_$SELECT(GMPLMODE="S":"services",1:"clinics")_" ..."
+6 KILL ^TMP("GMPLIST",$JOB,"VIEW")
SET ^TMP("GMPLIST",$JOB,"VIEW",0)=0
SET VALMBCK="Q"
SET GMPLMODE=""
+7 DO SAVE
WRITE " done."
End DoDot:1
+8 QUIT