source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCRJRCOT.m@ 1147

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

initial load of WorldVistAEHR

File size: 3.8 KB
Line 
1RCRJRCOT ;WISC/RFJ-calculate a transactions balance ;1 Mar 97
2 ;;4.5;Accounts Receivable;**68,134,103,153,168*;Mar 20, 1995
3 Q
4 ;
5 ;
6TRANBAL(TRANDA) ; gets a transactions balance
7 ; returns principal ^ interest ^ admin cost ^ mf ^ cc
8 N ADMIN,COURT,DATA1,DATA2,DATA3,DATA8,INTEREST,MARSHAL,PRINBAL,TRANTYPE
9 ; transaction not valid
10 I '$$VALID(TRANDA) Q ""
11 S DATA1=$G(^PRCA(433,TRANDA,1))
12 S PRINBAL=$P(DATA1,"^",5),INTEREST="",ADMIN="",MARSHAL="",COURT=""
13 ;
14 S TRANTYPE=+$P(DATA1,"^",2)
15 I $T(@TRANTYPE)'="" D @TRANTYPE
16 ;
17 Q PRINBAL_"^"_INTEREST_"^"_ADMIN_"^"_MARSHAL_"^"_COURT
18 ;
19 ;
20 ;
21 ;
221 ; increase adjustment
23 S PRINBAL=+$P(DATA1,"^",5),(INTEREST,ADMIN,MARSHAL,COURT)=""
24 Q
25 ;
26 ;
272 ; payment
28 S DATA3=$G(^PRCA(433,TRANDA,3))
29 S PRINBAL=+$P(DATA3,"^")
30 S INTEREST=+$P(DATA3,"^",2)
31 S ADMIN=+$P(DATA3,"^",3)
32 S MARSHAL=+$P(DATA3,"^",4)
33 S COURT=+$P(DATA3,"^",5)
34 Q
35 ;
36 ;
373 ; refer to district counsel
38 S PRINBAL=+$P(DATA1,"^",5),(INTEREST,ADMIN,MARSHAL,COURT)=""
39 Q
40 ;
41 ;
428 ; terminate by fiscal officer
43 S DATA8=$G(^PRCA(433,TRANDA,8))
44 S PRINBAL=+$P(DATA8,"^")
45 S INTEREST=+$P(DATA8,"^",2)
46 S ADMIN=+$P(DATA8,"^",3)
47 S MARSHAL=+$P(DATA8,"^",4)
48 S COURT=+$P(DATA8,"^",5)
49 ;
50 ; if data8 node not defined, lookup on bill
51 ; once patch 146 gets out, this can be removed
52 I $TR($P(DATA8,"^",1,5),"^0")="" D
53 . N BILLDA,DATA7
54 . S BILLDA=+$P(^PRCA(433,TRANDA,0),"^",2)
55 . S DATA7=$P($G(^PRCA(430,BILLDA,7)),"^",1,5)
56 . S PRINBAL=+$P(DATA7,"^")
57 . S INTEREST=+$P(DATA7,"^",2)
58 . S ADMIN=+$P(DATA7,"^",3)
59 . S MARSHAL=+$P(DATA7,"^",4)
60 . S COURT=+$P(DATA7,"^",5)
61 Q
62 ;
63 ;
649 ; terminate by compromise
65 D 8
66 Q
67 ;
68 ;
6910 ; payment waived in full
70 D 8
71 Q
72 ;
73 ;
7411 ; payment waived in partial
75 D 8
76 Q
77 ;
78 ;
7912 ; admin cost / charge
80 S DATA2=$G(^PRCA(433,TRANDA,2))
81 S PRINBAL=""
82 S INTEREST=+$P(DATA2,"^",7)
83 S ADMIN=$P(DATA2,"^")+$P(DATA2,"^",2)+$P(DATA2,"^",3)+$P(DATA2,"^",4)+$P(DATA2,"^",8)+$P(DATA2,"^",9)
84 S MARSHAL=+$P(DATA2,"^",5)
85 S COURT=+$P(DATA2,"^",6)
86 Q
87 ;
88 ;
8913 ; interest / admin charge
90 D 12
91 Q
92 ;
93 ;
9414 ; exempt interest / admin cost
95 S PRINBAL=""
96 S DATA2=$G(^PRCA(433,TRANDA,2))
97 S INTEREST=$P(DATA2,"^",7)
98 S ADMIN=$P(DATA2,"^")+$P(DATA2,"^",2)+$P(DATA2,"^",3)+$P(DATA2,"^",4)+$P(DATA2,"^",8)+$P(DATA2,"^",9)
99 S MARSHAL=+$P(DATA2,"^",5)
100 S COURT=+$P(DATA2,"^",6)
101 ; prior to patch 103, exempt interest and admin charges could
102 ; not be broken out
103 I (INTEREST+ADMIN+MARSHAL+COURT)'=$P(DATA1,"^",5) S INTEREST=$P(DATA1,"^",5),ADMIN="",MARSHAL="",COURT=""
104 Q
105 ;
106 ;
10729 ; terminate by rc/doj
108 D 8
109 Q
110 ;
111 ;
11234 ; payment in full
113 D 2
114 Q
115 ;
116 ;
11735 ; decrease adjustment
118 S PRINBAL=+$P(DATA1,"^",5),(INTEREST,ADMIN,MARSHAL,COURT)=""
119 ; make negative amounts positive
120 I PRINBAL<0 S PRINBAL=-PRINBAL
121 Q
122 ;
123 ;
12441 ; refund
125 S PRINBAL=+$P(DATA1,"^",5),(INTEREST,ADMIN,MARSHAL,COURT)=""
126 ; make negative amounts positive
127 I PRINBAL<0 S PRINBAL=-PRINBAL
128 Q
129 ;
130 ;
13143 ; re-establishment
132 S DATA8=$G(^PRCA(433,TRANDA,8))
133 S PRINBAL=+$P(DATA8,"^")
134 S INTEREST=+$P(DATA8,"^",2)
135 S ADMIN=+$P(DATA8,"^",3)
136 S MARSHAL=+$P(DATA8,"^",4)
137 S COURT=+$P(DATA8,"^",5)
138 Q
139 ;
140 ;
14146 ; unsuspended
142 S DATA8=$G(^PRCA(433,TRANDA,8))
143 S PRINBAL=+$P(DATA8,"^")
144 S INTEREST=+$P(DATA8,"^",2)
145 S ADMIN=+$P(DATA8,"^",3)
146 S MARSHAL=+$P(DATA8,"^",4)
147 S COURT=+$P(DATA8,"^",5)
148 Q
149 ;
150 ;
15147 ; suspended
152 D 46
153 Q
154 ;
155 ;
156TRANAMT(TRANDA) ; calculate transaction amount for transaction tranda
157 N %,AMT
158 S AMT=0
159 S %=0 F S %=$O(^PRCA(433,TRANDA,4,%)) Q:'% S AMT=AMT+$P($G(^(%,0)),"^",5)
160 Q AMT
161 ;
162 ;
163VALID(TRANDA) ; test to see if a transaction is valid
164 ; return 1 if it is, 0 if not
165 ; date entered is not set (this is the processed date)
166 I '$P($G(^PRCA(433,TRANDA,1)),"^",9) Q 0
167 N DATA0
168 S DATA0=$G(^PRCA(433,TRANDA,0))
169 ; transaction status is not complete (2)
170 I $P(DATA0,"^",4)'=2 Q 0
171 ; incomplete transaction flag set (invalid transaction)
172 ;I $P(DATA0,"^",10) Q 0
173 Q 1
Note: See TracBrowser for help on using the repository browser.