DGPFALH ;ALB/RBS - PRF LOCAL FLAG HISTORY API'S ; 3/10/03 3:14pm
;;5.3;Registration;**425**;Aug 13, 1993
;
Q ;no direct entry
;
GETALL(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
;
; Input:
; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
; DGPFIENS - (required) Result array passed by reference
;
; Output:
; Function Value - Count of returned IENs
; DGPFIENS - Output array subscripted by Local Flag history IENs
;
N DGCNT ;number of returned values
N DGHIEN ;single history IEN
;
S DGCNT=0
I $G(DGPFIEN)>0,$D(^DGPF(26.12,"B",DGPFIEN)) D
. S DGHIEN=0
. F S DGHIEN=$O(^DGPF(26.12,"B",DGPFIEN,DGHIEN)) Q:'DGHIEN D
. . S DGPFIENS(DGHIEN)=""
. . S DGCNT=DGCNT+1
Q DGCNT
;
;
GETALLDT(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
; Retrieve list of history IENs for a Local Flag and place in a local
; array subscripted by Flag Edit Date/Time.
;
; Input:
; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
; DGPFIENS - (required) Result array passed by reference
;
; Output:
; Function Value - Count of returned IENs
; DGPFIENS - Output array containing Local Flag history IENs,
; subscripted by Flag Edit Date/Time
; Ex. DGPFIENS(3030310.1025)=2
;
;
N DGCNT ;number of returned values
N DGDT ;flag edit date/time
N DGHIEN ;single history IEN
;
S DGCNT=0
;
I $G(DGPFIEN)>0,$D(^DGPF(26.12,"C",DGPFIEN)) D
. S DGDT=0
. F S DGDT=$O(^DGPF(26.12,"C",DGPFIEN,DGDT)) Q:'DGDT D
. . S DGHIEN=0
. . F S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGDT,DGHIEN)) Q:'DGHIEN D
. . . S DGPFIENS(DGDT)=DGHIEN
. . . S DGCNT=DGCNT+1
;
Q DGCNT
;
;
GETHIST(DGPFIEN,DGPFLH) ;retrieve a single Local Flag history record
;
; Input:
; DGPFIEN - (required) IEN for record in PRF LOCAL FLAG HISTORY
; (#26.12) file
; DGPFLH - (required) Result array passed by reference
;
; Output:
; Function Value - Return 1 on success, 0 on failure
; DGPFLH - Output array containing the field values
; Subscript Field#
; ----------------- ------
; "FLAG" .01
; "ENTERDT" .02
; "ENTERBY" .03
; "REASON",line#,0 .04
;
N DGIENS ;IEN string for DIQ
N DGFLDS ;results array for DIQ
N DGERR ;error array for DIQ
N DGRSLT
S DGRSLT=0
I $G(DGPFIEN)>0,$D(^DGPF(26.12,DGPFIEN)) D
. S DGIENS=DGPFIEN_","
. D GETS^DIQ(26.12,DGIENS,"*","IEZ","DGFLDS","DGERR")
. Q:$D(DGERR)
. S DGRSLT=1
. S DGPFLH("FLAG")=$G(DGFLDS(26.12,DGIENS,.01,"I"))_U_$G(DGFLDS(26.12,DGIENS,.01,"E"))
. S DGPFLH("ENTERDT")=$G(DGFLDS(26.12,DGIENS,.02,"I"))_U_$G(DGFLDS(26.12,DGIENS,.02,"E"))
. S DGPFLH("ENTERBY")=$G(DGFLDS(26.12,DGIENS,.03,"I"))_U_$G(DGFLDS(26.12,DGIENS,.03,"E"))
. ;build reason of enter/edit word processing array
. M DGPFLH("REASON")=DGFLDS(26.12,DGIENS,.04)
. K DGPFLH("REASON","E"),DGPFLH("REASON","I")
. ;
Q DGRSLT
;
;
GETLAST(DGPFIEN) ;determine IEN of last Local Flag history record
;This function returns the IEN of the most recent history record for
;a given Local Flag record.
;
; Input:
; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
;
; Output:
; Function Value - IEN of last history record on success
; - 0 on failure
N DGDAT,DGHIEN
S DGHIEN=0
I $G(DGPFIEN)>0,$D(^DGPF(26.11,DGPFIEN)) D
. S DGDAT=$O(^DGPF(26.12,"C",DGPFIEN,""),-1)
. I DGDAT>0 D
. . S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGDAT,0))
Q $S($G(DGHIEN)>0:DGHIEN,1:0)
;
;
GETADT(DGPFIEN) ;get the initial entry date/time
;This function returns the initia entry date/time for a given Local
;record flag.
;
; Input:
; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
;
; Output:
; Function Value - Entry date/time on success (internal^external)
; 0 on failure
;
N DGHIEN ;history IEN
N DGEDT ;edit date
N DGADT ;entry date
N DGPFLH ;history record data array
;
S DGADT=0
S DGHIEN=0
I $G(DGPFIEN)>0,$D(^DGPF(26.11,DGPFIEN)) D
. S DGEDT=$O(^DGPF(26.12,"C",DGPFIEN,0))
. I DGEDT>0 D
. . S DGHIEN=$O(^DGPF(26.12,"C",DGPFIEN,DGEDT,0))
. . I DGHIEN>0,$$GETHIST^DGPFALH(DGHIEN,.DGPFLH) D
. . . S DGADT=$G(DGPFLH("ENTERDT"))
Q DGADT
;
;
STOHIST(DGPFLH,DGPFERR) ;file a PRF LOCAL FLAG HISTORY (#26.12) file record
;
; Input:
; DGPFLH - (required) Array of values to be filed (see GETHIST tag
; above for valid array structure)
; DGPFERR - (optional) Passed by reference to contain error msg's
;
; Output:
; Function Value - Returns IEN of record on success
; - 0 on failure
; DGPFERR - Undefined on success, error message on failure
;
N DGSUB,DGFLD,DGIEN,DGIENS,DGFDA,DGFDAIEN,DGERR
;
F DGSUB="FLAG","ENTERDT","ENTERBY" D
. S DGFLD(DGSUB)=$P($G(DGPFLH(DGSUB)),U)
I $D(DGPFLH("REASON")) M DGFLD("REASON")=DGPFLH("REASON")
I $$VALID^DGPFUT("DGPFALH",26.12,.DGFLD,.DGPFERR) D
. S DGIENS="+1,"
. S DGFDA(26.12,DGIENS,.01)=DGFLD("FLAG")
. S DGFDA(26.12,DGIENS,.02)=DGFLD("ENTERDT")
. S DGFDA(26.12,DGIENS,.03)=DGFLD("ENTERBY")
. S DGFDA(26.12,DGIENS,.04)="DGFLD(""REASON"")"
. D UPDATE^DIE("","DGFDA","DGFDAIEN","DGERR")
. I '$D(DGERR) S DGIEN=$G(DGFDAIEN(1))
Q $S($G(DGIEN)>0:DGIEN,1:0)
;
;
; PRF LOCAL FLAG field VALIDATION DATA
XREF ;;array node name;field#;required param;word processing?;description
;;FLAG;.01;1;0;flag name
;;ENTERDT;.02;1;0;pointer to NEW PERSON (#200) file
;;ENTERBY;.03;1;0;pointer to NEW PERSON (#200) file
;;REASON;.04;1;1;Reason of Flag enter/edit
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGPFALH 5914 printed Nov 22, 2024@17:57:22 Page 2
DGPFALH ;ALB/RBS - PRF LOCAL FLAG HISTORY API'S ; 3/10/03 3:14pm
+1 ;;5.3;Registration;**425**;Aug 13, 1993
+2 ;
+3 ;no direct entry
QUIT
+4 ;
GETALL(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
+1 ;
+2 ; Input:
+3 ; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
+4 ; DGPFIENS - (required) Result array passed by reference
+5 ;
+6 ; Output:
+7 ; Function Value - Count of returned IENs
+8 ; DGPFIENS - Output array subscripted by Local Flag history IENs
+9 ;
+10 ;number of returned values
NEW DGCNT
+11 ;single history IEN
NEW DGHIEN
+12 ;
+13 SET DGCNT=0
+14 IF $GET(DGPFIEN)>0
IF $DATA(^DGPF(26.12,"B",DGPFIEN))
Begin DoDot:1
+15 SET DGHIEN=0
+16 FOR
SET DGHIEN=$ORDER(^DGPF(26.12,"B",DGPFIEN,DGHIEN))
if 'DGHIEN
QUIT
Begin DoDot:2
+17 SET DGPFIENS(DGHIEN)=""
+18 SET DGCNT=DGCNT+1
End DoDot:2
End DoDot:1
+19 QUIT DGCNT
+20 ;
+21 ;
GETALLDT(DGPFIEN,DGPFIENS) ;retrieve list of history IENs for a Local Flag
+1 ; Retrieve list of history IENs for a Local Flag and place in a local
+2 ; array subscripted by Flag Edit Date/Time.
+3 ;
+4 ; Input:
+5 ; DGPFIEN - (required) Pointer to PRF LOCAL FLAG (#26.11) file
+6 ; DGPFIENS - (required) Result array passed by reference
+7 ;
+8 ; Output:
+9 ; Function Value - Count of returned IENs
+10 ; DGPFIENS - Output array containing Local Flag history IENs,
+11 ; subscripted by Flag Edit Date/Time
+12 ; Ex. DGPFIENS(3030310.1025)=2
+13 ;
+14 ;
+15 ;number of returned values
NEW DGCNT
+16 ;flag edit date/time
NEW DGDT
+17 ;single history IEN
NEW DGHIEN
+18 ;
+19 SET DGCNT=0
+20 ;
+21 IF $GET(DGPFIEN)>0
IF $DATA(^DGPF(26.12,"C",DGPFIEN))
Begin DoDot:1
+22 SET DGDT=0
+23 FOR
SET DGDT=$ORDER(^DGPF(26.12,"C",DGPFIEN,DGDT))
if 'DGDT
QUIT
Begin DoDot:2
+24 SET DGHIEN=0
+25 FOR
SET DGHIEN=$ORDER(^DGPF(26.12,"C",DGPFIEN,DGDT,DGHIEN))
if 'DGHIEN
QUIT
Begin DoDot:3
+26 SET DGPFIENS(DGDT)=DGHIEN
+27 SET DGCNT=DGCNT+1
End DoDot:3
End DoDot:2
End DoDot:1
+28 ;
+29 QUIT DGCNT
+30 ;
+31 ;
GETHIST(DGPFIEN,DGPFLH) ;retrieve a single Local Flag history record
+1 ;
+2 ; Input:
+3 ; DGPFIEN - (required) IEN for record in PRF LOCAL FLAG HISTORY
+4 ; (#26.12) file
+5 ; DGPFLH - (required) Result array passed by reference
+6 ;
+7 ; Output:
+8 ; Function Value - Return 1 on success, 0 on failure
+9 ; DGPFLH - Output array containing the field values
+10 ; Subscript Field#
+11 ; ----------------- ------
+12 ; "FLAG" .01
+13 ; "ENTERDT" .02
+14 ; "ENTERBY" .03
+15 ; "REASON",line#,0 .04
+16 ;
+17 ;IEN string for DIQ
NEW DGIENS
+18 ;results array for DIQ
NEW DGFLDS
+19 ;error array for DIQ
NEW DGERR
+20 NEW DGRSLT
+21 SET DGRSLT=0
+22 IF $GET(DGPFIEN)>0
IF $DATA(^DGPF(26.12,DGPFIEN))
Begin DoDot:1
+23 SET DGIENS=DGPFIEN_","
+24 DO GETS^DIQ(26.12,DGIENS,"*","IEZ","DGFLDS","DGERR")
+25 if $DATA(DGERR)
QUIT
+26 SET DGRSLT=1
+27 SET DGPFLH("FLAG")=$GET(DGFLDS(26.12,DGIENS,.01,"I"))_U_$GET(DGFLDS(26.12,DGIENS,.01,"E"))
+28 SET DGPFLH("ENTERDT")=$GET(DGFLDS(26.12,DGIENS,.02,"I"))_U_$GET(DGFLDS(26.12,DGIENS,.02,"E"))
+29 SET DGPFLH("ENTERBY")=$GET(DGFLDS(26.12,DGIENS,.03,"I"))_U_$GET(DGFLDS(26.12,DGIENS,.03,"E"))
+30 ;build reason of enter/edit word processing array
+31 MERGE DGPFLH("REASON")=DGFLDS(26.12,DGIENS,.04)
+32 KILL DGPFLH("REASON","E"),DGPFLH("REASON","I")
+33 ;
End DoDot:1
+34 QUIT DGRSLT
+35 ;
+36 ;
GETLAST(DGPFIEN) ;determine IEN of last Local Flag history record
+1 ;This function returns the IEN of the most recent history record for
+2 ;a given Local Flag record.
+3 ;
+4 ; Input:
+5 ; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
+6 ;
+7 ; Output:
+8 ; Function Value - IEN of last history record on success
+9 ; - 0 on failure
+10 NEW DGDAT,DGHIEN
+11 SET DGHIEN=0
+12 IF $GET(DGPFIEN)>0
IF $DATA(^DGPF(26.11,DGPFIEN))
Begin DoDot:1
+13 SET DGDAT=$ORDER(^DGPF(26.12,"C",DGPFIEN,""),-1)
+14 IF DGDAT>0
Begin DoDot:2
+15 SET DGHIEN=$ORDER(^DGPF(26.12,"C",DGPFIEN,DGDAT,0))
End DoDot:2
End DoDot:1
+16 QUIT $SELECT($GET(DGHIEN)>0:DGHIEN,1:0)
+17 ;
+18 ;
GETADT(DGPFIEN) ;get the initial entry date/time
+1 ;This function returns the initia entry date/time for a given Local
+2 ;record flag.
+3 ;
+4 ; Input:
+5 ; DGPFIEN - (required) IEN of record in PRF LOCAL FLAG(#26.11) file
+6 ;
+7 ; Output:
+8 ; Function Value - Entry date/time on success (internal^external)
+9 ; 0 on failure
+10 ;
+11 ;history IEN
NEW DGHIEN
+12 ;edit date
NEW DGEDT
+13 ;entry date
NEW DGADT
+14 ;history record data array
NEW DGPFLH
+15 ;
+16 SET DGADT=0
+17 SET DGHIEN=0
+18 IF $GET(DGPFIEN)>0
IF $DATA(^DGPF(26.11,DGPFIEN))
Begin DoDot:1
+19 SET DGEDT=$ORDER(^DGPF(26.12,"C",DGPFIEN,0))
+20 IF DGEDT>0
Begin DoDot:2
+21 SET DGHIEN=$ORDER(^DGPF(26.12,"C",DGPFIEN,DGEDT,0))
+22 IF DGHIEN>0
IF $$GETHIST^DGPFALH(DGHIEN,.DGPFLH)
Begin DoDot:3
+23 SET DGADT=$GET(DGPFLH("ENTERDT"))
End DoDot:3
End DoDot:2
End DoDot:1
+24 QUIT DGADT
+25 ;
+26 ;
STOHIST(DGPFLH,DGPFERR) ;file a PRF LOCAL FLAG HISTORY (#26.12) file record
+1 ;
+2 ; Input:
+3 ; DGPFLH - (required) Array of values to be filed (see GETHIST tag
+4 ; above for valid array structure)
+5 ; DGPFERR - (optional) Passed by reference to contain error msg's
+6 ;
+7 ; Output:
+8 ; Function Value - Returns IEN of record on success
+9 ; - 0 on failure
+10 ; DGPFERR - Undefined on success, error message on failure
+11 ;
+12 NEW DGSUB,DGFLD,DGIEN,DGIENS,DGFDA,DGFDAIEN,DGERR
+13 ;
+14 FOR DGSUB="FLAG","ENTERDT","ENTERBY"
Begin DoDot:1
+15 SET DGFLD(DGSUB)=$PIECE($GET(DGPFLH(DGSUB)),U)
End DoDot:1
+16 IF $DATA(DGPFLH("REASON"))
MERGE DGFLD("REASON")=DGPFLH("REASON")
+17 IF $$VALID^DGPFUT("DGPFALH",26.12,.DGFLD,.DGPFERR)
Begin DoDot:1
+18 SET DGIENS="+1,"
+19 SET DGFDA(26.12,DGIENS,.01)=DGFLD("FLAG")
+20 SET DGFDA(26.12,DGIENS,.02)=DGFLD("ENTERDT")
+21 SET DGFDA(26.12,DGIENS,.03)=DGFLD("ENTERBY")
+22 SET DGFDA(26.12,DGIENS,.04)="DGFLD(""REASON"")"
+23 DO UPDATE^DIE("","DGFDA","DGFDAIEN","DGERR")
+24 IF '$DATA(DGERR)
SET DGIEN=$GET(DGFDAIEN(1))
End DoDot:1
+25 QUIT $SELECT($GET(DGIEN)>0:DGIEN,1:0)
+26 ;
+27 ;
+28 ; PRF LOCAL FLAG field VALIDATION DATA
XREF ;;array node name;field#;required param;word processing?;description
+1 ;;FLAG;.01;1;0;flag name
+2 ;;ENTERDT;.02;1;0;pointer to NEW PERSON (#200) file
+3 ;;ENTERBY;.03;1;0;pointer to NEW PERSON (#200) file
+4 ;;REASON;.04;1;1;Reason of Flag enter/edit