source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDRPGS1.m@ 1801

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1PSDRPGS1 ;BIR/JPW-Reprint Green Sheet (VA FORM 10-2638) cont'd ; 3 Mar 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
3 ;**Y2K compliance** display 4 digit year on va forms
4START ;loop through transactions
5 ;second call to %ZIS to restore varibles for open execute
6 I $D(ZTQUEUED) S IOP=ION D ^%ZIS U IO
7 S PSD=$P(PSDS,"^",2),PSDCNT=1
8 S PSD1="" F S PSD1=$O(PSD1(PSD1)) Q:PSD1="" D LOOP
9END K %ZIS,ANS,ASK,C,CNT,D,DA,DIC,DIE,DIR,DIROUT,DIRUT,DR,DTOUT,DUOUT,EXP,EXPD,LINE,LOT,NAOU,NAOUN,NODE,NODE1
10 K OK,ORD,ORDN,POP,PRT,PSD,PSD1,PSDA,PSDBY,PSDBYN,PSDCNT,PSDDT,PSDEV,PSDOUT,PSDCPI,PSDPN,PSDR,PSDRN,PSDS,PSDSN,PSDT,PSDTR,PSDTRN,PSDYR,REPRINT,QTY,SITE,STAT,TRANS,Y,ZTDESC,ZTDTH,ZTRTN,ZTSAVE,ZTSK
11 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
12 Q
13LOOP S PSDPN=$P(PSD1(PSD1),",",PSDCNT),PSDCNT=PSDCNT+1 I PSDPN="" S PSDCNT=1 Q
14 S PSDA=$O(^PSD(58.81,"D",PSDPN,0)) D SET
15 G LOOP
16 Q
17SET ;set data for printing
18 K TRANS,PSDTR S PSDOUT=0
19 Q:'$D(^PSD(58.81,+PSDA,0)) S NODE=^PSD(58.81,+PSDA,0)
20 Q:+$P(NODE,"^",3)'=+PSDS I (+$P(NODE,"^",11)>4)&(+$P(NODE,"^",11)'=10)&(+$P(NODE,U,11)'=13) Q
21 I +$P($G(^PSD(58.81,PSDA,"CS")),"^",4) S REPRINT=1
22 S PSD=+$P(NODE,"^",18)
23 S NAOUN=$S($P($G(^PSD(58.8,+PSD,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
24 S PSDR=$P(NODE,"^",5),PSDRN=$S($P($G(^PSDRUG(PSDR,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
25 S PSDT=$P(NODE,"^",4)
26 S QTY=$P(NODE,"^",6) I $D(^PSD(58.81,PSDA,4)),+$P(^(4),"^",3) S QTY=$P(^(4),"^",3)
27 S LOT=$P(NODE,"^",14),EXP=$P(NODE,"^",15),EXPD="" I EXP S Y=$E(EXP,1,7) X ^DD("DD") S EXPD=Y
28 S (PSDBY,PSDBYN,ORD,ORDN)=""
29 I $D(^PSD(58.81,PSDA,1)) S NODE1=^(1),PSDBY=$P(NODE1,"^"),ORD=$P(NODE1,"^",7)
30 S:ORD ORDN=$S($P($G(^VA(200,ORD,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
31 S:PSDBY PSDBYN=$S($P($G(^VA(200,PSDBY,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
32 S CNT=1,PSDTR(CNT)=+$O(^PSD(58.81,"AE",PSDA,0)) D:PSDTR(CNT) G:PSDOUT PRINT
33 .S TRANS=1
34 .D SETT Q:PSDOUT
35 .S NAOU=+$P($G(^PSD(58.81,PSDTR(CNT),0)),"^",18)
36 .S:NAOU $P(PSDTR(CNT),"^",2)=$S($P($G(^PSD(58.8,+NAOU,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
37PRINT ;print green sheet
38 I ORDN]"",ORDN'="UNKNOWN" S ORDN=$P(ORDN,",")_","_$E($P(ORDN,",",2))
39 I PSDBYN]"",PSDBYN'="UNKNOWN" S PSDBYN=$P(PSDBYN,",")_","_$E($P(PSDBYN,",",2))
40 S PSDDT="" I PSDT S Y=PSDT X ^DD("DD")
41 S PSDYR=$P(Y,",",2),PSDYR=$E(PSDYR,1,4) S PSDDT=$E(PSDT,4,5)_"/"_$E(PSDT,6,7)_"/"_PSDYR
42 W:$Y @IOF W:$D(REPRINT) ?10,"** REPRINT **" I '$D(TRANS) W ?33,NAOUN
43 W:$D(TRANS) "** Transferred to: ",$S($P(PSDTR(CNT),"^",2)]"":$P(PSDTR(CNT),"^",2),1:$P(PSDTR(CNT-1),"^",2))," **"
44 D A7BAR^PSDPGS1 I $D(A7PRT) W @A7BAR1,PSDPN,@A7BAR0 ;DALISC/JRR
45 W !!,?56,PSDPN,!!,?6,PSDRN,?36,EXPD,?65,QTY,!!,?6,LOT,?20,ORDN,?42,PSDBYN,?60,$E(NAOUN,1,6),?67,PSDDT,!
46 F LINE=1:1:50 W !
47 W:ASK !
48 W ?6,PSDRN,?61,PSDPN,!
49 K DA,DIE,DR S DA=PSDA,DIE=58.81,DR="103////1" D ^DIE K DA,DIE,DR
50 Q
51SETT ;set trans naous
52 S PSDTRN=+$O(^PSD(58.81,"AE",+PSDTR(CNT),0)) Q:'PSDTRN
53 S NAOU=$P($G(^PSD(58.81,+PSDTRN,0)),"^",18) I 'NAOU S PSDOUT=1 Q
54 S:NAOU $P(PSDTR(CNT),"^",2)=$S($P($G(^PSD(58.8,+NAOU,0)),"^")]"":$P(^(0),"^"),1:"UNKNOWN")
55 I $O(^PSD(58.81,"AE",+PSDTRN,0)) S CNT=CNT+1,PSDTR(CNT)=$O(^PSD(58.81,"AE",+PSDTRN,0)) G SETT
56 Q
Note: See TracBrowser for help on using the repository browser.