VistA-WorldVistAEHR/r/BAR_CODE_MED_ADMIN-ALPB-PSB/PSBOBL.m

74 lines
2.5 KiB
Mathematica

PSBOBL ;BIRMINGHAM/EFC-BAR CODE LABELS (ZEBRA SPECIFIC) ;Mar 2004
;;3.0;BAR CODE MED ADMIN;;Mar 2004
;
; Reference/IA
; File 50/221
;
EN ;
N PSBIENS,PSBBAR,PSBDRUG,PSBQTY,PSBDOSE,PSBNAME,PSBWARD,PSBLOT
N PSBEXP,PSBMFG,PSBFCB,PSBSYM,PSBCNT,PSBANS,PSBORD
S PSBIENS=PSBRPT_","
S PSBBAR=$P($P($G(^PSB(53.69,PSBRPT,.3)),U,1),"~",2)
;
S PSBPRE=$$GET^XPAR("DIV","PSB DEFAULT BARCODE PREFIX")
S:PSBPRE]"" PSBBAR=PSBPRE_$S(PSBPRE?1.N:"-",1:"")_PSBBAR
;
S PSBDRUG=$$GET1^DIQ(53.69,PSBIENS,.31)
S PSBQTY=+$$GET1^DIQ(53.69,PSBIENS,.35)
S:PSBQTY PSBDRUG=PSBDRUG_" (Qty: "_PSBQTY_")"
S PSBDOSE=$$GET1^DIQ(53.69,PSBIENS,.39)
S PSBNAME=$$GET1^DIQ(53.69,PSBIENS,.12)
I PSBNAME]"" S PSBNAME=PSBNAME_" ("_$E($$GET1^DIQ(53.69,PSBIENS,.121),6,9)_")"
S PSBWARD=$$GET1^DIQ(53.69,PSBIENS,.122)
S PSBLOT=$$GET1^DIQ(53.69,PSBIENS,.32)
S PSBEXP=$$GET1^DIQ(53.69,PSBIENS,.33)
S PSBMFG=$$GET1^DIQ(53.69,PSBIENS,.34)
S PSBFCB=$$GET1^DIQ(53.69,PSBIENS,.36)_"/"_$$GET1^DIQ(53.69,PSBIENS,.37)
S PSBSYM=$$GET^XPAR("DIV","PSB DEFAULT BARCODE FORMAT",,"E")
F PSBCNT=1:1:+$P(PSBRPT(.3),U,8) D LABEL
Q
;
LABEL ; Print the Label
W "^XA"
W !,"^LH0,0^FS"
W $$DATA(20,25,"Drug:")
W $$DATA(100,25,PSBDRUG)
I PSBDOSE]"" W $$DATA(20,60,"Dosage:") W $$DATA(100,60,PSBDOSE)
I PSBNAME]"" W $$DATA(350,60,PSBNAME)
I PSBWARD]"" W $$DATA(350,90,"Ward:") W $$DATA(400,90,PSBWARD)
I PSBLOT]"" W $$DATA(350,120,"Lot#:") W $$DATA(400,120,PSBLOT)
I PSBEXP]"" W $$DATA(500,120,"Exp:") W $$DATA(550,120,PSBEXP)
I PSBMFG]"" W $$DATA(350,150,"Mfg:") W $$DATA(400,150,PSBMFG)
W $$DATA(350,180,"Filled/Checked By:") W $$DATA(520,180,PSBFCB)
;
; Code 39
I PSBSYM="C39" W !,"^BY2,3.0^FO20,100^B3N,N,80,Y,N^FR^FD"_PSBBAR_"^FS"
;
; Code 128
I PSBSYM="128" W !,"^BY2,3.0^FO20,100^BCN,80,Y,N,N^FR^FD>:"_PSBBAR_"^FS"
;
; Code I 2 of 5
I PSBSYM="I25" W !,"^BY2,3.0^FO20,100^B2N,80,Y,N,N^FR^FD"_PSBBAR_"^FS"
;
I PSBSYM="" W $$DATA(20,100,"PSB DEFAULT BARCODE FORMAT Undefined.")
;
; Close Label
W !,"^XZ",!
H 2
Q
;
DATA(X,Y,TEXT) ; Code to place the data on the label
W !,"^FO"_X_","_Y_"^A0N,30,20^CI13^FR^FD"_TEXT_"^FS"
Q ""
;
INPTR ;Input transform for DRUG field (#.31) in file 53.69.
K:$L(X)>40!($L(X)<1) X I $D(X) D
.S X=$TR(X,"abcdefghijklmnopqrstuvwxyz","ABCDEFGHIJKLMNOPQRSTUVWXYZ")
.N DIC S DIC="^PSDRUG(",DIC(0)="EQNM",D="B^C^VAPN^VAC^NDC^XATC"
.S DIC("S")="I '$G(^PSDRUG(+Y,""I""))!($G(^(""I""))>DT),$P($G(^PSDRUG(+Y,2)),U,3)[""I""!($P($G(^PSDRUG(+Y,2)),U,3)[""U"")"
.D:+X'>0 MIX^DIC1
.D:+X>0 ^DIC
.S:+Y>0 X=$$GET1^DIQ(50,+Y_",",.01)_"~"_+Y K:+Y<1 X
Q
;