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

LA7SBCR2.m

Go to the documentation of this file.
  1. LA7SBCR2 ;VA/DALOI/JMC - Shipping Barcode Reader Utility ;JUL 06, 2010 3:14 PM
  1. ;;5.2;AUTOMATED LAB INSTRUMENTS;**27,46,64,1027**;NOV 01, 1997
  1. ;
  1. Q
  1. ;
  1. SITE(LA7,LA7PROM,LA7BAR) ; Setup remote site info.
  1. ; Input:
  1. ; LA7=array to return values
  1. ; LA7PROM=prompt to display to user
  1. ; LA7BAR=0/1 using barcode reader
  1. ; Screen: Second piece of bar-code must = SITE
  1. ; Returns array LA7()
  1. ;
  1. ; If successful ERROR=0
  1. ; IDTYPE=source of UID
  1. ; LPC=longitudinal parity check of SM barcode info
  1. ; RPSITE=primary sending site ien^name^station number
  1. ; RSITE=sending site ien^name^station number
  1. ; SCFG=pointer to shipping configuration (file #62.9)^name
  1. ; SDT=Shipping date/time
  1. ; SMID=shipping manifest id
  1. ;
  1. ; unsuccessful ERROR=>0^error message
  1. ;
  1. N LA7X,X,Y
  1. ; Initialize array.
  1. F Y="ERROR","IDTYPE","LPC","RPSITE","RSITE","SCFG","SDT","SMID" S LA7(Y)=""
  1. S LA7PROM=$G(LA7PROM,"Site")
  1. I LA7BAR D BAR
  1. ;
  1. I 'LA7BAR D
  1. . N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. . S DIR(0)="PO^62.9:EM",DIR("A")="Select Shipping Configuration"
  1. . S DIR("S")="I $P(^LAHM(62.9,Y,0),U,3)=DUZ(2),$P(^LAHM(62.9,Y,0),U,4)"
  1. . D ^DIR
  1. . I Y<1 S LA7("ERROR")=1 Q
  1. . S LA7("SCFG")=Y
  1. ;
  1. I 'LA7("ERROR") D
  1. . I LA7("SCFG") D GETSITE Q
  1. . I 'LA7("SCFG") S LA7("ERROR")=3 Q
  1. ;
  1. I LA7("ERROR") D
  1. . S LA7("ERROR")=LA7("ERROR")_"^"_$P($T(ERROR+LA7("ERROR")),";;",2)
  1. ;
  1. Q
  1. ;
  1. ;
  1. GETSITE ; Retrieve site info from institution file for this shipping configuration.
  1. ; Set ID type from shipping configuration.
  1. N LRX,LRY,X,Y
  1. S Y(0)=$G(^LAHM(62.9,+LA7("SCFG"),0))
  1. S LA7("IDTYPE")=$P(Y(0),"^",5)
  1. ;
  1. ; *** Remove line when other id types supported. ***
  1. I LA7("IDTYPE")>1 S LA7("ERROR")=4
  1. ;
  1. S LRX=$P(Y(0),"^",2)
  1. S LRY=$$GET1^DIQ(4,LRX_",",.01)
  1. I LRX,LRY'="" D
  1. . S LRY(99)=$$RETFACID^LA7VHLU2(LRX,2,1)
  1. . S LA7("RSITE")=LRX_"^"_LRY_"^"_LRY(99)
  1. E S LA7("ERROR")=5
  1. ;
  1. S LRX=$P(Y(0),"^",6)
  1. S LRY=$$GET1^DIQ(4,LRX_",",.01)
  1. I LRX,LRY'="" D
  1. . S LRY(99)=$$RETFACID^LA7VHLU2(LRX,2,1)
  1. . S LA7("RPSITE")=LRX_"^"_LRY_"^"_LRY(99)
  1. E S LA7("ERROR")=5
  1. Q
  1. ;
  1. ;
  1. BAR ; Read SM bar code
  1. ;
  1. N LA7BCS,Y
  1. ;
  1. S Y=$$RD^LA7SBCR(.LA7PROM,1),LA7=""
  1. I Y=0 S LA7("ERROR")=1 Q
  1. I Y<1 S LA7("ERROR")=2 Q
  1. ;
  1. ; barcode info & longitudinal parity check
  1. ; original bar code style
  1. I $E(Y,1,11)="1^STX^SITE^" D
  1. . S LA7=$P(Y,"STX^SITE^",2)
  1. . S LA7=$P(LA7,"^ETX",1)
  1. . S LA7("LPC")=$P(Y,"^ETX",2)
  1. ; new bar code style
  1. I $E(Y,1,7)="1^SITE^" D
  1. . S LA7=$P(Y,"^",3,5)
  1. . S LA7("LPC")=$P(Y,"^",6)
  1. . S LA7BCS=1
  1. ;
  1. I LA7="" S LA7("ERROR")=2 Q
  1. ;
  1. I $P(LA7,"^")'="" D
  1. . N X,Y,Z
  1. . S Z=$$FINDSITE^LA7VHLU2($P(LA7,"^"),2,1)
  1. . I Z="" S LA7("ERROR")=5 Q
  1. . S (X,Y)=0
  1. . F S X=$O(^LAHM(62.9,"C",Z,X)) Q:'X D Q:Y
  1. . . S X(0)=$G(^LAHM(62.9,X,0))
  1. . . I $P(X(0),"^",3)=DUZ(2),$P(X(0),"^",4) S LA7("SCFG")=X_"^"_$P(X(0),"^"),Y=1
  1. ;
  1. ; shipping date/time
  1. I $P(LA7,"^",2) S LA7("SDT")=$$DT^LA7SBCR($P(LA7,"^",2))
  1. ;
  1. ; shipping manifest id
  1. I $P(LA7,"^",3)'="" S LA7("SMID")=$P(LA7,"^",3)
  1. ;
  1. Q
  1. ;
  1. ;
  1. ERROR ;; Code/Text of error messages
  1. 1 ;;User timeout/abort;;
  1. 2 ;;Incorrect barcode format;;
  1. 3 ;;No Shipping Configuration identified in file #62.9;;
  1. 4 ;;Sender's Specimen ID source not presently supported;;
  1. 5 ;;No entry in INSTITUTION file #4;;