source: WorldVistAEHR/trunk/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPR5NAE.m@ 824

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

initial load of WorldVistAEHR

File size: 4.3 KB
Line 
1RMPR5NAE ;HIN/RVD-PROS INVENTORY ADD UTILITY ;2/11/98
2 ;;3.0;PROSTHETICS;**33,37,55**;Feb 09, 1996
3 ;
4 ;RVD patch #55 - fix the locking problem and don't allow
5 ; Fileman to use the number entered as an
6 ; PSAS/ITEM name
7 ;
8 D DIV4^RMPRSIT I $D(Y),(Y<0) K DIC("B") Q
9 S X="NOW" D ^%DT
10LOC ;add location.
11 W @IOF,!!,"Adding Item to a Location.....",! K DTOUT,DUOUT,DIC("B")
12 S DZ="??",D="B",DIC("S")="I $P(^RMPR(661.3,+Y,0),U,3)=RMPR(""STA"")"
13 S DIC="^RMPR(661.3,",DLAYGO=661.3,DIC(0)="AEQL"
14 S D="B",DIC("A")="Enter Pros Location: " D MIX^DIC1
15 G:$D(DTOUT)!$D(DUOUT)!(Y'>0) EXIT S (DA,RMLODA)=+Y
16 L +^RMPR(661.3,+Y,0):2
17 I '$T W !,"Record in use. Try again later..." H 3 G LOC
18 S RMLOC=$P(^RMPR(661.3,+Y,0),U,1),DIK=DIC
19 I $P(^RMPR(661.3,DA,0),U,3)="" S $P(^(0),U,3)=RMPR("STA") D IX1^DIK
20 L -^RMPR(661.3,RMLODA,0)
21 ;
22LIST ;list current HCPCS @ this Location
23 K DIR,DIC("S") S DIR(0)="FO",DIR("A")="Select HCPCS to ADD ",DIR("?")="^S RFL=1 D DSP^RMPR5NU1"
24 S DIR="^RMPR(661.1," D ^DIR G:(Y="^")!(Y="")!$D(DTOUT)!$D(DUOUT) LOC
25 S DIC(0)="EMNZ",DIC("S")="I $P(^RMPR(661.1,+Y,0),U,5)=1"
26 S DIC=661.1,DIC(0)="ENMZ" D ^DIC G:$D(DTOUT)!$D(DUOUT) LOC
27 G:Y="^" LOC
28 I +Y'>0 W !,"** No HCPCS Selected or Unable to Select Inactive HCPCS..." G LIST
29 S RMDAHC=+Y,RMHCPC=$P(^RMPR(661.1,RMDAHC,0),U,1)
30 S (RMITFLG,RMHCFLG,RMHCDA,RMITDA,RMAV,RMAVA,RMCO,RMBAL)=0
31 S DIC(0)="AEMQ",DA(1)=RMDAHC K DIC("S")
32ITEM ;ask for PSAS Item to add
33 S DIC("A")="Enter Item to Add: "
34 S DIC("B")=$O(^RMPR(661.1,RMDAHC,3,"B",0))
35 S DIC="^RMPR(661.1,"_DA(1)_",3,",RDIC1=DIC
36 S $P(^RMPR(661.1,DA(1),3,0),U,2)="661.12"
37 S DIC(0)="ALEMQ",DLAYGO=661.1 D ^DIC
38 G:Y'>0!$D(DTOUT)!$D(DUOUT) LIST S (DA,RMDAIT)=+Y K DIC("B"),DLAYGO
39 S DIE=DIC,DR=".01R" D ^DIE
40 G:'$D(^RMPR(661.1,RMDAHC,3,RMDAIT,0)) LIST
41 S RM1=$G(^RMPR(661.1,RMDAHC,3,RMDAIT,0)) G:RM1="" LIST
42 S RMAV=$P(RM1,U,2),RMTOBA=$P(RM1,U,3),RMTOCO=$P(RM1,U,4)
43 S $P(^RMPR(661.1,RMDAHC,0),U,9)=1
44 S RMITEM=$P(^RMPR(661.1,RMDAHC,3,RMDAIT,0),U,1)
45 S RMIT=RMHCPC_"-"_RMDAIT,RMHC=RMDAHC
46 ;
47 ;for HCPCS in 661.3
48 K DIC("A") S DA(1)=RMLODA
49 I '$D(^RMPR(661.3,RMLODA,1,"B",RMDAHC)) S X=RMDAHC D
50 .S $P(^RMPR(661.3,RMLODA,1,0),U,2)="661.31"
51 .K DD,DO S DIC="^RMPR(661.3,"_DA(1)_",1,",DIC(0)="L",DLAYGO=661.3
52 .D FILE^DICN Q:Y=-1
53 S RMHCDA=$O(^RMPR(661.3,RMLODA,1,"B",RMDAHC,0))
54 G:'RMHCDA EXIT
55 ;
56 ;for item in 661.3
57 S DA(2)=RMLODA,DA(1)=RMHCDA
58 S DIC="^RMPR(661.3,"_DA(2)_",1,"_DA(1)_",1,",RDIC3=DIC
59 I '$D(^RMPR(661.3,RMLODA,1,RMHCDA,1,"B",RMIT)) S X=RMIT D
60 .S $P(^RMPR(661.3,RMLODA,1,RMHCDA,1,0),U,2)="661.312I"
61 .K DD,DO S DLAYGO=661.3,DIC(0)="L" D FILE^DICN Q:Y=-1
62 S (DA,RMITDA)=$O(^RMPR(661.3,RMLODA,1,RMHCDA,1,"B",RMIT,0))
63 G:'RMITDA EXIT
64 L +^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA):2
65 I '$T W !!,"Record in use. Try again later..." H 3 G LOC
66 S RM3=^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA,0)
67 S RMQU=$P(RM3,U,2),RMCO=$P(RM3,U,3) S:'RMQU RMQU=0 S:'RMCO RMCO=0
68 ;
69UPD ;updates item in 661.3
70 S (RMAVA,RMQUD,RMCOD)=0
71 S DIE=RDIC3,DR="29R",DIE("NO^")="BACK" D ^DIE
72 S DR="22R;23R~TOTAL COST OF QUANTITY;24;25R;26;27"
73 S DR=DR_";28//^S X=RMITEM" D ^DIE
74 S RM3A=^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA,0)
75 S RMQUA=$P(RM3A,U,2),RMCOA=$P(RM3A,U,3),RMAVA=$P(RM3A,U,10),RMSO=$P(RM3A,U,9)
76 I (RMSO="C")&(RMCOA<.0001) G LOC
77 I RMSO="C" S:(RMAVA<1)&($G(RMQUA)) RMAVA=RMCOA/RMQUA
78 I RMCO'=RMCOA S RMCOD=RMCOA-RMCO
79 I RMQU'=RMQUA S RMQUD=RMQUA-RMQU
80 I RMQUD,'RMCOD S RMCOA=RMAVA*RMQUA
81 I 'RMQUD,RMCOD S:RMQUA>0 RMAVA=RMCOA/RMQUA
82 I RMQUD,RMCOD S:RMQUA>0 RMAVA=RMCOA/RMQUA
83 S $P(^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA,0),U,3)=RMCOA
84 S $P(^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA,0),U,8)=RMITEM
85 S $P(^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA,0),U,10)=$J(RMAVA,0,2)
86 ;
87STAT ;create an item statistics for this event.
88 G:RMQU=RMQUA&(RMCO=RMCOA) LOC
89 D BAL^RMPR5NU1
90 L -^RMPR(661.3,RMLODA,1,RMHCDA,1,RMITDA)
91 K DD,DO S DIC="^RMPR(661.2,",DIC(0)="L",X=DT,DLAYGO=661.2 D FILE^DICN
92 G:$D(DTOUT)!(Y'>0) LOC S DA=+Y
93 S RMMESF="Added/Updated by "_$E($P(^VA(200,DUZ,0),U,1),1,15)_": ("
94 S RMMESF=RMMESF_$S(RMQUD>0:"+"_RMQUD_")",1:RMQUD_")")
95 S ^RMPR(661.2,DA,0)=DT_"^^^"_RMDAHC_"^^^"_DUZ_"^"_RMQUD_"^"_RMIT_"^^^"_RMTOBA_"^"_RMMESF_"^"_$J(RMTOCO,0,2)_"^"_RMPR("STA")_"^"_RMLODA_"^"_$J(RMAVA,0,2) S DIK=DIC D IX1^DIK
96 W !!,"** Item ",RMITEM," was ",RMMESF," @ Location ",RMLOC
97 H 1 G LIST
98 ;
99EXIT ;MAIN EXIT POINT
100 N RMPRSITE,RMPR D KILL^XUSCLEAN
101 Q
Note: See TracBrowser for help on using the repository browser.