source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/PRCAGU.m@ 1569

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1PRCAGU ;WASH-ISC@ALTOONA,PA/CMS-Patient Statement Utility ;8/23/94 8:06 AM
2V ;;4.5;Accounts Receivable;**181**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q ;This routine should not be called from the top
5SITE ;Set statement variables from Site Parameter File
6 NEW SP0,SP2
7 S SP0=$G(^RC(342,1,0)) I SP0="" G SITEQ
8 S SP2=$G(^RC(342,1,2))
9 S SITE("SUP")=+$P(SP0,U,2) ;suppres right&oblig
10 S SITE("DETL")=+$P(SP0,U,5) ;Copay info 1-brief or 2-expanded
11 S SITE("COM1")=$P($G(SP2),U,1) ;statement comment 1
12 S SITE("COM2")="" ; statement comment 2 disabled with GMT patch ;($P($G(SP2),U,2))
13 S SITE("SCAN")=$G(^RC(342,1,5)) ;mark for auto stuffer
14 S SITE("ZERO")=$P($G(SP0),U,9) ;suppress zero balance
15SITEQ Q
16PBAL(DEB,DAT,PBAL) ;get previous balance and date of last transaction
17 N EVN,I,Y G:'DEB PBALQ
18 S EVN=$O(^RC(341,"AD",DEB,+$O(^RC(341.1,"AC",2,0)),DAT,0))
19 I '$G(EVN) G PBALQ
20 S Y=$G(^RC(341,EVN,1)) F I=1:1:5 S PBAL=PBAL+$P(Y,U,I)
21 S DAT=$P($G(^RC(341,EVN,0)),U,6)
22PBALQ Q
23BBAL(DEB,BBAL) ;get bills balances return array
24 NEW ADM,AC,BAL,CT,I,INT,MF,OP,PB,PRE,STAT
25 S (BBAL,PB,INT,ADM,MF,CT)=0
26 G:'DEB BBALQ
27 S AC=+$O(^PRCA(430.3,"AC",102,0)),OP=+$O(^PRCA(430.3,"AC",112,0)),PRE=+$O(^PRCA(430.2,"AC",33,0))
28 F STAT=AC,OP F BN=0:0 S BN=$O(^PRCA(430,"AS",DEB,STAT,BN)) Q:'BN D
29 .S BAL=$G(^PRCA(430,BN,7))
30 .I $P(^PRCA(430,BN,0),U,2)=PRE S PB=PB-BAL Q
31 .S PB=PB+$P(BAL,U,1),INT=INT+$P(BAL,U,2),ADM=ADM+$P(BAL,U,3),MF=MF+$P(BAL,U,4),CT=CT+$P(BAL,U,5)
32 S BBAL=PB+INT+ADM+MF+CT
33 F X="PB","INT","ADM","MF","CT" S BBAL(X)=@X
34BBALQ Q
35UPDAT(DEB,DAT) ;update bill file 430 letter fields
36 NEW BN,DA,DIE,DR,II,LET,NOT,X,Y
37 G:'DEB UPDATQ
38 S:$G(DAT)="" DAT=DT S DIE="^PRCA(430,",NOT=0,BN=0
39 F S BN=$O(^PRCA(430,"AS",DEB,16,BN)) Q:'BN S DA=BN D
40 .S LET=$G(^PRCA(430,BN,6))
41 .F II=1:1:4 Q:$P(LET,U,II)=DAT I $P(LET,U,II)="" S NOT=II,DR=$S(II=1:61,II=2:62,II=3:63,1:68)_"////^S X="_DAT_";68.1////^S X="_DAT D ^DIE Q
42UPDATQ Q
43BEVN(DEB,DAT) ;set event for non patient letters
44 NEW BAL,BN,DA,DIE,DR,EVN,I,NOT,X,Y
45 G:'DEB BEVNQ
46 S:$G(DAT)="" DAT=DT S DIE="^RC(341,",NOT=0,BN=0
47 F S BN=$O(^PRCA(430,"AS",DEB,16,BN)) Q:'BN D
48 .F I=1:1:3 I $P($G(^PRCA(430,BN,6)),U,I)=DAT S NOT=I Q
49 .S:'NOT NOT=4 S BAL=$G(^PRCA(430,BN,7)),ERR="",EVN=""
50 .D OPEN^RCEVDRV1(10,$P(^RCD(340,DEB,0),U),DAT,DUZ,$$SITE^RCMSITE,.ERR,.EVN,+BAL_U_$P(BAL,U,2)_U_$P(BAL,U,3)_U_$P(BAL,U,4)_U_$P(BAL,U,5))
51 .I EVN S DA=EVN,DR="5.01////^S X="_BN_";5.02////^S X="_NOT D ^DIE D CLOSE^RCEVDRV1(EVN)
52BEVNQ Q
53PRE(DEB) ;check for prepay bills in Refund review or Pending Calm
54 NEW BAL,BN,PEN,PRE,RR,STAT,Y
55 S (BAL,Y)=0 G:'DEB PREQ
56 S RR=+$O(^PRCA(430.3,"AC",113,0)),PEN=+$O(^PRCA(430.3,"AC",107,0)),PRE=+$O(^PRCA(430.2,"AC",33,0))
57 F STAT=RR,PEN F BN=0:0 S BN=$O(^PRCA(430,"AS",DEB,STAT,BN)) Q:'BN D
58 .I $P($G(^PRCA(430,BN,0)),U,2)=PRE S Y=BN,BAL=BAL+$G(^PRCA(430,BN,7))
59PREQ Q Y_U_BAL
60LST(DEB,EVN,BDT) ;get last statement date before the statement date sent
61 NEW BEG,DAT,Y
62 S BDT=0 I 'DEB G LSTQ
63 S Y=+$O(^RC(341.1,"AC",2,0)),BEG=$P($G(^RC(341,EVN,0)),U,7) I 'BEG G LSTQ
64 S BEG=9999999.999999-BEG
65 F DAT=BEG:0 S DAT=$O(^RC(341,"AD",DEB,Y,DAT)) Q:'DAT S BDT=DAT Q
66 ;return BDT in inverse date
67LSTQ Q
Note: See TracBrowser for help on using the repository browser.