DGDTHBR ;OAK/ELZ-MAINTAIN DEATH SOURCE OF NOTIFICATION/DOCUMENT TYPE BUSINESS RULES ;7/26/17
;;5.3;Registration;**944**;Aug 13, 1993;Build 2
;
;**944 - Stories 557804 and 557815 (elz)
; This routine will receive RPC calls from DG DEATH SOURCE/DOC UPDATE. The updates
; will be sent to all sites from the MPI to allow for dynamic updates to the selectable
; SOURCE OF NOTIFICATIONS and SUPPORTING DOCUMENTS as well as the business rules of which
; ones are allowed in combination
;
;
BRDATA(RETURN,DGDATA) ; = Entry point from RPC with list of business rules to be updated
; DGDATA = Array of business rules to file in the following format:
; IEN of Source of Notification^Active^Supporting Document Type (Type Code)^Active
;
K RETURN
N DGCOUNT,DGLINE,DGTIEN
S DGCOUNT=0
S DGLINE=0 F S DGLINE=$O(DGDATA(DGLINE)) Q:'DGLINE S DGDATA=DGDATA(DGLINE) D
. N DGFDA,DGTYPE,DGIEN,DGROOT
. S DGTYPE=$O(^DG(47.75,"C",$P(DGDATA,"^",3),0))
. I 'DGTYPE S RETURN(DGLINE)="-1^Document Type "_$P(DGDATA,"^",2)_" NOT FOUND!!" Q
. S DGIEN=+DGDATA
. ; Source of Notifications first
. I '$D(^DG(47.761,DGIEN)) D
.. N DGFDA
.. S DGFDA(1,47.761,"+1,",.01)=DGIEN
.. S DGFDA(1,47.761,"+1,",.02)=$P(DGDATA,"^",2)
.. S DGFDA(1,47.761,"+1,",.03)=DT
.. S DGIEN(1)=DGIEN
.. D UPDATE^DIE("","DGFDA(1)","DGIEN","DGROOT")
. E D
.. N DGFDA
.. S DGFDA(47.761,DGIEN_",",.02)=$P(DGDATA,"^",2)
.. S DGFDA(47.761,DGIEN_",",.03)=DT
.. D FILE^DIE("","DGFDA","DGROOT")
. I $D(DGROOT) S RETURN(DGLINE)="-1^ERROR filing Source "_DGDATA_" "_$G(DGROOT("DIERR",1,"TEXT",1)) Q
. ; Now for associated document type
. I '$D(^DG(47.761,DGIEN,1,DGTYPE)) D
.. S DGFDA(1,47.7611,"+1,"_DGIEN_",",.01)=DGTYPE
.. S DGFDA(1,47.7611,"+1,"_DGIEN_",",.02)=$P(DGDATA,"^",4)
.. S DGTIEN(1)=DGTYPE
.. D UPDATE^DIE("","DGFDA(1)","DGTIEN","DGROOT")
. E D
.. N DGFDA
.. S DGFDA(47.7611,DGTYPE_","_DGIEN_",",.02)=$P(DGDATA,"^",4)
.. D FILE^DIE("","DGFDA","DGROOT")
. I $D(DGROOT) S RETURN(DGLINE)="-1^ERROR filing Doc Type "_DGDATA_"." Q
. S DGCOUNT=DGCOUNT+1
I '$D(RETURN) S RETURN(1)=DGCOUNT_"^Successfully filed"
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HDGDTHBR 2169 printed Dec 13, 2024@02:42:08 Page 2
DGDTHBR ;OAK/ELZ-MAINTAIN DEATH SOURCE OF NOTIFICATION/DOCUMENT TYPE BUSINESS RULES ;7/26/17
+1 ;;5.3;Registration;**944**;Aug 13, 1993;Build 2
+2 ;
+3 ;**944 - Stories 557804 and 557815 (elz)
+4 ; This routine will receive RPC calls from DG DEATH SOURCE/DOC UPDATE. The updates
+5 ; will be sent to all sites from the MPI to allow for dynamic updates to the selectable
+6 ; SOURCE OF NOTIFICATIONS and SUPPORTING DOCUMENTS as well as the business rules of which
+7 ; ones are allowed in combination
+8 ;
+9 ;
BRDATA(RETURN,DGDATA) ; = Entry point from RPC with list of business rules to be updated
+1 ; DGDATA = Array of business rules to file in the following format:
+2 ; IEN of Source of Notification^Active^Supporting Document Type (Type Code)^Active
+3 ;
+4 KILL RETURN
+5 NEW DGCOUNT,DGLINE,DGTIEN
+6 SET DGCOUNT=0
+7 SET DGLINE=0
FOR
SET DGLINE=$ORDER(DGDATA(DGLINE))
if 'DGLINE
QUIT
SET DGDATA=DGDATA(DGLINE)
Begin DoDot:1
+8 NEW DGFDA,DGTYPE,DGIEN,DGROOT
+9 SET DGTYPE=$ORDER(^DG(47.75,"C",$PIECE(DGDATA,"^",3),0))
+10 IF 'DGTYPE
SET RETURN(DGLINE)="-1^Document Type "_$PIECE(DGDATA,"^",2)_" NOT FOUND!!"
QUIT
+11 SET DGIEN=+DGDATA
+12 ; Source of Notifications first
+13 IF '$DATA(^DG(47.761,DGIEN))
Begin DoDot:2
+14 NEW DGFDA
+15 SET DGFDA(1,47.761,"+1,",.01)=DGIEN
+16 SET DGFDA(1,47.761,"+1,",.02)=$PIECE(DGDATA,"^",2)
+17 SET DGFDA(1,47.761,"+1,",.03)=DT
+18 SET DGIEN(1)=DGIEN
+19 DO UPDATE^DIE("","DGFDA(1)","DGIEN","DGROOT")
End DoDot:2
+20 IF '$TEST
Begin DoDot:2
+21 NEW DGFDA
+22 SET DGFDA(47.761,DGIEN_",",.02)=$PIECE(DGDATA,"^",2)
+23 SET DGFDA(47.761,DGIEN_",",.03)=DT
+24 DO FILE^DIE("","DGFDA","DGROOT")
End DoDot:2
+25 IF $DATA(DGROOT)
SET RETURN(DGLINE)="-1^ERROR filing Source "_DGDATA_" "_$GET(DGROOT("DIERR",1,"TEXT",1))
QUIT
+26 ; Now for associated document type
+27 IF '$DATA(^DG(47.761,DGIEN,1,DGTYPE))
Begin DoDot:2
+28 SET DGFDA(1,47.7611,"+1,"_DGIEN_",",.01)=DGTYPE
+29 SET DGFDA(1,47.7611,"+1,"_DGIEN_",",.02)=$PIECE(DGDATA,"^",4)
+30 SET DGTIEN(1)=DGTYPE
+31 DO UPDATE^DIE("","DGFDA(1)","DGTIEN","DGROOT")
End DoDot:2
+32 IF '$TEST
Begin DoDot:2
+33 NEW DGFDA
+34 SET DGFDA(47.7611,DGTYPE_","_DGIEN_",",.02)=$PIECE(DGDATA,"^",4)
+35 DO FILE^DIE("","DGFDA","DGROOT")
End DoDot:2
+36 IF $DATA(DGROOT)
SET RETURN(DGLINE)="-1^ERROR filing Doc Type "_DGDATA_"."
QUIT
+37 SET DGCOUNT=DGCOUNT+1
End DoDot:1
+38 IF '$DATA(RETURN)
SET RETURN(1)=DGCOUNT_"^Successfully filed"
+39 QUIT
+40 ;