Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: RMPR5NDL

RMPR5NDL.m

Go to the documentation of this file.
  1. RMPR5NDL ;HIN/RVD-PROS INVENTORY DELETE UTILITY ;9/03/99
  1. ;;3.0;PROSTHETICS;**37,51**;Feb 09, 1996
  1. ;
  1. ; ODJ - patch 51 - 10/20/00 - implement requirement for dual RMPR
  1. ; manager signatories before deleting
  1. ; locations.
  1. ;
  1. D DIV4^RMPRSIT I $D(Y),(Y<0) K DIC("B") Q
  1. S X="NOW" D ^%DT
  1. LOC ;ask for Location.
  1. W @IOF,!!,"Delete an Inventory Location.....",!
  1. W !,"This option now requires the electronic signatures of 2 users"
  1. W !,"holding the RMPRMANAGER key to be entered before a location"
  1. W !,"will be deleted.",!
  1. K DTOUT,DUOUT,DIC("B")
  1. S DZ="??",D="B",DIC("S")="I $P(^RMPR(661.3,+Y,0),U,3)=RMPR(""STA"")"
  1. S DIC="^RMPR(661.3,",DIC(0)="AEQM"
  1. S D="B",DIC("A")="Enter Pros Location: " D MIX^DIC1
  1. G:$D(DTOUT)!$D(DUOUT)!(Y'>0) EXIT S (DA,RMLODA)=+Y
  1. CHK D STOCK(RMLODA) ;check and display number&quantities of items
  1. OSIG I '$$GETO(DUZ) G EXIT ;get other signature exit if not OK
  1. ESIG I $D(XQUSER) D
  1. . W !!,XQUSER," please..."
  1. . Q
  1. E D
  1. . W !!,$P(^VA(200,DUZ,0),"^",1)," please..."
  1. . Q
  1. D SIG^XUSESIG G:X1="" EXIT ;get electronic sig. of main user
  1. DEL ;delete a location
  1. S DIR(0)="Y",DIR("B")="N"
  1. W !
  1. S DIR("A")="Are you sure you want to DELETE this LOCATION (Y/N) "
  1. D ^DIR I $D(DTOUT)!$D(DUOUT)!(Y="^")!(Y=0) W !,"Nothing Deleted.." G EXIT
  1. L +^RMPR(661.3,RMLODA):2
  1. I '$T W !,"Record in use. Try again later..." G EXIT
  1. I Y>0 S DIK="^RMPR(661.3,",DA=RMLODA D ^DIK W:'$D(^RMPR(661.3,RMLODA,0)) !,"Location is deleted!!!!" H 2
  1. ;
  1. ;
  1. EXIT ;MAIN EXIT POINT
  1. N RMPR,RMPRSITE D KILL^XUSCLEAN
  1. Q
  1. ;
  1. ; Patch 51 - get electronic signatures from 2 RMPR managers in order
  1. ; to OK a delete
  1. GETO(RMPRDUZ) ;
  1. N RMPRMGR,RMPROK,RMPRUSR1,RMPRUSR2,X,X1,DUZ,RMPRKEYS
  1. W !!,"Pease ask another user with the RMPRMANAGER key to"
  1. W !,"enter their user name and electronic signature.",!
  1. S RMPROK=0
  1. S RMPRKEYS("RMPRMANAGER")=""
  1. S RMPRUSR1("DUZ")=RMPRDUZ
  1. I $$GETUSR2(.RMPRUSR2,.RMPRKEYS,.RMPRUSR1)'="" G GETOKX
  1. S DUZ=RMPRUSR2("DUZ")
  1. W !,RMPRUSR2("NAME")," please..."
  1. D SIG^XUSESIG I X1="" G GETOKX
  1. S RMPROK=1
  1. GETOKX Q RMPROK
  1. ;
  1. ; Get 2nd User and ensure they have RMPRMANAGER key
  1. GETUSR2(RMPRUSR2,RMPRKEYS,RMPRUSR1) ;
  1. N DIC,X,Y,DLAYGO,DTOUT,DUOUT,RMPREXC,RMPRKEY,DUZ
  1. S DUZ=RMPRUSR1("DUZ")
  1. USR2E K RMPRUSR2
  1. S DIC="^VA(200,"
  1. S DIC(0)="ABEQ"
  1. S DIC("A")="Enter user name of 2nd manager:"
  1. D ^DIC
  1. I Y=-1 S RMPREXC="^" G USR2X
  1. S RMPRUSR2("DUZ")=$P(Y,U,1)
  1. ;
  1. ; User 2 can't be same as user 1
  1. I RMPRUSR2("DUZ")=RMPRUSR1("DUZ") D G USR2E
  1. . W !,"The 2nd manager must be different to the manager logged on."
  1. . Q
  1. ;
  1. ; User 2 must have defined security keys
  1. S RMPRKEY=""
  1. F S RMPRKEY=$O(RMPRKEYS(RMPRKEY)) Q:RMPRKEY="" Q:$D(^XUSEC(RMPRKEY,RMPRUSR2("DUZ")))
  1. I RMPRKEY="" D G USR2E
  1. . W !,"The 2nd manager does not have the correct security key set up."
  1. . Q
  1. ;
  1. ; User 2 verified
  1. S RMPRUSR2("NAME")=$P(Y,U,2)
  1. S RMPREXC=""
  1. USR2X Q RMPREXC
  1. ;
  1. ; Get number of HCPC items, quantity in stock and cost for location
  1. STOCK(RMPRILOC) ;
  1. N IEN1,IEN2,S,RMPRSTK
  1. K RMPRSTK S RMPRSTK("ITEMS")=0
  1. S IEN1=0
  1. F S IEN1=$O(^RMPR(661.3,RMPRILOC,1,IEN1)) Q:'+IEN1 D
  1. . S IEN2=0
  1. . F S IEN2=$O(^RMPR(661.3,RMPRILOC,1,IEN1,1,IEN2)) Q:'+IEN2 D
  1. .. S RMPRSTK("ITEMS")=1+RMPRSTK("ITEMS")
  1. .. S S=$G(^RMPR(661.3,RMPRILOC,1,IEN1,1,IEN2,0))
  1. .. S RMPRSTK("QOH")=$P(S,"^",2)+$G(RMPRSTK("QOH"))
  1. .. S RMPRSTK("COST")=$P(S,"^",3)+$G(RMPRSTK("COST"))
  1. .. Q
  1. . Q
  1. W !,"The above location contains "
  1. W RMPRSTK("ITEMS")," types of items"
  1. I RMPRSTK("ITEMS")=0 D
  1. . W "."
  1. . Q
  1. E D
  1. . W ", ",!,"with a total quantity of ",RMPRSTK("QOH")
  1. . W " and cost of $",RMPRSTK("COST"),"."
  1. . Q
  1. W !
  1. Q