source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDLBL1.m@ 1111

Last change on this file since 1111 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 3.6 KB
Line 
1PSDLBL1 ;BIR/JPW-CS Label Print for Vault Drugs ; 29 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
4 S OK=$S($D(^XUSEC("PSJ RPHARM",DUZ)):1,$D(^XUSEC("PSJ PHARM TECH",DUZ)):1,1:0)
5 I 'OK W $C(7),!!,?9,"** Please contact your Pharmacy Coordinator for access to",!,?12,"print CS dispensing labels.",!!,"PSJ RPHARM or PSJ PHARM TECH security key required.",! K OK Q
6ASKD ;ask disp location
7 S PSDS=$P(PSDSITE,U,3),PSDSN=$P(PSDSITE,U,4)
8 G:$P(PSDSITE,U,5) CHKD
9 K DIC,DA S DIC=58.8,DIC(0)="QEAZ",DIC("S")="I $P(^(0),""^"",3)=+PSDSITE,$S($P(^(0),""^"",2)[""M"":1,$P(^(0),""^"",2)[""S"":1,1:0)"
10 S DIC("A")="Select Primary Dispensing Site: ",DIC("B")=PSDSN
11 D ^DIC K DIC G:Y<0 END
12 S PSDS=+Y,PSDSN=$P(Y,"^",2),$P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=PSDSN
13CHKD I '$O(^PSD(58.8,PSDS,1,0)) W !!,"There are no CS stocked drugs for your dispensing vault.",!! G END
14DRUG ;ask drug
15 W !!,?5,"You may select a single drug, several drugs,",!,?5,"or enter ^ALL to select all drugs.",!!
16 W ! K DA,DIC
17 F S DIC("W")="W:$P(^PSDRUG(Y,0),""^"",9) "" N/F"" I $P(^PSD(58.8,PSDS,1,Y,0),""^"",14)]"""",$P(^(0),""^"",14)'>DT W $C(7),"" *** INACTIVE ***""",DA(1)=+PSDS,DIC(0)="QEAM",DIC="^PSD(58.8,"_PSDS_",1," D ^DIC K DIC Q:Y<0 D
18 .S PSDRG(+Y)=""
19 I '$D(PSDRG)&(X'="^ALL") G END
20 I X="^ALL" S ALL=1
21DEV ;ask device and queue info
22 W $C(7),!!,?3,"WARNING: The printing of these labels requires the use of a sheet fed",!,?12,"laser printer setup to create Controlled Substances",!,?12,"barcodes.",!
23 W !,?12,"*** Check printer for LABEL paper before printing! ***",!
24 W !!,"This report is designed for a 3 column label format.",!,"You may queue this report to print at a later time.",!!
25 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",10),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
26 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")=PSDEV D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
27 I $D(IO("Q")) K IO("Q"),ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDLBL1",ZTDESC="Print Vault Labels for CS PHARM" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
28 U IO
29START ;entry for compile and print labels
30 K ^TMP("PSDLBL1",$J),PSDPRT
31 F JJ=0,1 S @("PSDBAR"_JJ)="" I $D(^%ZIS(2,^%ZIS(1,IOS,"SUBTYPE"),"BAR"_JJ)) S @("PSDBAR"_JJ)=^("BAR"_JJ)
32 I PSDBAR1]"",PSDBAR0]"" S PSDPRT=1
33 I $D(ALL) F PSD=0:0 S PSD=$O(^PSD(58.8,+PSDS,1,PSD)) Q:'PSD S:$S('$P($G(^PSD(58.8,+PSDS,1,PSD,0)),U,14):1,$P($G(^(0)),U,4):1,$P($G(^(0)),U,14)>DT:1,1:0) PSDRG(PSD)=""
34 F PSD=0:0 S PSD=$O(PSDRG(PSD)) Q:'PSD I $D(^PSD(58.8,+PSDS,1,PSD,0)) D
35 .S PSDRN=$S($P($G(^PSDRUG(+PSD,0)),"^")]"":$P($G(^(0)),"^"),1:"UNKNOWN")
36 .S ^TMP("PSDLBL1",$J,PSDRN)=PSD
37PRINT ;print labels
38 S (PSDOUT,PSDCNT)=0,PSDX2=1
39 S PSD="" F S PSD=$O(^TMP("PSDLBL1",$J,PSD)) Q:PSD=""!(PSDOUT) S PSDCNT=PSDCNT+1,TEMP(PSDCNT)=$E(PSD,1,28),TEST(PSDCNT)=$P(^TMP("PSDLBL1",$J,PSD),"^") D:PSDCNT=3 PRINT1
40 I PSDCNT,PSDCNT<3 D PRINT1
41DONE I $E(IOST)'="C" W @IOF
42 I $E(IOST,1,2)="C-",'PSDOUT W ! K DIR,DIRUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu" D ^DIR K DIR
43END ;kill variables and exit
44 K %ZIS,ALL,C,DA,DIC,DIR,DIROUT,DIRUT,DRUG,DTOUT,DUOUT,JJ,JLP1,OK,POP,PSD,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDOUT,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDX1,PSDX2,TEMP,TEST,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
45 K ^TMP("PSDLBL1",$J)
46 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
47 Q
48SAVE ;save queued variables
49 S:$D(ALL) ZTSAVE("ALL")=""
50 S:$D(PSDRG) ZTSAVE("PSDRG(")=""
51 S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"))=""
52 Q
53PRINT1 ;prints labels
54 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*33+1,$E(TEMP(PSDX1+1),1,30)
55 I $D(PSDPRT) W !! F PSDX1=1:1:PSDCNT W @PSDBAR1,TEST(PSDX1),@PSDBAR0
56 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*32+3,TEST(PSDX1+1)
57 W !!
58 S PSDCNT=0,PSDX2=PSDX2+1 S:PSDX2=11 PSDX2=1
59 Q
Note: See TracBrowser for help on using the repository browser.