PSOLLL4 ;BHAM/JLC - LASER LABELS PRINT PMI ;29-May-2012 14:52;PLS
;;7.0;OUTPATIENT PHARMACY;**120,135,1006,1008,161,1015**;DEC 1997;Build 62
;
;Reference to PSNPPIO supported by DBIA 3794
;
; Modified - IHS/CIA/PLS - 03/05/04 - Retrieve PMI data for drug
; IHS/MSC/PLS - 08/13/07 - EN+4 - Drug information conditional for refills
; - 03/11/09 - Restored use of VistA PMI information
S FLAG=$$EN^PSNPPIO(+$P(RXY,"^",6),.MSG)
;S FLAG=$$EN^APSPPPIO(+$P(RXY,U,6),.MSG)
EN I $G(PSOIO("PMII"))]"" X PSOIO("PMII")
I '$G(PMIM) D MOREWARN
; IHS/CIA/PLS - 03/31/04 - Output Barcode containing NDC,QTY and increment counter
S PSOY=PSOY+20
W $$BC^CIAUBC28($TR($$NDCVAL^APSPFUNC(RX,+$G(RXFL(RX))),"-","")_","_+$G(QTY),0,50,PSOX,PSOY)
Q:$$GET1^DIQ(9009033,PSOSITE,318)="NO"&$G(RXF) ;IHS/MSC/PLS - 08/13/07
S PSOY=PSOY+60
S T=PNM_" Rx#: "_RXN_" "_DRUG D PRINT(T,0) S PSOY=PSOY+PSOYI-25
S CONT=0 I PMIM S CONT=1 D PRINT(PMIF("T"),PMIF("H")) G CONT
I 'FLAG D PRINT(MSG) Q
S T=^TMP($J,"PSNPMI",0)_": "_$G(^TMP($J,"PSNPMI","F",1,0)) D PRINT(T,1) S PSOY=PSOY+PSOYI-25
S T=$G(^TMP($J,"PSNPMI","C",1,0)) I T]"" D PRINT(T,1) S PSOY=PSOY+PSOYI-25
CONT S XFONT=$E(PSOFONT,2,99),(CNT,OUT,PMIM)=0
K A F A="W","U","H","S","M","P","I","O","N","D","R" S CNT=CNT+1,A(CNT)=A
F J=PMIF("A"):1 Q:$G(A(J))="" S A=A(J) I $D(^TMP($J,"PSNPMI",A,1,0)) S HDR=$S(PMIF("A")=1:1,PMIF("B")=1:1,J=PMIF("A"):0,1:1),LENGTH=0,PTEXT="" D Q:OUT S PSOY=PSOY+PSOYI-25
. F B=PMIF("B"):1 Q:'$D(^TMP($J,"PSNPMI",A,B,0)) S TEXT=^(0) D Q:OUT
.. F I=1:1 Q:$E(TEXT,I)'=" " S TEXT=$E(TEXT,2,255)
.. F I=PMIF("I"):1:$L(TEXT," ") D STRT^PSOLLU1("FULL",$P(TEXT," ",I)_" ",.L) D Q:OUT
... I LENGTH+L(XFONT)<8.1 S PTEXT=PTEXT_$P(TEXT," ",I)_" ",LENGTH=LENGTH+L(XFONT) Q
... S LENGTH=0,I=I-1
... I HDR D Q
.... I PSOY>PSOYM S PMIF("A")=J,PMIF("I")=I+1,PMIF("B")=B,OUT=1,PMIM=1
.... D PRINT(PTEXT,1) S PTEXT="",HDR=0
... I PSOY>(PSOYM+25) S PMIF("A")=J,PMIF("I")=I+1,PMIF("B")=B,OUT=1,PMIM=1 Q
... D PRINT(PTEXT,0) S PTEXT=""
.. I 'PMIM F I="I","B" S PMIF(I)=1
. I 'PMIM S PMIF("B")=1
. I OUT S PMIF("T")=PTEXT,PMIF("H")=HDR
. Q:OUT I HDR,PTEXT[":" D Q
.. I PSOY>PSOYM S PMIF("A")=J,PMIF("I")=I+1,PMIF("B")=B,OUT=1,PMIM=1,PMIF("T")=PTEXT,PMIF("H")=HDR Q
.. I PTEXT]"" D PRINT(PTEXT,1)
. I PTEXT]"",PSOY>PSOYM S PMIF("A")=J,PMIF("I")=I+1,PMIF("B")=B,OUT=1,PMIM=1,PMIF("T")=PTEXT,PMIF("H")=HDR Q
. I PTEXT]"" D PRINT(PTEXT,0)
Q
PRINT(T,HDR) ;
; Input: T - text to be printed
; HDR - 0-no / 1-yes
;
S HDR=+$G(HDR)
I $G(PSOIO(PSOFONT))]"" X PSOIO(PSOFONT)
I $G(PSOIO("ST"))]"" X PSOIO("ST")
I HDR,$G(PSOIO(PSOFONT_"B"))]"" X PSOIO(PSOFONT_"B")
I HDR D G PRINT2
. W $P(T,":"),":"
. I $G(PSOIO(PSOFONT))]"" X PSOIO(PSOFONT)
. W $P(T,":",2,99)
W T
PRINT2 I $G(PSOIO("ET"))]"" X PSOIO("ET")
W ! Q
;
MOREWARN ; SEE ID MORE THAN 5 WARNINGS AND PRINT REMAINDER, IF SO
N LEN,LEN2,I,J,PSOWARN,NEWWARN,PRE
S LEN=$L($G(WARN),",") I LEN<6 Q
S NEWWARN=$P(WARN,",",6,99)
S T="Additional Warning Labels:" D PRINT(T)
F I=1:1:$L(NEWWARN,",") S PSOWARN=$P(NEWWARN,",",I) D
.S PRE=PSOWARN_": ",LEN2=$L(PRE)
.S TEXT=$$WTEXT^PSSWRNA(PSOWARN,PSOLAN) I TEXT'="" D
..I $L(TEXT)<100 S T=PRE_TEXT D PRINT(T) Q
..S PTEXT="" F J=1:1:$L(TEXT," ") S PTEXT=PTEXT_$P(TEXT," ",J)_" " D
...I $L(PTEXT)>90 D
....S T=PRE_PTEXT D PRINT(T) S PRE=$E(" ",1,LEN2),PTEXT=""
..I PTEXT'="" S T=$G(PRE)_PTEXT D PRINT(T) S PTEXT=""
I PTEXT'="" S T=$G(PRE)_PTEXT D PRINT(T) S PTEXT=""
S PSOY=PSOY+PSOYI
Q
;
PSOLLL4 ;BHAM/JLC - LASER LABELS PRINT PMI ;29-May-2012 14:52;PLS
+1 ;;7.0;OUTPATIENT PHARMACY;**120,135,1006,1008,161,1015**;DEC 1997;Build 62
+2 ;
+3 ;Reference to PSNPPIO supported by DBIA 3794
+4 ;
+5 ; Modified - IHS/CIA/PLS - 03/05/04 - Retrieve PMI data for drug
+6 ; IHS/MSC/PLS - 08/13/07 - EN+4 - Drug information conditional for refills
+7 ; - 03/11/09 - Restored use of VistA PMI information
+8 SET FLAG=$$EN^PSNPPIO(+$PIECE(RXY,"^",6),.MSG)
+9 ;S FLAG=$$EN^APSPPPIO(+$P(RXY,U,6),.MSG)
EN IF $GET(PSOIO("PMII"))]""
XECUTE PSOIO("PMII")
+1 IF '$GET(PMIM)
DO MOREWARN
+2 ; IHS/CIA/PLS - 03/31/04 - Output Barcode containing NDC,QTY and increment counter
+3 SET PSOY=PSOY+20
+4 WRITE $$BC^CIAUBC28($TRANSLATE($$NDCVAL^APSPFUNC(RX,+$GET(RXFL(RX))),"-","")_","_+$GET(QTY),0,50,PSOX,PSOY)
+5 ;IHS/MSC/PLS - 08/13/07
IF $$GET1^DIQ(9009033,PSOSITE,318)="NO"&$GET(RXF)
QUIT
+6 SET PSOY=PSOY+60
+7 SET T=PNM_" Rx#: "_RXN_" "_DRUG
DO PRINT(T,0)
SET PSOY=PSOY+PSOYI-25
+8 SET CONT=0
IF PMIM
SET CONT=1
DO PRINT(PMIF("T"),PMIF("H"))
GOTO CONT
+9 IF 'FLAG
DO PRINT(MSG)
QUIT
+10 SET T=^TMP($JOB,"PSNPMI",0)_": "_$GET(^TMP($JOB,"PSNPMI","F",1,0))
DO PRINT(T,1)
SET PSOY=PSOY+PSOYI-25
+11 SET T=$GET(^TMP($JOB,"PSNPMI","C",1,0))
IF T]""
DO PRINT(T,1)
SET PSOY=PSOY+PSOYI-25
CONT SET XFONT=$EXTRACT(PSOFONT,2,99)
SET (CNT,OUT,PMIM)=0
+1 KILL A
FOR A="W","U","H","S","M","P","I","O","N","D","R"
SET CNT=CNT+1
SET A(CNT)=A
+2 FOR J=PMIF("A"):1
IF $GET(A(J))=""
QUIT
SET A=A(J)
IF $DATA(^TMP($JOB,"PSNPMI",A,1,0))
SET HDR=$SELECT(PMIF("A")=1:1,PMIF("B")=1:1,J=PMIF("A"):0,1:1)
SET LENGTH=0
SET PTEXT=""
Begin DoDot:1
+3 FOR B=PMIF("B"):1
IF '$DATA(^TMP($JOB,"PSNPMI",A,B,0))
QUIT
SET TEXT=^(0)
Begin DoDot:2
+4 FOR I=1:1
IF $EXTRACT(TEXT,I)'=" "
QUIT
SET TEXT=$EXTRACT(TEXT,2,255)
+5 FOR I=PMIF("I"):1:$LENGTH(TEXT," ")
DO STRT^PSOLLU1("FULL",$PIECE(TEXT," ",I)_" ",.L)
Begin DoDot:3
+6 IF LENGTH+L(XFONT)<8.1
SET PTEXT=PTEXT_$PIECE(TEXT," ",I)_" "
SET LENGTH=LENGTH+L(XFONT)
QUIT
+7 SET LENGTH=0
SET I=I-1
+8 IF HDR
Begin DoDot:4
+9 IF PSOY>PSOYM
SET PMIF("A")=J
SET PMIF("I")=I+1
SET PMIF("B")=B
SET OUT=1
SET PMIM=1
+10 DO PRINT(PTEXT,1)
SET PTEXT=""
SET HDR=0
End DoDot:4
QUIT
+11 IF PSOY>(PSOYM+25)
SET PMIF("A")=J
SET PMIF("I")=I+1
SET PMIF("B")=B
SET OUT=1
SET PMIM=1
QUIT
+12 DO PRINT(PTEXT,0)
SET PTEXT=""
End DoDot:3
IF OUT
QUIT
+13 IF 'PMIM
FOR I="I","B"
SET PMIF(I)=1
End DoDot:2
IF OUT
QUIT
+14 IF 'PMIM
SET PMIF("B")=1
+15 IF OUT
SET PMIF("T")=PTEXT
SET PMIF("H")=HDR
+16 IF OUT
QUIT
IF HDR
IF PTEXT[":"
Begin DoDot:2
+17 IF PSOY>PSOYM
SET PMIF("A")=J
SET PMIF("I")=I+1
SET PMIF("B")=B
SET OUT=1
SET PMIM=1
SET PMIF("T")=PTEXT
SET PMIF("H")=HDR
QUIT
+18 IF PTEXT]""
DO PRINT(PTEXT,1)
End DoDot:2
QUIT
+19 IF PTEXT]""
IF PSOY>PSOYM
SET PMIF("A")=J
SET PMIF("I")=I+1
SET PMIF("B")=B
SET OUT=1
SET PMIM=1
SET PMIF("T")=PTEXT
SET PMIF("H")=HDR
QUIT
+20 IF PTEXT]""
DO PRINT(PTEXT,0)
End DoDot:1
IF OUT
QUIT
SET PSOY=PSOY+PSOYI-25
+21 QUIT
PRINT(T,HDR) ;
+1 ; Input: T - text to be printed
+2 ; HDR - 0-no / 1-yes
+3 ;
+4 SET HDR=+$GET(HDR)
+5 IF $GET(PSOIO(PSOFONT))]""
XECUTE PSOIO(PSOFONT)
+6 IF $GET(PSOIO("ST"))]""
XECUTE PSOIO("ST")
+7 IF HDR
IF $GET(PSOIO(PSOFONT_"B"))]""
XECUTE PSOIO(PSOFONT_"B")
+8 IF HDR
Begin DoDot:1
+9 WRITE $PIECE(T,":"),":"
+10 IF $GET(PSOIO(PSOFONT))]""
XECUTE PSOIO(PSOFONT)
+11 WRITE $PIECE(T,":",2,99)
End DoDot:1
GOTO PRINT2
+12 WRITE T
PRINT2 IF $GET(PSOIO("ET"))]""
XECUTE PSOIO("ET")
+1 WRITE !
QUIT
+2 ;
MOREWARN ; SEE ID MORE THAN 5 WARNINGS AND PRINT REMAINDER, IF SO
+1 NEW LEN,LEN2,I,J,PSOWARN,NEWWARN,PRE
+2 SET LEN=$LENGTH($GET(WARN),",")
IF LEN<6
QUIT
+3 SET NEWWARN=$PIECE(WARN,",",6,99)
+4 SET T="Additional Warning Labels:"
DO PRINT(T)
+5 FOR I=1:1:$LENGTH(NEWWARN,",")
SET PSOWARN=$PIECE(NEWWARN,",",I)
Begin DoDot:1
+6 SET PRE=PSOWARN_": "
SET LEN2=$LENGTH(PRE)
+7 SET TEXT=$$WTEXT^PSSWRNA(PSOWARN,PSOLAN)
IF TEXT'=""
Begin DoDot:2
+8 IF $LENGTH(TEXT)<100
SET T=PRE_TEXT
DO PRINT(T)
QUIT
+9 SET PTEXT=""
FOR J=1:1:$LENGTH(TEXT," ")
SET PTEXT=PTEXT_$PIECE(TEXT," ",J)_" "
Begin DoDot:3
+10 IF $LENGTH(PTEXT)>90
Begin DoDot:4
+11 SET T=PRE_PTEXT
DO PRINT(T)
SET PRE=$EXTRACT(" ",1,LEN2)
SET PTEXT=""
End DoDot:4
End DoDot:3
+12 IF PTEXT'=""
SET T=$GET(PRE)_PTEXT
DO PRINT(T)
SET PTEXT=""
End DoDot:2
End DoDot:1
+13 IF PTEXT'=""
SET T=$GET(PRE)_PTEXT
DO PRINT(T)
SET PTEXT=""
+14 SET PSOY=PSOY+PSOYI
+15 QUIT
+16 ;