| 1 | IBCERPT ;ALB/TMP - 277 EDI ENVOY REPORT MESSAGE PROCESSING ;15-JUL-98 | 
|---|
| 2 | ;;2.0;INTEGRATED BILLING;**137,296**;21-MAR-94 | 
|---|
| 3 | Q | 
|---|
| 4 | ; | 
|---|
| 5 | RPTHDR(IBD,IBDATE) ; Report message header | 
|---|
| 6 | ;   ^TMP("IBMSG",$J,"REPORT",0,0)=MESSAGE HEADER DATA STRING | 
|---|
| 7 | ;                                  ,"D",0,1)=header record raw data | 
|---|
| 8 | ;                                  ,line #)=report message lines | 
|---|
| 9 | ; | 
|---|
| 10 | N X,Y,%DT | 
|---|
| 11 | S IBD("LINE")=0 | 
|---|
| 12 | S ^TMP("IBMSG",$J,"REPORT",0,0)="REPORT^"_$G(IBD("MSG#"))_U_$G(IBD("SUBJ"))_U_U_U_IBDATE_"^0^ENVOY" | 
|---|
| 13 | Q | 
|---|
| 14 | ; | 
|---|
| 15 | REPORT(IBHD,IBDATE,IBD,IBTXN) ; Assemble, store report message | 
|---|
| 16 | ; Returns IBD array if passed by reference, IBHOLDCT, IBLAST | 
|---|
| 17 | ; | 
|---|
| 18 | N IBWANT,IBMCT | 
|---|
| 19 | S IBMCT=($G(IBD("Q"))="MCT") | 
|---|
| 20 | 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 | 
|---|
| 21 | D RPTHDR(.IBD,IBDATE) | 
|---|
| 22 | S (IBD("MESSAGE"),IBD)=IBTXN | 
|---|
| 23 | I IBWANT D RPTLINE(.IBD,IBHD),RPTLINE(.IBD,IBHD,1,IBMCT) | 
|---|
| 24 | ; | 
|---|
| 25 | F  X XMREC Q:XMER<0  D  Q:IBLAST  ;Extract rest of message | 
|---|
| 26 | . S IBHOLDCT=IBHOLDCT+1,(IBD,^TMP("IB-HOLD",$J,IBHOLDCT))=XMRG | 
|---|
| 27 | . D:IBWANT RPTLINE(.IBD,IBHD) | 
|---|
| 28 | . ; | 
|---|
| 29 | . I $P(XMRG,U)="REPORT" D  Q  ; Add message subject as part of text | 
|---|
| 30 | .. 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) | 
|---|
| 31 | .. D:IBWANT RPTLINE(.IBD,IBHD,1,IBMCT) | 
|---|
| 32 | .. ; | 
|---|
| 33 | . I +XMRG=99,$P(XMRG,U,2)="$" S IBLAST=1 Q | 
|---|
| 34 | K:'$O(^TMP("IBMSG",$J,"REPORT",0,"D",0,0)) ^TMP("IBMSG",$J,"REPORT") | 
|---|
| 35 | Q | 
|---|
| 36 | ; | 
|---|
| 37 | RPTLINE(IBD,IBHD,IBSUB,IBMCT) ;Process report lines | 
|---|
| 38 | ; INPUT: | 
|---|
| 39 | ;   IBD must be passed by reference = entire message line | 
|---|
| 40 | ;   IBHD = the header data from the message | 
|---|
| 41 | ;   IBSUB = 1 to signify the subject line should be output | 
|---|
| 42 | ;   IBMCT = 1 if message from the MCT (test) queue | 
|---|
| 43 | ; | 
|---|
| 44 | ; OUTPUT: | 
|---|
| 45 | ;   IBD array returned with processed data | 
|---|
| 46 | ;      "LINE" = The last line # populated in the message | 
|---|
| 47 | ; | 
|---|
| 48 | ;   ^TMP("IBMSG",$J,"REPORT",0,"D",0,line #)=report line data | 
|---|
| 49 | ; | 
|---|
| 50 | S IBMCT=+$G(IBMCT) | 
|---|
| 51 | 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) | 
|---|
| 52 | S IBD("LINE")=$G(IBD("LINE"))+1 | 
|---|
| 53 | S ^TMP("IBMSG",$J,"REPORT",0,"D",0,IBD("LINE"))=IBD | 
|---|
| 54 | Q | 
|---|
| 55 | ; | 
|---|