GMTSOBT ; SLC/KER - HS Object - Time and Type ; 01/06/2003
;;2.7;Health Summary;**58**;Oct 20, 1995
;
; External References
; DBIA 10104 $$UP^XLFSTR
; DBIA 10088 ENDR^%ZISS
; DBIA 10026 ^DIR
;
Q
TP ; Time Period
Q:+($G(GMTSQ))>0 N X,Y,DIR,GMTSX,GMTSDEF K GMTSOBJ("TIME")
S GMTSDEF=$$TIM($P($G(^GMT(142.5,+($G(GMTSDA)),0)),U,4))
S DIR("A")=" Enter REPORT PERIOD: ",DIR("B")="3M" S:$L(GMTSDEF) DIR("B")=GMTSDEF
S DIR(0)="FAO^2;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
S (DIR("?"),DIR("??"))="^D TH^GMTSOBT"
D ^DIR S:$D(DIROUT)!($D(DTOUT)) GMTSQ=1
Q:+($G(GMTSQ))>0 Q:'$L($G(GMTSX)) W " ",GMTSX S GMTSOBJ("TIME")=$G(GMTSX)
Q
TH ; Time Help
D ATTR
W !," Enter a time limit for the Health Summary report/object. It"
W !," must be in the format of a numeric time length and an alpha"
W !," time unit, and can not exceed 5 characters. If no time unit"
W !," is provided, then the time unit will be set to Days (D), i.e.,"
W !," "
W !,$G(BOLD)," 11, 2D, 4D, 6W, 18W, 3M, 6M, 1Y",$G(NORM)
D KATTR
Q
TIM(X) ; Input Transform for Time
Q:$L(X)=1&(X="@") X S X=$$UP^XLFSTR($G(X)) Q:$L($G(X))>5 "" Q:$L((+($G(X))))>4 "" S X=$G(X)
N GMTSLEN,GMTSUNIT S GMTSLEN=+X,GMTSUNIT=$E(X,$L(X)) S:+GMTSUNIT>0 GMTSUNIT="D" S:$L(GMTSLEN)=$L(X) GMTSUNIT="D"
Q:GMTSUNIT'="D"&(GMTSUNIT'="W")&(GMTSUNIT'="M")&(GMTSUNIT'="Y") ""
I GMTSUNIT="D",GMTSLEN>5 D
. N GMTSO S GMTSO=GMTSLEN I +GMTSLEN>89!(GMTSLEN#7=0)!(GMTSLEN#7=6) D
. . S GMTSLEN=GMTSLEN\7,GMTSUNIT="W"
. . S:GMTSO#7>3 GMTSLEN=GMTSLEN+1
. I GMTSUNIT="D",GMTSLEN#32>28 D
. . S GMTSLEN=GMTSLEN\32 S:GMTSO#32>28 GMTSLEN=GMTSLEN+1 S GMTSUNIT="M"
I GMTSUNIT="W",GMTSLEN>3 D
. N GMTSO S GMTSO=GMTSLEN I +GMTSLEN>23!(GMTSLEN#4=3)!(GMTSLEN#4=0) D
. . S GMTSLEN=GMTSLEN\4.333333333,GMTSUNIT="M"
. . S:GMTSO#4.333333333>3 GMTSLEN=GMTSLEN+1
I GMTSUNIT="M",GMTSLEN>11 D
. N GMTSO S GMTSO=GMTSLEN I GMTSLEN#12=11!(GMTSLEN#12=0) D
. . S GMTSLEN=GMTSLEN\12,GMTSUNIT="Y" S:GMTSO#12=11 GMTSLEN=GMTSLEN+1
S X=GMTSLEN_GMTSUNIT
Q X
;
TYPE(I) ; Select Type
; Uses Fileman's DIC variables for Lookup
N GMTSHDR,GMTSNOQ,GMTSNOI,GMTSX,GMTSREDO
TY2 ; Prompt for Type
S GMTSX=$$TYPE^GMTSULT I X["@" S X="@",Y=-1 Q -1
Q:+GMTSX'>0 -1
S GMTSHDR(1)="You have selected the following Health Summary Type to use as an Object:"
S GMTSHDR(2)=" ",GMTSNOQ="",GMTSNOI="",GMTSREDO=0
D DT^GMTSOBD(+GMTSX) I $D(^TMP("GMTSOBT",$J)) D
. D NOQUE^GMTSOBD W ! N DIR,DTOUT,DUOUT S DIR(0)="YAO",DIR("A")="Is this correct? ",DIR("B")="Y"
. D ^DIR S:$$UP^XLFSTR($E(X,1))="N" GMTSREDO=1 I +Y'>0 S GMTSX=-1
W:+GMTSREDO>0 ! G:+GMTSREDO>0 TY2
D XY(GMTSX) S I=GMTSX K ^TMP("GMTSOBT",$J)
Q I
;
RP(TYPE,OBJ) ; Report Period
; Input TYPE Required, Health Summary Type IEN
; OBJ Optional, Health Summary Object IEN
;
; Output X Report Period, "" or "@"
; GMTSQ Up Arrow/Time Out
;
Q:+($G(GMTSQ))>0 "" N X,Y,DIR,GMTSX,GMTSDEF,GMTSS,GMTSTY,GMTSOB K GMTSOBJ("TIME") S GMTSOB=+($G(OBJ)),GMTSTY=+($G(TYPE)) Q:+GMTSTY=0 "@"
S GMTSS=$$RT(GMTSTY) Q:+($G(GMTSQ))>0 -1 Q:GMTSS'>0 "@"
S GMTSDEF=$$TIM($P($G(^GMT(142.5,+($G(GMTSDA)),0)),U,4))
S DIR("A")=" Enter new TIME LIMIT: " S:$L(GMTSDEF) DIR("B")=GMTSDEF
S DIR(0)="FAO^1;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
S (DIR("?"),DIR("??"))="^D TH^GMTSOBT" W ! D ^DIR I X="@",Y="" Q X
S:$D(DIRUT)!($D(DIROUT))!($D(DTOUT))!($D(DUOUT)) GMTSQ=1 Q:+($G(GMTSQ))>0 -1
Q:'$L($G(GMTSX)) "" W " ",GMTSX S GMTSOBJ("TIME")=$G(GMTSX)
S X=GMTSX
Q X
RT(X) ; Report Period or Time Limits
; Input X IEN or Health Summary Type
Q:+($G(GMTSQ))>0 -1 N Y,DIR,GMTSX S GMTSX=+($G(X)) D RTA(+GMTSX)
I '$D(DIR("A")) S DIR("A",1)=" Overwrite Health Summary Type Time Limits ",DIR("A")=" with Health Summary Object Report Period? "
S DIR(0)="YAO",DIR("B")="N",(DIR("?"),DIR("??"))="^D RTH^GMTSOBT(GMTSX)"
W ! D ^DIR S:$D(DIRUT)!($D(DIROUT))!($D(DTOUT))!($D(DUOUT)) GMTSQ=1
Q:+($G(GMTSQ))>0 -1 S X=+($G(Y))
Q X
RTH(X) ; Report Period or Time Limits Help
; Input X IEN or Health Summary Type
D LS(+($G(X))) W !
D ATTR
W !," Entering a new TIME LIMIT for the Health Summary Object will "
W !," overwrite the TIME LIMITS set the for individual components. "
W !," It must be alpha numeric and can not exceed 5 characters."
W !," Examples: ",$G(BOLD),"3D, 6W, 3M, 1Y",$G(NORM)
D KATTR
Q
RTA(X) ; Report Period or Time Limit DIR(A)
D ATTR K DIR("A") N GMTSC,GMTST,GMTSP,GMTSS,GMTSR,GMTSI,GMTSN S GMTSI=+($G(X)) Q:+X'>0
S GMTSN=$P($G(^GMT(142,+GMTSI,0)),"^",1)
Q:'$L(GMTSN)
I $L(GMTSN) D
. S GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type '"
. S GMTST=GMTST_$$UP^XLFSTR(GMTSN)_"'?"
I '$L(GMTSN) D
. S GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type?"
F Q:'$L($$TRIM(GMTST)) D
. I $L(GMTST)'>60 S GMTSC=+($G(GMTSC))+1,DIR("A",GMTSC)=" "_$$TRIM(GMTST)_" ",GMTST="" Q
. S GMTSS=$E($$TRIM(GMTST),1,60),GMTSS=$P(GMTSS," ",1,($L(GMTSS," ")-1)),GMTSR=$P($$TRIM(GMTST),GMTSS,2,299),GMTST=GMTSR,GMTSC=+($G(GMTSC))+1,DIR("A",GMTSC)=" "_$$TRIM(GMTSS)_" "
S:+($G(GMTSC))>0 DIR("A")=DIR("A",GMTSC) K:+($G(GMTSC))>0 DIR("A",GMTSC)
S (GMTSC,GMTSI)=0 F GMTSC=1:1 D Q:GMTSI>0
. S:'$D(DIR("A",GMTSC)) GMTSS="DIR(""A"")",GMTSI=1
. S:$D(DIR("A",GMTSC)) GMTSS="DIR(""A"","_GMTSC_")"
. S GMTST=@GMTSS I GMTST["Time Limits" S GMTST=$P(GMTST,"Time Limits",1)_$G(BOLD)_"Time Limits"_$G(NORM)_$P(GMTST,"Time Limits",2),@GMTSS=GMTST Q
. S GMTST=@GMTSS I GMTST["Report Period" S GMTST=$P(GMTST,"Report Period",1)_$G(BOLD)_"Report Period"_$G(NORM)_$P(GMTST,"Report Period",2),@GMTSS=GMTST Q
. S GMTST=@GMTSS I GMTST["a Report" S GMTST=$P(GMTST,"a Report",1)_"a "_$G(BOLD)_"Report"_$G(NORM)_$P(GMTST,"a Report",2),@GMTSS=GMTST
. S GMTST=@GMTSS I GMTST["Period which" S GMTST=$P(GMTST,"Period which",1)_$G(BOLD)_"Period"_$G(NORM)_" which"_$P(GMTST,"Period which",2,299),@GMTSS=GMTST
D KATTR
Q
LS(X) ; List Structure
D ATTR
N GMTST,GMTSS,GMTSC,GMTSTA,GMTSI,GMTSAB,GMTSOL,GMTSTL,GMTSNM,GMTSHD,GMTSCT
S GMTST=+($G(X)) Q:'$D(^GMT(142,+GMTST,0))!('$D(^GMT(142,+GMTST,1))) 0
S (GMTSCT,GMTSTA,GMTSI)=0
F S GMTSI=$O(^GMT(142,+GMTST,1,GMTSI)) Q:+GMTSI=0 D Q:+($G(GMTSCT))>1
. S GMTSS=$G(^GMT(142,+GMTST,1,GMTSI,0)),GMTSC=$G(^GMT(142.1,+($P(GMTSS,"^",2)),0)) Q:+($P(GMTSS,"^",4))'>0!($P(GMTSC,"^",3)'="Y")
. S GMTSOL=$P(GMTSS,"^",3) S:'$L(GMTSOL) GMTSOL="--" S GMTSTL=$P(GMTSS,"^",4),GMTSNM=$$EN2^GMTSUMX($P(GMTSC,"^",1))
. S GMTSHD=$P(GMTSC,"^",9) S:$L(GMTSHD) GMTSNM=GMTSNM S GMTSAB=$P(GMTSC,"^",4),GMTSCT=+($G(GMTSCT))+1
. I GMTSCT=1 D
. . W !," Example of Health Summary Type component ",$G(BOLD),"TIME LIMITS",$G(NORM),!
. . W !,?9,"Abbr",?15,"Component Name",?45,"Max Occurrences",?62,$G(BOLD),"Time Limits",$G(NORM)
. . W !,?9,"----------------------------------------------------------------"
. W !,?9,GMTSAB,?15,GMTSNM,?49,$J(GMTSOL,4),?63,$G(BOLD),$J(GMTSTL,5),$G(NORM)
D KATTR
Q
TA(X) ; Time Limits Applicable
N GMTST,GMTSS,GMTSC,GMTSTA,GMTSI
S GMTST=+($G(X)) Q:'$D(^GMT(142,+GMTST,0))!('$D(^GMT(142,+GMTST,1))) 0
S (GMTSTA,GMTSI)=0
F S GMTSI=$O(^GMT(142,+GMTST,1,GMTSI)) Q:+GMTSI=0 D Q:+GMTSTA>0
. S GMTSS=$G(^GMT(142,+GMTST,1,GMTSI,0))
. S GMTSC=$G(^GMT(142.1,+($P(GMTSS,"^",2)),0))
. S:+($P(GMTSS,"^",4))>0&($P(GMTSC,"^",3)="Y") GMTSTA=1
S X=GMTSTA
Q X
;
; Miscellaneous
TRIM(X) ; Trim Spaces
S X=$G(X) F Q:$E(X,1)'=" " S X=$E(X,2,$L(X))
F Q:$E(X,$L(X))'=" " S X=$E(X,1,($L(X)-1))
Q X
XY(I) ; Set X and Y Variables
K Y,X S X=+($G(I)) I X'>0!('$D(^GMT(142,+X,0))) S Y=-1 Q
S Y=+X_"^"_$P($G(^GMT(142,+X,0)),"^",1),Y(0)=$G(^GMT(142,+X,0)),Y(0,0)=$P($G(^GMT(142,+X,0)),"^",1),Y(0,1)=$$EN^GMTSUMX(Y(0,0))
Q
ATTR ; Set Screen Attributes
N X,IOINHI,IOINORM S X="IOINHI;IOINORM" D ENDR^%ZISS S BOLD=$G(IOINHI),NORM=$G(IOINORM) Q
KATTR ; Kill Screen Attributes
K NORM,BOLD Q
GMTSOBT ; SLC/KER - HS Object - Time and Type ; 01/06/2003
+1 ;;2.7;Health Summary;**58**;Oct 20, 1995
+2 ;
+3 ; External References
+4 ; DBIA 10104 $$UP^XLFSTR
+5 ; DBIA 10088 ENDR^%ZISS
+6 ; DBIA 10026 ^DIR
+7 ;
+8 QUIT
TP ; Time Period
+1 IF +($GET(GMTSQ))>0
QUIT
NEW X,Y,DIR,GMTSX,GMTSDEF
KILL GMTSOBJ("TIME")
+2 SET GMTSDEF=$$TIM($PIECE($GET(^GMT(142.5,+($GET(GMTSDA)),0)),U,4))
+3 SET DIR("A")=" Enter REPORT PERIOD: "
SET DIR("B")="3M"
IF $LENGTH(GMTSDEF)
SET DIR("B")=GMTSDEF
+4 SET DIR(0)="FAO^2;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
+5 SET (DIR("?"),DIR("??"))="^D TH^GMTSOBT"
+6 DO ^DIR
IF $DATA(DIROUT)!($DATA(DTOUT))
SET GMTSQ=1
+7 IF +($GET(GMTSQ))>0
QUIT
IF '$LENGTH($GET(GMTSX))
QUIT
WRITE " ",GMTSX
SET GMTSOBJ("TIME")=$GET(GMTSX)
+8 QUIT
TH ; Time Help
+1 DO ATTR
+2 WRITE !," Enter a time limit for the Health Summary report/object. It"
+3 WRITE !," must be in the format of a numeric time length and an alpha"
+4 WRITE !," time unit, and can not exceed 5 characters. If no time unit"
+5 WRITE !," is provided, then the time unit will be set to Days (D), i.e.,"
+6 WRITE !," "
+7 WRITE !,$GET(BOLD)," 11, 2D, 4D, 6W, 18W, 3M, 6M, 1Y",$GET(NORM)
+8 DO KATTR
+9 QUIT
TIM(X) ; Input Transform for Time
+1 IF $LENGTH(X)=1&(X="@")
QUIT X
SET X=$$UP^XLFSTR($GET(X))
IF $LENGTH($GET(X))>5
QUIT ""
IF $LENGTH((+($GET(X))))>4
QUIT ""
SET X=$GET(X)
+2 NEW GMTSLEN,GMTSUNIT
SET GMTSLEN=+X
SET GMTSUNIT=$EXTRACT(X,$LENGTH(X))
IF +GMTSUNIT>0
SET GMTSUNIT="D"
IF $LENGTH(GMTSLEN)=$LENGTH(X)
SET GMTSUNIT="D"
+3 IF GMTSUNIT'="D"&(GMTSUNIT'="W")&(GMTSUNIT'="M")&(GMTSUNIT'="Y")
QUIT ""
+4 IF GMTSUNIT="D"
IF GMTSLEN>5
Begin DoDot:1
+5 NEW GMTSO
SET GMTSO=GMTSLEN
IF +GMTSLEN>89!(GMTSLEN#7=0)!(GMTSLEN#7=6)
Begin DoDot:2
+6 SET GMTSLEN=GMTSLEN\7
SET GMTSUNIT="W"
+7 IF GMTSO#7>3
SET GMTSLEN=GMTSLEN+1
End DoDot:2
+8 IF GMTSUNIT="D"
IF GMTSLEN#32>28
Begin DoDot:2
+9 SET GMTSLEN=GMTSLEN\32
IF GMTSO#32>28
SET GMTSLEN=GMTSLEN+1
SET GMTSUNIT="M"
End DoDot:2
End DoDot:1
+10 IF GMTSUNIT="W"
IF GMTSLEN>3
Begin DoDot:1
+11 NEW GMTSO
SET GMTSO=GMTSLEN
IF +GMTSLEN>23!(GMTSLEN#4=3)!(GMTSLEN#4=0)
Begin DoDot:2
+12 SET GMTSLEN=GMTSLEN\4.333333333
SET GMTSUNIT="M"
+13 IF GMTSO#4.333333333>3
SET GMTSLEN=GMTSLEN+1
End DoDot:2
End DoDot:1
+14 IF GMTSUNIT="M"
IF GMTSLEN>11
Begin DoDot:1
+15 NEW GMTSO
SET GMTSO=GMTSLEN
IF GMTSLEN#12=11!(GMTSLEN#12=0)
Begin DoDot:2
+16 SET GMTSLEN=GMTSLEN\12
SET GMTSUNIT="Y"
IF GMTSO#12=11
SET GMTSLEN=GMTSLEN+1
End DoDot:2
End DoDot:1
+17 SET X=GMTSLEN_GMTSUNIT
+18 QUIT X
+19 ;
TYPE(I) ; Select Type
+1 ; Uses Fileman's DIC variables for Lookup
+2 NEW GMTSHDR,GMTSNOQ,GMTSNOI,GMTSX,GMTSREDO
TY2 ; Prompt for Type
+1 SET GMTSX=$$TYPE^GMTSULT
IF X["@"
SET X="@"
SET Y=-1
QUIT -1
+2 IF +GMTSX'>0
QUIT -1
+3 SET GMTSHDR(1)="You have selected the following Health Summary Type to use as an Object:"
+4 SET GMTSHDR(2)=" "
SET GMTSNOQ=""
SET GMTSNOI=""
SET GMTSREDO=0
+5 DO DT^GMTSOBD(+GMTSX)
IF $DATA(^TMP("GMTSOBT",$JOB))
Begin DoDot:1
+6 DO NOQUE^GMTSOBD
WRITE !
NEW DIR,DTOUT,DUOUT
SET DIR(0)="YAO"
SET DIR("A")="Is this correct? "
SET DIR("B")="Y"
+7 DO ^DIR
IF $$UP^XLFSTR($EXTRACT(X,1))="N"
SET GMTSREDO=1
IF +Y'>0
SET GMTSX=-1
End DoDot:1
+8 IF +GMTSREDO>0
WRITE !
IF +GMTSREDO>0
GOTO TY2
+9 DO XY(GMTSX)
SET I=GMTSX
KILL ^TMP("GMTSOBT",$JOB)
+10 QUIT I
+11 ;
RP(TYPE,OBJ) ; Report Period
+1 ; Input TYPE Required, Health Summary Type IEN
+2 ; OBJ Optional, Health Summary Object IEN
+3 ;
+4 ; Output X Report Period, "" or "@"
+5 ; GMTSQ Up Arrow/Time Out
+6 ;
+7 IF +($GET(GMTSQ))>0
QUIT ""
NEW X,Y,DIR,GMTSX,GMTSDEF,GMTSS,GMTSTY,GMTSOB
KILL GMTSOBJ("TIME")
SET GMTSOB=+($GET(OBJ))
SET GMTSTY=+($GET(TYPE))
IF +GMTSTY=0
QUIT "@"
+8 SET GMTSS=$$RT(GMTSTY)
IF +($GET(GMTSQ))>0
QUIT -1
IF GMTSS'>0
QUIT "@"
+9 SET GMTSDEF=$$TIM($PIECE($GET(^GMT(142.5,+($GET(GMTSDA)),0)),U,4))
+10 SET DIR("A")=" Enter new TIME LIMIT: "
IF $LENGTH(GMTSDEF)
SET DIR("B")=GMTSDEF
+11 SET DIR(0)="FAO^1;5^S X=$$TIM^GMTSOBT(X) S:$L(X) GMTSX=X K:'$L(X) X"
+12 SET (DIR("?"),DIR("??"))="^D TH^GMTSOBT"
WRITE !
DO ^DIR
IF X="@"
IF Y=""
QUIT X
+13 IF $DATA(DIRUT)!($DATA(DIROUT))!($DATA(DTOUT))!($DATA(DUOUT))
SET GMTSQ=1
IF +($GET(GMTSQ))>0
QUIT -1
+14 IF '$LENGTH($GET(GMTSX))
QUIT ""
WRITE " ",GMTSX
SET GMTSOBJ("TIME")=$GET(GMTSX)
+15 SET X=GMTSX
+16 QUIT X
RT(X) ; Report Period or Time Limits
+1 ; Input X IEN or Health Summary Type
+2 IF +($GET(GMTSQ))>0
QUIT -1
NEW Y,DIR,GMTSX
SET GMTSX=+($GET(X))
DO RTA(+GMTSX)
+3 IF '$DATA(DIR("A"))
SET DIR("A",1)=" Overwrite Health Summary Type Time Limits "
SET DIR("A")=" with Health Summary Object Report Period? "
+4 SET DIR(0)="YAO"
SET DIR("B")="N"
SET (DIR("?"),DIR("??"))="^D RTH^GMTSOBT(GMTSX)"
+5 WRITE !
DO ^DIR
IF $DATA(DIRUT)!($DATA(DIROUT))!($DATA(DTOUT))!($DATA(DUOUT))
SET GMTSQ=1
+6 IF +($GET(GMTSQ))>0
QUIT -1
SET X=+($GET(Y))
+7 QUIT X
RTH(X) ; Report Period or Time Limits Help
+1 ; Input X IEN or Health Summary Type
+2 DO LS(+($GET(X)))
WRITE !
+3 DO ATTR
+4 WRITE !," Entering a new TIME LIMIT for the Health Summary Object will "
+5 WRITE !," overwrite the TIME LIMITS set the for individual components. "
+6 WRITE !," It must be alpha numeric and can not exceed 5 characters."
+7 WRITE !," Examples: ",$GET(BOLD),"3D, 6W, 3M, 1Y",$GET(NORM)
+8 DO KATTR
+9 QUIT
RTA(X) ; Report Period or Time Limit DIR(A)
+1 DO ATTR
KILL DIR("A")
NEW GMTSC,GMTST,GMTSP,GMTSS,GMTSR,GMTSI,GMTSN
SET GMTSI=+($GET(X))
IF +X'>0
QUIT
+2 SET GMTSN=$PIECE($GET(^GMT(142,+GMTSI,0)),"^",1)
+3 IF '$LENGTH(GMTSN)
QUIT
+4 IF $LENGTH(GMTSN)
Begin DoDot:1
+5 SET GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type '"
+6 SET GMTST=GMTST_$$UP^XLFSTR(GMTSN)_"'?"
End DoDot:1
+7 IF '$LENGTH(GMTSN)
Begin DoDot:1
+8 SET GMTST="Do you want to overwrite the TIME LIMITS in the Health Summary Type?"
End DoDot:1
+9 FOR
IF '$LENGTH($$TRIM(GMTST))
QUIT
Begin DoDot:1
+10 IF $LENGTH(GMTST)'>60
SET GMTSC=+($GET(GMTSC))+1
SET DIR("A",GMTSC)=" "_$$TRIM(GMTST)_" "
SET GMTST=""
QUIT
+11 SET GMTSS=$EXTRACT($$TRIM(GMTST),1,60)
SET GMTSS=$PIECE(GMTSS," ",1,($LENGTH(GMTSS," ")-1))
SET GMTSR=$PIECE($$TRIM(GMTST),GMTSS,2,299)
SET GMTST=GMTSR
SET GMTSC=+($GET(GMTSC))+1
SET DIR("A",GMTSC)=" "_$$TRIM(GMTSS)_" "
End DoDot:1
+12 IF +($GET(GMTSC))>0
SET DIR("A")=DIR("A",GMTSC)
IF +($GET(GMTSC))>0
KILL DIR("A",GMTSC)
+13 SET (GMTSC,GMTSI)=0
FOR GMTSC=1:1
Begin DoDot:1
+14 IF '$DATA(DIR("A",GMTSC))
SET GMTSS="DIR(""A"")"
SET GMTSI=1
+15 IF $DATA(DIR("A",GMTSC))
SET GMTSS="DIR(""A"","_GMTSC_")"
+16 SET GMTST=@GMTSS
IF GMTST["Time Limits"
SET GMTST=$PIECE(GMTST,"Time Limits",1)_$GET(BOLD)_"Time Limits"_$GET(NORM)_$PIECE(GMTST,"Time Limits",2)
SET @GMTSS=GMTST
QUIT
+17 SET GMTST=@GMTSS
IF GMTST["Report Period"
SET GMTST=$PIECE(GMTST,"Report Period",1)_$GET(BOLD)_"Report Period"_$GET(NORM)_$PIECE(GMTST,"Report Period",2)
SET @GMTSS=GMTST
QUIT
+18 SET GMTST=@GMTSS
IF GMTST["a Report"
SET GMTST=$PIECE(GMTST,"a Report",1)_"a "_$GET(BOLD)_"Report"_$GET(NORM)_$PIECE(GMTST,"a Report",2)
SET @GMTSS=GMTST
+19 SET GMTST=@GMTSS
IF GMTST["Period which"
SET GMTST=$PIECE(GMTST,"Period which",1)_$GET(BOLD)_"Period"_$GET(NORM)_" which"_$PIECE(GMTST,"Period which",2,299)
SET @GMTSS=GMTST
End DoDot:1
IF GMTSI>0
QUIT
+20 DO KATTR
+21 QUIT
LS(X) ; List Structure
+1 DO ATTR
+2 NEW GMTST,GMTSS,GMTSC,GMTSTA,GMTSI,GMTSAB,GMTSOL,GMTSTL,GMTSNM,GMTSHD,GMTSCT
+3 SET GMTST=+($GET(X))
IF '$DATA(^GMT(142,+GMTST,0))!('$DATA(^GMT(142,+GMTST,1)))
QUIT 0
+4 SET (GMTSCT,GMTSTA,GMTSI)=0
+5 FOR
SET GMTSI=$ORDER(^GMT(142,+GMTST,1,GMTSI))
IF +GMTSI=0
QUIT
Begin DoDot:1
+6 SET GMTSS=$GET(^GMT(142,+GMTST,1,GMTSI,0))
SET GMTSC=$GET(^GMT(142.1,+($PIECE(GMTSS,"^",2)),0))
IF +($PIECE(GMTSS,"^",4))'>0!($PIECE(GMTSC,"^",3)'="Y")
QUIT
+7 SET GMTSOL=$PIECE(GMTSS,"^",3)
IF '$LENGTH(GMTSOL)
SET GMTSOL="--"
SET GMTSTL=$PIECE(GMTSS,"^",4)
SET GMTSNM=$$EN2^GMTSUMX($PIECE(GMTSC,"^",1))
+8 SET GMTSHD=$PIECE(GMTSC,"^",9)
IF $LENGTH(GMTSHD)
SET GMTSNM=GMTSNM
SET GMTSAB=$PIECE(GMTSC,"^",4)
SET GMTSCT=+($GET(GMTSCT))+1
+9 IF GMTSCT=1
Begin DoDot:2
+10 WRITE !," Example of Health Summary Type component ",$GET(BOLD),"TIME LIMITS",$GET(NORM),!
+11 WRITE !,?9,"Abbr",?15,"Component Name",?45,"Max Occurrences",?62,$GET(BOLD),"Time Limits",$GET(NORM)
+12 WRITE !,?9,"----------------------------------------------------------------"
End DoDot:2
+13 WRITE !,?9,GMTSAB,?15,GMTSNM,?49,$JUSTIFY(GMTSOL,4),?63,$GET(BOLD),$JUSTIFY(GMTSTL,5),$GET(NORM)
End DoDot:1
IF +($GET(GMTSCT))>1
QUIT
+14 DO KATTR
+15 QUIT
TA(X) ; Time Limits Applicable
+1 NEW GMTST,GMTSS,GMTSC,GMTSTA,GMTSI
+2 SET GMTST=+($GET(X))
IF '$DATA(^GMT(142,+GMTST,0))!('$DATA(^GMT(142,+GMTST,1)))
QUIT 0
+3 SET (GMTSTA,GMTSI)=0
+4 FOR
SET GMTSI=$ORDER(^GMT(142,+GMTST,1,GMTSI))
IF +GMTSI=0
QUIT
Begin DoDot:1
+5 SET GMTSS=$GET(^GMT(142,+GMTST,1,GMTSI,0))
+6 SET GMTSC=$GET(^GMT(142.1,+($PIECE(GMTSS,"^",2)),0))
+7 IF +($PIECE(GMTSS,"^",4))>0&($PIECE(GMTSC,"^",3)="Y")
SET GMTSTA=1
End DoDot:1
IF +GMTSTA>0
QUIT
+8 SET X=GMTSTA
+9 QUIT X
+10 ;
+11 ; Miscellaneous
TRIM(X) ; Trim Spaces
+1 SET X=$GET(X)
FOR
IF $EXTRACT(X,1)'=" "
QUIT
SET X=$EXTRACT(X,2,$LENGTH(X))
+2 FOR
IF $EXTRACT(X,$LENGTH(X))'=" "
QUIT
SET X=$EXTRACT(X,1,($LENGTH(X)-1))
+3 QUIT X
XY(I) ; Set X and Y Variables
+1 KILL Y,X
SET X=+($GET(I))
IF X'>0!('$DATA(^GMT(142,+X,0)))
SET Y=-1
QUIT
+2 SET Y=+X_"^"_$PIECE($GET(^GMT(142,+X,0)),"^",1)
SET Y(0)=$GET(^GMT(142,+X,0))
SET Y(0,0)=$PIECE($GET(^GMT(142,+X,0)),"^",1)
SET Y(0,1)=$$EN^GMTSUMX(Y(0,0))
+3 QUIT
ATTR ; Set Screen Attributes
+1 NEW X,IOINHI,IOINORM
SET X="IOINHI;IOINORM"
DO ENDR^%ZISS
SET BOLD=$GET(IOINHI)
SET NORM=$GET(IOINORM)
QUIT
KATTR ; Kill Screen Attributes
+1 KILL NORM,BOLD
QUIT