source: FOIAVistA/trunk/r/ACCOUNTS_RECEIVABLE-PRCA-PRY-RC/RCXFMSW1.m@ 794

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

initial load of FOIAVistA 6/30/08 version

File size: 5.9 KB
Line 
1RCXFMSW1 ;WISC/RFJ-fms writeoff (wr) code sheet generator for a transaction ;1 Feb 2000
2 ;;4.5;Accounts Receivable;**168,172,204**;Mar 20, 1995
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 Q
5 ;
6 ;
7REGENWR ; regenerate write off document (menu option)
8 N FMSDOC,PRINAMT,RCTRANDA,TRANTYPE,Y
9 F D Q:'RCTRANDA
10 . W ! S RCTRANDA=$$SELTRAN^RCDPTPLM I RCTRANDA<1 S RCTRANDA=0 Q
11 . L +^PRCA(433,RCTRANDA):5 I '$T W !,"Another user is working with this transaction. Try again later." Q
12 . S TRANTYPE=$P($G(^PRCA(433,RCTRANDA,1)),"^",2)
13 . I TRANTYPE'=8,TRANTYPE'=9,TRANTYPE'=10,TRANTYPE'=11,TRANTYPE'=29 L -^PRCA(433,RCTRANDA) W !,"You can only send a WRITE OFF document for transactions that write off a bill." Q
14 . ; check to see if transaction was processed
15 . I $P($G(^PRCA(433,RCTRANDA,0)),"^",4)'=2 L -^PRCA(433,RCTRANDA) W !,"This transaction was NOT processed." Q
16 . D SHOWTRAN(RCTRANDA)
17 . I $$ACCK^PRCAACC(+$P($G(^PRCA(433,RCTRANDA,0)),"^",2)) L -^PRCA(433,RCTRANDA) W !,"ACCRUED bills do not get sent in detail to FMS." Q
18 . ; get fms document and status
19 . S FMSDOC=$$FMSSTAT(RCTRANDA)
20 . W !,"Previously sent in WR FMS document: ",$S($P(FMSDOC,"^")="":"NOT FOUND",1:$P(FMSDOC,"^"))," Status: ",$E($P(FMSDOC,"^",2),1,16)
21 . I $P(FMSDOC,"^",2)["ACCEPT"!($P(FMSDOC,"^",2)["TRANSMIT") L -^PRCA(433,RCTRANDA) W !,"The FMS document has been ",$P(FMSDOC,"^",2)," and cannot be regenerated." Q
22 . S PRINAMT=$P($G(^PRCA(433,RCTRANDA,8)),"^")
23 . I PRINAMT'>0 L -^PRCA(433,RCTRANDA) W !,"The principal amount needs to be greater than ZERO." Q
24 . S Y=$$ASKOK I Y'=1 L -^PRCA(433,RCTRANDA) S:Y<0 RCTRANDA=0 Q
25 . S Y=$$BUILDWR(RCTRANDA)
26 . L -^PRCA(433,RCTRANDA)
27 . I Y W !,"WR Document regenerated and retransmitted to FMS." Q
28 . W !,"Unable to regenerate document. ",$P(Y,"^",2)
29 Q
30 ;
31 ;
32BUILDWR(RCTRANDA) ; this entry point is called to generate a wr document to fms for a single transaction
33 N CATEGORY,CR2,DA347,DIQ2,DOCTOTAL,FMSDOCNO,FMSLINE,GECSDATA,RCBILLDA,TRANNUMB,REFMS
34 S RCBILLDA=$P($G(^PRCA(433,RCTRANDA,0)),"^",2)
35 I 'RCBILLDA Q "0^Bill Number missing on transaction."
36 ;
37 S DOCTOTAL=$P($G(^PRCA(433,RCTRANDA,8)),"^")
38 I 'DOCTOTAL Q "0^Total Principal Amount is ZERO."
39 ;
40 ; find a previously sent document
41 S FMSDOCNO=$P($G(^PRCA(433,RCTRANDA,1)),"^",12) I FMSDOCNO'="" S DA347=$O(^RC(347,"C",FMSDOCNO,0))
42 I FMSDOCNO="" D
43 . S DA347=$O(^RC(347,"D","T"_RCTRANDA,0)) I 'DA347 Q
44 . S FMSDOCNO=$P($G(^RC(347,DA347,0)),"^",9)
45 ; if previously sent, get the data from gcs
46 I FMSDOCNO'="" S REFMS=1 D DATA^GECSSGET(FMSDOCNO,0) I $G(GECSDATA) S TRANNUMB=$E($P(FMSDOCNO,"-",2),1,11)
47 ;
48 I $G(TRANNUMB)="" S TRANNUMB=$$ENUM^RCMSNUM
49 I TRANNUMB<0 Q "0^Unable to lookup next transaction number."
50 ; remove dash (example 460-K1A05HY)
51 S TRANNUMB=$TR(TRANNUMB,"-")
52 ;
53 S FMSLINE="LIN^~CRA^001"
54 S $P(FMSLINE,"^",20)=$J(DOCTOTAL,0,2)
55 S $P(FMSLINE,"^",21)="I"
56 S $P(FMSLINE,"^",23)=$P($$DTYPE^PRCAFBD1($P($G(^PRCA(430,RCBILLDA,11)),"^",10)),"^",4) ;refund/reimbursement
57 S $P(FMSLINE,"^",24)="BD"
58 S $P(FMSLINE,"^",25)=$TR($P(^PRCA(430,RCBILLDA,0),"^"),"-") ;bill number with no dash
59 S $P(FMSLINE,"^",26)=$$LINE^RCXFMSC1(RCBILLDA)_"^~"
60 ;
61 ; tricare bill
62 S CATEGORY=$P($G(^PRCA(430,RCBILLDA,0)),"^",2)
63 I CATEGORY=30!(CATEGORY=32) S $P(FMSLINE,"^",23)="06"
64 ;
65 N FMSDT S FMSDT=$$FMSDATE^RCBEUTRA(DT)
66 S CR2="CR2^"_$E(FMSDT,2,3)_"^"_$E(FMSDT,4,5)_"^"_$E(FMSDT,6,7)
67 S $P(CR2,"^",10)="E"
68 S $P(CR2,"^",13)=999999999999
69 S $P(CR2,"^",15)=$J(DOCTOTAL,0,2)
70 S $P(CR2,"^",17)=$E(DT,2,3)
71 S $P(CR2,"^",18)=$E(DT,4,5)
72 S $P(CR2,"^",19)=$E(DT,6,7)_"^~"
73 ;
74 ; put together document in fms
75 N %DT,D,D0,DA,DI,DIC,DIE,DQ,DR,GECSFMS,X
76 I '$G(GECSDATA) D CONTROL^GECSUFMS("A",$E(TRANNUMB,1,3),TRANNUMB,"WR",10,0,"","WRITE OFF")
77 E D REBUILD^GECSUFM1(+GECSDATA,"A",10,"N","Rebuild WRITE OFF") S GECSFMS("DA")=+GECSDATA
78 D SETCS^GECSSTAA(GECSFMS("DA"),CR2)
79 D SETCS^GECSSTAA(GECSFMS("DA"),FMSLINE)
80 D SETCODE^GECSSDCT(GECSFMS("DA"),"D RETN^RCFMFN02")
81 D SETSTAT^GECSSTAA(GECSFMS("DA"),"Q")
82 ;
83 ; store the gcs number in 433 for future reference
84 S $P(^PRCA(433,RCTRANDA,1),"^",12)="WR-"_$P(GECSFMS("CTL"),"^",9)
85 ;
86 ; add/update entry in file 347 for reports
87 N %DT,X,D,D0,DI,DQ,DIC,ERROR
88 I 'DA347 D OPEN^RCFMDRV1("WR-"_$P(GECSFMS("CTL"),"^",9),1,"T"_RCTRANDA,.DA347,.ERROR,RCBILLDA,RCTRANDA)
89 I DA347 D SSTAT^RCFMFN02("T"_RCTRANDA,1)
90 ;
91 Q "1^WR-"_$P(GECSFMS("CTL"),"^",9)
92 ;
93 ;
94FMSSTAT(RCTRANDA) ; return the fms wr document ^ status ^ file 347 ien
95 N DA347,FMSDOCNO,STATUS
96 ; get the fms document from the transaction
97 S FMSDOCNO=$P($G(^PRCA(433,RCTRANDA,1)),"^",12)
98 ; if fms document found, get the file 347 entry
99 I FMSDOCNO'="" S DA347=$O(^RC(347,"C",FMSDOCNO,0))
100 ; if not on transaction, it may be earlier than patch 146
101 I FMSDOCNO="" D
102 . S DA347=$O(^RC(347,"D","T"_RCTRANDA,0)) I 'DA347 Q
103 . S FMSDOCNO=$P($G(^RC(347,DA347,0)),"^",9)
104 ; get the status
105 S STATUS="NOT FOUND"
106 I FMSDOCNO'="" S STATUS=$$STATUS^GECSSGET(FMSDOCNO)
107 Q FMSDOCNO_"^"_STATUS_"^"_$G(DA347)
108 ;
109 ;
110SHOWTRAN(RCTRANDA) ; show data for transaction
111 N DATA0,DATA1,DATA8,RCWRLINE,Y
112 S DATA0=$G(^PRCA(433,RCTRANDA,0))
113 S DATA1=$G(^PRCA(433,RCTRANDA,1))
114 S DATA8=$G(^PRCA(433,RCTRANDA,8))
115 S RCWRLINE="",$P(RCWRLINE,"=",79)=""
116 W !!,RCWRLINE
117 W !,"TRANSACTION NUMBER: ",RCTRANDA
118 W ?40,"WAIVED AMOUNT: ",$J($P(DATA1,"^",5),0,2)
119 W !,"BILL NUMBER: ",$P($G(^PRCA(430,+$P(DATA0,"^",2),0)),"^")
120 S Y=$P($P(DATA1,"^"),".") I Y D DD^%DT
121 W ?42,"WAIVED DATE: ",Y
122 W !?8,"Principal Waived: ",$J($P(DATA8,"^"),9,2)
123 W !?8," Interest Waived: ",$J($P(DATA8,"^",2),9,2)
124 W !?8," Admin Waived: ",$J($P(DATA8,"^",3)+$P(DATA8,"^",4)+$P(DATA8,"^",5),9,2)
125 W !?26,"---------"
126 W !?8," TOTAL Waived: ",$J($P(DATA8,"^")+$P(DATA8,"^",2)+$P(DATA8,"^",3)+$P(DATA8,"^",4)+$P(DATA8,"^",5),9,2)
127 W !!,RCWRLINE
128 Q
129 ;
130 ;
131ASKOK() ; ask to regenerate write off document
132 N DIR,DIQ2,DIRUT,DTOUT,DUOUT,X,Y
133 S DIR(0)="YO",DIR("B")="NO"
134 S DIR("A")="Are you sure you want to regenerate the write off document to FMS"
135 W ! D ^DIR
136 I $G(DTOUT)!($G(DUOUT)) S Y=-1
137 Q Y
Note: See TracBrowser for help on using the repository browser.