source: WorldVistAEHR/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCWROFF1.m@ 1211

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

initial load of WorldVistAEHR

File size: 5.6 KB
RevLine 
[613]1RCWROFF1 ;WISC/RFJ-partial waiver ;1 Feb 2000
2 ;;4.5;Accounts Receivable;**168,204**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7PARTIAL ; enter a partial waived (menu option)
8 N DR,RCBILLDA,RCCURPRI,RCFYCNT,RCTOTAL,RCTRANDA,RCWAIVED,Y
9 F D Q:RCBILLDA<1
10 . K RCTRANDA ;do not leave around in for loop
11 . ; select a bill
12 . S RCBILLDA=$$GETABILL^RCBEUBIL I RCBILLDA<1 Q
13 . ; lock the bill
14 . L +^PRCA(430,RCBILLDA):5 I '$T W !,"ANOTHER USER IS CURRENTLY WORKING WITH THIS BILL." Q
15 . D SHOWBILL(RCBILLDA)
16 . I '$G(^PRCA(430,RCBILLDA,7)) W !,"THIS BILL HAS NO PRINCIPAL BALANCE." D UNLOCK^RCWROFF Q
17 . W !
18 . ; add a new partial waiver transaction to file 433
19 . S RCTRANDA=$$ADD433^RCBEUTRA(RCBILLDA,11) I 'RCTRANDA W !,$P(RCTRANDA,"^",2) D UNLOCK^RCWROFF Q
20 . W !," Transaction number ",RCTRANDA," added ..."
21 . ; transfer fy multiple from bill
22 . D FY433^RCBEUTRA(RCTRANDA)
23 . ;
24 . ; build dr string for call to die
25 . S DR="11WAIVED IN PART DATE;"
26 . ; determine if there is more than one fiscal year for build DR string
27 . S RCFYCNT=$P($G(^PRCA(433,RCTRANDA,4,0)),"^",4)
28 . ; single fiscal year in multiple
29 . I RCFYCNT'>1 D
30 . . ; get the current principal balance
31 . . S RCCURPRI=+$P($G(^PRCA(433,RCTRANDA,4,+$O(^PRCA(433,RCTRANDA,4,0)),0)),"^",2)
32 . . S DR=DR_"15WAIVED AMOUNT;"
33 . . S DR=DR_"S RCWAIVED=+X;"
34 . . S DR=DR_"I RCWAIVED'>0 W !,""Amount must be greater than ZERO. Press ^ to exit."" S Y=15;"
35 . . S DR=DR_"I RCWAIVED>RCCURPRI W !,""Waived amount CAN NOT EXCEED Principal amount ($ "",$J(RCCURPRI,0,2),"")."" S Y=15;"
36 . . S DR=DR_"I RCWAIVED=RCCURPRI W !,""If you are creating a waiver for the FULL AMOUNT, use the option Full Waiver."" S Y=15;"
37 . . S DR=DR_"81///^S X=RCWAIVED;"
38 . ; multiple fiscal years in multiple
39 . I RCFYCNT>1 D
40 . . S DR=DR_"S RCTOTAL=0;"
41 . . S DR=DR_".02;"
42 . . S DR(2,433.01)="4WAIVED AMOUNT;"
43 . . S DR(2,433.01)=DR(2,433.01)_"S RCWAIVED=+X,RCCURPRI=+$P(^PRCA(433,DA(1),4,DA,0),U,2);"
44 . . S DR(2,433.01)=DR(2,433.01)_"I RCWAIVED>RCCURPRI W !,""Waived amount CAN NOT EXCEED Principal Amount ($ "",$J(RCCURPRI,0,2),"") for this Fiscal Year."" S Y=4;"
45 . . S DR(2,433.01,1)="I RCWAIVED=RCCURPRI W !,""If you are creating a waiver for the FULL AMOUNT, use the option Full Waiver."" S Y=4;"
46 . . S DR(2,433.01,1)=DR(2,433.01,1)_"1///^S X=$P(^PRCA(433,DA(1),4,DA,0),U,2)-RCWAIVED;"
47 . . S DR(2,433.01,1)=DR(2,433.01,1)_"S RCTOTAL=$G(RCTOTAL)+RCWAIVED;"
48 . . S DR=DR_"I RCTOTAL'>0 W !,""Amount must be greater than ZERO. Press ^ to exit."" S Y=.02;"
49 . . S DR=DR_"15///^S X=RCTOTAL;"
50 . . S DR=DR_"81///^S X=RCTOTAL;"
51 . ;
52 . ; allow user to edit key fields
53 . S Y=$$EDIT433^RCBEUTRA(RCTRANDA,.DR)
54 . I 'Y W !,$P(Y,"^",2) D DEL433^RCBEUTRA(RCTRANDA,"",0),UNLOCK^RCWROFF Q
55 . ;
56 . ; if only one fiscal year, update the multiple since it was not done
57 . ; by the user in the die call
58 . I RCFYCNT=1 D
59 . . N DA40,DATA40,RCTOTAL
60 . . S RCTOTAL=$P($G(^PRCA(433,RCTRANDA,8)),"^") ;amount waived
61 . . S DA40=+$O(^PRCA(433,RCTRANDA,4,0)) I 'DA40 Q
62 . . S DATA40=$G(^PRCA(433,RCTRANDA,4,DA40,0)) I DATA40="" Q
63 . . S $P(DATA40,"^",2)=$P(DATA40,"^",2)-RCTOTAL ;principal remaining
64 . . S $P(DATA40,"^",5)=RCTOTAL ;amount waived
65 . . S ^PRCA(433,RCTRANDA,4,DA40,0)=DATA40
66 . ;
67 . D SHOWTRAN(RCTRANDA)
68 . I $$ASKOK^RCWROFF("Partial Waiver")'=1 D DEL433^RCBEUTRA(RCTRANDA,"",0),UNLOCK^RCWROFF Q
69 . ;
70 . ; move the fy multiple from 433 to 430
71 . D FYMULT^RCBEUBIL(RCTRANDA)
72 . ; mark transaction as processed
73 . D PROCESS^RCBEUTRA(RCTRANDA)
74 . ; update the principal balance on the bill (subtract the waived amount)
75 . D SETBAL^RCBEUBIL(RCTRANDA)
76 . ; create fms write off document, if not accrued
77 . I '$$ACCK^PRCAACC(RCBILLDA) D FMSDOC^RCWROFF(RCTRANDA)
78 . ;
79 . W !," * * * * * Partial Waiver has been PROCESSED! * * * * *"
80 .I '$G(REFMS)&(DT>$$LDATE^RCRJR(DT)) S Y=$E($$FPS^RCAMFN01(DT,1),1,5)_"01" D DD^%DT W !!," * * * * Transmission will be held until "_Y_" * * * *"
81 . D UNLOCK^RCWROFF
82 Q
83 ;
84 ;
85SHOWTRAN(RCTRANDA) ; show data for transaction
86 N %,DATA0,DATA1,DATA40,RCWRLINE,Y
87 S DATA0=$G(^PRCA(433,RCTRANDA,0))
88 S DATA1=$G(^PRCA(433,RCTRANDA,1))
89 S RCWRLINE="",$P(RCWRLINE,"=",79)=""
90 W !!,RCWRLINE
91 W !,"BILL NUMBER: ",$P($G(^PRCA(430,+$P(DATA0,"^",2),0)),"^")
92 W ?40,"WAIVED AMOUNT: ",$J($P(DATA1,"^",5),0,2)
93 S Y=$P($P(DATA1,"^"),".") I Y D DD^%DT
94 W !?42,"WAIVED DATE: ",Y
95 W !!,"FISCAL YEAR",?30,"WAIVED AMOUNT",?50,"NEW PRINCIPAL BALANCE DUE"
96 S %=0 F S %=$O(^PRCA(433,RCTRANDA,4,%)) Q:'% D
97 . S DATA40=$G(^PRCA(433,RCTRANDA,4,%,0))
98 . W !,$P(DATA40,"^"),?30,$J($P(DATA40,"^",5),13,2),?50,$J($P(DATA40,"^",2),25,2)
99 W !!,RCWRLINE
100 Q
101 ;
102 ;
103SHOWBILL(RCBILLDA) ; show data for bill
104 N DATA7,DATA20,FYDA
105 S DATA7=$G(^PRCA(430,RCBILLDA,7))
106 W !?8,"Principal Balance: ",$J($P(DATA7,"^"),9,2)
107 ;
108 ; show fy data
109 S FYDA=$O(^PRCA(430,RCBILLDA,2,0)),DATA20=$G(^PRCA(430,RCBILLDA,2,FYDA,0))
110 W ?40,"FY: ",$P(DATA20,"^"),?50,"Principal Balance: ",$J($P(DATA20,"^",2),0,2)
111 ; if multiple fiscal years, show them here
112 F S FYDA=$O(^PRCA(430,RCBILLDA,2,FYDA)) Q:'FYDA D
113 . S DATA20=$G(^PRCA(430,RCBILLDA,2,FYDA,0))
114 . W !?40,"FY: ",$P(DATA20,"^"),?50,"Principal Balance: ",$J($P(DATA20,"^",2),0,2)
115 ;
116 W !?8," Interest Balance: ",$J($P(DATA7,"^",2),9,2)
117 W !?8," Admin Balance: ",$J($P(DATA7,"^",3)+$P(DATA7,"^",4)+$P(DATA7,"^",5),9,2)
118 W !?27,"---------"
119 W !?8," TOTAL Balance: ",$J($P(DATA7,"^")+$P(DATA7,"^",2)+$P(DATA7,"^",3)+$P(DATA7,"^",4)+$P(DATA7,"^",5),9,2)
120 Q
Note: See TracBrowser for help on using the repository browser.