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

RMPRPIU7.m

Go to the documentation of this file.
  1. RMPRPIU7 ;HINCIO/ODJ - PIP STOCK RECEIPT UPDATE UTILITY ;3/8/01
  1. ;;3.0;PROSTHETICS;**61**;Feb 09, 1996
  1. Q
  1. ;
  1. ;***** REC - Create a Stock Receipt Transaction
  1. ; implements business rules for Stock Receipt
  1. ; called by RMPRPIY9
  1. ;
  1. ; Inputs:
  1. ; RMPR6 - Transaction (661.6) array elements
  1. ; RMPR6("VENDOR") - Vendor ien
  1. ; RMPR6("QUANTITY") - Receipt quantity
  1. ; RMPR6("VALUE") - Total $ value of received quantity
  1. ; RMPR6("COMMENT") - (optional) comment
  1. ;
  1. ; RMPR11 - HCPCS Item (661.11) array elements
  1. ; RMPR11("STATION IEN")
  1. ; RMPR11("HCPCS")
  1. ; RMPR11("ITEM")
  1. ;
  1. ; RMPR5 - Location (661.5) array elements
  1. ; RMPR5("IEN") - Location ien (ptr ^RMPR(661.5,)
  1. ;
  1. ; RMPR4
  1. ;
  1. ; Outputs:
  1. ; RMPR6("IEN")
  1. ; RMPR4("IEN")
  1. ; RMPRERR
  1. ;
  1. REC(RMPR6,RMPR11,RMPR5) ;
  1. N RMPRERR,RMPR6I,RMPR7,RMPR9
  1. S RMPRERR=0
  1. S RMPR6("COMMENT")=$G(RMPR6("COMMENT"))
  1. S RMPR6("SEQUENCE")=1
  1. S RMPR6("TRAN TYPE")=1
  1. S RMPR6("LOCATION")=$G(RMPR5("IEN"))
  1. S RMPR6("HCPCS")=$G(RMPR11("HCPCS"))
  1. S RMPR6("ITEM")=$G(RMPR11("ITEM"))
  1. S RMPR6("USER")=$G(DUZ)
  1. I RMPR6("QUANTITY")=0 G RECX
  1. ;
  1. ; Lock current stock to prevent simultaneous access at HCPCS Item level
  1. L +^RMPR(661.7,"XSLHIDS",RMPR11("STATION IEN"),RMPR5("IEN"),RMPR11("HCPCS"),RMPR11("ITEM"))
  1. ;
  1. ; Create 661.6 Transaction record
  1. S RMPRERR=$$CRE^RMPRPIX6(.RMPR6,.RMPR11)
  1. I RMPRERR S RMPRERR=19 G RECU ;error 19 problem with 661.6 create
  1. ;
  1. ; Create 661.7 Current Stock record
  1. S RMPR7("DATE&TIME")=RMPR6("DATE&TIME")
  1. S RMPR7("SEQUENCE")=RMPR6("SEQUENCE")
  1. S RMPR7("QUANTITY")=RMPR6("QUANTITY")
  1. S RMPR7("VALUE")=RMPR6("VALUE")
  1. S RMPR7("LOCATION")=RMPR6("LOCATION")
  1. S RMPRERR=$$CRE^RMPRPIX7(.RMPR7,.RMPR11)
  1. I RMPRERR S RMPRERR=29 G RECU ;error 29 problem with 661.7 create
  1. ;
  1. ; Update 661.9 Daily Running Balance record
  1. S RMPR9("STA")=RMPR11("STATION")
  1. S RMPR9("HCP")=RMPR11("HCPCS")
  1. S RMPR9("ITE")=RMPR11("ITEM")
  1. S RMPR9("RDT")=$P(RMPR6("DATE&TIME"),".",1)
  1. S RMPR9("TQTY")=RMPR6("QUANTITY")
  1. S RMPR9("TCST")=RMPR6("VALUE")
  1. S RMPRERR=$$UPCR^RMPRPIXJ(.RMPR9) ;error 49 problem with 661.9 update
  1. I RMPRERR S RMPRERR=49 G RECU ;error 49 problem with 661.9 update
  1. ;
  1. ; Update 661.41 orders record
  1. S RMPRERR=$$UPORD^RMPRPIU8(RMPR11("STATION IEN"),RMPR11("HCPCS"),RMPR11("ITEM"),RMPR6("QUANTITY"),RMPR6("VENDOR"))
  1. I RMPRERR S RMPRERR=59 G RECU ;error 59 problem with Orders update
  1. ;
  1. ; Exit points
  1. RECU L -^RMPR(661.7,"XSLHIDS",RMPR11("STATION IEN"),RMPR5("IEN"),RMPR11("HCPCS"),RMPR11("ITEM"))
  1. RECX Q RMPRERR