source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDLBLI.m@ 1722

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

initial load of FOIAVistA 6/30/08 version

File size: 2.7 KB
Line 
1PSDLBLI ;BIR/JPW-CS Label Print for CS Inspectors Name ; 30 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
4 I '$D(^XUSEC("PSDMGR",DUZ)) W !!,"Contact your Pharmacy Coordinator. You do not have the Supervisor",!,"access required to print labels.",!!,"PSDMGR security key required.",! Q
5INSP ;ask inspector name
6 W !!,?5,"You may select a single name or several names.",!
7 W ! S PSDCNT=0 K DA,DIC
8 F S DIC=200,DIC(0)="QEA",DIC("A")="Select CS Inspectors Name: " D ^DIC K DIC Q:Y<0 D
9 .S PSDTMP(+Y)="",PSDCNT=PSDCNT+1
10 G:'$D(PSDTMP) END
11DEV ;ask device and queue info
12 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.",!
13 W !,?12,"*** Check printer for LABEL paper before printing! ***",!
14 W !!,"This report is designed for a 3 column label format.",!,"You may queue this report to print at a later time.",!!
15 K %ZIS,IOP,IO("Q"),POP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G END
16 I $D(IO("Q")) K IO("Q"),ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDLBLI",ZTDESC="Print Inspector Labels for CS PHARM" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
17 U IO
18START ;entry for compile and print labels
19 K ^TMP("PSDLBLI",$J),PSDPRT
20 F JJ=0,1 S @("PSDBAR"_JJ)="" I $D(^%ZIS(2,^%ZIS(1,IOS,"SUBTYPE"),"BAR"_JJ)) S @("PSDBAR"_JJ)=^("BAR"_JJ)
21 I PSDBAR1]"",PSDBAR0]"" S PSDPRT=1
22 F PSD=0:0 S PSD=$O(PSDTMP(PSD)) Q:'PSD I $D(^VA(200,PSD,0)),$D(^VA(200,PSD,1)) D
23 .S PSDN=$S($P($G(^VA(200,+PSD,0)),"^")]"":$P($G(^(0)),"^"),1:"UNKNOWN")
24 .S SSN=$P($G(^VA(200,+PSD,1)),"^",9) S:SSN SSN="I"_$E(SSN,1,3)_"-"_$E(SSN,4,5)_"-"_$E(SSN,6,9)
25 .S ^TMP("PSDLBLI",$J,PSDN)=SSN
26PRINT ;print labels
27 S (PSDOUT,PSDCNT)=0,PSDX2=1
28 S PSD="" F S PSD=$O(^TMP("PSDLBLI",$J,PSD)) Q:PSD=""!(PSDOUT) S PSDCNT=PSDCNT+1,TEMP(PSDCNT)=PSD,TEST(PSDCNT)=$P(^TMP("PSDLBLI",$J,PSD),"^") D:PSDCNT=3 PRINT1
29 I PSDCNT,PSDCNT<3 D PRINT1
30DONE I $E(IOST)'="C" W @IOF
31 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
32END ;kill variables and exit
33 K %ZIS,ALL,DA,DIC,DIR,DIROUT,DIRUT,DRUG,DTOUT,DUOUT,JJ,JLP1,POP,PSD,PSDBAR0,PSDBAR1,PSDCNT,PSDN,PSDOUT,PSDPRT,PSDR,PSDTMP,PSDX1,PSDX2,SSN,TEMP,TEST,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
34 K ^TMP("PSDLBLI",$J)
35 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
36 Q
37SAVE ;save queued variables
38 S ZTSAVE("PSDCNT")="" S:$D(ALL) ZTSAVE("ALL")=""
39 S:$D(PSDTMP) ZTSAVE("PSDTMP(")=""
40 Q
41PRINT1 ;prints labels
42 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*33+1,TEMP(PSDX1+1)
43 I $D(PSDPRT) W !! F PSDX1=1:1:PSDCNT W @PSDBAR1,TEST(PSDX1),@PSDBAR0
44 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*32+3,"Ins"
45 W !!
46 S PSDCNT=0,PSDX2=PSDX2+1 S:PSDX2=11 PSDX2=1
47 Q
Note: See TracBrowser for help on using the repository browser.