source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCCPCSV1.m@ 1611

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

initial load of FOIAVistA 6/30/08 version

File size: 5.3 KB
Line 
1RCCPCSV1 ;WASH-ISC@ALTOONA,PA/LDB-Receive and Process CCPC messages ;1/6/97 2:54 PM
2 ;;4.5;Accounts Receivable;**34,70,76,130,153**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5IS ;INVALID STATEMENT
6 D CHKTRAN(LABEL)
7 S ERR="The following statements did not print due to errors:" D ERRMSG
8 S ERR=" " D ERRMSG
9 S ERR=" KEY ERROR" D ERRMSG S ERR=" " D ERRMSG
10 D ID
11 S ERR="If these errors are corrected, these statements will not print until" D ERRMSG S ERR="the next billing cycle." D ERRMSG
12 Q
13 ;
14ID ;INVALID STATEMENT DETAIL ERROR
15 F S RCMSG=$O(^TMP($J,"MSG",RCMSG)) Q:'RCMSG D
16 .I $P(^TMP($J,"MSG",RCMSG),"^")'="ID" S ERR="ERROR IN READING CCPC ERROR RECORD" D ERRMSG Q
17 .S KEY=$P(^TMP($J,"MSG",RCMSG),"^",2),KEY=$TR(KEY," ",""),KEY=$E(KEY,$F(KEY,$$SITE^RCMSITE),999)
18 .I KEY']"" D KEYERR Q
19 .S DEB=$O(^RCPS(349.2,"AKEY",KEY,0)) I 'DEB D KEYERR Q
20 .S ERROR=$P(^TMP($J,"MSG",RCMSG),"^",3),^RCPS(349.2,+DEB,5)=ERROR
21 .F RCX=1:5:21 S RCX1=RCX+4 S ERR(0)=$E(ERROR,RCX,RCX1) Q:ERR(0)="" D
22 ..S ERR(1)=$O(^RCPSE(349.7,"B",ERR(0),""))
23 ..I 'ERR(1) S ERR="NO ERROR DESCRIPTION FOR ERROR CODE: "_ERR(0)
24 ..I ERR(1) S ERR=$P(^RCPSE(349.7,+ERR(1),0),"^",4)
25 ..S ERR=KEY_" "_ERR(0)_" "_ERR
26 ..D ERRMSG
27 ..S ERR=" " D ERRMSG
28 .S ^RCPS(349.2,+DEB,5)=$P(^TMP($J,"MSG",RCMSG),"^",3)
29 .S ^RCPS(349.2,"AD","E",+DEB)=""
30 Q
31 ;
32 ;
33KEYERR ;SEND MESSAGE TO MAIL GROUP INDICATING NO KEY
34 S ERR="CCPC ERROR MESSAGE - NO AR KEY ID FOR CCPC KEY: "_KEY D ERRMSG
35 S ERR="This patient record is corrupted. Please contact IRM." D ERRMSG
36 S ERR=" " D ERRMSG
37 Q
38 ;
39PA ;STATEMENT ACKNOWLEDGEMENT
40 N STDT,SSTDT
41 Q:$P(RCTR,"^")'="PA"
42 D CHKTRAN(LABEL)
43 S SDAT=$P(RCTR,"^",7) S SDAT=$E(SDAT,1,2)_"/"_$E(SDAT,3,4)_"/"_$E(SDAT,5,8) S X=SDAT D ^%DT S SDAT=Y
44 S STOT=+$P(RCTR,"^",6)
45 S SEQ=+$P(RCTR,"^",3)
46 F S RCMSG=$O(^TMP($J,"MSG",RCMSG)) Q:'RCMSG D
47 .S RCTR=^TMP($J,"MSG",RCMSG)
48 .Q:$P(RCTR,"^")'="AD"
49 .S KEY=$P(RCTR,"^",2),KEY=$TR(KEY," ",""),KEY=$E(KEY,$F(KEY,$$SITE^RCMSITE),999)
50 .I KEY']"" D KEYERR Q
51 .S DEB=$O(^RCPS(349.2,"AKEY",KEY,0))
52 .I 'DEB D KEYERR Q
53 .S END=$P(^RCPS(349.2,+DEB,0),"^",10)
54 .S:'END END=$O(^RCPS(349.2,0)),END=$P($G(^(+END,0)),"^",10)
55 .F P=13:1:17 S SBAL(P)=$P(^RCPS(349.2,+DEB,0),"^",P)
56 .;update patient statement date in 341 to end process time
57 .D OPEN^RCEVDRV1(2,$P(^RCD(340,DEB,0),U),END,DUZ,$$SITE^RCMSITE,.ERR,.EVN,SBAL(13)_U_SBAL(14)_U_SBAL(15)_U_SBAL(16)_U_SBAL(17))
58 .I EVN S DR=".07////"_END_";.11////"_1,DA=+EVN,DIE="^RC(341," D ^DIE K DIE,DR,DA
59 .I EVN S $P(^RC(341,+EVN,6),"^")=$G(SDAT)
60 .;update bill file 430 letter fields
61 .NEW BN,DA,DIC,DIE,DR,II,LET,NOT,X,Y
62 .S DIE="^PRCA(430,",NOT=0,BN=0
63 .F S BN=$O(^PRCA(430,"AS",DEB,16,BN)) Q:'BN S DA=BN D
64 ..S LET=$G(^PRCA(430,BN,6))
65 ..I $P(LET,"^",21)>END Q
66 ..S END=$G(SDAT)
67 ..F II=1:1:4 Q:$P(LET,U,II)=END I $P(LET,U,II)="" S DR=$S(II=1:61,II=2:62,II=3:63,1:68)_"////^S X="_END_";68.1////^S X="_END D ^DIE Q
68 .S ^RCPS(349.2,+DEB,6)=1
69PAMAIL S XMSUB="Patient Acknowledgments received from CCPC."
70 S XMY("G.RCCPC STATEMENTS")="",XMDUZ="AR PACKAGE",XMTEXT="MSG("
71 S MSG(1)="Patient acknowledgment message "_$G(XMZ)_" received."
72 S MSG(2)="This means that CCPC has printed patient statements for this statement period."
73 D ^XMD
74 Q
75 ;CODE BELOW NO LONGER NEEDED SINCE INTEREST/ADMIN UPDATE NOW DONE
76 ;WHEN STATEMENTS ARE GENERATED.
77 N ZTDESC,ZTDTH,ZTRTN,ZTSAVE
78 S DATE=$G(SDAT) Q:'DATE
79 S ZTDTH=$S(DT'>SDAT:$$FMADD^XLFDT(SDAT,1),1:$$FMADD^XLFDT(DT,1))_".02"
80 S ZTIO="",ZTRTN="FIRSTPTY^RCBECHGS",ZTDESC="Accrue interest/admin charges"
81 S ZTSAVE("RCUPDATE")=DATE
82 D ^%ZTLOAD
83 Q
84 ;
85CHKTRAN(LABEL) ;Check for incomplete message from CCPC
86 Q:$G(LABEL)']""
87 S LABEL(1)=+$O(^RCT(349.1,"B",LABEL,0))
88 I LABEL(1) S:$P(^TMP($J,"MSG",RCMSG),"^",2)=$P(^TMP($J,"MSG",RCMSG),"^",3) $P(^RCT(349.1,+LABEL(1),4),"^",1,2)=$P(^TMP($J,"MSG",RCMSG),"^",2,3),$P(^RCT(349.1,+LABEL(1),4),"^",3)=$G(XMZ)
89 Q
90 ;
91TRANCHK ;Check for complete ACK transmission
92 N MSG,RCT,SEG,SEQ,X
93 F RCT=3,4 I $P($G(^RCT(349.1,+RCT,4)),"^")'=$P($G(^RCT(349.1,+RCT,4)),"^",2) D
94 .S XMDUZ="AR PACKAGE"
95 .S XMSUB="CCPC ACKNOWLEDGMENT TRANSMISSION(S) INCOMPLETE"
96 .I $O(^XMB(3.8,"B","RCCPC STATEMENTS",0)) S XMY("G.RCCPC STATEMENTS")="" E S XMY(.5)=""
97 .S XMTEXT="MSG("
98 .S SEG=$S(RCT=3:"IS",1:"PA")
99 .S SEG(1)=$P(^RCT(349.1,+RCT,4),"^",2)
100 .S MSG(2)="The last "_SEG_" segment message received from CCPC was numbered "_SEG(1)_"."
101 .S MSG(3)="This was not labeled the final message in that segment type transmission."
102 .S MSG(4)="This may cause patient statement information to be missing."
103 .S MSG(5)="The last message number received was "_$P($G(^RCT(349.1,RCT,4)),"^",3)
104 .S MSG(6)="Please contact the CCPC in Austin."
105 .D ^XMD
106 Q
107 ;
108 ;
109IT ;INVALID TRANSMISSION
110 S ERR="The CCPC patient statement messages were not accepted by CCPC" D ERRMSG
111 S ERR="due to the following error(s):" D ERRMSG
112 S ERR=" " D ERRMSG
113 S RCMSG=1 F S RCMSG=$O(^TMP($J,"MSG",RCMSG)) Q:'RCMSG D
114 .S MSG=^TMP($J,"MSG",RCMSG)
115 .S MSG=$P(MSG,"^",8)
116 .F RCX=1:5:21 S RCX1=RCX+4 S ERROR=$E(MSG,RCX,RCX1) Q:ERROR="" D
117 ..S ERR(1)=$O(^RCPSE(349.7,"B",ERROR,""))
118 ..I 'ERR(1) S ERR="NO ERROR DESCRIPTION FOR ERROR CODE: "_ERROR
119 ..I ERR(1) S ERR=$P(^RCPSE(349.7,+ERR(1),0),"^",4),ERR=ERROR_" "_ERR
120 ..I ERR(1) S:$P(^RCPSE(349.7,+ERR(1),0),"^",3)="R" RE=1
121 ..D ERRMSG
122 S ERR=" " D ERRMSG
123 S ERR="Please contact IRM."
124 D ERRMSG
125 Q
126 ;
127ERRMSG ;ERROR MESSAGE
128 S LN=LN+1,^TMP($J,"ERR",LN)=ERR
129 Q
Note: See TracBrowser for help on using the repository browser.