source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCRJRTR1.m@ 1087

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

initial load of WorldVistAEHR

File size: 6.0 KB
Line 
1RCRJRTR1 ;WISC/RFJ-transaction report (print) ;1 Mar 97
2 ;;4.5;Accounts Receivable;**68**;Mar 20, 1995
3 Q
4 ;
5 ;
6PRINT ; print the report
7 N %I,DATA,DATEDIS1,DATEDIS2,INTTOTAL,NDB,NDBFLAG,NOW,PAGE,PRINTOTL,RCRJFLAG,RCRJLINE,SCREEN,SIGN,TOTALC,TOTALT,X,Y
8 ;
9 ; calculate new receivables from bills and store in 43C
10 I $D(TRANTYPE(43)) S NDB("43C",2)=$P($$GETNEW^RCRJRCOL(DATESTRT,DATEEND,0),"^",2)
11 ;
12 S Y=$P(DATESTRT,".") D DD^%DT S DATEDIS1=Y
13 S Y=$P(DATEEND,".") D DD^%DT S DATEDIS2=Y
14 D NOW^%DTC S Y=% D DD^%DT S NOW=Y
15 S PAGE=1,RCRJLINE="",$P(RCRJLINE,"-",81)=""
16 S SCREEN=0 I '$D(ZTQUEUED),IO=IO(0),$E(IOST)="C" S SCREEN=1
17 U IO D H
18 ;
19 S TRANTYPE="" F S TRANTYPE=$O(^TMP($J,"RCRJRTRA",TRANTYPE)) Q:TRANTYPE=""!($G(RCRJFLAG)) D
20 . I $Y>(IOSL-6) D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
21 . S TYPE=$TR(TRANTYPE," ")
22 . W !!,"TRANSACTION TYPE: ",TYPE," ",$P($G(^PRCA(430.3,+TYPE,0)),"^")
23 . I TYPE="12A" W " [ADDED]"
24 . I TYPE="12E" W " [EXEMPT]"
25 . I TYPE="35C" W " [CONTRACTUAL ADJUSTMENTS]"
26 . I TYPE="34P" W " [PRE-PAYMENTS]"
27 . ;
28 . K TOTALT
29 . S CATDA=0 F S CATDA=$O(^TMP($J,"RCRJRTRA",TRANTYPE,CATDA)) Q:'CATDA!($G(RCRJFLAG)) D
30 . . I $Y>(IOSL-6) D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
31 . . W !?5,"CATEGORY: ",$E($S($L(CATDA)=1:" ",1:"")_CATDA_" "_$P($G(^PRCA(430.2,CATDA,0)),"^"),1,20),?36
32 . . ;
33 . . K TOTALC
34 . . S BILLDA=0 F S BILLDA=$O(^TMP($J,"RCRJRTRA",TRANTYPE,CATDA,BILLDA)) Q:'BILLDA!($G(RCRJFLAG)) D
35 . . . ;
36 . . . S DA=0 F S DA=$O(^TMP($J,"RCRJRTRA",TRANTYPE,CATDA,BILLDA,DA)) Q:'DA!($G(RCRJFLAG)) S DATA=^(DA) D
37 . . . . I $Y>(IOSL-5) D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
38 . . . . I RCRJSUMM=2 W !?10,$P($G(^PRCA(430,BILLDA,0)),"^"),?28,$P($G(^PRCA(433,DA,0)),"^"),?36
39 . . . . F %=1:1:4 D:RCRJSUMM=2 WRITE($P(DATA,"^",%)) I $P(DATA,"^",%)'="" S TOTALC(%)=$G(TOTALC(%))+$P(DATA,"^",%)
40 . . I $G(RCRJFLAG) Q
41 . . I RCRJSUMM=2 W !?10,$E($TR(RCRJLINE,"-","."),11,80),!?10,"TOTALS FOR CATEGORY ...",?36
42 . . F %=1:1:4 D WRITE($G(TOTALC(%))) I $G(TOTALC(%))'="" S TOTALT(%)=$G(TOTALT(%))+TOTALC(%)
43 . . I $Y>(IOSL-6) D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
44 . ;
45 . I $G(RCRJFLAG) Q
46 . W !?5,$E($TR(RCRJLINE,"-","."),6,80),!?5,"TOTALS FOR TRANSACTION TYPE ...",?36
47 . F %=1:1:4 D WRITE($G(TOTALT(%))) I $G(TOTALT(%))'="" S NDB(TYPE,%)=$G(NDB(TYPE,%))+TOTALT(%)
48 . I $Y>(IOSL-6) D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
49 ;
50 I $G(RCRJFLAG) Q
51 ;
52 ; set ndbflag to change header for ndb totals (see H)
53 S NDBFLAG=1
54 D:SCREEN PAUSE Q:$G(RCRJFLAG) D H
55 ;
56 ; print national database totals
57 S PRINTOTL=0,INTTOTAL=0
58 W !!,"NATIONAL DATABASE TOTALS (VALUES FROM THE REPORT) ...",!
59 D NDB(13,43,2)
60 D NDB(13,"43C",2)
61 D NDB(13,43,3)
62 D NDB(13,43,4)
63 D NDB(14,1,2)
64 D NDB(16,35,2)
65 D NDB(18,34,2)
66 D NDB(19,2,2)
67 D NDB(20,"35C",2)
68 D NDB(21,"34P",2)
69 D NDB(22,10,2),NDB(22,10,3),NDB(22,10,4)
70 D NDB(23,11,2),NDB(23,11,3),NDB(23,11,4)
71 D NDB(24,9,2),NDB(24,9,3),NDB(24,9,4)
72 D NDB(25,8,2),NDB(25,8,3),NDB(25,8,4)
73 D NDB(38,34,3),NDB(38,"34P",3),NDB(38,2,3)
74 D NDB(39,34,4),NDB(39,2,4)
75 D NDB(40,"12A",3),NDB(40,13,3)
76 D NDB(41,"12A",4),NDB(41,13,4)
77 D NDB(42,"12E",3),NDB(42,"12E",4),NDB(42,14,3)
78 D NDB(43,41,2)
79 W !,$E(RCRJLINE,1,80),!,"BALANCE GAINS/LOSSES FOR DATE RANGE",?42,"+/-",$J(PRINTOTL,13,2),$J(INTTOTAL,11,2)
80 ;
81 W !!," The following formula can be used to balance the values in the national"
82 W !," database. Note: This report must be run for the entire month and all"
83 W !," transaction types must be selected. Also, this will only balance for"
84 W !," the months following the installation of this patch."
85 W !," Principal Int/Adm",!
86 W !,"Previous months receivables from NDB (category 1) + __________.__ _______.__"
87 W !,"Current months gains/losses from this report +/-",$J(PRINTOTL,14,2),$J(INTTOTAL,12,2)
88 W !,$E(RCRJLINE,1,80)
89 W !,"Current months receivables from NDB (category 1) = __________.__ _______.__"
90 ;
91 Q
92 ;
93 ;
94NDB(NDBTYPE,TRANTYPE,NODE) ; write ndb totals and calc end total
95 I +$G(NDB(TRANTYPE,NODE))=0 Q
96 ;
97 W !,"(",NDBTYPE,") ",$$NDBCATEG(NDBTYPE),?36
98 ;
99 S SIGN="-"
100 I TRANTYPE=1!(TRANTYPE="12A")!(TRANTYPE=13)!(TRANTYPE=43)!(TRANTYPE="43C")!(TRANTYPE=46) S SIGN="+"
101 W $J(SIGN_" ",11),$J($G(NDB(TRANTYPE,NODE)),$S(NODE=2:11,1:22),2)
102 W ?75,"(",$J(TRANTYPE,3),")"
103 ;
104 I NODE=2 S PRINTOTL=PRINTOTL+$S(SIGN="+":$G(NDB(TRANTYPE,NODE)),1:-$G(NDB(TRANTYPE,NODE)))
105 I NODE=3!(NODE=4) S INTTOTAL=INTTOTAL+$S(SIGN="+":$G(NDB(TRANTYPE,NODE)),1:-$G(NDB(TRANTYPE,NODE)))
106 Q
107 ;
108 ;
109NDBCATEG(NDBTYPE) ; return ndb category
110 I NDBTYPE=13 Q "NEW RECEIVABLES"
111 I NDBTYPE=14 Q "TOTAL INCREASE ADJUSTMENTS"
112 I NDBTYPE=16 Q "TOTAL DECREASE ADJUSTMENTS"
113 I NDBTYPE=18 Q "COLLECTIONS - FULL PAYMENT"
114 I NDBTYPE=19 Q "COLLECTIONS - PART PAYMENT"
115 I NDBTYPE=20 Q "COLLECTIONS - CONTRACT ADJ"
116 I NDBTYPE=21 Q "COLLECTIONS - PREPAYMENTS"
117 I NDBTYPE=22 Q "COLLECTIONS - WAIVED IN FULL"
118 I NDBTYPE=23 Q "COLLECTIONS - WAIVED IN PART"
119 I NDBTYPE=24 Q "COLLECTIONS - TERM COMPROMISE"
120 I NDBTYPE=25 Q "COLLECTIONS - TERM FISCAL OFF"
121 I NDBTYPE=38 Q "COLLECTIONS - INTEREST"
122 I NDBTYPE=39 Q "COLLECTIONS - ADMIN"
123 I NDBTYPE=40 Q "INTEREST ADDED"
124 I NDBTYPE=41 Q "ADMINISTRATIVE COST ADDED"
125 I NDBTYPE=42 Q "INTEREST/ADMIN COST EXEMPT"
126 I NDBTYPE=43 Q "REFUNDS"
127 Q "UNKNOWN"
128 ;
129 ;
130WRITE(VALUE) ; write value
131 I VALUE="" W $J(VALUE,11) Q
132 W $J(VALUE,11,2)
133 Q
134 ;
135 ;
136PAUSE ; pause at end of page
137 N X U IO(0) W !,"Press RETURN to continue, '^' to exit:" R X:DTIME S:'$T X="^" S:X["^" RCRJFLAG=1 U IO Q
138 ;
139 ;
140H ; header
141 S %=NOW_" PAGE "_PAGE,PAGE=PAGE+1 I PAGE'=2!(SCREEN) W @IOF
142 W $C(13),"AR TRANSACTION LISTING REPORT",?(80-$L(%)),%
143 W !," FOR THE DATE RANGE: ",DATEDIS1," TO ",DATEDIS2,?65,$J("TYPE: "_$S(RCRJSUMM=1:"SUMMARY",1:"DETAILED"),15)
144 ;
145 I '$G(NDBFLAG) W !?26,$J("TRANSACTION AMOUNT",21),$J("PRINCIPAL",11),$J("INTEREST",11),$J("ADMIN",11)
146 I $G(NDBFLAG) W !,"NATIONAL DATABASE CATEGORY",?26,$J("ADD (+)/SUB (-)",21),$J("PRINCIPAL",11),$J("INT/ADM",11),$J("TRANSTYPE",11)
147 ;
148 W !,RCRJLINE
149 Q
Note: See TracBrowser for help on using the repository browser.