source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/PRCACPV.m@ 1375

Last change on this file since 1375 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.1 KB
RevLine 
[613]1PRCACPV ;WASH-ISC@ALTOONA,PA/LDB- CHAMPVA FMS DOCUMENTS ;5/1/95 3:06 PM
2V ;;4.5;Accounts Receivable;**1,48,90,119,204,192,235**;Mar 20, 1995
3 ;
4EN(BILL,ERR) ;Send CHAMPVA SUBSISTENCE bill to FMS
5 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
6 S ERR=-1
7 I '$G(BILL) S ERR="NO BILL NUMBER TO PROCESS" D ERR Q
8 S BILL0=$G(^PRCA(430,+BILL,0)) I BILL0']"" S ERR="BILL INFO CORRUPTED FOR BILL '"_BILL D ERR Q
9 I "^27^28^30^31^"'[("^"_$P(BILL0,"^",2)_"^") Q
10 I $P(BILL0,"^",2)=30,$$AUD^IBRFN(+BILL) Q
11 S SITE=$P($P(BILL0,"^"),"-") I SITE']"" S ERR="BILL NUMBER CORRUPTED" D ERR Q
12 S BNUM=$P(BILL0,"^")
13 S AMT=$J($P(BILL0,"^",3),0,2)
14 S CAT=$P(BILL0,"^",2)
15 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,",")
16 S FY=$$FY^RCFN01(DT)
17 S ADD=$$SADD^RCFN01(5)
18 S DESC=$S(CAT=27:"CHAMPVA Subsistence",CAT=30:"TRICARE",CAT=31:"TRICARE PATIENT",1:"CHAMPVA Third Party")
19 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
20 I ERR>0 Q
21 ;CALL TO GET VENDORID BELOW - CHECK NOT NECESSARY SINCE GENERIC
22 ;VENDOR CODE ALWAYS RETURNED FOR THESE BILL TYPES
23 S VENDORID=$$VENDORID^RCXFMSUV(BILL)
24 I ADDR(6)["-" S ADDR(7)=$P(ADDR(6),"-",2),ADDR(6)=$P(ADDR(6),"-")
25 N FMSDT S FMSDT=$$FMSDATE^RCBEUTRA(DT)
26 S ^TMP("PRCACPV",$J,1)="BD2^"_$E(FMSDT,4,5)_"^"_$E(FMSDT,6,7)_"^"_$E(FMSDT,2,3)
27 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^~"
28 S ^TMP("PRCACPV",$J,2)="LIN^~BDA^"_$$LINE^RCXFMSC1(BILL)_"^"_FY_"^^"_$S(CAT=28:"0160A1",CAT<30:"3220",1:"0160A1")_"^"_SITE_"^^^"
29 S:CAT<30 CAT("R")=1000
30 I CAT'<30 S CAT("R")=$P($G(^PRCA(430,+BILL,11)),U,6)
31 S ^TMP("PRCACPV",$J,2)=^TMP("PRCACPV",$J,2)_CAT("R")_"^^^^^^^"_AMT_"^I^AR_INTERFACE^^^^"_$S(CAT<30:"09",1:"02")_"^~"
32 D CONTROL^GECSUFMS("A",SITE,BNUM,"BD",10,0,"",DESC)
33 I '$D(GECSFMS("DA")) S ERR="COULD NOT ACCESS STACK FILE" D ERR Q
34 S DOC=$S($G(GECSFMS("DOC"))]"":$P(GECSFMS("DOC"),"^",3)_"-"_$P(GECSFMS("DOC"),"^",4),1:BNUM)
35 S DA=0 F S DA=$O(^TMP("PRCACPV",$J,DA)) Q:'DA D
36 . D SETCS^GECSSTAA(GECSFMS("DA"),^TMP("PRCACPV",$J,DA))
37 D OPEN^RCFMDRV1(DOC,6,"B"_+BILL,.ENT,.ERROR,+BILL)
38 I ERROR]"" S ERR="AR DOCUMENT MISSING - "_ERROR Q
39 D SETCODE^GECSSDCT(GECSFMS("DA"),"D RETN^RCFMFN02")
40 D SETSTAT^GECSSTAA(GECSFMS("DA"),"Q")
41 D SSTAT^RCFMFN02("B"_+BILL,1)
42 K ^TMP("PRCACPV",$J)
43 ;
44ERR I ERR'<0 S ERR="1^"_ERR D
45 .S TXT(1)="The following error has occurred while processing a "_$S(CAT=31:"TRICARE PATIENT ",1:"CHAMPVA")
46 .S TXT(2)="bill: ("_$S($G(BNUM):BNUM,1:"BILL IFN - "_+BILL)_")"
47 .S TXT(3)=" "
48 .S TXT(4)=$P(ERR,"^",2)
49 .S TXT(5)=""
50 .S TXT(6)="You will need to use the BILLING DOCUMENT REGENERATION option to create the FMS document."
51 .S XMTEXT="TXT(",XMY("G.PRCA ERROR")=""
52 .S XMSUB=$S(CAT=31:"TRICARE PATIENT",1:"CHAMPVA")_" FMS DOC error",XMDUZ="ACCOUNTS RECEIVABLE PACKAGE"
53 .D ^XMD
54 Q
Note: See TracBrowser for help on using the repository browser.