Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBARXCBK

IBARXCBK.m

Go to the documentation of this file.
IBARXCBK ;ALB/CLT-CERNER COPAY BACKBILLING  ; 02 Mar 2021
 ;;2.0;INTEGRATED BILLING;**676**;21-MAR-94;Build 34
 ;
 ;Send to cerner the IBARXC-SEND - DFT^PO3 message with a backbilling notice 
 ;
EN(IBA,IBBIL) ;ENTRY POINT - PASS IN TRANS FILE IEN, AMOUNT TO BE BACKBILLED
 ;
 N PARMS,MSG,HDR,SEG,FIELD,VALUE,WHOTO,ERROR,XXX,ICN,NAME,RXNUM,FACID,NODE0,X,DFN
 N OBIL,PARENT,CBIL,PTRAN
 ;
MSH ;
 N PARMS K ^TMP("DFT")
 S PARMS("COUNTRY")="USA"
 S PARMS("EVENT")="P03"
 S PARMS("MESSAGE TYPE")="DFT"
 S PARMS("SENDING APPLICATION")="IBARXC-SEND"
 S PARMS("RECEIVING APPLICATION")="IBARXC-RECV"
 S PARMS("VERSION")="2.3"
 S PARMS("MESSAGE STRUCTURE")="DFT_P03"
 S MSG="^TMP("_"DFT"
 S X=$$NEWMSG^HLOAPI(.PARMS,.MSG,.ERROR)
 S NODE0=$G(^IBAM(354.71,+IBA,0))
 Q:NODE0=""
 S DFN=$P(NODE0,"^",2)
EVN ;
 S VALUE="EVN",FIELD=0 D SET^HLOAPI(.SEG,VALUE,FIELD)
 S VALUE="P03",FIELD=1 D SET^HLOAPI(.SEG,VALUE,FIELD)
 D NOW^%DTC S %P1=% S VALUE=$$FMTHL7^XLFDT(%P1),FIELD=2
 D SET^HLOAPI(.SEG,VALUE,FIELD)
 S X=$$ADDSEG^HLOAPI(.MSG,.SEG,.ERROR)
 ;
PID ;ADD PID SEGMENT
 ;Set PID field
 S VALUE="PID",FIELD=0
 D SET^HLOAPI(.SEG,VALUE,FIELD)
 D SET^HLOAPI(.SEG,1,1)
 ;Set ICN field
 S ICN=$$ICN^IBARXMU(DFN)
 S VALUE=ICN,FIELD=3
 D SET^HLOAPI(.SEG,VALUE,FIELD)
 ;Set Name
 S NAME=$$GET1^DIQ(2,DFN_",",.01)
 S VALUE=$P(NAME,",",1),FIELD=5 D SET^HLOAPI(.SEG,VALUE,FIELD,1)
 S VALUE=$P(NAME,",",2),FIELD=5 D SET^HLOAPI(.SEG,VALUE,FIELD,2)
 S X=$$ADDSEG^HLOAPI(.MSG,.SEG,.ERROR)
 ;
FT1 ;INPT FT1 DATA FOR ONE CANCELLED RX COPAY
 S VALUE="FT1",FIELD=0 D SET^HLOAPI(.SEG,VALUE,FIELD)
 D SET^HLOAPI(.SEG,1,1)
 D SET^HLOAPI(.SEG,"B",6)
 S RXNUM=$P(NODE0,"^",6)
 D SET^HLOAPI(.SEG,RXNUM,11)
 S PARENT=$P(NODE0,"^",10)  ;Get parent ID
 ;S OBIL=$$NET^IBARXMC(PARENT)  ;Get the Old Billing amount
 ;S CBIL=(IBBIL-OBIL)  ;Send the change amount not total
 D SET^HLOAPI(.SEG,IBBIL,13)
 S FACID=$$FAC^IBARXMU($P(NODE0,"^",13))
 D SET^HLOAPI(.SEG,$P(FACID,"^",2),18,1)
 D SET^HLOAPI(.SEG,$P(FACID,"^",1),18,2)
 ;INCLUDE PARENT TRANSACTION ID, ADD "CRNR" TO SITE ID
 S PTRAN=$P(NODE0,"^",10)
 S PTRAN=$$GET1^DIQ(354.71,PTRAN_",",.01,"E")
 S $P(PTRAN,"-")=($P(PTRAN,"-")_"CRNR")
 D SET^HLOAPI(.SEG,PTRAN,17)
 S X=$$ADDSEG^HLOAPI(.MSG,.SEG,.ERROR)
 ;
SEND ;SEND MESSAGE AND QUIT
 S WHOTO("RECEIVING APPLICATION")="IBARXC-RECV"
 S WHOTO("STATION NUMBER")="200CRNR"
 S WHOTO("MIDDLEWARE LINK NAME")="IBARXCVDF"
 ;S WHOTO("FACILITY LINK NAME")="IBARXCVDF"
 ;S WHOTO("RECEIVING FACILITY",1)="200CRNR"
 S PARMS("SENDING APPLICATION")="IBARXC-SEND"
 S XXX=$$SENDONE^HLOAPI1(.MSG,.PARMS,.WHOTO,.ERROR)
 Q
 ;