| 1 | MAGGSFL1 ;WOIFO/GEK - Image list Filters utilities ; [ 06/20/2001 08:57 ]
 | 
|---|
| 2 |  ;;3.0;IMAGING;**8**;Sep 15, 2004
 | 
|---|
| 3 |  ;; +---------------------------------------------------------------+
 | 
|---|
| 4 |  ;; | Property of the US Government.                                |
 | 
|---|
| 5 |  ;; | No permission to copy or redistribute this software is given. |
 | 
|---|
| 6 |  ;; | Use of unreleased versions of this software requires the user |
 | 
|---|
| 7 |  ;; | to execute a written test agreement with the VistA Imaging    |
 | 
|---|
| 8 |  ;; | Development Office of the Department of Veterans Affairs,     |
 | 
|---|
| 9 |  ;; | telephone (301) 734-0100.                                     |
 | 
|---|
| 10 |  ;; |                                                               |
 | 
|---|
| 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 | SET(MAGRY,MAGGZ) ;RPC [MAG4 FILTER SAVE]
 | 
|---|
| 20 |  ; Enter/Edit a filter.
 | 
|---|
| 21 |  ;  Use DUZ for field  #22 Ceated By
 | 
|---|
| 22 |  ;  MAGGZ is input array in format
 | 
|---|
| 23 |  ;  MAGGZ(n)="field number ^ field value"
 | 
|---|
| 24 |  ;                       if field number = "IEN".  User is modifying an existing filter.
 | 
|---|
| 25 |  ;                          field number = "USER".  The filter is being saved for that user.
 | 
|---|
| 26 |  ;
 | 
|---|
| 27 |  K MAGRY
 | 
|---|
| 28 |  S MAGRY="0^Starting: Saving Filter..."
 | 
|---|
| 29 |  N MAGGDA,MAGGFDA,MFDA2,MAGGIEN,MAGGXE,MAGGFLD,MAGGDAT,MAGOK,FLTIEN,FLTUSER,RES,MAGMOD
 | 
|---|
| 30 |  S FLTIEN=0,FLTUSER=0,MAGOK=1,MAGMOD=0
 | 
|---|
| 31 |  N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
 | 
|---|
| 32 |  I ($D(MAGGZ)<10) S MAGRY="0^No input data, Operation CANCELED" Q
 | 
|---|
| 33 |  ;
 | 
|---|
| 34 |  S Z="" F  S Z=$O(MAGGZ(Z)) Q:Z=""  D  I 'MAGOK S MAGRY=MAGOK Q
 | 
|---|
| 35 |  . N $ETRAP,$ESTACK S $ETRAP="D ERR^"_$T(+0)
 | 
|---|
| 36 |  . S MAGGFLD=$P(MAGGZ(Z),U,1),MAGGDAT=$P(MAGGZ(Z),U,2,99)
 | 
|---|
| 37 |  . I MAGGFLD=""!(MAGGDAT="") S MAGOK="0^Field and Value are Required" Q
 | 
|---|
| 38 |  . I MAGGFLD="IEN" S FLTIEN=+MAGGDAT,MAGMOD=1 Q
 | 
|---|
| 39 |  . I MAGGFLD="USER" S FLTUSER=+MAGGDAT S MAGGFLD=20
 | 
|---|
| 40 |  . I '$$VALID^MAGGSIV1(2005.87,MAGGFLD,.MAGGDAT,.RES) S MAGOK="0^"_RES Q
 | 
|---|
| 41 |  . S MAGGFDA(2005.87,"+1,",MAGGFLD)=MAGGDAT
 | 
|---|
| 42 |  I 'MAGOK Q
 | 
|---|
| 43 |  ; Data is valid.  If modifying existing entry make sure we clear old values.
 | 
|---|
| 44 |  L +(^MAG(2005.87,0)):10 E  S MAGRY="0^The File Image List Filters is locked.  Operation canceled" Q
 | 
|---|
| 45 |  I MAGMOD D
 | 
|---|
| 46 |  . I '$D(^MAG(2005.87,FLTIEN)) S MAGRY="0^Invalid Filter IEN: "_FLTIEN Q
 | 
|---|
| 47 |  . N MAGV F I=1,2,3,4,5,6,7,8,9,20,21 S MAGV(I)="@"
 | 
|---|
| 48 |  . M MAGV=MAGGFDA(2005.87,"+1,")
 | 
|---|
| 49 |  . K MAGGFDA
 | 
|---|
| 50 |  . M MAGGFDA(2005.87,FLTIEN_",")=MAGV
 | 
|---|
| 51 |  . ; Here we file the modified entry, killing old values and setting new.
 | 
|---|
| 52 |  . ;L// L +(^MAG(2005.87,FLTIEN)):5 E  S MAGRY="0^Filter is locked.  Operation canceled" Q
 | 
|---|
| 53 |  . D FILE^DIE("","MAGGFDA","MAGGXE")
 | 
|---|
| 54 |  . ;L// L -(^MAG(2005.87,FLTIEN))
 | 
|---|
| 55 |  . I $D(DIERR) D RTRNERR(.MAGRY) Q
 | 
|---|
| 56 |  . S MAGRY=FLTIEN_"^"_$P(^MAG(2005.87,FLTIEN,0),"^",1)
 | 
|---|
| 57 |  . Q
 | 
|---|
| 58 |  I 'MAGMOD D
 | 
|---|
| 59 |  . S MAGGFDA(2005.87,"+1,",22)=DUZ
 | 
|---|
| 60 |  . D UPDATE^DIE("","MAGGFDA","MAGGIEN","MAGGXE")
 | 
|---|
| 61 |  . I $D(DIERR) D RTRNERR(.MAGRY) Q
 | 
|---|
| 62 |  . S MAGRY=MAGGIEN(1)_"^"_$P(^MAG(2005.87,+MAGGIEN(1),0),"^",1)
 | 
|---|
| 63 |  . Q
 | 
|---|
| 64 |  L -(^MAG(2005.87,0))
 | 
|---|
| 65 |  D CLEAN^DILF
 | 
|---|
| 66 |  Q
 | 
|---|
| 67 | RTRNERR(ETXT) ; There was error from UPDATE^DIE quit with error text
 | 
|---|
| 68 |  N MAGRESA
 | 
|---|
| 69 |  D MSG^DIALOG("A",.MAGRESA,245,5,"MAGGXE")
 | 
|---|
| 70 |  S ETXT="0^"_MAGRESA(1)
 | 
|---|
| 71 |  D CLEAN^DILF
 | 
|---|
| 72 |  Q
 | 
|---|
| 73 | ERR ;
 | 
|---|
| 74 |  ;L// L -(^MAG(2005.87,FLTIEN))
 | 
|---|
| 75 |  L -(^MAG(2005.87,0))
 | 
|---|
| 76 |  N ERR
 | 
|---|
| 77 |  S ERR=$$EC^%ZOSV
 | 
|---|
| 78 |  S MAGRY="0^Error Filter Add/Edit: "_ERR
 | 
|---|
| 79 |  S MAGOK=MAGRY
 | 
|---|
| 80 |  D LOGERR^MAGGTERR(ERR)
 | 
|---|
| 81 |  D @^%ZOSF("ERRTN")
 | 
|---|
| 82 |  D CLEAN^DILF
 | 
|---|
| 83 |  Q
 | 
|---|