source: FOIAVistA/tag/r/PROSTHETICS-RMPR-RMPO-RMPS/RMPR5NDL.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

File size: 3.6 KB
Line 
1RMPR5NDL ;HIN/RVD-PROS INVENTORY DELETE UTILITY ;9/03/99
2 ;;3.0;PROSTHETICS;**37,51**;Feb 09, 1996
3 ;
4 ; ODJ - patch 51 - 10/20/00 - implement requirement for dual RMPR
5 ; manager signatories before deleting
6 ; locations.
7 ;
8 D DIV4^RMPRSIT I $D(Y),(Y<0) K DIC("B") Q
9 S X="NOW" D ^%DT
10LOC ;ask for Location.
11 W @IOF,!!,"Delete an Inventory Location.....",!
12 W !,"This option now requires the electronic signatures of 2 users"
13 W !,"holding the RMPRMANAGER key to be entered before a location"
14 W !,"will be deleted.",!
15 K DTOUT,DUOUT,DIC("B")
16 S DZ="??",D="B",DIC("S")="I $P(^RMPR(661.3,+Y,0),U,3)=RMPR(""STA"")"
17 S DIC="^RMPR(661.3,",DIC(0)="AEQM"
18 S D="B",DIC("A")="Enter Pros Location: " D MIX^DIC1
19 G:$D(DTOUT)!$D(DUOUT)!(Y'>0) EXIT S (DA,RMLODA)=+Y
20CHK D STOCK(RMLODA) ;check and display number&quantities of items
21OSIG I '$$GETO(DUZ) G EXIT ;get other signature exit if not OK
22ESIG I $D(XQUSER) D
23 . W !!,XQUSER," please..."
24 . Q
25 E D
26 . W !!,$P(^VA(200,DUZ,0),"^",1)," please..."
27 . Q
28 D SIG^XUSESIG G:X1="" EXIT ;get electronic sig. of main user
29DEL ;delete a location
30 S DIR(0)="Y",DIR("B")="N"
31 W !
32 S DIR("A")="Are you sure you want to DELETE this LOCATION (Y/N) "
33 D ^DIR I $D(DTOUT)!$D(DUOUT)!(Y="^")!(Y=0) W !,"Nothing Deleted.." G EXIT
34 L +^RMPR(661.3,RMLODA):2
35 I '$T W !,"Record in use. Try again later..." G EXIT
36 I Y>0 S DIK="^RMPR(661.3,",DA=RMLODA D ^DIK W:'$D(^RMPR(661.3,RMLODA,0)) !,"Location is deleted!!!!" H 2
37 ;
38 ;
39EXIT ;MAIN EXIT POINT
40 N RMPR,RMPRSITE D KILL^XUSCLEAN
41 Q
42 ;
43 ; Patch 51 - get electronic signatures from 2 RMPR managers in order
44 ; to OK a delete
45GETO(RMPRDUZ) ;
46 N RMPRMGR,RMPROK,RMPRUSR1,RMPRUSR2,X,X1,DUZ,RMPRKEYS
47 W !!,"Pease ask another user with the RMPRMANAGER key to"
48 W !,"enter their user name and electronic signature.",!
49 S RMPROK=0
50 S RMPRKEYS("RMPRMANAGER")=""
51 S RMPRUSR1("DUZ")=RMPRDUZ
52 I $$GETUSR2(.RMPRUSR2,.RMPRKEYS,.RMPRUSR1)'="" G GETOKX
53 S DUZ=RMPRUSR2("DUZ")
54 W !,RMPRUSR2("NAME")," please..."
55 D SIG^XUSESIG I X1="" G GETOKX
56 S RMPROK=1
57GETOKX Q RMPROK
58 ;
59 ; Get 2nd User and ensure they have RMPRMANAGER key
60GETUSR2(RMPRUSR2,RMPRKEYS,RMPRUSR1) ;
61 N DIC,X,Y,DLAYGO,DTOUT,DUOUT,RMPREXC,RMPRKEY,DUZ
62 S DUZ=RMPRUSR1("DUZ")
63USR2E K RMPRUSR2
64 S DIC="^VA(200,"
65 S DIC(0)="ABEQ"
66 S DIC("A")="Enter user name of 2nd manager:"
67 D ^DIC
68 I Y=-1 S RMPREXC="^" G USR2X
69 S RMPRUSR2("DUZ")=$P(Y,U,1)
70 ;
71 ; User 2 can't be same as user 1
72 I RMPRUSR2("DUZ")=RMPRUSR1("DUZ") D G USR2E
73 . W !,"The 2nd manager must be different to the manager logged on."
74 . Q
75 ;
76 ; User 2 must have defined security keys
77 S RMPRKEY=""
78 F S RMPRKEY=$O(RMPRKEYS(RMPRKEY)) Q:RMPRKEY="" Q:$D(^XUSEC(RMPRKEY,RMPRUSR2("DUZ")))
79 I RMPRKEY="" D G USR2E
80 . W !,"The 2nd manager does not have the correct security key set up."
81 . Q
82 ;
83 ; User 2 verified
84 S RMPRUSR2("NAME")=$P(Y,U,2)
85 S RMPREXC=""
86USR2X Q RMPREXC
87 ;
88 ; Get number of HCPC items, quantity in stock and cost for location
89STOCK(RMPRILOC) ;
90 N IEN1,IEN2,S,RMPRSTK
91 K RMPRSTK S RMPRSTK("ITEMS")=0
92 S IEN1=0
93 F S IEN1=$O(^RMPR(661.3,RMPRILOC,1,IEN1)) Q:'+IEN1 D
94 . S IEN2=0
95 . F S IEN2=$O(^RMPR(661.3,RMPRILOC,1,IEN1,1,IEN2)) Q:'+IEN2 D
96 .. S RMPRSTK("ITEMS")=1+RMPRSTK("ITEMS")
97 .. S S=$G(^RMPR(661.3,RMPRILOC,1,IEN1,1,IEN2,0))
98 .. S RMPRSTK("QOH")=$P(S,"^",2)+$G(RMPRSTK("QOH"))
99 .. S RMPRSTK("COST")=$P(S,"^",3)+$G(RMPRSTK("COST"))
100 .. Q
101 . Q
102 W !,"The above location contains "
103 W RMPRSTK("ITEMS")," types of items"
104 I RMPRSTK("ITEMS")=0 D
105 . W "."
106 . Q
107 E D
108 . W ", ",!,"with a total quantity of ",RMPRSTK("QOH")
109 . W " and cost of $",RMPRSTK("COST"),"."
110 . Q
111 W !
112 Q
Note: See TracBrowser for help on using the repository browser.