source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDLBL0.m@ 1611

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

initial load of FOIAVistA 6/30/08 version

File size: 2.8 KB
Line 
1PSDLBL0 ;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 (PSDCNT,PSDOUT)=0,PSDX2=1
16 S PSD="" F S PSD=$O(^TMP("PSDLBL",$J,PSD)) Q:PSD=""!(PSDOUT) S PSDCNT=PSDCNT+1,TEMP(PSDCNT)=$E($P(^TMP("PSDLBL",$J,PSD),"^",2),1,28),TEST(PSDCNT)=$P(^TMP("PSDLBL",$J,PSD),"^")_" "_$P(^TMP("PSDLBL",$J,PSD),"^",3) D:PSDCNT=3 PRINT1
17 I PSDCNT,PSDCNT<3 D PRINT1
18DONE I $E(IOST)'="C" W @IOF
19 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
20END ;kill variables and exit
21 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
22 K POP,PSD,PSD1,PSD2,PSDA,PSDBAR0,PSDBAR1,PSDCNT,PSDEV,PSDG,PSDJ,PSDN,PSDPN,PSDOUT,PSDR,PSDRG,PSDPRT,PSDRN,PSDS,PSDSN,PSDT,PSDX1,PSDX2
23 K SEL,STAT,TEMP,TEST,TEXT,X,Y,ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTSK
24 K ^TMP("PSDLBL",$J)
25 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
26 Q
27LOOP S PSDPN=$P(PSD1(PSD1),",",PSDCNT),PSDCNT=PSDCNT+1 I PSDPN="" S PSDCNT=1 Q
28 F PSDJ=0:0 S PSDJ=$O(^PSD(58.81,"D",PSDPN,PSDJ)) Q:'PSDJ D SET1
29 G LOOP
30 Q
31PRINT1 ;prints labels
32 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*33+1,$E(TEMP(PSDX1+1),1,30)
33 I $D(PSDPRT) W !! F PSDX1=1:1:PSDCNT W @PSDBAR1,$P(TEST(PSDX1)," "),@PSDBAR0
34 W ! F PSDX1=0:1:PSDCNT-1 W ?PSDX1*32+3,TEST(PSDX1+1)
35 W !!
36 S PSDCNT=0,PSDX2=PSDX2+1 S:PSDX2=11 PSDX2=1
37 Q
38SET1 ;sets disp info
39 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)
40 I ANS="N" Q:'$D(NAOU(+PSD)) S PSDPN=$P(NODE,"^",17) Q:PSDPN']""
41 I ANS="R" S STAT=+$P(NODE,"^",11) Q:STAT'=3
42 S NAOU=+$P(NODE,"^",18) Q:'NAOU S NAOUN=$P($G(^PSD(58.8,+NAOU,0)),"^")
43 S PSDR=+$P(NODE,"^",5) Q:'PSDR
44 S PSDA=+$P(NODE,"^",20) Q:'PSDA
45 S PSDN=$P($G(^PSDRUG(+PSDR,0)),"^")
46 S TEXT(PSDR)=PSDN_"^"_NAOUN
47SET ;sets ^tmp
48 S ^TMP("PSDLBL",$J,PSDPN)=PSDPN_"^"_$P(TEXT(PSDR),"^")_"^"_$E($P(TEXT(PSDR),"^",2),1,12)
49DIE ;update label printed
50 Q:'PSDJ
51 K DA,DIE,DR S DA=+PSDJ,DIE=58.81,DR="104////"_PSDT D ^DIE K DA,DIE,DR
52 Q
Note: See TracBrowser for help on using the repository browser.