GMPLPRF1 ; SLC/MKB -- Problem List User Prefs cont ;3/30/94 09:25
;;2.0;Problem List;;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 (GMPLIST("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 "_+GMPLIST("VIEW",0)_" "_I_$S(GMPLIST("VIEW",0)'=1:"s",1:"")_"."
. W !,"Please select again, choosing no more than "_(60-GMPLIST("VIEW",0))_" "_I_$S(GMPLIST("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=+GMPLIST("IDX",NUM) W "."
. S TMP=$E(GMPLIST(NUM,0),1,44)_" Y",GMPLIST(NUM,0)=TMP
. S:'$D(GMPLIST("VIEW",IFN)) GMPLIST("VIEW",IFN)="",GMPLIST("VIEW",0)=GMPLIST("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(GMPLIST("B",J)) W "."
. . I CNUM S TMP=$E(GMPLIST(CNUM,0),1,44)_" Y",GMPLIST(CNUM,0)=TMP S:'$D(GMPLIST("VIEW",J)) GMPLIST("VIEW",J)="",GMPLIST("VIEW",0)=GMPLIST("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=+GMPLIST("IDX",NUM),GMPLIST(NUM,0)=$E(GMPLIST(NUM,0),1,44)
. S:$D(GMPLIST("VIEW",IFN)) GMPLIST("VIEW",0)=GMPLIST("VIEW",0)-1
. K GMPLIST("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(GMPLIST("B",J)) W "."
. . I CNUM S GMPLIST(CNUM,0)=$E(GMPLIST(CNUM,0),1,44) S:$D(GMPLIST("VIEW",J)) GMPLIST("VIEW",0)=GMPLIST("VIEW",0)-1 K GMPLIST("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(GMPLIST(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(GMPLIST("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(GMPLIST("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 GMPLIST("VIEW") S GMPLIST("VIEW",0)=0,VALMBCK="Q",GMPLMODE=""
. D SAVE W " done."
Q
GMPLPRF1 ; SLC/MKB -- Problem List User Prefs cont ;3/30/94 09:25
+1 ;;2.0;Problem List;;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 (GMPLIST("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 "_+GMPLIST("VIEW",0)_" "_I_$SELECT(GMPLIST("VIEW",0)'=1:"s",1:"")_"."
+5 WRITE !,"Please select again, choosing no more than "_(60-GMPLIST("VIEW",0))_" "_I_$SELECT(GMPLIST("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=+GMPLIST("IDX",NUM)
WRITE "."
+3 SET TMP=$EXTRACT(GMPLIST(NUM,0),1,44)_" Y"
SET GMPLIST(NUM,0)=TMP
+4 IF '$DATA(GMPLIST("VIEW",IFN))
SET GMPLIST("VIEW",IFN)=""
SET GMPLIST("VIEW",0)=GMPLIST("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(GMPLIST("B",J))
WRITE "."
+8 IF CNUM
SET TMP=$EXTRACT(GMPLIST(CNUM,0),1,44)_" Y"
SET GMPLIST(CNUM,0)=TMP
IF '$DATA(GMPLIST("VIEW",J))
SET GMPLIST("VIEW",J)=""
SET GMPLIST("VIEW",0)=GMPLIST("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=+GMPLIST("IDX",NUM)
SET GMPLIST(NUM,0)=$EXTRACT(GMPLIST(NUM,0),1,44)
+7 IF $DATA(GMPLIST("VIEW",IFN))
SET GMPLIST("VIEW",0)=GMPLIST("VIEW",0)-1
+8 KILL GMPLIST("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(GMPLIST("B",J))
WRITE "."
+12 IF CNUM
SET GMPLIST(CNUM,0)=$EXTRACT(GMPLIST(CNUM,0),1,44)
IF $DATA(GMPLIST("VIEW",J))
SET GMPLIST("VIEW",0)=GMPLIST("VIEW",0)-1
KILL GMPLIST("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(GMPLIST(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(GMPLIST("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(GMPLIST("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 GMPLIST("VIEW")
SET GMPLIST("VIEW",0)=0
SET VALMBCK="Q"
SET GMPLMODE=""
+7 DO SAVE
WRITE " done."
End DoDot:1
+8 QUIT