Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/IMAGING-MAG-ZMAG/MAGGTU6.m

    r613 r623  
    1 MAGGTU6 ;WOIFO/GEK - Silent Utilities ; [ 06/20/2001 08:57 ]
    2         ;;3.0;IMAGING;**24,8,48,45,20,46,59**;Nov 27, 2007;Build 20
    3         ;; Per VHA Directive 2004-038, this routine should not be modified.
    4         ;; +---------------------------------------------------------------+
    5         ;; | Property of the US Government.                                |
    6         ;; | No permission to copy or redistribute this software is given. |
    7         ;; | Use of unreleased versions of this software requires the user |
    8         ;; | to execute a written test agreement with the VistA Imaging    |
    9         ;; | Development Office of the Department of Veterans Affairs,     |
    10         ;; | telephone (301) 734-0100.                                     |
    11         ;; |                                                               |
    12         ;; | The Food and Drug Administration classifies this software as  |
    13         ;; | a medical device.  As such, it may not be changed in any way. |
    14         ;; | Modifications to this software may result in an adulterated   |
    15         ;; | medical device under 21CFR820, the use of which is considered |
    16         ;; | to be a violation of US Federal Statutes.                     |
    17         ;; +---------------------------------------------------------------+
    18         ;;
    19         Q
    20         ;
    21 LOGACT(MAGRY,ZY)        ;RPC [MAGGACTION LOG]
    22         ; Call to LogAction from Delphi Window
    23         ;
    24         ; ZY is input variable it is '^' delimited string
    25         ; 'A|B|C|D|E' ^^ MAGIEN ^ 'Copy/Download' ^ DFN ^ '1';
    26         ;  DUZ is inserted as 2nd piece below.
    27         ; I.E. zy  = "C^^103660^Copy To Clipboard^1033^1"
    28         N Y
    29         S MAGRY="0^Logging access..."
    30         ;
    31         N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
    32         ;                 C       DUZ      MAGIEN     ACTION       DFN       1
    33         D ENTRY^MAGLOG($P(ZY,U),+$G(DUZ),$P(ZY,U,3),$P(ZY,U,4),$P(ZY,U,5),$P(ZY,U,6))
    34         S MAGRY="1^Action was Logged."
    35         Q
    36 LINKDT(MAGRY,MAGDA,DTTM)        ; This is called when an Image is successfully
    37         ; linked (Associated) with a Report/Procedure/Note etc.
    38         ;  MAGDA = Image IEN
    39         ;  DTTM = ""            No date sent, so use NOW
    40         ;  DTTM = 1                     No Date Sent, but use Image capture Date.
    41         ;  DTTM = Valid FM Date/Time    , Use it.
    42         N MSG
    43         S DTTM=$G(DTTM)
    44         I 'DTTM S DTTM=$$NOW^XLFDT      ; Using NOW
    45         I '$D(^MAG(2005,MAGDA)) Q
    46         I DTTM=1 S DTTM=$P(^MAG(2005,MAGDA,2),"^",1) ; Using Date Image Captured.
    47         I '$$VALID^MAGGSIV1(2005,64,.DTTM,.MSG) S MAGRY="0^"_MSG Q
    48         S $P(^MAG(2005,MAGDA,2),"^",11)=DTTM
    49         S MAGRY="1^Okay"
    50         Q
    51 TIMEOUT(MAGRY,APP)      ;RPC [MAGG GET TIMEOUT]
    52         ; Call  Returns the timeout for the APP from IMAGING SITE PARAMETERS File
    53         ;  APP is either 'DISPLAY'  'CAPTURE' or   'VISTARAD'
    54         N I,MAGTIMES,MAGPLC
    55         S MAGRY=""
    56         S MAGPLC=$$PLACE^MAGBAPI(DUZ(2)) I 'MAGPLC Q  ; DBI - SEB 9/20/2002
    57         S MAGTIMES=$G(^MAG(2006.1,MAGPLC,"KEYS"))
    58         I APP="DISPLAY" S MAGRY=$P(MAGTIMES,U,2)
    59         I APP="CAPTURE" S MAGRY=$P(MAGTIMES,U,3)
    60         I APP="VISTARAD" S MAGRY=$P(MAGTIMES,U,4)
    61         I APP="TELEREADER" S MAGRY=$P(MAGTIMES,U,6)  ;  MJK - 2006.01.25 - TeleReader
    62         Q
    63 EXIST(EKGPLACE) ;Does an ekg server exist in 2005.2
    64         I $$CONSOLID^MAGBAPI()=0 Q $O(^MAG(2005.2,"E","EKG","")) ; DBI - SEB 9/20/2002
    65         Q $O(^MAG(2005.2,"F",EKGPLACE,"EKG",""))
    66         ;
    67 ONLINE(MAGR)    ;RPC [MAG EKG ONLINE] EKG network location status   
    68         ;returns the status of the first EKG network location type
    69         ;O if offline or a network location doesn't exist
    70         ;1 if online
    71         ;
    72         N EKG1,EKGPLACE
    73         S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ; DBI - SEB 9/20/2002
    74         I EKGPLACE=0 S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ;Convert to extrinsic /gek 8/2003
    75         I $$EXIST(EKGPLACE) D
    76         . I $$CONSOLID^MAGBAPI() S EKG1=$O(^MAG(2005.2,"F",EKGPLACE,"EKG","")) ; DBI - SEB 9/20/2002
    77         . E  S EKG1=$O(^MAG(2005.2,"E","EKG",""))
    78         . S MAGR=$P(^MAG(2005.2,EKG1,0),U,6)
    79         E  S MAGR=0
    80         Q
    81 SHARE(MAGRY,TYPE)       ;RPC [MAG GET NETLOC]
    82         ; Get list of image shares
    83         ;TYPE = One of the STORAGE TYPE codes : MAG, EKG, WORM, URL or ALL
    84         N TMP,I,DATA0,DATA2,DATA3,DATA6,INFO,VALUE,STYP,PHYREF
    85         N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
    86         S I=0
    87         I TYPE="" S TYPE="ALL"
    88         S MAGRY(0)="1^SUCCESS"
    89         F  S I=$O(^MAG(2005.2,I)) Q:'I  D
    90         . Q:$$LOCDRIVE(I)
    91         . S DATA0=$G(^MAG(2005.2,I,0))
    92         . S DATA2=$G(^MAG(2005.2,I,2))
    93         . S DATA3=$G(^MAG(2005.2,I,3))
    94         . S DATA6=$G(^MAG(2005.2,I,6))
    95         . ;
    96         . S PHYREF=$P(DATA0,"^",2) ; PHYSICAL REFERENCE
    97         . S STYP=$P(DATA0,"^",7) ; STORAGE TYPE
    98         . ;
    99         . I TYPE'="ALL" Q:STYP'[TYPE
    100         . Q:$P(DATA0,"^",6)=0     ;SHARE IS OFFLINE (don't return offline shares)
    101         . I STYP'="URL" Q:(PHYREF[".")  ; pre 45, quit if '.' in phyref
    102         . I STYP'="URL" Q:($E(PHYREF,1,2)'="\\")  ; pre 45 quit if doesn't start with '\\'
    103         . ;
    104         . S INFO=$S($E(PHYREF,$L(PHYREF))="\":$E(PHYREF,1,$L(PHYREF)-1),1:PHYREF)
    105         . S $P(INFO,"^",2)=$P($G(DATA0),"^",7) ;Physical reference (path)
    106         . S $P(INFO,"^",3)=$P($G(DATA0),"^",6)  ;Operational Status 0=OFFLINE 1=ONLINE
    107         . S $P(INFO,"^",4)=$P($G(DATA2),"^",1) ;Username
    108         . S $P(INFO,"^",5)=$P($G(DATA2),"^",2) ;Password
    109         . S $P(INFO,"^",6)=$P($G(DATA6),"^",1)  ;MUSE Site #
    110         . I $P($G(DATA6),"^",2)'="" S $P(INFO,"^",7)=^MAG(2006.17,$P(DATA6,"^",2),0)  ;MUSE version #
    111         . S $P(INFO,"^",8)=$P($G(DATA3),"^",5)  ;Network location SITE
    112         . Q:$D(TMP(INFO))
    113         . S TMP(INFO)=I
    114         S INFO=""
    115         F  S INFO=$O(TMP(INFO)) Q:INFO=""  D
    116         . S MAGRY($O(MAGRY(""),-1)+1)=TMP(INFO)_"^"_INFO
    117         K TMP
    118         Q
    119 LOCDRIVE(I)     ; Returns 1 if this is a local drive, else 0
    120         ; Local Drive is determined by the DIR not being Type : URL and having a ":"
    121         I $P(^MAG(2005.2,I,0),"^",7)'="URL" I $P(^MAG(2005.2,I,0),"^",2)[":" Q 1
    122         Q 0
    123 GETENV(MAGRY)   ;RPC [MAG GET ENV]
    124         ; Get some environment variables (used by annotation control)
    125         S MAGRY=DUZ(2)_"^"_$$NOW^XLFDT
    126         Q
    127 ANNCB(STATARR)  ;Status Callback (called by the import API)
    128         ;
    129         N I,CDUZ,QINDEX,A,COUNT
    130         N XMDUZ,XMSUB,XMTEXT,XMY
    131         ;  0 = error, all others are success.
    132         I $P(STATARR(0),"^",1)'=0 D
    133         . ;   Import was successful
    134         E  D
    135         . ;   Import failed - send mail to MAG SERVER group and person who queued the import
    136         . S XMDUZ=DUZ
    137         . S XMSUB="Import Error Report"
    138         . ;    get text of message from status array
    139         . S XMTEXT="A("
    140         . ; XMD needs array to start with 1, not 0
    141         . S COUNT=1,I=""
    142         . F  S I=$O(STATARR(I)) Q:I=""  D
    143         . . S A(COUNT)=I_") "_STATARR(I)
    144         . . S COUNT=COUNT+1
    145         . . Q
    146         . S A(COUNT+1)=" "
    147         . S A(COUNT+2)=" "
    148         . S A(COUNT+3)="     The errors listed above were generated by"
    149         . S A(COUNT+4)="     the VistA Imaging Annotation Editor while"
    150         . S A(COUNT+5)="     trying to import your diagram.  Please"
    151         . S A(COUNT+6)="     report these errors to your VistA Imaging"
    152         . S A(COUNT+7)="     support personnel."
    153         . ;Get person who did the import
    154         . S QINDEX=STATARR(2)
    155         . S I=-1 F  S I=$O(^MAG(2006.034,QINDEX,1,I)) Q:I=""  D
    156         . . I $P($G(^MAG(2006.034,QINDEX,1,I,0)),"^",1)=8 S CDUZ=$P(^MAG(2006.034,QINDEX,1,I,0),"^",2)
    157         . ;Set recipients of message
    158         . S XMY("G.MAG SERVER")=""
    159         . I $G(CDUZ) S XMY(CDUZ)=""
    160         . D ^XMD
    161         . Q
    162         Q
    163 GETCTP(MAGRY)   ;RPC [MAG4 CT PRESETS GET]
    164         N MAGPLC
    165         S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
    166         I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
    167         S MAGRY=$G(^MAG(2006.1,MAGPLC,"CT"))
    168         I MAGRY="" S MAGRY="0^Site doesn't have CT Presets defined." Q
    169         S MAGRY="1^"_MAGRY
    170         Q
    171 SAVECTP(MAGRY,VALUE)    ;RPC [MAG4 CT PRESETS SAVE]
    172         N MAGPLC
    173         S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
    174         I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
    175         S ^MAG(2006.1,MAGPLC,"CT")=VALUE
    176         S MAGRY="1^CT Presets saved."
    177         Q
    178 NETPLCS ; Create an array of Place, SiteCodes for all entries of
    179         ; Network Location entries. 
    180         N I,PLC,PLCODE,CONS
    181         S CONS=$$CONSOLID^MAGBAPI
    182         I 'CONS S PLC=$O(^MAG(2006.1,0)),PLCODE=$P(^MAG(2006.1,PLC,0),"^",9)
    183         ;
    184         K MAGJOB("NETPLC")
    185         S I=0 F  S I=$O(^MAG(2005.2,I)) Q:'I  D
    186         . I 'CONS S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE Q
    187         . ; Here, for consolidated sites we get the real Site IEN, and Site Code.
    188         . I CONS S PLC=$P($G(^MAG(2005.2,I,0)),"^",10),PLCODE=$S(PLC:$P($G(^MAG(2006.1,PLC,0)),"^",9),1:"n/a")
    189         . S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE
    190         . Q
    191         Q
     1MAGGTU6 ;WOIFO/GEK - Silent Utilities ; 25 Jan 2006  12:14 PM
     2 ;;3.0;IMAGING;**24,8,48,45,20,46**;16-February-2007;;Build 1023
     3 ;; Per VHA Directive 2004-038, this routine should not be modified.
     4 ;; +---------------------------------------------------------------+
     5 ;; | Property of the US Government.                                |
     6 ;; | No permission to copy or redistribute this software is given. |
     7 ;; | Use of unreleased versions of this software requires the user |
     8 ;; | to execute a written test agreement with the VistA Imaging    |
     9 ;; | Development Office of the Department of Veterans Affairs,     |
     10 ;; | telephone (301) 734-0100.                                     |
     11 ;; | The Food and Drug Administration classifies this software as  |
     12 ;; | a medical device.  As such, it may not be changed in any way. |
     13 ;; | Modifications to this software may result in an adulterated   |
     14 ;; | medical device under 21CFR820, the use of which is considered |
     15 ;; | to be a violation of US Federal Statutes.                     |
     16 ;; +---------------------------------------------------------------+
     17 ;;
     18 Q
     19 ;
     20LOGACT(MAGRY,ZY) ;RPC [MAGGACTION LOG]
     21 ; Call to LogAction from Delphi Window
     22 ;
     23 ; ZY is input variable it is '^' delimited string
     24 ; 'A|B|C|D|E' ^^ MAGIEN ^ 'Copy/Download' ^ DFN ^ '1';
     25 ;  DUZ is inserted as 2nd piece below.
     26 ; I.E. zy  = "C^^103660^Copy To Clipboard^1033^1"
     27 N Y
     28 S MAGRY="0^Logging access..."
     29 ;
     30 N $ETRAP,$ESTACK S $ETRAP="D ERR^MAGGTERR"
     31 ;                 C       DUZ      MAGIEN     ACTION       DFN       1
     32 D ENTRY^MAGLOG($P(ZY,U),+$G(DUZ),$P(ZY,U,3),$P(ZY,U,4),$P(ZY,U,5),$P(ZY,U,6))
     33 S MAGRY="1^Action was Logged."
     34 Q
     35LINKDT(MAGRY,MAGDA,DTTM) ; This is called when an Image is successfully
     36 ; linked (Associated) with a Report/Procedure/Note etc.
     37 ;  MAGDA = Image IEN
     38 ;  DTTM = ""            No date sent, so use NOW
     39 ;  DTTM = 1                     No Date Sent, but use Image capture Date.
     40 ;  DTTM = Valid FM Date/Time    , Use it.
     41 N MSG
     42 S DTTM=$G(DTTM)
     43 I 'DTTM S DTTM=$$NOW^XLFDT      ; Using NOW
     44 I '$D(^MAG(2005,MAGDA)) Q
     45 I DTTM=1 S DTTM=$P(^MAG(2005,MAGDA,2),"^",1) ; Using Date Image Captured.
     46 I '$$VALID^MAGGSIV1(2005,64,.DTTM,.MSG) S MAGRY="0^"_MSG Q
     47 S $P(^MAG(2005,MAGDA,2),"^",11)=DTTM
     48 S MAGRY="1^Okay"
     49 Q
     50TIMEOUT(MAGRY,APP) ;RPC [MAGG GET TIMEOUT]
     51 ; Call  Returns the timeout for the APP from IMAGING SITE PARAMETERS File
     52 ;  APP is either 'DISPLAY'  'CAPTURE' or   'VISTARAD'
     53 N I,MAGTIMES,MAGPLC
     54 S MAGRY=""
     55 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2)) I 'MAGPLC Q  ; DBI - SEB 9/20/2002
     56 S MAGTIMES=$G(^MAG(2006.1,MAGPLC,"KEYS"))
     57 I APP="DISPLAY" S MAGRY=$P(MAGTIMES,U,2)
     58 I APP="CAPTURE" S MAGRY=$P(MAGTIMES,U,3)
     59 I APP="VISTARAD" S MAGRY=$P(MAGTIMES,U,4)
     60 I APP="TELEREADER" S MAGRY=$P(MAGTIMES,U,6)  ;  MJK - 2006.01.25 - TeleReader
     61 Q
     62EXIST(EKGPLACE) ;Does an ekg server exist in 2005.2
     63 I $$CONSOLID^MAGBAPI()=0 Q $O(^MAG(2005.2,"E","EKG","")) ; DBI - SEB 9/20/2002
     64 Q $O(^MAG(2005.2,"F",EKGPLACE,"EKG",""))
     65 ;
     66ONLINE(MAGR) ;RPC [MAG EKG ONLINE] EKG network location status   
     67 ;returns the status of the first EKG network location type
     68 ;O if offline or a network location doesn't exist
     69 ;1 if online
     70 ;
     71 N EKG1,EKGPLACE
     72 S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ; DBI - SEB 9/20/2002
     73 I EKGPLACE=0 S EKGPLACE=$$PLACE^MAGBAPI(DUZ(2)) ;Convert to extrinsic /gek 8/2003
     74 I $$EXIST(EKGPLACE) D
     75 . I $$CONSOLID^MAGBAPI() S EKG1=$O(^MAG(2005.2,"F",EKGPLACE,"EKG","")) ; DBI - SEB 9/20/2002
     76 . E  S EKG1=$O(^MAG(2005.2,"E","EKG",""))
     77 . S MAGR=$P(^MAG(2005.2,EKG1,0),U,6)
     78 E  S MAGR=0
     79 Q
     80SHARE(MAGRY,TYPE) ;RPC [MAG GET NETLOC]
     81 ; Get list of image shares
     82 ;TYPE = One of the STORAGE TYPE codes : MAG, EKG, WORM, URL or ALL
     83 N TMP,I,DATA0,DATA2,DATA3,DATA6,INFO,VALUE,STYP,PHYREF
     84 N $ETRAP,$ESTACK S $ETRAP="D ERRA^MAGGTERR"
     85 S I=0
     86 I TYPE="" S TYPE="ALL"
     87 S MAGRY(0)="1^SUCCESS"
     88 F  S I=$O(^MAG(2005.2,I)) Q:'I  D
     89 . Q:$$LOCDRIVE(I)
     90 . S DATA0=$G(^MAG(2005.2,I,0))
     91 . S DATA2=$G(^MAG(2005.2,I,2))
     92 . S DATA3=$G(^MAG(2005.2,I,3))
     93 . S DATA6=$G(^MAG(2005.2,I,6))
     94 . ;
     95 . S PHYREF=$P(DATA0,"^",2) ; PHYSICAL REFERENCE
     96 . S STYP=$P(DATA0,"^",7) ; STORAGE TYPE
     97 . ;
     98 . I TYPE'="ALL" Q:STYP'[TYPE
     99 . Q:$P(DATA0,"^",6)=0     ;SHARE IS OFFLINE (don't return offline shares)
     100 . I STYP'="URL" Q:(PHYREF[".")  ; pre 45, quit if '.' in phyref
     101 . I STYP'="URL" Q:($E(PHYREF,1,2)'="\\")  ; pre 45 quit if doesn't start with '\\'
     102 . ;
     103 . S INFO=$S($E(PHYREF,$L(PHYREF))="\":$E(PHYREF,1,$L(PHYREF)-1),1:PHYREF)
     104 . S $P(INFO,"^",2)=$P($G(DATA0),"^",7) ;Physical reference (path)
     105 . S $P(INFO,"^",3)=$P($G(DATA0),"^",6)  ;Operational Status 0=OFFLINE 1=ONLINE
     106 . S $P(INFO,"^",4)=$P($G(DATA2),"^",1) ;Username
     107 . S $P(INFO,"^",5)=$P($G(DATA2),"^",2) ;Password
     108 . S $P(INFO,"^",6)=$P($G(DATA6),"^",1)  ;MUSE Site #
     109 . I $P($G(DATA6),"^",2)'="" S $P(INFO,"^",7)=^MAG(2006.17,$P(DATA6,"^",2),0)  ;MUSE version #
     110 . S $P(INFO,"^",8)=$P($G(DATA3),"^",5)  ;Network location SITE
     111 . Q:$D(TMP(INFO))
     112 . S TMP(INFO)=I
     113 S INFO=""
     114 F  S INFO=$O(TMP(INFO)) Q:INFO=""  D
     115 . S MAGRY($O(MAGRY(""),-1)+1)=TMP(INFO)_"^"_INFO
     116 K TMP
     117 Q
     118LOCDRIVE(I) ; Returns 1 if this is a local drive, else 0
     119 ; Local Drive is determined by the DIR not being Type : URL and having a ":"
     120 I $P(^MAG(2005.2,I,0),"^",7)'="URL" I $P(^MAG(2005.2,I,0),"^",2)[":" Q 1
     121 Q 0
     122GETENV(MAGRY) ;RPC [MAG GET ENV]
     123 ; Get some environment variables (used by annotation control)
     124 S MAGRY=DUZ(2)_"^"_$$NOW^XLFDT
     125 Q
     126ANNCB(STATARR) ;Status Callback (called by the import API)
     127 ;
     128 N I,CDUZ,QINDEX,A,COUNT
     129 N XMDUZ,XMSUB,XMTEXT,XMY
     130 ;  0 = error, all others are success.
     131 I $P(STATARR(0),"^",1)'=0 D
     132 . ;   Import was successful
     133 E  D
     134 . ;   Import failed - send mail to MAG SERVER group and person who queued the import
     135 . S XMDUZ=DUZ
     136 . S XMSUB="Import Error Report"
     137 . ;    get text of message from status array
     138 . S XMTEXT="A("
     139 . ; XMD needs array to start with 1, not 0
     140 . S COUNT=1,I=""
     141 . F  S I=$O(STATARR(I)) Q:I=""  D
     142 . . S A(COUNT)=I_") "_STATARR(I)
     143 . . S COUNT=COUNT+1
     144 . . Q
     145 . S A(COUNT+1)=" "
     146 . S A(COUNT+2)=" "
     147 . S A(COUNT+3)="     The errors listed above were generated by"
     148 . S A(COUNT+4)="     the VistA Imaging Annotation Editor while"
     149 . S A(COUNT+5)="     trying to import your diagram.  Please"
     150 . S A(COUNT+6)="     report these errors to your VistA Imaging"
     151 . S A(COUNT+7)="     support personnel."
     152 . ;Get person who did the import
     153 . S QINDEX=STATARR(2)
     154 . S I=-1 F  S I=$O(^MAG(2006.034,QINDEX,1,I)) Q:I=""  D
     155 . . I $P($G(^MAG(2006.034,QINDEX,1,I,0)),"^",1)=8 S CDUZ=$P(^MAG(2006.034,QINDEX,1,I,0),"^",2)
     156 . ;Set recipients of message
     157 . S XMY("G.MAG SERVER")=""
     158 . I $G(CDUZ) S XMY(CDUZ)=""
     159 . D ^XMD
     160 . Q
     161 Q
     162GETCTP(MAGRY) ;RPC [MAG4 CT PRESETS GET]
     163 N MAGPLC
     164 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
     165 I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
     166 S MAGRY=$G(^MAG(2006.1,MAGPLC,"CT"))
     167 I MAGRY="" S MAGRY="0^Site doesn't have CT Presets defined." Q
     168 S MAGRY="1^"_MAGRY
     169 Q
     170SAVECTP(MAGRY,VALUE) ;RPC [MAG4 CT PRESETS SAVE]
     171 N MAGPLC
     172 S MAGPLC=$$PLACE^MAGBAPI(DUZ(2))
     173 I 'MAGPLC S MAGRY="0^Error resolving Users Division" Q
     174 S ^MAG(2006.1,MAGPLC,"CT")=VALUE
     175 S MAGRY="1^CT Presets saved."
     176 Q
     177NETPLCS ; Create an array of Place, SiteCodes for all entries of
     178 ; Network Location entries. 
     179 N I,PLC,PLCODE,CONS
     180 S CONS=$$CONSOLID^MAGBAPI
     181 I 'CONS S PLC=$O(^MAG(2006.1,0)),PLCODE=$P(^MAG(2006.1,PLC,0),"^",9)
     182 ;
     183 K MAGJOB("NETPLC")
     184 S I=0 F  S I=$O(^MAG(2005.2,I)) Q:'I  D
     185 . I 'CONS S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE Q
     186 . ; Here, for consolidated sites we get the real Site IEN, and Site Code.
     187 . I CONS S PLC=$P($G(^MAG(2005.2,I,0)),"^",10),PLCODE=$S(PLC:$P($G(^MAG(2006.1,PLC,0)),"^",9),1:"n/a")
     188 . S MAGJOB("NETPLC",I)=PLC_"^"_PLCODE
     189 . Q
     190 Q
Note: See TracChangeset for help on using the changeset viewer.