source: FOIAVistA/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPOBILA.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1RMPOBILA ;HIN/RVD - BILLING TRANSACTIONS (ADD/DEL PATIENT) ;3/18/99
2 ;;3.0;PROSTHETICS;**29,46,41**;Feb 09, 1996
3 ;
4ADD K DIC,RMPODFN
5 S DIC("S")="I '$D(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,""V"",+Y))"
6 S DIC="^RMPR(665,",DIC(0)="QEAMZ" D ^DIC I Y<0!$$QUIT G EXIT
7 S RMPODFN=+Y I $$VEN(RMPOVDR)<1 W !,"** Error: ",$$STAT(RMPODFN),! G EXIT
8 I $D(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN)) G EXIT
9GETPAT ;get patient information
10 S ZXITM=0
11 F S ZXITM=$O(^RMPR(665,RMPODFN,"RMPOC",ZXITM)) Q:ZXITM'>0 D
12 . S ZX1=$G(^RMPR(665,RMPODFN,"RMPOC",ZXITM,0))
13 . Q:$P(ZX1,U,2)'=RMPOVDR D BUILDP,BUILDI W !,"Item ",$P(ZX1,U,1)," was added to Billing Transaction....",!
14 Q
15 ;
16VEN(RVEN) ; Determine whether to include trx for RMPODFN
17 ;
18 ; Do NOT process if not at correct site.
19 Q:$P($G(^RMPR(665,RMPODFN,"RMPOA")),U,7)'=RMPOXITE -1
20 ;
21 ; Do NOT process if no Boiler-plate
22 Q:'$D(^RMPR(665,RMPODFN,"RMPOA")) -2
23 ;
24 ; Do NOT process if Inactivation date less the billing date.
25 S RMPOINDT=$P($G(^RMPR(665,RMPODFN,"RMPOA")),U,3)
26 I $G(RMPOINDT) Q:RMPOINDT<RMPORVDT -3
27 ;
28 ; Do NOT process if no Rx
29 Q:'$D(^RMPR(665,RMPODFN,"RMPOB",0)) -4
30 ;
31 ; 1st find correct Rx
32 S RMPORX=$O(^RMPR(665,RMPODFN,"RMPOB","B"),-1)
33 Q:'RMPORX -5
34 ;
35 ; Quit if the Rx Expiration Date is before the billing period
36 Q:$P(^RMPR(665,RMPODFN,"RMPOB",RMPORX,0),U,3)<(RMPORVDT) -6
37 ;
38 ; Quit if there are no items.
39 Q:$O(^RMPR(665,RMPODFN,"RMPOC",0))'>0 -7
40 ;
41 I $G(RVEN)>0 Q $$VDRSTAT(RVEN)
42 Q 1
43 ;
44VDRSTAT(VDR) ;
45 S ZXITM=0,FOUND=0
46 F S ZXITM=$O(^RMPR(665,RMPODFN,"RMPOC",ZXITM)) Q:ZXITM'>0 D
47 . I $P($G(^RMPR(665,RMPODFN,"RMPOC",ZXITM,0)),U,2)=VDR S FOUND=1
48 Q $S(FOUND=1:1,1:-8)
49 Q
50 ;
51BUILDP ;Now the Patient level
52 Q:$D(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN)) ; DONE
53 K DA,DIC,DD,DO
54 S DA(3)=RMPOXITE,DA(2)=RMPORVDT,DA(1)=RMPOVDR,(DINUM,X)=RMPODFN
55 S DIC("P")=$P(^DD(665.7231,9,0),U,2),DIC(0)="L",ZV=",""V"","
56 S DIC="^RMPO(665.72,"_DA(3)_",1,"_DA(2)_",1,"_DA(1)_ZV
57 D FILE^DICN
58 Q
59 ;
60BUILDI ; BUILD ITEM (REQUIRES ZX1 = ENTIRE ITEM NODE FROM FILE #665)
61 ;Finally, set up the item multiple
62 K DA,DIC,DD,DO,DINUM,DIE,DR
63 S DA(4)=RMPOXITE,DA(3)=RMPORVDT,DA(2)=RMPOVDR,DA(1)=RMPODFN
64 S X=$P(ZX1,U),ZV=",""V"","
65 S DIC="^RMPO(665.72,"_DA(4)_",1,"_DA(3)_",1,"_DA(2)_ZV_DA(1)_",1,"
66 S DIC("P")=$P(^DD(665.72319,1,0),U,2),DIC(0)="L"
67 D FILE^DICN
68 S DIE=DIC,DA=+Y
69 ;Do some calculations
70 ;Multiply the unit cost by the number of units
71 S RMPOTOT=$P(ZX1,U,3)*$P(ZX1,U,4)
72 S RMREMARK=$P(ZX1,U,9)
73 S DR="1////"_$P(ZX1,U,11) ; PRIMARY ITEM
74 S DR=DR_";2////"_$P(ZX1,U,7) ; HCPCS CODE
75 S DR=DR_";3////"_$P(ZX1,U,6) ; FUND CONTROL POINT
76 S DR=DR_";4///^S X=RMREMARK" ; REMARKS
77 S DR=DR_";5///"_$P(ZX1,U,4) ; UNIT COST
78 S DR=DR_";6///"_$J($G(RMPOTOT),1,2) ; TOTAL (QTY X UNIT COST)
79 S DR=DR_";7///"_$P(ZX1,U,3) ; QUANTITY
80 S DR=DR_";8////"_$P(ZX1,U,8) ; ICD-9 CODE
81 S DR=DR_";12////"_ZXITM ; IEN OF ITEM
82 S DR=DR_";13////"_$P(ZX1,U,10) ; ITEM TYPE
83 S DR=DR_";14////"_$P(ZX1,U,5) ; UNIT OF ISSUE
84 S DR=DR_";17////"_$P(ZX1,U,12) ; RENTAL FLAG
85 S DR=DR_";18////"_$P(ZX1,U,13) ; OXYGEN CONSERVING FLAG
86 D ^DIE
87 Q
88STAT(RMPODFN) ;STATUS OF PT FOR GIVEN BUILD
89 S OK=$$VEN($G(RMPOVDR))
90 Q:OK=1 "OK"
91 Q:OK=-1 "Different Home Oxygen Contract Location"
92 Q:OK=-2 "No Home Oxygen Information"
93 Q:OK=-3 "Deactivated"
94 Q:OK=-4 "No RX on file"
95 Q:OK=-5 "No RX on file"
96 Q:OK=-6 "RX expires prior to billing period"
97 Q:OK=-7 "No items on file"
98 Q:OK=-8 "No items for vendor"
99 Q "Other Unknown Error"
100 Q
101QUIT() S QUIT=$D(DTOUT)!$D(DUOUT)!$D(DIROUT) Q QUIT
102 ;
103EXIT ;Kill variables before quitting
104 K DIC,RMPODFN,DA,DIR,Y,X,ZXITM
105 Q
106 ;
107DEL I '$$OK2EDIT D Q
108 . W !,$C(7)_"Cannot DELETE a Posted or Partially Posted Transactions. "
109 . K DIR S DIR(0)="E" D ^DIR
110 I $$LOCKED D Q
111 . W !,$C(7)_"Record is locked. " K DIR S DIR(0)="E" D ^DIR
112 K DIR S DIR("A")="Are you sure you want to delete patient from this month's billing " S DIR("B")="N",DIR(0)="Y"
113 D ^DIR I Y=0!$D(DTOUT)!$D(DUOUT) Q
114 S DA(3)=RMPOXITE,DA(2)=RMPORVDT,DA(1)=RMPOVDR,DA=RMPODFN
115 S DIK="^RMPO(665.72,"_DA(3)_",1,"_DA(2)_",1,"_DA(1)_","_"""V"""_","
116 D ^DIK
117 W:'$D(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0)) !!,"Patient deleted from billing..."
118 Q
119OK2EDIT() ;
120 ;
121 Q $P(^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0),U,3)'="Y"&($P(^(0),U,3)'="P")
122 Q
123LOCKED() ;
124 ;
125 L +^RMPO(665.72,RMPOXITE,1,RMPORVDT,1,RMPOVDR,"V",RMPODFN,0):2
126 Q '$T
Note: See TracBrowser for help on using the repository browser.