[613] | 1 | DGPFALH ;ALB/RBS - PRF LOCAL FLAG HISTORY API'S ; 3/10/03 3:14pm
|
---|
| 2 | ;;5.3;Registration;**425**;Aug 13, 1993
|
---|
| 3 | ;
|
---|
| 4 | Q ;no direct entry
|
---|
| 5 | ;
|
---|
| 6 | GETALL(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
|
---|
| 7 | ;
|
---|
| 8 | ; Input:
|
---|
| 9 | ; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
|
---|
| 10 | ; DGPFIENS - (required) Result array passed by reference
|
---|
| 11 | ;
|
---|
| 12 | ; Output:
|
---|
| 13 | ; Function Value - Count of returned IENs
|
---|
| 14 | ; DGPFIENS - Output array subscripted by Local Flag history IENs
|
---|
| 15 | ;
|
---|
| 16 | N DGCNT ;number of returned values
|
---|
| 17 | N DGHIEN ;single history IEN
|
---|
| 18 | ;
|
---|
| 19 | S DGCNT=0
|
---|
| 20 | I $G(DGPFIEN)>0,$D(^DGPF(26.12,"B",DGPFIEN)) D
|
---|
| 21 | . S DGHIEN=0
|
---|
| 22 | . F S DGHIEN=$O(^DGPF(26.12,"B",DGPFIEN,DGHIEN)) Q:'DGHIEN D
|
---|
| 23 | . . S DGPFIENS(DGHIEN)=""
|
---|
| 24 | . . S DGCNT=DGCNT+1
|
---|
| 25 | Q DGCNT
|
---|
| 26 | ;
|
---|
| 27 | ;
|
---|
| 28 | GETALLDT(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
|
---|
| 29 | ; Retrieve list of history IENs for a Local Flag and place in a local
|
---|
| 30 | ; array subscripted by Flag Edit Date/Time.
|
---|
| 31 | ;
|
---|
| 32 | ; Input:
|
---|
| 33 | ; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
|
---|
| 34 | ; DGPFIENS - (required) Result array passed by reference
|
---|
| 35 | ;
|
---|
| 36 | ; Output:
|
---|
| 37 | ; Function Value - Count of returned IENs
|
---|
| 38 | ; DGPFIENS - Output array containing Local Flag history IENs,
|
---|
| 39 | ; subscripted by Flag Edit Date/Time
|
---|
| 40 | ; Ex. DGPFIENS(3030310.1025)=2
|
---|
| 41 | ;
|
---|
| 42 | ;
|
---|
| 43 | N DGCNT ;number of returned values
|
---|
| 44 | N DGDT ;flag edit date/time
|
---|
| 45 | N DGHIEN ;single history IEN
|
---|
| 46 | ;
|
---|
| 47 | S DGCNT=0
|
---|
| 48 | ;
|
---|
| 49 | I $G(DGPFIEN)>0,$D(^DGPF(26.12,"C",DGPFIEN)) D
|
---|
| 50 | . S DGDT=0
|
---|
| 51 | . F S DGDT=$O(^DGPF(26.12,"C",DGPFIEN,DGDT)) Q:'DGDT D
|
---|
| 52 | . . S DGHIEN=0
|
---|
| 53 | . . F S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGDT,DGHIEN)) Q:'DGHIEN D
|
---|
| 54 | . . . S DGPFIENS(DGDT)=DGHIEN
|
---|
| 55 | . . . S DGCNT=DGCNT+1
|
---|
| 56 | ;
|
---|
| 57 | Q DGCNT
|
---|
| 58 | ;
|
---|
| 59 | ;
|
---|
| 60 | GETHIST(DGPFIEN,DGPFLH) ;retrieve a single Local Flag history record
|
---|
| 61 | ;
|
---|
| 62 | ; Input:
|
---|
| 63 | ; DGPFIEN - (required) IEN for record in PRF LOCAL FLAG HISTORY
|
---|
| 64 | ; (#26.12) file
|
---|
| 65 | ; DGPFLH - (required) Result array passed by reference
|
---|
| 66 | ;
|
---|
| 67 | ; Output:
|
---|
| 68 | ; Function Value - Return 1 on success, 0 on failure
|
---|
| 69 | ; DGPFLH - Output array containing the field values
|
---|
| 70 | ; Subscript Field#
|
---|
| 71 | ; ----------------- ------
|
---|
| 72 | ; "FLAG" .01
|
---|
| 73 | ; "ENTERDT" .02
|
---|
| 74 | ; "ENTERBY" .03
|
---|
| 75 | ; "REASON",line#,0 .04
|
---|
| 76 | ;
|
---|
| 77 | N DGIENS ;IEN string for DIQ
|
---|
| 78 | N DGFLDS ;results array for DIQ
|
---|
| 79 | N DGERR ;error array for DIQ
|
---|
| 80 | N DGRSLT
|
---|
| 81 | S DGRSLT=0
|
---|
| 82 | I $G(DGPFIEN)>0,$D(^DGPF(26.12,DGPFIEN)) D
|
---|
| 83 | . S DGIENS=DGPFIEN_","
|
---|
| 84 | . D GETS^DIQ(26.12,DGIENS,"*","IEZ","DGFLDS","DGERR")
|
---|
| 85 | . Q:$D(DGERR)
|
---|
| 86 | . S DGRSLT=1
|
---|
| 87 | . S DGPFLH("FLAG")=$G(DGFLDS(26.12,DGIENS,.01,"I"))_U_$G(DGFLDS(26.12,DGIENS,.01,"E"))
|
---|
| 88 | . S DGPFLH("ENTERDT")=$G(DGFLDS(26.12,DGIENS,.02,"I"))_U_$G(DGFLDS(26.12,DGIENS,.02,"E"))
|
---|
| 89 | . S DGPFLH("ENTERBY")=$G(DGFLDS(26.12,DGIENS,.03,"I"))_U_$G(DGFLDS(26.12,DGIENS,.03,"E"))
|
---|
| 90 | . ;build reason of enter/edit word processing array
|
---|
| 91 | . M DGPFLH("REASON")=DGFLDS(26.12,DGIENS,.04)
|
---|
| 92 | . K DGPFLH("REASON","E"),DGPFLH("REASON","I")
|
---|
| 93 | . ;
|
---|
| 94 | Q DGRSLT
|
---|
| 95 | ;
|
---|
| 96 | ;
|
---|
| 97 | GETLAST(DGPFIEN) ;determine IEN of last Local Flag history record
|
---|
| 98 | ;This function returns the IEN of the most recent history record for
|
---|
| 99 | ;a given Local Flag record.
|
---|
| 100 | ;
|
---|
| 101 | ; Input:
|
---|
| 102 | ; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
|
---|
| 103 | ;
|
---|
| 104 | ; Output:
|
---|
| 105 | ; Function Value - IEN of last history record on success
|
---|
| 106 | ; - 0 on failure
|
---|
| 107 | N DGDAT,DGHIEN
|
---|
| 108 | S DGHIEN=0
|
---|
| 109 | I $G(DGPFIEN)>0,$D(^DGPF(26.11,DGPFIEN)) D
|
---|
| 110 | . S DGDAT=$O(^DGPF(26.12,"C",DGPFIEN,""),-1)
|
---|
| 111 | . I DGDAT>0 D
|
---|
| 112 | . . S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGDAT,0))
|
---|
| 113 | Q $S($G(DGHIEN)>0:DGHIEN,1:0)
|
---|
| 114 | ;
|
---|
| 115 | ;
|
---|
| 116 | GETADT(DGPFIEN) ;get the initial entry date/time
|
---|
| 117 | ;This function returns the initia entry date/time for a given Local
|
---|
| 118 | ;record flag.
|
---|
| 119 | ;
|
---|
| 120 | ; Input:
|
---|
| 121 | ; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
|
---|
| 122 | ;
|
---|
| 123 | ; Output:
|
---|
| 124 | ; Function Value - Entry date/time on success (internal^external)
|
---|
| 125 | ; 0 on failure
|
---|
| 126 | ;
|
---|
| 127 | N DGHIEN ;history IEN
|
---|
| 128 | N DGEDT ;edit date
|
---|
| 129 | N DGADT ;entry date
|
---|
| 130 | N DGPFLH ;history record data array
|
---|
| 131 | ;
|
---|
| 132 | S DGADT=0
|
---|
| 133 | S DGHIEN=0
|
---|
| 134 | I $G(DGPFIEN)>0,$D(^DGPF(26.11,DGPFIEN)) D
|
---|
| 135 | . S DGEDT=$O(^DGPF(26.12,"C",DGPFIEN,0))
|
---|
| 136 | . I DGEDT>0 D
|
---|
| 137 | . . S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGEDT,0))
|
---|
| 138 | . . I DGHIEN>0,$$GETHIST^DGPFALH(DGHIEN,.DGPFLH) D
|
---|
| 139 | . . . S DGADT=$G(DGPFLH("ENTERDT"))
|
---|
| 140 | Q DGADT
|
---|
| 141 | ;
|
---|
| 142 | ;
|
---|
| 143 | STOHIST(DGPFLH,DGPFERR) ;file a PRF LOCAL FLAG HISTORY (#26.12) file record
|
---|
| 144 | ;
|
---|
| 145 | ; Input:
|
---|
| 146 | ; DGPFLH - (required) Array of values to be filed (see GETHIST tag
|
---|
| 147 | ; above for valid array structure)
|
---|
| 148 | ; DGPFERR - (optional) Passed by reference to contain error msg's
|
---|
| 149 | ;
|
---|
| 150 | ; Output:
|
---|
| 151 | ; Function Value - Returns IEN of record on success
|
---|
| 152 | ; - 0 on failure
|
---|
| 153 | ; DGPFERR - Undefined on success, error message on failure
|
---|
| 154 | ;
|
---|
| 155 | N DGSUB,DGFLD,DGIEN,DGIENS,DGFDA,DGFDAIEN,DGERR
|
---|
| 156 | ;
|
---|
| 157 | F DGSUB="FLAG","ENTERDT","ENTERBY" D
|
---|
| 158 | . S DGFLD(DGSUB)=$P($G(DGPFLH(DGSUB)),U)
|
---|
| 159 | I $D(DGPFLH("REASON")) M DGFLD("REASON")=DGPFLH("REASON")
|
---|
| 160 | I $$VALID^DGPFUT("DGPFALH",26.12,.DGFLD,.DGPFERR) D
|
---|
| 161 | . S DGIENS="+1,"
|
---|
| 162 | . S DGFDA(26.12,DGIENS,.01)=DGFLD("FLAG")
|
---|
| 163 | . S DGFDA(26.12,DGIENS,.02)=DGFLD("ENTERDT")
|
---|
| 164 | . S DGFDA(26.12,DGIENS,.03)=DGFLD("ENTERBY")
|
---|
| 165 | . S DGFDA(26.12,DGIENS,.04)="DGFLD(""REASON"")"
|
---|
| 166 | . D UPDATE^DIE("","DGFDA","DGFDAIEN","DGERR")
|
---|
| 167 | . I '$D(DGERR) S DGIEN=$G(DGFDAIEN(1))
|
---|
| 168 | Q $S($G(DGIEN)>0:DGIEN,1:0)
|
---|
| 169 | ;
|
---|
| 170 | ;
|
---|
| 171 | ; PRF LOCAL FLAG field VALIDATION DATA
|
---|
| 172 | XREF ;;array node name;field#;required param;word processing?;description
|
---|
| 173 | ;;FLAG;.01;1;0;flag name
|
---|
| 174 | ;;ENTERDT;.02;1;0;pointer to NEW PERSON (#200) file
|
---|
| 175 | ;;ENTERBY;.03;1;0;pointer to NEW PERSON (#200) file
|
---|
| 176 | ;;REASON;.04;1;1;Reason of Flag enter/edit
|
---|