source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDLBL5.m@ 1751

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1PSDLBL5 ;BIR/JPW-CS Label Prt for CS Disp Drug (cont'd) ; 17 May 94
2 ;;3.0; CONTROLLED SUBSTANCES ;;13 Feb 97
3START ;entry for compile and print labels
4 K ^TMP("PSDLBL",$J),PSDPRT D NOW^%DTC S PSDT=+$E(%,1,12)
5 F JJ=0,1 S @("PSDBAR"_JJ)="" I $D(^%ZIS(2,^%ZIS(1,IOS,"SUBTYPE"),"BAR"_JJ)) S @("PSDBAR"_JJ)=^("BAR"_JJ)
6 I PSDBAR1]"",PSDBAR0]"" S PSDPRT=1
7 S PSDCNT=1
8 I ANS="R" S PSD1="" F S PSD1=$O(PSD1(PSD1)) Q:PSD1="" D LOOP
9 I ANS="R" G PRINT
10 I ANS="N",$D(PSDG) F PSD=0:0 S PSD=$O(PSDG(PSD)) Q:'PSD F PSDN=0:0 S PSDN=$O(^PSI(58.2,PSD,3,PSDN)) Q:'PSDN I $D(^PSD(58.8,PSDN,0)),'$P(^(0),"^",7),$P(^(0),"^",3)=+PSDSITE S NAOU(PSDN)="",CNT=CNT+1
11 I ANS="N",$D(ALL) F PSD=0:0 S PSD=$O(^PSD(58.8,PSD)) Q:'PSD I $D(^PSD(58.8,PSD,0)),$P(^(0),"^",2)="N",$P(^(0),"^",3)=+PSDSITE S NAOU(+PSD)=""
12 S STAT=3
13 F PSD=0:0 S PSD=$O(^PSD(58.81,"AD",STAT,PSD)) Q:'PSD F PSDJ=0:0 S PSDJ=$O(^PSD(58.81,"AD",STAT,PSD,PSDJ)) Q:'PSDJ D SET1
14PRINT ;print labels
15 S (PSD,PSDOUT)="" F S PSD=$O(^TMP("PSDLBL",$J,PSD)) Q:PSD=""!(PSDOUT) D
16 .S PSD(1)=$G(^TMP("PSDLBL",$J,PSD))
17 .W !,$P(PSD(1),U,2)
18 .I $D(PSDPRT) W !,@PSDBAR1,$P(PSD(1),U),@PSDBAR0
19 .W $P(PSD(1),U)," ",$P(PSD(1),U,3),!
20DONE I $E(IOST)'="C" W @IOF
21 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
22END ;kill variables and exit
23 K %,%DT,%H,%I,%ZIS,ALL,ANS,CNT,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DRUG,DTOUT,DUOUT,JJ,JLP1,LIQ,NAOU,NAOUN,NODE,OK
24 K POP,PSD,PSD1,PSD2,PSDA,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDG,PSDJ,PSDN,PSDPN,PSDOUT,PSDR,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDT,PSDX1,PSDX2
25 K SEL,STAT,TEMP,TEST,TEXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
26 K ^TMP("PSDLBL",$J)
27 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
28 Q
29LOOP S PSDPN=$P(PSD1(PSD1),",",PSDCNT),PSDCNT=PSDCNT+1 I PSDPN="" S PSDCNT=1 Q
30 F PSDJ=0:0 S PSDJ=$O(^PSD(58.81,"D",PSDPN,PSDJ)) Q:'PSDJ D SET1
31 G LOOP
32 Q
33PRINT1 ;prints labels
34 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*33+1,$E(TEMP(PSDX1+1),1,30)
35 I $D(PSDPRT) W !! F PSDX1=1:1:PSDCNT W @PSDBAR1,$P(TEST(PSDX1)," "),@PSDBAR0
36 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*32+3,TEST(PSDX1+1)
37 W !!
38 S PSDCNT=0,PSDX2=PSDX2+1 S:PSDX2=11 PSDX2=1
39 Q
40SET1 ;sets disp info
41 Q:'$D(^PSD(58.81,+PSDJ,0)) Q:$P($G(^PSD(58.81,+PSDJ,"CS")),"^",5) S NODE=^PSD(58.81,+PSDJ,0) Q:+$P(NODE,"^",3)'=+$G(PSDS)
42 I ANS="N" Q:'$D(NAOU(+PSD)) S PSDPN=$P(NODE,"^",17) Q:PSDPN']""
43 I ANS="R" S STAT=+$P(NODE,"^",11) Q:STAT'=3
44 S NAOU=+$P(NODE,"^",18) Q:'NAOU S NAOUN=$P($G(^PSD(58.8,+NAOU,0)),"^")
45 S PSDR=+$P(NODE,"^",5) Q:'PSDR
46 S PSDA=+$P(NODE,"^",20) Q:'PSDA
47 S PSDN=$P($G(^PSDRUG(+PSDR,0)),"^")
48 S TEXT(PSDR)=PSDN_"^"_NAOUN
49SET ;sets ^tmp
50 S ^TMP("PSDLBL",$J,PSDPN)=PSDPN_"^"_$P(TEXT(PSDR),"^")_"^"_$E($P(TEXT(PSDR),"^",2),1,12)
51DIE ;update label printed
52 Q:'PSDJ
53 K DA,DIE,DR S DA=+PSDJ,DIE=58.81,DR="104////"_PSDT D ^DIE K DA,DIE,DR
54 Q
Note: See TracBrowser for help on using the repository browser.