source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCRCREC.m@ 1270

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

initial load of WorldVistAEHR

File size: 3.9 KB
RevLine 
[613]1RCRCREC ;ALB/CMS - RC AND DHCP RECONCILIATION REPORTS ; 16-JUN-00
2V ;;4.5;Accounts Receivable;**61,63,147,159**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;Tasked from the RC RC SERV routine
6 ; INPUT: RCJOB,RCSITE,RCVAR,RCXTYP,RCXMY,RCBDT,RCEDT,RCXMZ
7 ;OUTPUT: Four mail messages to G.RC RC REFERRALS
8 ;
9 N OUT,RCDIV,RCDOMNM
10 D RCDIV^RCRCDIV(.RCDIV)
11 ;
12 ; - if only one RC division of care, run process and quit
13 I '$O(RCDIV(0)) D EN G MAINQ
14 ;
15 ; - build new array by the RC domain and division, i.e.
16 ; rcdiv("rcdomain",rc domain name,division)=""
17 I $O(RCDIV(0)) S RCDIV=0 F S RCDIV=$O(RCDIV(RCDIV)) Q:'RCDIV D
18 .S RCDIV("RCDOMAIN",$P(RCDIV(RCDIV),"^",2),RCDIV)=""
19 ;
20 ; - run process for each RC domain/office
21 S RCDOMNM="" F S RCDOMNM=$O(RCDIV("RCDOMAIN",RCDOMNM)) Q:RCDOMNM="" D EN
22 ;
23MAINQ I '$D(OUT) K ^XTMP(RCXTYP,RCXMZ)
24 K RCJOB,RCSITE,RCVAR,RCXTYP,RCXMY,RCXMZ
25 Q
26 ;
27 ;
28EN ; Process bills for each specific RC Office
29 D INIT
30 D ^RCRCREC2
31 D SEND ; Create the four messages and send them to RCXMY
32 K ^TMP("PRCA",$J)
33 Q
34 ;
35 ;
36INIT ;Initialize variables and arrays
37 N I,LN,MTYP,RCREG
38 K ^TMP("PRCA",$J)
39 S RCSITE=$$SITE^RCMSITE
40 ;
41 ; - set RC reference name for message
42 S RCREG=$S($G(RCDOMNM)]"":RCDOMNM,1:"REGIONAL COUNSEL SYSTEM")
43 ;
44 F I=1:1:4 D
45 .S ^TMP("PRCA",$J,"MR"_I,0)=5
46 .S ^TMP("PRCA",$J,"MR"_I,3)=" VAMC: "_RCSITE_" - "_$P($G(^DIC(4,RCSITE,0)),U,1)
47 .S ^TMP("PRCA",$J,"MR"_I,4)=" "
48 .S ^TMP("PRCA",$J,"MR"_I,5)="============================================================================="
49 S ^TMP("PRCA",$J,"MR1",1)=" BILLS ACTIVE/REFERRED IN ACCOUNTS RECEIVABLE SYSTEM"
50 S ^TMP("PRCA",$J,"MR1",2)=" BUT NOT PENDING IN "_RCREG
51 S ^TMP("PRCA",$J,"MR2",1)=" BILLS PENDING IN "_RCREG
52 S ^TMP("PRCA",$J,"MR2",2)=" BUT NOT ACTIVE/REFERRED IN ACCOUNTS RECEIVABLE SYSTEM"
53 S ^TMP("PRCA",$J,"MR3",1)=" BILLS IN REGIONAL COUNSEL SYSTEM AND ACCOUNTS RECEIVABLE SYSTEM"
54 S ^TMP("PRCA",$J,"MR3",2)=" WITH DIFFERENT DOLLAR AMOUNTS OR PATIENT SSN NUMBER"
55 S ^TMP("PRCA",$J,"MR4",1)=" BILLS IN REGIONAL COUNSEL SYSTEM AND ACCOUNTS RECEIVABLE SYSTEM"
56 S ^TMP("PRCA",$J,"MR4",2)=" WITH A DECREASE ADJUSTMENT BEFORE BILL REF.DT "
57 I RCEDT,RCBDT D
58 .S Y=RCBDT D D^DIQ
59 .S ^TMP("PRCA",$J,"MR4",2)=^TMP("PRCA",$J,"MR4",2)_" ("_Y_" to "
60 .S Y=RCEDT D D^DIQ
61 .S ^TMP("PRCA",$J,"MR4",2)=^TMP("PRCA",$J,"MR4",2)_Y_")"
62 ;
63INITQ Q
64 ;
65SEND ;Send reports to Mailman
66 ;Loop for MR1 to MR4
67 N MREP
68 F MREP="MR1","MR2","MR3","MR4" D ;
69 .N LN S MTYP=$E(MREP,3)
70 .I +$G(^TMP("PRCA",$J,MREP,0))=5 D Q
71 ..S ^TMP("PRCA",$J,MREP,6)=" NO RECORDS FOUND"
72 ..M LN=^TMP("PRCA",$J,MREP) D XMB
73 .D SBIG Q
74SENDQ Q
75 ;
76SBIG ;Send the four large reports in a mail message to site and RC
77 N DATA,II,LN,RETRY,XMCHAN,XMDUZ,XMSUB,XMY,XMZ S RETRY=0
78 S XMCHAN=1,XMSUB="AR/RC - SITE: "_$G(RCSITE,"UNK")_" ("_+MTYP_" of 4) RECONCILIATION REPORT"
79 S (XMDUN,XMDUZ)="ACCOUNTS RECEIVABLE RC SERVER"
80 D XMZ^XMA2 I XMZ<1 S RETRY=RETRY+1 I RETRY<100 G SBIG
81 I RETRY>99 D D XMB S OUT=1 G SBIGQ
82 .S MTYP=0
83 .S LN(1)=" The AR/RC Reconciliation Report is having trouble creating"
84 .S LN(2)="the four mail messages. Please contact an IRM support person."
85 S II=0,LN=0 F S II=$O(^TMP("PRCA",$J,MREP,II)) Q:'II D
86 .S DATA=^TMP("PRCA",$J,MREP,II)
87 .I $L(DATA) S LN=LN+1 S ^XMB(3.9,XMZ,2,LN,0)=DATA
88 I $D(^XMB(3.9,XMZ,2)) S ^XMB(3.9,XMZ,2,0)="^3.92^"_LN_U_LN_U_DT
89 S XMY("G.RC RC REFERRALS")=""
90 I $G(RCXMY)]"" S XMY(RCXMY)=""
91 D ENT1^XMD I XMZ<1 S RETRY=RETRY+1 I RETRY<100 G XMB
92SBIGQ Q
93 ;
94XMB ;Call to mailman
95 ;INPUT: LN( for message text array
96 ; MTYP for message type (1 of 4) or 0 for (1 of 1)
97 ; RCSITE
98 N RETRY,XMCHAN,XMDUZ,XMSUB,XMTEXT,XMY,XMZ S RETRY=0
99 S XMCHAN=1,XMSUB="AR/RC - SITE: "_$G(RCSITE,"UNK")_" ("_$S(MTYP=0:1,1:+MTYP)_" of "_$S(MTYP=0:1,1:4)_") RECONCILIATION REPORT"
100 S XMTEXT="LN(",XMDUZ="ACCOUNTS RECEIVABLE RC SERVER"
101 S XMY("G.RC RC REFERRALS")=""
102 I $G(RCXMY)]"" S XMY(RCXMY)=""
103 D ^XMD I XMZ<1 S RETRY=RETRY+1 I RETRY<100 G XMB
104XMBQ Q
105 ;RCRCREC
Note: See TracBrowser for help on using the repository browser.