source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPOBIL6.m@ 1582

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

initial load of FOIAVistA 6/30/08 version

File size: 7.9 KB
Line 
1RMPOBIL6 ;HINES/RVD - HOME OXYGEN BILLING TRANSACTIONS ;9/16/02 11:01
2 ;;3.0;PROSTHETICS;**70**;Feb 09, 1996
3 ;
4 ;RVD 7/8/02 patch #70 - This routine is a copy of RMPOBIL2 routine.
5 ; For Read Only 2319.
6 ;
7 Q
82319 ; SHOW PAGE 8 OF 2319
9 ;S:$D(RMPRDFN)&('$D(RMPODFN)) RMPODFN=RMPRDFN
10 S RMPODFN=RMPRDFN
11 D BPI,DPI
12 K DIR S DIR(0)="E" D ^DIR
13 I $$QUIT G ASK1^RMPOPAT
14 D ^RMPOBIL7
15 K PTI,I,RX,Y,DT1,DT2,TRX,IENS,DFN
16 Q
17QUIT() S QUIT=$D(DTOUT)!$D(DUOUT)!$D(DIROUT) Q QUIT
18EQUIT() S QUIT=$D(DTOUT)!$D(Y) Q QUIT
19LJ(S,W,C) ; Left justify S in a field W wide padding with char C
20 ;
21 S C=$G(C," ") ; Default pad char is space
22 I $L(S)'=W S $P(S,C,W-$L(S)+$L(S,C))=""
23 Q $E(S,1,W)
24EDIT ;NEW billing transaction edit module
25 ;This module edits a single billing transaction (trx)
26 ;a single trx is identified by 4 values
27 ; site, billing month, vendor, and patient
28 ; these four values represent an entry in file 665.72
29 ;
30 Q:'($D(RMPOXITE)&$D(RMPORVDT)&$D(RMPOVDR)&$D(RMPODFN))
31 Q:'$D(^RMPO(665.72,+RMPOXITE,1,+RMPORVDT,1,+RMPOVDR,"V",+RMPODFN))
32 ; previous two lines for development only - shouldn't be needed
33 ;
34 D ITEM
35EXIT L -^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0)
36 K ITM,IEN,IENS,ITMACT,PTI,TMP,ZX1,TOT,T910,OTH,A,RX,TRX,DT1,DT2
37 K DIC,DIE,DA,DR,DO,DD,DIR,DIK,DIROUT,DUOUT
38 K TIEN,FCP,DFN,I,ITEM,NEW,QUIT,TOTAL,VADM,X,Y,Z,Z1,Z2,ZV,Z3
39 K PSTFLG,PITM,BACKPTR,POSTED,SUSP,DFCP,C,W,S,CIEN,RMIT,RMDIC
40 Q
41QUIK ; QUICK ITEM EDIT
42 ;
43 I '$$OK2EDIT D Q
44 . W !,$C(7)_"Cannot edit Accepted Transactions. "
45 . W "Please 'Unaccept' first." K DIR S DIR(0)="E" D ^DIR
46 I $$LOCKED D Q
47 . W !,$C(7)_"Record is locked. " K DIR S DIR(0)="E" D ^DIR
48 D ITEMD
49 F I=1:1:IEN D Q:QUIT
50 . W !,ITM(I)
51 .K DR D SDICE
52 .S DA=IEN(I),DR="7" D ^DIE Q:$$EQUIT
53 .S Z=^RMPO(665.72,DA(4),1,DA(3),1,DA(2),"V",DA(1),1,DA,0)
54 .S Z1=$P(Z,U,7),Z2=$P(Z,U,5),Z3=$P(Z,U,11)
55 .S DR="6///"_((Z1*Z2)-Z3) D ^DIE Q:$$EQUIT
56 D BII,DII
57 K DIR S DIR(0)="E" D ^DIR Q:$$QUIT
58 G EXIT
59 Q
60ITEM ; Main edit loop
61 ;
62 I '$$OK2EDIT D Q
63 . W !,$C(7)_"Cannot edit Accepted Transactions. "
64 . W "Please 'Unaccept' first." K DIR S DIR(0)="E" D ^DIR
65 I $$LOCKED D Q
66 . W !,$C(7)_"Record is locked. " K DIR S DIR(0)="E" D ^DIR
67 ;
68ITEMLOOP ;
69 ;
70 S QUIT=0
71 D ITEMD
72 ; ask for ACTION, quit if <return>, timeout, etc
73 S ITMACT=$$ITEMO Q:$$QUIT!(ITMACT="")
74 ; if they entered 'A', do ADD ITEM, then edit it
75 I ITMACT="A" D ITEMA Q:QUIT!(ITEM="") D ITEME Q:QUIT G ITEMLOOP
76 ; if they entered 'D', select an item, then delete it
77 I ITMACT="D" D ITEMS Q:QUIT!(ITEM="") D ITEMK G ITEMLOOP
78 ; if they entered 'E', select an item, then edit it
79 I ITMACT="E" D ITEMS Q:QUIT!(ITEM="") D ITEME Q:QUIT G ITEMLOOP
80 ; if they entered 'Z', select an item, then zero it
81 I ITMACT="Z" D ITEMS Q:QUIT!(ITEM="") D ITEMZ Q:QUIT G ITEMLOOP
82 G ITEMLOOP
83 Q
84OK2EDIT() ;
85 ;
86 Q $P(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0),U,2)'="Y"
87 Q
88LOCKED() ;
89 ;
90 L +^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0):2
91 Q '$T
92 Q
93ITEMD ; Display items
94 ;
95 D BPI,DPI,BII,DII
96 Q
97BPI ; Build pt info hdr
98 K PTI
99 ; Name,SSN
100 S DFN=RMPODFN D DEM^VADPT
101 S PTI(1)=VADM(1)_" "_$P(VADM(2),U,2)
102 ; Current Rx (IEN on ACT DATE)
103 S RX=$O(^RMPR(665,RMPODFN,"RMPOB"," "),-1)
104 Q:'RX
105 S Y=$P(^RMPR(665,RMPODFN,"RMPOB",RX,0),U) X ^DD("DD") S DT1=Y
106 S Y=$P(^RMPR(665,RMPODFN,"RMPOB",RX,0),U,3) X ^DD("DD") S DT2=Y
107 S PTI(2)="Current Prescription (#"_RX_")"
108 S PTI(3)=" Active Date: "_DT1_" Expiration Date: "_DT2
109 ; Rx Remarks
110 K TRX
111 S IENS=RX_","_RMPODFN_","
112 D GETS^DIQ(665.193,IENS,3,,"TRX")
113 S I=0 F S I=$O(TRX(665.193,IENS,3,I)) Q:I="" D
114 . S PTI(3+I)=" "_TRX(665.193,IENS,3,I)
115 Q
116DPI ; Display pt info hdr
117 S I=0 F S I=$O(PTI(I)) Q:I="" W !,PTI(I)
118 Q
119BII ; Build item info array
120 K TRX,ITM,TOT,SUSP,POSTED,PITM,IEN,CIEN
121 S SUSP=0,CIEN=1
122 S IENS=RMPODFN_","_RMPOVDR_","_RMPORVDT_","_RMPOXITE
123 D GETS^DIQ(665.72319,IENS,"**","IE","TRX")
124 S ZX1=""
125 F IEN=0:1 S ZX1=$O(TRX(665.723191,ZX1)) Q:ZX1="" D
126 . K TMP M TMP=TRX(665.723191,ZX1)
127 . F Z=5,6,10 S TMP(Z,"E")=$J($G(TMP(Z,"E")),0,2)
128 . S TIEN=+ZX1 D BIIL
129 K TMP
130 S TMP(2,"E")="HCPCS"
131 S TMP(.01,"E")="Description"
132 S TMP(3,"E")="FCP"
133 S TMP(7,"E")="Qty"
134 S TMP(5,"E")="Cost"
135 S TMP(6,"E")="Total"
136 S TMP(8,"I")=" "
137 S TMP(10,"E")="Susp."
138 S (CIEN,TIEN)=0 D BIIL
139 Q
140BIIL ;Build detail line
141 ;
142 S:TIEN IEN(CIEN)=TIEN ;S:TIEN IEN(TIEN)=TIEN
143 S ITM(CIEN)=" "
144 ;S:TIEN ITM(TIEN)=$J(TIEN,2)_"." ; ITEM #
145 S:TIEN ITM(CIEN)=$J(CIEN,2)_"." ; ITEM #
146 S PSTFLG=$S($G(TMP(8,"I"))="Y":"p",1:" ")
147 S BACKPTR=$G(TMP(12,"I"))
148 S TMP(.01,"E")=$G(TMP(.01,"E"))_" "
149 S ITM(CIEN)=ITM(CIEN)_$$LJ(PSTFLG,2) ; POSTED
150 S ITM(CIEN)=ITM(CIEN)_$$LJ($G(TMP(2,"E")),7) ; HCPCS
151 S ITM(CIEN)=ITM(CIEN)_$$LJ($G(TMP(.01,"E")),30) ; ITEM DESCR
152 S ITM(CIEN)=ITM(CIEN)_" "_$$LJ($P($G(TMP(3,"E"))," "),5) ; FCP
153 S ITM(CIEN)=ITM(CIEN)_$J($G(TMP(7,"E")),5) ; QTY
154 S ITM(CIEN)=ITM(CIEN)_$J($G(TMP(5,"E")),8) ; UNIT COST
155 S ITM(CIEN)=ITM(CIEN)_$J($G(TMP(10,"E")),8) ; SUSP
156 S ITM(CIEN)=ITM(CIEN)_$J($G(TMP(6,"E")),8) ; QTY * CST
157 ; Quit if we're doing the header
158 Q:TIEN=0
159 I $G(TMP(8,"I"))="Y" S POSTED(TIEN)=""
160 ; Do totals while we're here
161 S FCP=+TMP(3,"E"),TOTAL=TMP(6,"E")
162 S TOT(FCP)=$G(TOT(FCP))+TOTAL
163 S TOT=$G(TOT)+TOTAL
164 S SUSP=SUSP+$G(TMP(10,"E")),CIEN=CIEN+1
165 Q
166DII ; Display item info array
167 Q:'$G(IEN)
168 W ! F I=0:1:IEN W !,ITM(I)
169 W !!,"TOTAL COST",?72,$J(TOT,6,2),!
170 W !,"Total 910 Charges:",?72,$J(+$G(TOT(910)),6,2),!
171 W !,"Total Station FCP Charges:",?72,$J(TOT-$G(TOT(910)),6,2),!
172 W:SUSP !,"Total Suspended Charges:",?72,$J(SUSP,6,2),!
173 Q
174ITEMO() ; Select action (A/E/D/Z)
175 K DIR
176 S DIR(0)="SBO^A:Add;D:Delete;E:Edit;Z:Zero"
177 S DIR("A")="Select ACTION" D ^DIR
178 Q Y
179 Q
180ITEMA ; Add an item
181 S ITEM=""
182 K DIC S DIC="^RMPR(661,",DIC(0)="AEQMZ" D ^DIC Q:Y<0!$$QUIT
183 S NEW=+Y
184 K DD,DO D SDICE S DIC(0)="LN" S X=NEW
185 D FILE^DICN Q:Y<0!$$QUIT
186 S DA=+Y,DR="2;9" D ^DIE I $$EQUIT S DIK=DIE D WAK Q
187 ;S FCP=$$GETFCP^RMPOBILU I $$QUIT!(FCP<0) S DIK=DIE D WAK Q
188 ;S DR="3///"_$P(FCP,U,2) D ^DIE I $$EQUIT S DIK=DIE D WAK Q
189 ;S ITEM=DA,IEN=$G(IEN)+1,IEN(IEN)=ITEM
190 S IEN=$G(IEN)+1,IEN(IEN)=DA,ITEM=IEN
191 Q
192SDICE ; Set DIC,DIE,DA for adding Trx items
193 K DIC,DIE,DA
194 S ZV=",""V"","
195 S DA(1)=RMPODFN,DA(2)=RMPOVDR,DA(3)=RMPORVDT,DA(4)=RMPOXITE
196 S DIC="^RMPO(665.72,"_DA(4)_",1,"_DA(3)_",1,"_DA(2)_ZV_DA(1)_",1,"
197 S DIE=DIC
198 Q
199ITEMS ; Select an item
200 I IEN=1 S ITEM=1 Q
201 K DIR
202 S ITEM=""
203 S DIR(0)="NO^1:"_IEN,DIR("A")="Select an ITEM"
204 S DIR("?")="Note: You cannot select POSTED items"
205 M DIR("?")=ITM
206 D ^DIR Q:Y'>0!$$QUIT
207 I $D(POSTED(+Y)) D G ITEMS
208 . W !,$C(7)_"Item "_(+Y)_" has been POSTED!"
209 S ITEM=+Y I $P($G(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,1,ITEM,0)),U,8)="Y" S PITM=ITEM
210 S BACKPTR=$P($G(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,1,ITEM,0)),U,13)
211 I $G(BACKPTR),$D(^RMPR(665,RMPODFN,"RMPOC",BACKPTR,0)),$P(^RMPR(665,RMPODFN,"RMPOC",BACKPTR,0),U,11)="Y" S PITM=ITEM
212 Q
213ITEME ; Edit an item
214 K DR D SDICE
215 S DIE("NO^")="BACK"
216 S DA=IEN(ITEM),DR="1;7;S Z1=X;5;S Z2=X;4" D ^DIE Q:$$EQUIT
217SACK S DR="10;S Z3=X" D ^DIE Q:$$EQUIT
218 I Z3>(Z1*Z2) D G SACK
219 . W !,"SUSPENDED AMT SHOULD NOT BE GREATER THAN TOTAL AMOUNT!"
220 S DR="11"_$S(+X=0:"///@",1:"") D ^DIE Q:$$EQUIT
221 S DR="6///"_((Z1*Z2)-Z3) D ^DIE Q:$$EQUIT
222 S DFCP=$P(^RMPO(665.72,DA(4),1,DA(3),1,DA(2),"V",DA(1),1,DA,0),U,3)
223 F D Q:(FCP>0)!QUIT
224 . S FCP=$P($$GETFCP^RMPOBILU(DFCP),U,2) Q:$$QUIT
225 . I FCP<0!(FCP="") W $C(7)_"REQUIRED FIELD!"
226 I FCP>0 S DR="3R///"_FCP_";13;14" D ^DIE Q:$$EQUIT
227 Q
228ITEMZ ; Zero an item
229 K DR D SDICE
230 S DA=IEN(ITEM),DR="5///0;6///0;10///0;11///@" D ^DIE Q:$$EQUIT
231 Q
232ITEMK ; Delete an item
233 D SDICE
234 S RMDIC=DIC_IEN(ITEM)_",0)",RMIT=$G(@RMDIC),PITM=$P(RMIT,U,8)
235 I PITM="Y" D Q
236 . W !,"Can't delete PRIMARY ITEM!"
237 K DIR S DIR(0)="Y",DIR("A")="Are you SURE you want to delete this item"
238 S DIR("B")="NO" D ^DIR Q:Y'>0
239 K DIK,DA D SDICE S DIK=DIC,DA=IEN(ITEM)
240WAK D ^DIK W " ...deleted!"
241 Q
Note: See TracBrowser for help on using the repository browser.