GMTSP102 ; SLC/RFR - Pre/Post Install GMTS*2.7*102 ; 11/04/2011
;;2.7;Health Summary;**102**;;Build 25
;
PRE ;PRE-INSTALL
N GMTSIEN,GMTSFDA,GMTSERR,GMTSMSG,GMTSX,INCLUDE
S XPDIDTOT=2
D UPDATE^XPDID(0)
;DEACTIVATE THE MENTAL HEALTH PHYSICAL EXAM COMPONENT
S GMTSIEN=$$GETIEN
Q:GMTSIEN=0
D BMES^XPDUTL("Deactivating the MENTAL HEALTH PHYSICAL EXAM component...")
S GMTSFDA(142.1,GMTSIEN_",",5)="P"
S GMTSFDA(142.1,GMTSIEN_",",8)="DEACTIVATED BY HEALTH SUMMARY PATCH GMTS*2.7*102"
L +^GMT(142.1,GMTSIEN):+$G(DILOCKTM)
I '$T D Q
.S GMTSMSG(1)=" "
.S GMTSMSG(2)="Unable to lock the MENTAL HEALTH PHYSICAL EXAM component for editing."
.D MES^XPDUTL(.GMTSMSG)
.S XPDABORT=1
D FILE^DIE("","GMTSFDA","GMTSERR")
L -^GMT(142.1,GMTSIEN):+$G(DILOCKTM)
I $D(GMTSERR) D Q
.S GMTSLINE=1
.S GMTSMSG(GMTSLINE)=" ",GMTSLINE=GMTSLINE+1
.S GMTSMSG(GMTSLINE)="VA FileMan Error #"_GMTSERR("DIERR",1)_":",GMTSLINE=GMTSLINE+1
.F GMTSX=1:1:+$O(GMTSERR("DIERR",1,"TEXT","A"),-1) D
..S GMTSMSG(GMTSLINE)=GMTSERR("DIERR",1,"TEXT",GMTSX),GMTSLINE=GMTSLINE+1
.D MES^XPDUTL(.GMTSMSG)
.S XPDABORT=1
D MES^XPDUTL("DONE")
D UPDATE^XPDID(1)
;REBUILD THE ADHOC HEALTH SUMMARY TYPE, EXCLUDING ALL DISABLED COMPONENTS BY DEFAULT
S INCLUDE=$S($D(XPDQUES("PRE1"))>0:XPDQUES("PRE1"),1:0)
D ENPOST^GMTSLOAD
D UPDATE^XPDID(2)
Q
POST ;POST-INSTALL
N GMTSLINE,GMTSREP,GMTSIEN,GMTSTIEN,GMTSOIEN,GMTSMSG
N XMMG,XMDUZ,XMY,XMSUB,XMTEXT,XMZ,XMERR,XPDIDTOT,DIFROM
S XPDIDTOT=1
D UPDATE^XPDID(0)
S GMTSIEN=$$GETIEN
Q:GMTSIEN=0
D BMES^XPDUTL("Assembling usage report...")
S GMTSLINE=1
S GMTSREP(GMTSLINE)="The following health summary types contain a reference to the",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)="MENTAL HEALTH PHYSICAL EXAM component. The health summary objects",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)="listed below each type contain a reference to that type.",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)="",GMTSLINE=GMTSLINE+1,GMTSREP(GMTSLINE)="TYPE",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",12)_"OBJECTS CONTAINING THAT TYPE",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR("-",72),GMTSLINE=GMTSLINE+1
S GMTSTIEN=0
F S GMTSTIEN=$O(^GMT(142,"AE",GMTSIEN,GMTSTIEN)) Q:+$G(GMTSTIEN)=0 D
.S GMTSREP(GMTSLINE)=$P($G(^GMT(142,GMTSTIEN,0)),U,1)
.I $D(^GMT(142.5,"AC",GMTSTIEN))>9 D
..S GMTSOIEN=0
..F S GMTSOIEN=$O(^GMT(142.5,"AC",GMTSTIEN,GMTSOIEN)) Q:+$G(GMTSOIEN)=0 D
...S GMTSLINE=GMTSLINE+1
...S GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",12)_$P($G(^GMT(142.5,GMTSOIEN,0)),U,1)
.S GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)="",GMTSLINE=GMTSLINE+1
S GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",32)_"[END OF REPORT]"
S XMSUB="PATCH GMTS*2.7*102 REPORT"
S XMTEXT="GMTSREP("
I $D(ZTQUEUED)>0 D
.S XMY(DUZ)=""
E D
.S GMTSMSG(1)=" "
.S GMTSMSG(2)="Select the recipient(s) of the report below."
.D MES^XPDUTL(.GMTSMSG)
D ^XMD
I $D(XMMG)>0 D Q
.K GMTSMSG
.S GMTSMSG(1)=" "
.S GMTSMSG(2)="Unable to email the report:"
.S GMTSMSG(3)=XMMG
.D MES^XPDUTL(.GMTSMSG)
K GMTSMSG
S GMTSMSG(1)=" "
S GMTSMSG(2)="Finished assembling the usage report."
D MES^XPDUTL(.GMTSMSG)
D UPDATE^XPDID(1)
Q
GETIEN() ;FIND THE COMPONENT'S IEN
N IEN
S IEN=+$O(^GMT(142.1,"B","MENTAL HEALTH PHYSICAL EXAM",0))
D:IEN=0 BMES^XPDUTL("MENTAL HEALTH PHYSICAL EXAM component was not found.")
Q IEN
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HGMTSP102 3408 printed Dec 13, 2024@01:58:37 Page 2
GMTSP102 ; SLC/RFR - Pre/Post Install GMTS*2.7*102 ; 11/04/2011
+1 ;;2.7;Health Summary;**102**;;Build 25
+2 ;
PRE ;PRE-INSTALL
+1 NEW GMTSIEN,GMTSFDA,GMTSERR,GMTSMSG,GMTSX,INCLUDE
+2 SET XPDIDTOT=2
+3 DO UPDATE^XPDID(0)
+4 ;DEACTIVATE THE MENTAL HEALTH PHYSICAL EXAM COMPONENT
+5 SET GMTSIEN=$$GETIEN
+6 if GMTSIEN=0
QUIT
+7 DO BMES^XPDUTL("Deactivating the MENTAL HEALTH PHYSICAL EXAM component...")
+8 SET GMTSFDA(142.1,GMTSIEN_",",5)="P"
+9 SET GMTSFDA(142.1,GMTSIEN_",",8)="DEACTIVATED BY HEALTH SUMMARY PATCH GMTS*2.7*102"
+10 LOCK +^GMT(142.1,GMTSIEN):+$GET(DILOCKTM)
+11 IF '$TEST
Begin DoDot:1
+12 SET GMTSMSG(1)=" "
+13 SET GMTSMSG(2)="Unable to lock the MENTAL HEALTH PHYSICAL EXAM component for editing."
+14 DO MES^XPDUTL(.GMTSMSG)
+15 SET XPDABORT=1
End DoDot:1
QUIT
+16 DO FILE^DIE("","GMTSFDA","GMTSERR")
+17 LOCK -^GMT(142.1,GMTSIEN):+$GET(DILOCKTM)
+18 IF $DATA(GMTSERR)
Begin DoDot:1
+19 SET GMTSLINE=1
+20 SET GMTSMSG(GMTSLINE)=" "
SET GMTSLINE=GMTSLINE+1
+21 SET GMTSMSG(GMTSLINE)="VA FileMan Error #"_GMTSERR("DIERR",1)_":"
SET GMTSLINE=GMTSLINE+1
+22 FOR GMTSX=1:1:+$ORDER(GMTSERR("DIERR",1,"TEXT","A"),-1)
Begin DoDot:2
+23 SET GMTSMSG(GMTSLINE)=GMTSERR("DIERR",1,"TEXT",GMTSX)
SET GMTSLINE=GMTSLINE+1
End DoDot:2
+24 DO MES^XPDUTL(.GMTSMSG)
+25 SET XPDABORT=1
End DoDot:1
QUIT
+26 DO MES^XPDUTL("DONE")
+27 DO UPDATE^XPDID(1)
+28 ;REBUILD THE ADHOC HEALTH SUMMARY TYPE, EXCLUDING ALL DISABLED COMPONENTS BY DEFAULT
+29 SET INCLUDE=$SELECT($DATA(XPDQUES("PRE1"))>0:XPDQUES("PRE1"),1:0)
+30 DO ENPOST^GMTSLOAD
+31 DO UPDATE^XPDID(2)
+32 QUIT
POST ;POST-INSTALL
+1 NEW GMTSLINE,GMTSREP,GMTSIEN,GMTSTIEN,GMTSOIEN,GMTSMSG
+2 NEW XMMG,XMDUZ,XMY,XMSUB,XMTEXT,XMZ,XMERR,XPDIDTOT,DIFROM
+3 SET XPDIDTOT=1
+4 DO UPDATE^XPDID(0)
+5 SET GMTSIEN=$$GETIEN
+6 if GMTSIEN=0
QUIT
+7 DO BMES^XPDUTL("Assembling usage report...")
+8 SET GMTSLINE=1
+9 SET GMTSREP(GMTSLINE)="The following health summary types contain a reference to the"
SET GMTSLINE=GMTSLINE+1
+10 SET GMTSREP(GMTSLINE)="MENTAL HEALTH PHYSICAL EXAM component. The health summary objects"
SET GMTSLINE=GMTSLINE+1
+11 SET GMTSREP(GMTSLINE)="listed below each type contain a reference to that type."
SET GMTSLINE=GMTSLINE+1
+12 SET GMTSREP(GMTSLINE)=""
SET GMTSLINE=GMTSLINE+1
SET GMTSREP(GMTSLINE)="TYPE"
SET GMTSLINE=GMTSLINE+1
+13 SET GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",12)_"OBJECTS CONTAINING THAT TYPE"
SET GMTSLINE=GMTSLINE+1
+14 SET GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR("-",72)
SET GMTSLINE=GMTSLINE+1
+15 SET GMTSTIEN=0
+16 FOR
SET GMTSTIEN=$ORDER(^GMT(142,"AE",GMTSIEN,GMTSTIEN))
if +$GET(GMTSTIEN)=0
QUIT
Begin DoDot:1
+17 SET GMTSREP(GMTSLINE)=$PIECE($GET(^GMT(142,GMTSTIEN,0)),U,1)
+18 IF $DATA(^GMT(142.5,"AC",GMTSTIEN))>9
Begin DoDot:2
+19 SET GMTSOIEN=0
+20 FOR
SET GMTSOIEN=$ORDER(^GMT(142.5,"AC",GMTSTIEN,GMTSOIEN))
if +$GET(GMTSOIEN)=0
QUIT
Begin DoDot:3
+21 SET GMTSLINE=GMTSLINE+1
+22 SET GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",12)_$PIECE($GET(^GMT(142.5,GMTSOIEN,0)),U,1)
End DoDot:3
End DoDot:2
+23 SET GMTSLINE=GMTSLINE+1
End DoDot:1
+24 SET GMTSREP(GMTSLINE)=""
SET GMTSLINE=GMTSLINE+1
+25 SET GMTSREP(GMTSLINE)=$$REPEAT^XLFSTR(" ",32)_"[END OF REPORT]"
+26 SET XMSUB="PATCH GMTS*2.7*102 REPORT"
+27 SET XMTEXT="GMTSREP("
+28 IF $DATA(ZTQUEUED)>0
Begin DoDot:1
+29 SET XMY(DUZ)=""
End DoDot:1
+30 IF '$TEST
Begin DoDot:1
+31 SET GMTSMSG(1)=" "
+32 SET GMTSMSG(2)="Select the recipient(s) of the report below."
+33 DO MES^XPDUTL(.GMTSMSG)
End DoDot:1
+34 DO ^XMD
+35 IF $DATA(XMMG)>0
Begin DoDot:1
+36 KILL GMTSMSG
+37 SET GMTSMSG(1)=" "
+38 SET GMTSMSG(2)="Unable to email the report:"
+39 SET GMTSMSG(3)=XMMG
+40 DO MES^XPDUTL(.GMTSMSG)
End DoDot:1
QUIT
+41 KILL GMTSMSG
+42 SET GMTSMSG(1)=" "
+43 SET GMTSMSG(2)="Finished assembling the usage report."
+44 DO MES^XPDUTL(.GMTSMSG)
+45 DO UPDATE^XPDID(1)
+46 QUIT
GETIEN() ;FIND THE COMPONENT'S IEN
+1 NEW IEN
+2 SET IEN=+$ORDER(^GMT(142.1,"B","MENTAL HEALTH PHYSICAL EXAM",0))
+3 if IEN=0
DO BMES^XPDUTL("MENTAL HEALTH PHYSICAL EXAM component was not found.")
+4 QUIT IEN