source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDEVOR.m@ 1259

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1PSDEVOR ;BIR/BJW-Print Edit/Canc Ver Orders Report ; 9 Feb 98
2 ;;3.0; CONTROLLED SUBSTANCES ;**8**;13 Feb 97
3 ;**Y2K compliance**,"P" added to date input string
4 I '$D(PSDSITE) D ^PSDSET Q:'$D(PSDSITE)
5 I '$D(^XUSEC("PSJ RPHARM",DUZ)) W !!,"Contact your Pharmacy Coordinator for access to print the Edit Verified",!,"Orders data. PSJ RPHARM security key required.",!! 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
14DATE W ! K %DT S %DT="AEPX",%DT("A")="Start with Date: " D ^%DT I Y<0 G END
15 S PSDSD=Y D D^DIQ S PSDATE=Y,%DT("A")="End with Date: " D ^%DT I Y<0 G END
16 I Y<PSDSD W !!,"The ending date of the range must be later than the starting date." G DATE
17 S PSDED=Y D D^DIQ S PSDATE=PSDATE_"^"_Y,PSDSD=PSDSD-.0001,PSDED=PSDED+.9999
18 W !!,"This report is designed for a 132 column format.",!,"You may queue this report to print at a later time.",!!
19DEV ;sel device
20 S Y=$P($G(^PSD(58.8,+PSDS,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
21 W ! 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
22 I $D(IO("Q")) K IO("Q"),ZTIO,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDEVOR",ZTDESC="CS PHARM Edit/Canc Ver Ord" D SAVE,^%ZTLOAD,HOME^%ZIS K ZTSK G END
23 U IO
24START ;entry for compile
25 K ^TMP("PSDEVOR",$J) S PSD1=12.99,PSD2=14.99
26 F PSD=PSDSD:0 S PSD=$O(^PSD(58.81,"ACT",PSD)) Q:'PSD!(PSD>PSDED) F PSDR=0:0 S PSDR=$O(^PSD(58.81,"ACT",PSD,PSDS,PSDR)) Q:'PSDR D
27 .F PSDTYP=PSD1:0 S PSDTYP=$O(^PSD(58.81,"ACT",PSD,PSDS,PSDR,PSDTYP)) Q:'PSDTYP!(PSDTYP>PSD2) F PSDA=0:0 S PSDA=$O(^PSD(58.81,"ACT",PSD,PSDS,PSDR,PSDTYP,PSDA)) Q:'PSDA D
28 ..Q:'$D(^PSD(58.81,PSDA,0)) S NODE=^(0),PSDPN=$S($P(NODE,"^",17)]"":$P(NODE,"^",17),1:"UNKNOWN"),QTY=$P(NODE,"^",6)
29 ..S PSDRN=$S($P($G(^PSDRUG(PSDR,0)),"^")]"":$P(^(0),"^"),1:"ZZ/"_PSDR_" NAME MISSING")
30 ..I $D(^PSD(58.81,PSDA,4)),PSDTYP=14 S NQTY=$P(^(4),"^",3),MFG=+$P(^(4),"^",5),PHARM=$P(^(4),"^",2),PHARM=$P($G(^VA(200,+PHARM,0)),"^"),PHARM=$P(PHARM,",")_","_$E($P(PHARM,",",2)),ACT="EDIT"
31 ..I $D(^PSD(58.81,PSDA,5)),PSDTYP=13 S PHARM=$P(^(5),"^",2),PHARM=$P($G(^VA(200,+PHARM,0)),"^"),PHARM=$P(PHARM,",")_","_$E($P(PHARM,",",2)),NQTY=0,MFG=0,ACT="CANC"
32 ..S ^TMP("PSDEVOR",$J,PSD,PSDPN,PSDTYP)=PSDRN_"^"_ACT_"^"_PHARM_"^"_QTY_"^"_NQTY_"^"_MFG
33PRINT ;prints data
34 K LN S (PG,PSDOUT)=0,$P(LN,"-",132)="" D HDR
35 I '$D(^TMP("PSDEVOR",$J)) W !!,?15,"**** NO VERIFIED ORDERS EDITED OR CANCELLED ****",!! G DONE
36 F PSD=0:0 S PSD=$O(^TMP("PSDEVOR",$J,PSD)) Q:'PSD!(PSDOUT) S NUM="" F S NUM=$O(^TMP("PSDEVOR",$J,PSD,NUM)) Q:NUM=""!(PSDOUT) F TYPE=0:0 S TYPE=$O(^TMP("PSDEVOR",$J,PSD,NUM,TYPE)) Q:'TYPE!(PSDOUT) D
37 .S DATE=$E(PSD,4,5)_"/"_$E(PSD,6,7)_"/"_$E(PSD,2,3),NODE=^TMP("PSDEVOR",$J,PSD,NUM,TYPE)
38 .S MFG=$P(NODE,"^",6)
39 .D:$Y+4>IOSL HDR Q:PSDOUT
40 .W !,NUM,?10,$P(NODE,"^"),?53,$P(NODE,"^",2),?60,DATE,?70,$P(NODE,"^",4),?78,$P(NODE,"^",5),?90,$S(MFG:"FIELDS EDITED",1:"NOT EDITED"),?110,$P(NODE,"^",3)
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 ;
44 K %,%DT,%H,%I,%ZIS,ACT,C,DA,DATE,DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,LN,MFG,NODE,NQTY,NUM
45 K PG,PHARM,POP,PSD,PSD1,PSD2,PSDA,PSDATE,PSDED,PSDEV,PSDOUT,PSDPN,PSDR,PSDRN,PSDS,PSDSD,PSDSN,PSDTYP,QTY,TYPE,X,Y
46 K ^TMP("PSDEVOR",$J),ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE,ZTSK
47 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
48 Q
49SAVE S (ZTSAVE("PSDS"),ZTSAVE("PSDSN"))=""
50 S (ZTSAVE("PSDSD"),ZTSAVE("PSDED"),ZTSAVE("PSDATE"))=""
51 Q
52HDR ;header
53 I $E(IOST,1,2)="C-",PG K DA,DIR S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
54 S PG=PG+1 W:$Y @IOF W !,?20,"Edited or Verified Orders for ",PSDSN,?115,"Page: ",PG,!,?20,"Date: ",$P(PSDATE,"^")," to ",$P(PSDATE,"^",2),!!
55 W ?70,"ORIG",?78,"NEW",!
56 W "DISP #",?10,"DRUG",?52,"ACTION",?62,"DATE",?70,"QTY",?78,"QTY",?86,"MFG/LOT #/EXP.DATE",?110,"PHARMACIST",!,LN,!!
57 Q
Note: See TracBrowser for help on using the repository browser.