55 lines
3.1 KiB
Mathematica
55 lines
3.1 KiB
Mathematica
PRCACPV ;WASH-ISC@ALTOONA,PA/LDB- CHAMPVA FMS DOCUMENTS ;5/1/95 3:06 PM
|
|
V ;;4.5;Accounts Receivable;**1,48,90,119,204,192,235**;Mar 20, 1995
|
|
;
|
|
EN(BILL,ERR) ;Send CHAMPVA SUBSISTENCE bill to FMS
|
|
N ADD,ADDR,AMT,BILL0,BNUM,CAT,DA,DIE,DOC,DR,ERROR,ENT,FY,GECSFMS,I,P,PAT,SITE,TXT,VA,VAERR,VADM,X,XMDUZ,XMTEXT,XMY,XMSUB,Y
|
|
S ERR=-1
|
|
I '$G(BILL) S ERR="NO BILL NUMBER TO PROCESS" D ERR Q
|
|
S BILL0=$G(^PRCA(430,+BILL,0)) I BILL0']"" S ERR="BILL INFO CORRUPTED FOR BILL '"_BILL D ERR Q
|
|
I "^27^28^30^31^"'[("^"_$P(BILL0,"^",2)_"^") Q
|
|
I $P(BILL0,"^",2)=30,$$AUD^IBRFN(+BILL) Q
|
|
S SITE=$P($P(BILL0,"^"),"-") I SITE']"" S ERR="BILL NUMBER CORRUPTED" D ERR Q
|
|
S BNUM=$P(BILL0,"^")
|
|
S AMT=$J($P(BILL0,"^",3),0,2)
|
|
S CAT=$P(BILL0,"^",2)
|
|
I "^27^31^"[("^"_CAT_"^") S PAT=$P($G(^PRCA(430,+BILL,0)),"^",9),PAT=$P($G(^RCD(340,+PAT,0)),"^"),PAT=$$NAM^RCFN01(PAT),PAT=$P(PAT,",",2)_" "_$P(PAT,",")
|
|
S FY=$$FY^RCFN01(DT)
|
|
S ADD=$$SADD^RCFN01(5)
|
|
S DESC=$S(CAT=27:"CHAMPVA Subsistence",CAT=30:"TRICARE",CAT=31:"TRICARE PATIENT",1:"CHAMPVA Third Party")
|
|
F I=1:1:6 S ADDR(I)=$P(ADD,"^",I) I (I'=3),(ADDR(I)']"") S ERR="NO HOSPITAL ADDRESS FOUND FOR SITE GROUP" D ERR Q
|
|
I ERR>0 Q
|
|
;CALL TO GET VENDORID BELOW - CHECK NOT NECESSARY SINCE GENERIC
|
|
;VENDOR CODE ALWAYS RETURNED FOR THESE BILL TYPES
|
|
S VENDORID=$$VENDORID^RCXFMSUV(BILL)
|
|
I ADDR(6)["-" S ADDR(7)=$P(ADDR(6),"-",2),ADDR(6)=$P(ADDR(6),"-")
|
|
N FMSDT S FMSDT=$$FMSDATE^RCBEUTRA(DT)
|
|
S ^TMP("PRCACPV",$J,1)="BD2^"_$E(FMSDT,4,5)_"^"_$E(FMSDT,6,7)_"^"_$E(FMSDT,2,3)
|
|
S ^TMP("PRCACPV",$J,1)=^TMP("PRCACPV",$J,1)_"^^^^^^E^"_VENDORID_"^^"_AMT_"^^^^"_$E(ADDR(1),1,30)_"^"_$E(ADDR(2),1,30)_"^"_$E(ADDR(3),1,30)_"^"_$E(ADDR(4),1,19)_"^"_ADDR(5)_"^"_ADDR(6)_"^"_$G(ADDR(7))_"^"_"N^^^^^^W^~"
|
|
S ^TMP("PRCACPV",$J,2)="LIN^~BDA^"_$$LINE^RCXFMSC1(BILL)_"^"_FY_"^^"_$S(CAT=28:"0160A1",CAT<30:"3220",1:"0160A1")_"^"_SITE_"^^^"
|
|
S:CAT<30 CAT("R")=1000
|
|
I CAT'<30 S CAT("R")=$P($G(^PRCA(430,+BILL,11)),U,6)
|
|
S ^TMP("PRCACPV",$J,2)=^TMP("PRCACPV",$J,2)_CAT("R")_"^^^^^^^"_AMT_"^I^AR_INTERFACE^^^^"_$S(CAT<30:"09",1:"02")_"^~"
|
|
D CONTROL^GECSUFMS("A",SITE,BNUM,"BD",10,0,"",DESC)
|
|
I '$D(GECSFMS("DA")) S ERR="COULD NOT ACCESS STACK FILE" D ERR Q
|
|
S DOC=$S($G(GECSFMS("DOC"))]"":$P(GECSFMS("DOC"),"^",3)_"-"_$P(GECSFMS("DOC"),"^",4),1:BNUM)
|
|
S DA=0 F S DA=$O(^TMP("PRCACPV",$J,DA)) Q:'DA D
|
|
. D SETCS^GECSSTAA(GECSFMS("DA"),^TMP("PRCACPV",$J,DA))
|
|
D OPEN^RCFMDRV1(DOC,6,"B"_+BILL,.ENT,.ERROR,+BILL)
|
|
I ERROR]"" S ERR="AR DOCUMENT MISSING - "_ERROR Q
|
|
D SETCODE^GECSSDCT(GECSFMS("DA"),"D RETN^RCFMFN02")
|
|
D SETSTAT^GECSSTAA(GECSFMS("DA"),"Q")
|
|
D SSTAT^RCFMFN02("B"_+BILL,1)
|
|
K ^TMP("PRCACPV",$J)
|
|
;
|
|
ERR I ERR'<0 S ERR="1^"_ERR D
|
|
.S TXT(1)="The following error has occurred while processing a "_$S(CAT=31:"TRICARE PATIENT ",1:"CHAMPVA")
|
|
.S TXT(2)="bill: ("_$S($G(BNUM):BNUM,1:"BILL IFN - "_+BILL)_")"
|
|
.S TXT(3)=" "
|
|
.S TXT(4)=$P(ERR,"^",2)
|
|
.S TXT(5)=""
|
|
.S TXT(6)="You will need to use the BILLING DOCUMENT REGENERATION option to create the FMS document."
|
|
.S XMTEXT="TXT(",XMY("G.PRCA ERROR")=""
|
|
.S XMSUB=$S(CAT=31:"TRICARE PATIENT",1:"CHAMPVA")_" FMS DOC error",XMDUZ="ACCOUNTS RECEIVABLE PACKAGE"
|
|
.D ^XMD
|
|
Q
|