IBCERPT ;ALB/TMP - 277 EDI ENVOY REPORT MESSAGE PROCESSING ;15-JUL-98
;;2.0;INTEGRATED BILLING;**137,296**;21-MAR-94
Q
;
RPTHDR(IBD,IBDATE) ; Report message header
; ^TMP("IBMSG",$J,"REPORT",0,0)=MESSAGE HEADER DATA STRING
; ,"D",0,1)=header record raw data
; ,line #)=report message lines
;
N X,Y,%DT
S IBD("LINE")=0
S ^TMP("IBMSG",$J,"REPORT",0,0)="REPORT^"_$G(IBD("MSG#"))_U_$G(IBD("SUBJ"))_U_U_U_IBDATE_"^0^ENVOY"
Q
;
REPORT(IBHD,IBDATE,IBD,IBTXN) ; Assemble, store report message
; Returns IBD array if passed by reference, IBHOLDCT, IBLAST
;
N IBWANT,IBMCT
S IBMCT=($G(IBD("Q"))="MCT")
S IBWANT=$S($P(IBTXN,U,3)'="":+$P($G(^IBE(361.2,+$O(^IBE(361.2,"B",$P(IBTXN,U,3),0)),0)),U,2),1:1) ; Send report anyway if name is not in the file
D RPTHDR(.IBD,IBDATE)
S (IBD("MESSAGE"),IBD)=IBTXN
I IBWANT D RPTLINE(.IBD,IBHD),RPTLINE(.IBD,IBHD,1,IBMCT)
;
F X XMREC Q:XMER<0 D Q:IBLAST ;Extract rest of message
. S IBHOLDCT=IBHOLDCT+1,(IBD,^TMP("IB-HOLD",$J,IBHOLDCT))=XMRG
. D:IBWANT RPTLINE(.IBD,IBHD)
. ;
. I $P(XMRG,U)="REPORT" D Q ; Add message subject as part of text
.. S IBD("MESSAGE")=XMRG,IBWANT=$S($P(XMRG,U,3)'="":+$P($G(^IBE(361.2,+$O(^IBE(361.2,"B",$P(XMRG,U,3),0)),0)),U,2),1:1)
.. D:IBWANT RPTLINE(.IBD,IBHD,1,IBMCT)
.. ;
. I +XMRG=99,$P(XMRG,U,2)="$" S IBLAST=1 Q
K:'$O(^TMP("IBMSG",$J,"REPORT",0,"D",0,0)) ^TMP("IBMSG",$J,"REPORT")
Q
;
RPTLINE(IBD,IBHD,IBSUB,IBMCT) ;Process report lines
; INPUT:
; IBD must be passed by reference = entire message line
; IBHD = the header data from the message
; IBSUB = 1 to signify the subject line should be output
; IBMCT = 1 if message from the MCT (test) queue
;
; OUTPUT:
; IBD array returned with processed data
; "LINE" = The last line # populated in the message
;
; ^TMP("IBMSG",$J,"REPORT",0,"D",0,line #)=report line data
;
S IBMCT=+$G(IBMCT)
I $G(IBSUB) S IBD="SUBJECT^WebMD REPORT "_$S('IBMCT:"",1:" * * TEST RESULTS * * ")_$P($G(IBD("MESSAGE")),U,3)_" "_$P(IBHD,U)_" "_$P(IBHD,U,6)
S IBD("LINE")=$G(IBD("LINE"))+1
S ^TMP("IBMSG",$J,"REPORT",0,"D",0,IBD("LINE"))=IBD
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HIBCERPT 2227 printed Nov 22, 2024@17:22:28 Page 2
IBCERPT ;ALB/TMP - 277 EDI ENVOY REPORT MESSAGE PROCESSING ;15-JUL-98
+1 ;;2.0;INTEGRATED BILLING;**137,296**;21-MAR-94
+2 QUIT
+3 ;
RPTHDR(IBD,IBDATE) ; Report message header
+1 ; ^TMP("IBMSG",$J,"REPORT",0,0)=MESSAGE HEADER DATA STRING
+2 ; ,"D",0,1)=header record raw data
+3 ; ,line #)=report message lines
+4 ;
+5 NEW X,Y,%DT
+6 SET IBD("LINE")=0
+7 SET ^TMP("IBMSG",$JOB,"REPORT",0,0)="REPORT^"_$GET(IBD("MSG#"))_U_$GET(IBD("SUBJ"))_U_U_U_IBDATE_"^0^ENVOY"
+8 QUIT
+9 ;
REPORT(IBHD,IBDATE,IBD,IBTXN) ; Assemble, store report message
+1 ; Returns IBD array if passed by reference, IBHOLDCT, IBLAST
+2 ;
+3 NEW IBWANT,IBMCT
+4 SET IBMCT=($GET(IBD("Q"))="MCT")
+5 ; Send report anyway if name is not in the file
SET IBWANT=$SELECT($PIECE(IBTXN,U,3)'="":+$PIECE($GET(^IBE(361.2,+$ORDER(^IBE(361.2,"B",$PIECE(IBTXN,U,3),0)),0)),U,2),1:1)
+6 DO RPTHDR(.IBD,IBDATE)
+7 SET (IBD("MESSAGE"),IBD)=IBTXN
+8 IF IBWANT
DO RPTLINE(.IBD,IBHD)
DO RPTLINE(.IBD,IBHD,1,IBMCT)
+9 ;
+10 ;Extract rest of message
FOR
XECUTE XMREC
if XMER<0
QUIT
Begin DoDot:1
+11 SET IBHOLDCT=IBHOLDCT+1
SET (IBD,^TMP("IB-HOLD",$JOB,IBHOLDCT))=XMRG
+12 if IBWANT
DO RPTLINE(.IBD,IBHD)
+13 ;
+14 ; Add message subject as part of text
IF $PIECE(XMRG,U)="REPORT"
Begin DoDot:2
+15 SET IBD("MESSAGE")=XMRG
SET IBWANT=$SELECT($PIECE(XMRG,U,3)'="":+$PIECE($GET(^IBE(361.2,+$ORDER(^IBE(361.2,"B",$PIECE(XMRG,U,3),0)),0)),U,2),1:1)
+16 if IBWANT
DO RPTLINE(.IBD,IBHD,1,IBMCT)
+17 ;
End DoDot:2
QUIT
+18 IF +XMRG=99
IF $PIECE(XMRG,U,2)="$"
SET IBLAST=1
QUIT
End DoDot:1
if IBLAST
QUIT
+19 if '$ORDER(^TMP("IBMSG",$JOB,"REPORT",0,"D",0,0))
KILL ^TMP("IBMSG",$JOB,"REPORT")
+20 QUIT
+21 ;
RPTLINE(IBD,IBHD,IBSUB,IBMCT) ;Process report lines
+1 ; INPUT:
+2 ; IBD must be passed by reference = entire message line
+3 ; IBHD = the header data from the message
+4 ; IBSUB = 1 to signify the subject line should be output
+5 ; IBMCT = 1 if message from the MCT (test) queue
+6 ;
+7 ; OUTPUT:
+8 ; IBD array returned with processed data
+9 ; "LINE" = The last line # populated in the message
+10 ;
+11 ; ^TMP("IBMSG",$J,"REPORT",0,"D",0,line #)=report line data
+12 ;
+13 SET IBMCT=+$GET(IBMCT)
+14 IF $GET(IBSUB)
SET IBD="SUBJECT^WebMD REPORT "_$SELECT('IBMCT:"",1:" * * TEST RESULTS * * ")_$PIECE($GET(IBD("MESSAGE")),U,3)_" "_$PIECE(IBHD,U)_" "_$PIECE(IBHD,U,6)
+15 SET IBD("LINE")=$GET(IBD("LINE"))+1
+16 SET ^TMP("IBMSG",$JOB,"REPORT",0,"D",0,IBD("LINE"))=IBD
+17 QUIT
+18 ;