Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: GMTSP102

GMTSP102.m

Go to the documentation of this file.
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