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

RMPRPIYA.m

Go to the documentation of this file.
RMPRPIYA ;HINCIO/ODJ - UP - Stock Reconciliation ;3/8/01
 ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
 Q
 ;
 ; Replaces UP option in old PIP (cf UPD^RMPR5NTU)
UP N RMPRERR,RMPRSTN,RMPREXC,RMPR5,RMPR6,RMPR11,RMPRV,RMPR,RMPRI,RMPROVAL
 N RMPR1,RMPRLCN
 ;
 ; Station
STN S RMPROVAL=$G(RMPRSTN("IEN"))
 W @IOF S RMPRERR=$$STN^RMPRPIY1(.RMPRSTN,.RMPREXC)
 I RMPRERR G UPX
 I RMPREXC'="" G UPX
 I RMPROVAL'=RMPRSTN("IEN") K RMPR1,RMPR11
 ;
 ;***** HCPCS - prompt for HCPCS and Item
HCPCS W !!,"Reconcile Inventory item quantities on hand...",!
 K RMPR11,RMPR6,RMPRVEND,RMPR5,RMPRQTY,RMPR1
 D HCPCS^RMPRPIY1(RMPRSTN("IEN"),$G(RMPR1("HCPCS")),.RMPR1,.RMPR11,.RMPREXC)
 I RMPREXC="P" G STN
 I RMPREXC="T" G UPX
 I RMPREXC="^" G UPX
 S (RMPR11("STATION"),RMPR11("STATION IEN"))=RMPRSTN("IEN")
 ;
 ;***** LOCN - prompt for location (if more than 1)
LOCN W ! S RMPRLCN=$$LOC1^RMPRPIYB(RMPRSTN("IEN"))
 I RMPRLCN D  G VEND0
 . K RMPR5
 . S RMPR5("IEN")=RMPRLCN
 . S RMPRERR=$$GET^RMPRPIX5(.RMPR5)
 . W !,"Location: "_RMPR5("NAME")
 . Q
 D LOCNM^RMPRPIY7(RMPRSTN("IEN"),.RMPR5,.RMPREXC)
 I RMPREXC="T" G UPX
 I RMPREXC="^" G HCPCS
 I RMPREXC="P" G HCPCS
 ;
 ; Vendor
VEND0 K RMPR
 S RMPR("STATION IEN")=RMPRSTN("IEN")
 S RMPR("LOCATION IEN")=RMPR5("IEN")
 S RMPR("HCPCS")=RMPR11("HCPCS")
 S RMPR("ITEM")=RMPR11("ITEM")
 K RMPRV
 S RMPRERR=$$STOCK^RMPRPIUV(.RMPR,.RMPRV)
 I RMPRV=0 G VEND
 S RMPRVEND("IEN")=$O(RMPRV(""))
 S RMPRVEND("NAME")=$P(RMPRV(RMPRVEND("IEN")),"^",3)
 S RMPRQTY=$P(RMPRV(RMPRVEND("IEN")),"^",1)
 I RMPRV>1 D
 . W !,"The following Vendors of the selected Item exist in this location..."
 . S RMPRI=""
 . F  S RMPRI=$O(RMPRV(RMPRI)) Q:RMPRI=""  D
 .. W !,$E($$GETVEN(RMPRI),1,20)
 .. W ?22,$P(RMPRV(RMPRI),"^",1)_" units on hand"
 .. Q
 . Q
VEND D VEND^RMPRPIY5(.RMPRVEND,.RMPREXC)
 I RMPREXC="T" G UPX
 I RMPREXC="^" G HCPCS
 I RMPREXC="P" G HCPCS
 ;
 ; Quantity
QTY D QTY^RMPRPIY5(.RMPRQTY,.RMPREXC)
 I RMPREXC="T" G UPX
 I RMPREXC="^" G HCPCS
 I RMPREXC="P" G VEND
 ;
 ; Now create reconciliation record
TRANS S RMPR11("STATION")=RMPRSTN("IEN")
 S RMPR11("STATION IEN")=RMPRSTN("IEN")
 S RMPR6("QUANTITY")=RMPRQTY
 S RMPR6("VENDOR")=RMPRVEND("IEN")
 S RMPR6("VENDOR IEN")=RMPRVEND("IEN")
 S RMPRERR=$$REC^RMPRPIU9(.RMPR6,.RMPR11,.RMPR5)
 I RMPRERR D
 . W !,"*** There were problems with the reconciliation, please contact support."
 . Q
 E  D
 . W !,"*** Item was reconciled..."
 . Q
 H 1
 K RMPR11,RMPR6,RMPRVEND,RMPR5,RMPRQTY,RMPR1
 G HCPCS
UPX D KILL^XUSCLEAN
 Q
 Q
 ;
 ; Return Vendor Name
GETVEN(RMPRIEN) ;
 N RMPRFDA,RMPRI,RMPRO,X,Y,DA
 S RMPRI=RMPRIEN_","
 D GETS^DIQ(440,RMPRI,".01","","RMPRO")
 Q RMPRO(440,RMPRI,.01)