GMTSP125 ; CIO/SLC - Post Install GMTS*2.7*125 ;Mar 07, 2019@10:53:03
 ;;2.7;Health Summary;**125**;Oct 20, 1995;Build 15
 Q
CI ; Component Install
 N GMTSIN,GMTSLIM,GMTSINST,GMTSTL,GMTSINST,GMTSTOT,GMTSBLD,GMTSCPS,GMTSCP,GMTSCI
 S GMTSCPS="RXDC;RXOI"
 F GMTSCI=1:1 Q:'$L($P(GMTSCPS,";",GMTSCI))  D
 . S GMTSCP=$P(GMTSCPS,";",GMTSCI) K GMTSIN
 . D ARRAY Q:'$D(GMTSIN)
 . I $L($G(GMTSIN("TIM"))),+($G(GMTSIN(0)))>0 S GMTSLIM(+($G(GMTSIN(0))),"TIM")=$G(GMTSIN("TIM"))
 . I $L($G(GMTSIN("OCC"))),+($G(GMTSIN(0)))>0 S GMTSLIM(+($G(GMTSIN(0))),"OCC")=$G(GMTSIN("OCC"))
 . S GMTSINST=$$ADD^GMTSXPD1(.GMTSIN),GMTSTOT=+($G(GMTSTOT))+($G(GMTSINST))
 ; Rebuild Ad Hoc Health Summary Type
 D:+($G(GMTSTOT))>0 BUILD^GMTSXPD3
 D LIM
 I +$$ROK("GMTSXPS1")>0 D
 . N GMTSHORT S GMTSHORT=1,GMTSINST="",GMTSBLD="GMTS*2.7*125" D SEND^GMTSXPS1
 Q
ARRAY ; Build Array
 K GMTSIN N GMTSI,GMTSTXT,GMTSEX,GMTSFLD,GMTSUB,GMTSVAL,GMTSPDX S GMTSPDX=1,GMTSCP=$G(GMTSCP) Q:'$L(GMTSCP)
 F GMTSI=1:1 D  Q:'$L(GMTSTXT)
 . S GMTSTXT="",GMTSEX="S GMTSTXT=$T("_GMTSCP_"+"_GMTSI_")" X GMTSEX S:$L(GMTSTXT,";")'>3 GMTSTXT="" Q:'$L(GMTSTXT)
 . S GMTSFLD=$P(GMTSTXT,";",2),GMTSUB=$P(GMTSTXT,";",3),GMTSVAL=$P(GMTSTXT,";",4)
 . S:$E(GMTSFLD,1)=1&(+GMTSFLD<2) GMTSVAL=$P(GMTSTXT,";",4,5)
 . S:$E(GMTSFLD,1)=" "!('$L(GMTSFLD)) GMTSTXT="" Q:GMTSTXT=""
 . S:$L(GMTSFLD)&('$L(GMTSUB)) GMTSIN(GMTSFLD)=GMTSVAL Q:$L(GMTSFLD)&('$L(GMTSUB))  S:$L(GMTSFLD)&($L(GMTSUB)) GMTSIN(GMTSFLD,GMTSUB)=GMTSVAL
 . S:$G(GMTSFLD)=7&(+($G(GMTSUB))>0) GMTSPDX=0
 K:+($G(GMTSPDX))=0 GMTSIN("PDX")
 Q
LIM ; Limits
 N GMTSI,GMTST,GMTSO,GMTSA S GMTSI=0 F  S GMTSI=$O(GMTSLIM(GMTSI)) Q:+GMTSI=0  D
 . S GMTSA=$P($G(^GMT(142.1,+($G(GMTSI)),0)),"^",3),GMTST=$G(GMTSLIM(+GMTSI,"TIM")) S:'$L(GMTST) GMTST=$S(GMTSA="Y ":"1Y ",1:"")
 . S GMTSA=$P($G(^GMT(142.1,+($G(GMTSI)),0)),"^",5),GMTSO=$G(GMTSLIM(+GMTSI,"OCC")) S:'$L(GMTSO) GMTSO=$S(GMTSA="Y ":"10 ",1:"")
 . D TO^GMTSXPD3(GMTSI,GMTST,GMTSO)
 Q
ROK(X) ; Routine OK
 S X=$G(X) Q:'$L(X) 0 N GMTSEX,GMTSTXT S GMTSEX="S GMTSTXT=$T(+1^"_X_")" X GMTSEX
 Q:'$L(GMTSTXT) 0  Q 1
 ;
RXDC ; Meds OP/Drug Class Component Data
 ;0;;269
 ;.01;;Meds OP/Drug Class
 ;1;;MAIN;GMTSPSO8
 ;1.1;;0
 ;2;;Y
 ;3;;RXDC
 ;3.5;;13
 ;3.5;1;This component contains information from the Outpatient Pharmacy package.
 ;3.5;2;It allows selection of prescriptions to display, based on the drug class.
 ;3.5;3;Only 'child' classes are displayed, with the exception of the HA000 class.
 ;3.5;4;
 ;3.5;5;Only time limits apply. Data presented include:  drug, prescription number,
 ;3.5;6;status expiration/cancellation date (when appropriate), quantity, issue
 ;3.5;7;date, last fill date, refills remaining, provider, and cost/fill (when
 ;3.5;8;available).
 ;3.5;9;
 ;3.5;10;Note: If no time limit is defined, only active outpatient orders are
 ;3.5;11;reported. If a time limit is defined, all outpatient pharmacy orders which
 ;3.5;12;have an expiration or cancel date within the time limit range are
 ;3.5;13;reported.
 ;4;;
 ;5;;
 ;6;;
 ;7;;1
 ;7;1;50.605
 ;8;;
 ;9;;Meds OP/Drug Class
 ;10;;
 ;11;;
 ;12;;
 ;13;;
 ;14;;
 ;TIM;;1Y
 ;
 Q
 ;
RXOI ; Meds OP/Rx Ord Item Component Data
 ;0;;270
 ;.01;;Meds OP/Rx Ord Item
 ;1;;MAIN;GMTSPSO9
 ;1.1;;0
 ;2;;Y
 ;3;;RXOI
 ;3.5;;13
 ;3.5;1;This component contains information from the Outpatient Pharmacy package.
 ;3.5;2;It allows selection of prescriptions to display, based on the Pharmacy
 ;3.5;3;orderable item associated with the order.
 ;3.5;4;
 ;3.5;5;Only time limits apply.  Data presented include:  drug, prescription number,
 ;3.5;6;status expiration/cancellation date (when appropriate), quantity, issue
 ;3.5;7;date, last fill date, refills remaining, provider, and cost/fill (when
 ;3.5;8;available).
 ;3.5;9;
 ;3.5;10;Note: If no time limit is defined, only active outpatient orders are
 ;3.5;11;reported. If a time limit is defined, all outpatient pharmacy orders which
 ;3.5;12;have an expiration or cancel date within the time limit range are
 ;3.5;13;reported.
 ;4;;
 ;5;;
 ;6;;
 ;7;;1
 ;7;1;50.7
 ;8;;
 ;9;;Meds OP/Rx Ord Item
 ;10;;
 ;11;;
 ;12;;
 ;13;;
 ;14;;
 ;TIM;;1Y
 ;
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSP125   4206     printed  Sep 23, 2025@19:34:46                                                                                                                                                                                                    Page 2
GMTSP125  ; CIO/SLC - Post Install GMTS*2.7*125 ;Mar 07, 2019@10:53:03
 +1       ;;2.7;Health Summary;**125**;Oct 20, 1995;Build 15
 +2        QUIT 
CI        ; Component Install
 +1        NEW GMTSIN,GMTSLIM,GMTSINST,GMTSTL,GMTSINST,GMTSTOT,GMTSBLD,GMTSCPS,GMTSCP,GMTSCI
 +2        SET GMTSCPS="RXDC;RXOI"
 +3        FOR GMTSCI=1:1
               if '$LENGTH($PIECE(GMTSCPS,";",GMTSCI))
                   QUIT 
               Begin DoDot:1
 +4                SET GMTSCP=$PIECE(GMTSCPS,";",GMTSCI)
                   KILL GMTSIN
 +5                DO ARRAY
                   if '$DATA(GMTSIN)
                       QUIT 
 +6                IF $LENGTH($GET(GMTSIN("TIM")))
                       IF +($GET(GMTSIN(0)))>0
                           SET GMTSLIM(+($GET(GMTSIN(0))),"TIM")=$GET(GMTSIN("TIM"))
 +7                IF $LENGTH($GET(GMTSIN("OCC")))
                       IF +($GET(GMTSIN(0)))>0
                           SET GMTSLIM(+($GET(GMTSIN(0))),"OCC")=$GET(GMTSIN("OCC"))
 +8                SET GMTSINST=$$ADD^GMTSXPD1(.GMTSIN)
                   SET GMTSTOT=+($GET(GMTSTOT))+($GET(GMTSINST))
               End DoDot:1
 +9       ; Rebuild Ad Hoc Health Summary Type
 +10       if +($GET(GMTSTOT))>0
               DO BUILD^GMTSXPD3
 +11       DO LIM
 +12       IF +$$ROK("GMTSXPS1")>0
               Begin DoDot:1
 +13               NEW GMTSHORT
                   SET GMTSHORT=1
                   SET GMTSINST=""
                   SET GMTSBLD="GMTS*2.7*125"
                   DO SEND^GMTSXPS1
               End DoDot:1
 +14       QUIT 
ARRAY     ; Build Array
 +1        KILL GMTSIN
           NEW GMTSI,GMTSTXT,GMTSEX,GMTSFLD,GMTSUB,GMTSVAL,GMTSPDX
           SET GMTSPDX=1
           SET GMTSCP=$GET(GMTSCP)
           if '$LENGTH(GMTSCP)
               QUIT 
 +2        FOR GMTSI=1:1
               Begin DoDot:1
 +3                SET GMTSTXT=""
                   SET GMTSEX="S GMTSTXT=$T("_GMTSCP_"+"_GMTSI_")"
                   XECUTE GMTSEX
                   if $LENGTH(GMTSTXT,";")'>3
                       SET GMTSTXT=""
                   if '$LENGTH(GMTSTXT)
                       QUIT 
 +4                SET GMTSFLD=$PIECE(GMTSTXT,";",2)
                   SET GMTSUB=$PIECE(GMTSTXT,";",3)
                   SET GMTSVAL=$PIECE(GMTSTXT,";",4)
 +5                if $EXTRACT(GMTSFLD,1)=1&(+GMTSFLD<2)
                       SET GMTSVAL=$PIECE(GMTSTXT,";",4,5)
 +6                if $EXTRACT(GMTSFLD,1)=" "!('$LENGTH(GMTSFLD))
                       SET GMTSTXT=""
                   if GMTSTXT=""
                       QUIT 
 +7                if $LENGTH(GMTSFLD)&('$LENGTH(GMTSUB))
                       SET GMTSIN(GMTSFLD)=GMTSVAL
                   if $LENGTH(GMTSFLD)&('$LENGTH(GMTSUB))
                       QUIT 
                   if $LENGTH(GMTSFLD)&($LENGTH(GMTSUB))
                       SET GMTSIN(GMTSFLD,GMTSUB)=GMTSVAL
 +8                if $GET(GMTSFLD)=7&(+($GET(GMTSUB))>0)
                       SET GMTSPDX=0
               End DoDot:1
               if '$LENGTH(GMTSTXT)
                   QUIT 
 +9        if +($GET(GMTSPDX))=0
               KILL GMTSIN("PDX")
 +10       QUIT 
LIM       ; Limits
 +1        NEW GMTSI,GMTST,GMTSO,GMTSA
           SET GMTSI=0
           FOR 
               SET GMTSI=$ORDER(GMTSLIM(GMTSI))
               if +GMTSI=0
                   QUIT 
               Begin DoDot:1
 +2                SET GMTSA=$PIECE($GET(^GMT(142.1,+($GET(GMTSI)),0)),"^",3)
                   SET GMTST=$GET(GMTSLIM(+GMTSI,"TIM"))
                   if '$LENGTH(GMTST)
                       SET GMTST=$SELECT(GMTSA="Y ":"1Y ",1:"")
 +3                SET GMTSA=$PIECE($GET(^GMT(142.1,+($GET(GMTSI)),0)),"^",5)
                   SET GMTSO=$GET(GMTSLIM(+GMTSI,"OCC"))
                   if '$LENGTH(GMTSO)
                       SET GMTSO=$SELECT(GMTSA="Y ":"10 ",1:"")
 +4                DO TO^GMTSXPD3(GMTSI,GMTST,GMTSO)
               End DoDot:1
 +5        QUIT 
ROK(X)    ; Routine OK
 +1        SET X=$GET(X)
           if '$LENGTH(X)
               QUIT 0
           NEW GMTSEX,GMTSTXT
           SET GMTSEX="S GMTSTXT=$T(+1^"_X_")"
           XECUTE GMTSEX
 +2        if '$LENGTH(GMTSTXT)
               QUIT 0
           QUIT 1
 +3       ;
RXDC      ; Meds OP/Drug Class Component Data
 +1       ;0;;269
 +2       ;.01;;Meds OP/Drug Class
 +3       ;1;;MAIN;GMTSPSO8
 +4       ;1.1;;0
 +5       ;2;;Y
 +6       ;3;;RXDC
 +7       ;3.5;;13
 +8       ;3.5;1;This component contains information from the Outpatient Pharmacy package.
 +9       ;3.5;2;It allows selection of prescriptions to display, based on the drug class.
 +10      ;3.5;3;Only 'child' classes are displayed, with the exception of the HA000 class.
 +11      ;3.5;4;
 +12      ;3.5;5;Only time limits apply. Data presented include:  drug, prescription number,
 +13      ;3.5;6;status expiration/cancellation date (when appropriate), quantity, issue
 +14      ;3.5;7;date, last fill date, refills remaining, provider, and cost/fill (when
 +15      ;3.5;8;available).
 +16      ;3.5;9;
 +17      ;3.5;10;Note: If no time limit is defined, only active outpatient orders are
 +18      ;3.5;11;reported. If a time limit is defined, all outpatient pharmacy orders which
 +19      ;3.5;12;have an expiration or cancel date within the time limit range are
 +20      ;3.5;13;reported.
 +21      ;4;;
 +22      ;5;;
 +23      ;6;;
 +24      ;7;;1
 +25      ;7;1;50.605
 +26      ;8;;
 +27      ;9;;Meds OP/Drug Class
 +28      ;10;;
 +29      ;11;;
 +30      ;12;;
 +31      ;13;;
 +32      ;14;;
 +33      ;TIM;;1Y
 +34      ;
 +35       QUIT 
 +36      ;
RXOI      ; Meds OP/Rx Ord Item Component Data
 +1       ;0;;270
 +2       ;.01;;Meds OP/Rx Ord Item
 +3       ;1;;MAIN;GMTSPSO9
 +4       ;1.1;;0
 +5       ;2;;Y
 +6       ;3;;RXOI
 +7       ;3.5;;13
 +8       ;3.5;1;This component contains information from the Outpatient Pharmacy package.
 +9       ;3.5;2;It allows selection of prescriptions to display, based on the Pharmacy
 +10      ;3.5;3;orderable item associated with the order.
 +11      ;3.5;4;
 +12      ;3.5;5;Only time limits apply.  Data presented include:  drug, prescription number,
 +13      ;3.5;6;status expiration/cancellation date (when appropriate), quantity, issue
 +14      ;3.5;7;date, last fill date, refills remaining, provider, and cost/fill (when
 +15      ;3.5;8;available).
 +16      ;3.5;9;
 +17      ;3.5;10;Note: If no time limit is defined, only active outpatient orders are
 +18      ;3.5;11;reported. If a time limit is defined, all outpatient pharmacy orders which
 +19      ;3.5;12;have an expiration or cancel date within the time limit range are
 +20      ;3.5;13;reported.
 +21      ;4;;
 +22      ;5;;
 +23      ;6;;
 +24      ;7;;1
 +25      ;7;1;50.7
 +26      ;8;;
 +27      ;9;;Meds OP/Rx Ord Item
 +28      ;10;;
 +29      ;11;;
 +30      ;12;;
 +31      ;13;;
 +32      ;14;;
 +33      ;TIM;;1Y
 +34      ;
 +35       QUIT 
 +36      ;