LR7OSBR1 ;slc/dcm - Silent BB rpt cont. ;8/11/97
;;5.2T9;LR;**1018**;Nov 17, 2004
;;5.2;LAB SERVICE;**121,201,228,230,292**;Sep 27, 1994
;from LRBLPBR
;Reference to GETS^DIQ supported by IA #2056
EN ;
N A,B,J,LRMD,LRI,X,X0
S LR(2)=0,LRMD=$P(LR,"^",5)
D H
S LR("F")=1
I $D(^LR(LRDFN,1.7)) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(4,CCNT,"Antibodies identified: ") F LR(9)=0:0 S LR(9)=$O(^LR(LRDFN,1.7,LR(9))) Q:'LR(9) D
. I CCNT>(GIOM-15) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT," ")
. S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$P(^LAB(61.3,LR(9),0),"^")_"; ")
I $O(^LR("AB",LRDFN,0)) D
. D LINE^LR7OSUM4
. S J=0
. F S J=$O(^LR("AB",LRDFN,J)) Q:'J S A=0 F S A=$O(^LR("AB",LRDFN,J,A)) Q:'A D
.. S LR(1.9)=$G(^LR(LRDFN,1.6,A,0))
.. I LR(1.9)="" K ^LR("AB",LRDFN,J,A) Q
.. S Y=+LR(1.9)
.. D D^LRU
.. D LN
.. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,"TRANSFUSION REACTIONS WITH UNIT IDENTIFIED")_$$S^LR7OS(51,CCNT,"UNIT ID")_$$S^LR7OS(66,CCNT,"COMPONENT")
.. D LN
.. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,Y)_$$S^LR7OS(21,CCNT,$P($G(^LAB(65.4,J,0)),U))_$$S^LR7OS(51,CCNT,$P(LR(1.9),U,3))_$$S^LR7OS(69,CCNT,$P($G(^LAB(66,+$P(LR(1.9),U,2),0)),U,2))
.. F B(1)=0:0 S B(1)=$O(^LR(LRDFN,1.6,A,1,B(1))) Q:'B(1) S B(2)=^(B(1),0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,B(2))
I $O(^LR(LRDFN,1.9,0)) D
. D LINE^LR7OSUM4
. S A=0
. F B=0:1 S A=$O(^LR(LRDFN,1.9,A)) Q:'A S LR(1.9)=^(A,0) D
.. I 'B D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,"TRANSFUSION REACTIONS WITHOUT UNIT IDENTIFIED:")
.. S Y=+LR(1.9)
.. D D^LRU
.. D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,Y)_$$S^LR7OS(21,CCNT,$P($G(^LAB(65.4,+$P(LR(1.9),U,2),0)),U))
.. F B=0:0 S B=$O(^LR(LRDFN,1.9,A,1,B)) Q:'B S X0=^(B,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(0,CCNT,X0)
D LINE^LR7OSUM4
I $D(LRN(2)) D C
D DT
S LRI=LRIN
F A=1:1 S LRI=$O(^LR(LRDFN,LRSS,LRI)) Q:'LRI!(CT1>COUNT)!(LRI>LROUT) S LR(5)=^(LRI,0) I $P(LR(5),"^",3) D
. S T=+LR(5),CT1=CT1+1
. D T,LN
. S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(4,CCNT,T)
. D W
Q
W ;
S X=$G(^LR(LRDFN,LRSS,LRI,10)),LRN(10.3,3)=$P(X,"^",3)
S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(21,CCNT,$J($P(X,"^"),2))
S X=$G(^LR(LRDFN,LRSS,LRI,11)),LRN(11.3,3)=$P(X,"^",3),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(24,CCNT,$P(X,"^"))
S X=$G(^LR(LRDFN,LRSS,LRI,2)),LRN(2.91,3)=$P(X,"^",10)
F H=1,4,6,9 S Y=$P(X,"^",H) S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS((30+$S(H=4:5,H=6:10,H=9:15,1:0)),CCNT,$S(Y="N":"Neg",Y="P":"Pos",H=9&(Y="I"):"Invalid",1:Y))
S X=$G(^LR(LRDFN,LRSS,LRI,6)),Y=$P(X,"^"),^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(62,CCNT,$S(Y="N":"Neg",Y="P":"Pos",1:Y))
F X=10.3,11.3,2.91 I LRN(X,3)]"" D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,LRN(X)_":"_LRN(X,3))
S J=0 F S J=$O(^LR(LRDFN,LRSS,LRI,"EA",J)) Q:'J D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"ELUATE ANTIBODY: "_$S($D(^LAB(61.3,J,0)):$P(^(0),"^"),1:J))
S J=0 F S J=$O(^LR(LRDFN,LRSS,LRI,5,J)) Q:'J D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"SERUM ANTIBODY IDENTIFIED: "_$S($D(^LAB(61.3,J,0)):$P(^(0),"^"),1:J))
S J=0 F S J=$O(^LR(LRDFN,LRSS,LRI,4,J)) Q:'J S J(1)=^(J,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,LRN(8)_":"_J(1))
S J=0 F S J=$O(^LR(LRDFN,LRSS,LRI,99,J)) Q:'J S J(1)=^(J,0) D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(8,CCNT,J(1))
Q
T ;
S T=T_"000",T=$$FMTE^XLFDT($P(T,"."),"5Z")_$S(T[".":" "_$E(T,9,10)_":"_$E(T,11,12),1:"")
Q
C ;
S A=0 F B=1:1 S A=$O(^LRD(65,"AP",LRDFN,A)) Q:'A D N
I B=1 D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"No UNITS assigned/xmatched")
D LINE^LR7OSUM4
S A=0 F B=0:1 S A=$O(^LR(LRDFN,1.8,A)) Q:'A S F=^(A,0) I $P(F,"^",3)>(9999999-LROUT),$P(F,"^",3)<(9999999-LRIN) D:'B R D L
I 'B D LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"No component requests")
Q
N ;
I B=1 D LINE^LR7OSUM4,LN S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(6,CCNT,"Unit assigned/xmatched:")_$$S^LR7OS(46,CCNT,"Exp date")_$$S^LR7OS(64,CCNT,"Loc")
I '$D(^LRD(65,A,0)) K ^LRD(65,"AP",LRDFN,A) Q
S F=^LRD(65,A,0),L=$O(^(3,0)) I L S L=$P(^(L,0),"^",4)
E D LOCAT
I $P(F,"^",5)<(9999999-LROUT)!($P(F,"^",5)>(9999999-LRIN)) Q
S M=^LAB(66,$P(F,"^",4),0)
D LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,$J(B,2)_")")_$$S^LR7OS(6,CCNT,$P(F,"^"))_$$S^LR7OS(17,CCNT,$E($P(M,"^"),1,19))_$$S^LR7OS(38,CCNT,$P(F,"^",7)_" "_$P(F,"^",8))
S Y=$P(F,"^",6)
D D^LRU
D:'(L]"") LOCAT
S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(45,CCNT,Y)_$$S^LR7OS(64,CCNT,L)
Q
LOCAT ;Determine the Institution (file 4) where the unit resides if no
;location is listed in 65.03,.04
S L=$P(^LRD(65,A,0),"^",16)
I L]"" K LERROR D GETS^DIQ(4,L,.01,,"L","LERROR") D
. I L]"",L'=-1 S L="BB-"_$G(L(4,L_",",.01))
. K L(4) Q
;S L=$P(^DIC(4,L,0),"^") ;Convert to FileMan reference
I L=""!((L=-1)!($D(LERROR))) S L="???????????"
Q
L ;
I '$D(^LAB(66,+F,0)) L +^LR(LRDFN,1.8):360 G:'$T L K ^LR(LRDFN,1.8,+F) S X=^LR(LRDFN,1.8,0),X(1)=$O(^LR(LRDFN,1.8,0)),^LR(LRDFN,1.8,0)=$P(X,"^",1,2)_"^"_X(1)_"^"_$S(X(1)="":"",1:($P(X,"^",4)-1)) L -^LR(LRDFN,1.8) Q
S T=$P(F,"^",3)
D T,LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,$E($P(^LAB(66,+F,0),"^"),1,25))_$$S^LR7OS(26,CCNT,$J($P(F,"^",4),3))_$$S^LR7OS(32,CCNT,T)
S T=$P(F,"^",5)
D T
S ^TMP("LRC",$J,GCNT,0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(49,CCNT,T)_$$S^LR7OS(65,CCNT,$E($P(F,"^",9),1,10))_$$S^LR7OS(77,CCNT,$S($P(F,"^",8)="":"",$D(^VA(200,$P(F,"^",8),0)):$P(^(0),"^",2),1:$P(F,"^",8)))
Q
H ;
D LN
S X=GIOM/2-(10/2+5),^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(X,CCNT,"---- BLOOD BANK ----"),^TMP("LRH",$J,"BLOOD BANK")=GCNT
D LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"ABO Rh: "_$J($P(LR,"^",3),2)_" "_$P(LR,"^",4))
Q
DT ;
D LINE^LR7OSUM4,LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(30,CCNT,"|---")_$$S^LR7OS(39,CCNT,"AHG(direct)")_$$S^LR7OS(55,CCNT,"---|")_$$S^LR7OS(62,CCNT,"|-AHG(indirect)-|")
D LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(4,CCNT,"Date/time")_$$S^LR7OS(20,CCNT,"ABO")_$$S^LR7OS(24,CCNT,"Rh")_$$S^LR7OS(30,CCNT,"POLY")_$$S^LR7OS(35,CCNT,"IgG")_$$S^LR7OS(40,CCNT,"C3")
S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(45,CCNT,"Interpretation")_$$S^LR7OS(62,CCNT,"(Antibody screen)")
D LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(4,CCNT,"---------")_$$S^LR7OS(20,CCNT,"---")_$$S^LR7OS(24,CCNT,"--")_$$S^LR7OS(30,CCNT,"----")_$$S^LR7OS(35,CCNT,"---")
S ^(0)=^TMP("LRC",$J,GCNT,0)_$$S^LR7OS(40,CCNT,"---")_$$S^LR7OS(45,CCNT,"--------------")_$$S^LR7OS(62,CCNT,"-----------------")
Q
H3 ;
D H,LINE^LR7OSUM4,LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(6,CCNT,"Unit assigned/xmatched:")_$$S^LR7OS(46,CCNT,"Exp date")_$$S^LR7OS(64,CCNT,"Loc")
Q
R ;
D LN
S ^TMP("LRC",$J,GCNT,0)=$$S^LR7OS(1,CCNT,"Component requests")_$$S^LR7OS(26,CCNT,"Units")_$$S^LR7OS(32,CCNT,"Request date")_$$S^LR7OS(49,CCNT,"Date wanted")_$$S^LR7OS(65,CCNT,"Requestor")_$$S^LR7OS(77,CCNT,"By")
Q
LN ;
S GCNT=GCNT+1,CCNT=1
Q
LR7OSBR1 ;slc/dcm - Silent BB rpt cont. ;8/11/97
+1 ;;5.2T9;LR;**1018**;Nov 17, 2004
+2 ;;5.2;LAB SERVICE;**121,201,228,230,292**;Sep 27, 1994
+3 ;from LRBLPBR
+4 ;Reference to GETS^DIQ supported by IA #2056
EN ;
+1 NEW A,B,J,LRMD,LRI,X,X0
+2 SET LR(2)=0
SET LRMD=$PIECE(LR,"^",5)
+3 DO H
+4 SET LR("F")=1
+5 IF $DATA(^LR(LRDFN,1.7))
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(4,CCNT,"Antibodies identified: ")
FOR LR(9)=0:0
SET LR(9)=$ORDER(^LR(LRDFN,1.7,LR(9)))
IF 'LR(9)
QUIT
Begin DoDot:1
+6 IF CCNT>(GIOM-15)
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT," ")
+7 SET ^TMP("LRC",$JOB,GCNT,0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(CCNT,CCNT,$PIECE(^LAB(61.3,LR(9),0),"^")_"; ")
End DoDot:1
+8 IF $ORDER(^LR("AB",LRDFN,0))
Begin DoDot:1
+9 DO LINE^LR7OSUM4
+10 SET J=0
+11 FOR
SET J=$ORDER(^LR("AB",LRDFN,J))
IF 'J
QUIT
SET A=0
FOR
SET A=$ORDER(^LR("AB",LRDFN,J,A))
IF 'A
QUIT
Begin DoDot:2
+12 SET LR(1.9)=$GET(^LR(LRDFN,1.6,A,0))
+13 IF LR(1.9)=""
KILL ^LR("AB",LRDFN,J,A)
QUIT
+14 SET Y=+LR(1.9)
+15 DO D^LRU
+16 DO LN
+17 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,"TRANSFUSION REACTIONS WITH UNIT IDENTIFIED")_$$S^LR7OS(51,CCNT,"UNIT ID")_$$S^LR7OS(66,CCNT,"COMPONENT")
+18 DO LN
+19 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,Y)_$$S^LR7OS(21,CCNT,$PIECE($GET(^LAB(65.4,J,0)),U))_$$S^LR7OS(51,CCNT,$PIECE(LR(1.9),U,3))_$$S^LR7OS(69,CCNT,$PIECE($GET(^LAB(66,+$PIECE(LR(1.9),U,2),0)),U,2))
+20 FOR B(1)=0:0
SET B(1)=$ORDER(^LR(LRDFN,1.6,A,1,B(1)))
IF 'B(1)
QUIT
SET B(2)=^(B(1),0)
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,B(2))
End DoDot:2
End DoDot:1
+21 IF $ORDER(^LR(LRDFN,1.9,0))
Begin DoDot:1
+22 DO LINE^LR7OSUM4
+23 SET A=0
+24 FOR B=0:1
SET A=$ORDER(^LR(LRDFN,1.9,A))
IF 'A
QUIT
SET LR(1.9)=^(A,0)
Begin DoDot:2
+25 IF 'B
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,"TRANSFUSION REACTIONS WITHOUT UNIT IDENTIFIED:")
+26 SET Y=+LR(1.9)
+27 DO D^LRU
+28 DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,Y)_$$S^LR7OS(21,CCNT,$PIECE($GET(^LAB(65.4,+$PIECE(LR(1.9),U,2),0)),U))
+29 FOR B=0:0
SET B=$ORDER(^LR(LRDFN,1.9,A,1,B))
IF 'B
QUIT
SET X0=^(B,0)
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(0,CCNT,X0)
End DoDot:2
End DoDot:1
+30 DO LINE^LR7OSUM4
+31 IF $DATA(LRN(2))
DO C
+32 DO DT
+33 SET LRI=LRIN
+34 FOR A=1:1
SET LRI=$ORDER(^LR(LRDFN,LRSS,LRI))
IF 'LRI!(CT1>COUNT)!(LRI>LROUT)
QUIT
SET LR(5)=^(LRI,0)
IF $PIECE(LR(5),"^",3)
Begin DoDot:1
+35 SET T=+LR(5)
SET CT1=CT1+1
+36 DO T
DO LN
+37 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(4,CCNT,T)
+38 DO W
End DoDot:1
+39 QUIT
W ;
+1 SET X=$GET(^LR(LRDFN,LRSS,LRI,10))
SET LRN(10.3,3)=$PIECE(X,"^",3)
+2 SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(21,CCNT,$JUSTIFY($PIECE(X,"^"),2))
+3 SET X=$GET(^LR(LRDFN,LRSS,LRI,11))
SET LRN(11.3,3)=$PIECE(X,"^",3)
SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(24,CCNT,$PIECE(X,"^"))
+4 SET X=$GET(^LR(LRDFN,LRSS,LRI,2))
SET LRN(2.91,3)=$PIECE(X,"^",10)
+5 FOR H=1,4,6,9
SET Y=$PIECE(X,"^",H)
SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS((30+$SELECT(H=4:5,H=6:10,H=9:15,1:0)),CCNT,$SELECT(Y="N":"Neg",Y="P":"Pos",H=9&(Y="I"):"Invalid",1:Y))
+6 SET X=$GET(^LR(LRDFN,LRSS,LRI,6))
SET Y=$PIECE(X,"^")
SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(62,CCNT,$SELECT(Y="N":"Neg",Y="P":"Pos",1:Y))
+7 FOR X=10.3,11.3,2.91
IF LRN(X,3)]""
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,LRN(X)_":"_LRN(X,3))
+8 SET J=0
FOR
SET J=$ORDER(^LR(LRDFN,LRSS,LRI,"EA",J))
IF 'J
QUIT
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"ELUATE ANTIBODY: "_$SELECT($DATA(^LAB(61.3,J,0)):$PIECE(^(0),"^"),1:J))
+9 SET J=0
FOR
SET J=$ORDER(^LR(LRDFN,LRSS,LRI,5,J))
IF 'J
QUIT
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"SERUM ANTIBODY IDENTIFIED: "_$SELECT($DATA(^LAB(61.3,J,0)):$PIECE(^(0),"^"),1:J))
+10 SET J=0
FOR
SET J=$ORDER(^LR(LRDFN,LRSS,LRI,4,J))
IF 'J
QUIT
SET J(1)=^(J,0)
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,LRN(8)_":"_J(1))
+11 SET J=0
FOR
SET J=$ORDER(^LR(LRDFN,LRSS,LRI,99,J))
IF 'J
QUIT
SET J(1)=^(J,0)
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(8,CCNT,J(1))
+12 QUIT
T ;
+1 SET T=T_"000"
SET T=$$FMTE^XLFDT($PIECE(T,"."),"5Z")_$SELECT(T[".":" "_$EXTRACT(T,9,10)_":"_$EXTRACT(T,11,12),1:"")
+2 QUIT
C ;
+1 SET A=0
FOR B=1:1
SET A=$ORDER(^LRD(65,"AP",LRDFN,A))
IF 'A
QUIT
DO N
+2 IF B=1
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"No UNITS assigned/xmatched")
+3 DO LINE^LR7OSUM4
+4 SET A=0
FOR B=0:1
SET A=$ORDER(^LR(LRDFN,1.8,A))
IF 'A
QUIT
SET F=^(A,0)
IF $PIECE(F,"^",3)>(9999999-LROUT)
IF $PIECE(F,"^",3)<(9999999-LRIN)
IF 'B
DO R
DO L
+5 IF 'B
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"No component requests")
+6 QUIT
N ;
+1 IF B=1
DO LINE^LR7OSUM4
DO LN
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(6,CCNT,"Unit assigned/xmatched:")_$$S^LR7OS(46,CCNT,"Exp date")_$$S^LR7OS(64,CCNT,"Loc")
+2 IF '$DATA(^LRD(65,A,0))
KILL ^LRD(65,"AP",LRDFN,A)
QUIT
+3 SET F=^LRD(65,A,0)
SET L=$ORDER(^(3,0))
IF L
SET L=$PIECE(^(L,0),"^",4)
+4 IF '$TEST
DO LOCAT
+5 IF $PIECE(F,"^",5)<(9999999-LROUT)!($PIECE(F,"^",5)>(9999999-LRIN))
QUIT
+6 SET M=^LAB(66,$PIECE(F,"^",4),0)
+7 DO LN
+8 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,$JUSTIFY(B,2)_")")_$$S^LR7OS(6,CCNT,$PIECE(F,"^"))_$$S^LR7OS(17,CCNT,$EXTRACT($PIECE(M,"^"),1,19))_$$S^LR7OS(38,CCNT,$PIECE(F,"^",7)_" "_$PIECE(F,"^",8))
+9 SET Y=$PIECE(F,"^",6)
+10 DO D^LRU
+11 IF '(L]"")
DO LOCAT
+12 SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(45,CCNT,Y)_$$S^LR7OS(64,CCNT,L)
+13 QUIT
LOCAT ;Determine the Institution (file 4) where the unit resides if no
+1 ;location is listed in 65.03,.04
+2 SET L=$PIECE(^LRD(65,A,0),"^",16)
+3 IF L]""
KILL LERROR
DO GETS^DIQ(4,L,.01,,"L","LERROR")
Begin DoDot:1
+4 IF L]""
IF L'=-1
SET L="BB-"_$GET(L(4,L_",",.01))
+5 KILL L(4)
QUIT
End DoDot:1
+6 ;S L=$P(^DIC(4,L,0),"^") ;Convert to FileMan reference
+7 IF L=""!((L=-1)!($DATA(LERROR)))
SET L="???????????"
+8 QUIT
L ;
+1 IF '$DATA(^LAB(66,+F,0))
LOCK +^LR(LRDFN,1.8):360
IF '$TEST
GOTO L
KILL ^LR(LRDFN,1.8,+F)
SET X=^LR(LRDFN,1.8,0)
SET X(1)=$ORDER(^LR(LRDFN,1.8,0))
SET ^LR(LRDFN,1.8,0)=$PIECE(X,"^",1,2)_"^"_X(1)_"^"_$SELECT(X(1)="":"",1:($PIECE(X,"^",4)-1))
LOCK -^LR(LRDFN,1.8)
QUIT
+2 SET T=$PIECE(F,"^",3)
+3 DO T
DO LN
+4 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,$EXTRACT($PIECE(^LAB(66,+F,0),"^"),1,25))_$$S^LR7OS(26,CCNT,$JUSTIFY($PIECE(F,"^",4),3))_$$S^LR7OS(32,CCNT,T)
+5 SET T=$PIECE(F,"^",5)
+6 DO T
+7 SET ^TMP("LRC",$JOB,GCNT,0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(49,CCNT,T)_$$S^LR7OS(65,CCNT,$EXTRACT($PIECE(F,"^",9),1,10))_$$S^LR7OS(77,CCNT,$SELECT($PIECE(F,"^",8)="":"",$DATA(^VA(200,$PIECE(F,"^",8),0)):$PIECE(^(0),"^",2),1:$PIECE(F,"^",8)))
+8 QUIT
H ;
+1 DO LN
+2 SET X=GIOM/2-(10/2+5)
SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(X,CCNT,"---- BLOOD BANK ----")
SET ^TMP("LRH",$JOB,"BLOOD BANK")=GCNT
+3 DO LN
+4 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"ABO Rh: "_$JUSTIFY($PIECE(LR,"^",3),2)_" "_$PIECE(LR,"^",4))
+5 QUIT
DT ;
+1 DO LINE^LR7OSUM4
DO LN
+2 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(30,CCNT,"|---")_$$S^LR7OS(39,CCNT,"AHG(direct)")_$$S^LR7OS(55,CCNT,"---|")_$$S^LR7OS(62,CCNT,"|-AHG(indirect)-|")
+3 DO LN
+4 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(4,CCNT,"Date/time")_$$S^LR7OS(20,CCNT,"ABO")_$$S^LR7OS(24,CCNT,"Rh")_$$S^LR7OS(30,CCNT,"POLY")_$$S^LR7OS(35,CCNT,"IgG")_$$S^LR7OS(40,CCNT,"C3")
+5 SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(45,CCNT,"Interpretation")_$$S^LR7OS(62,CCNT,"(Antibody screen)")
+6 DO LN
+7 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(4,CCNT,"---------")_$$S^LR7OS(20,CCNT,"---")_$$S^LR7OS(24,CCNT,"--")_$$S^LR7OS(30,CCNT,"----")_$$S^LR7OS(35,CCNT,"---")
+8 SET ^(0)=^TMP("LRC",$JOB,GCNT,0)_$$S^LR7OS(40,CCNT,"---")_$$S^LR7OS(45,CCNT,"--------------")_$$S^LR7OS(62,CCNT,"-----------------")
+9 QUIT
H3 ;
+1 DO H
DO LINE^LR7OSUM4
DO LN
+2 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(6,CCNT,"Unit assigned/xmatched:")_$$S^LR7OS(46,CCNT,"Exp date")_$$S^LR7OS(64,CCNT,"Loc")
+3 QUIT
R ;
+1 DO LN
+2 SET ^TMP("LRC",$JOB,GCNT,0)=$$S^LR7OS(1,CCNT,"Component requests")_$$S^LR7OS(26,CCNT,"Units")_$$S^LR7OS(32,CCNT,"Request date")_$$S^LR7OS(49,CCNT,"Date wanted")_$$S^LR7OS(65,CCNT,"Requestor")_$$S^LR7OS(77,CCNT,"By")
+3 QUIT
LN ;
+1 SET GCNT=GCNT+1
SET CCNT=1
+2 QUIT