source: FOIAVistA/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDOPTS.m@ 1397

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

initial load of FOIAVistA 6/30/08 version

File size: 4.4 KB
Line 
1PSDOPTS ;BIR/LT L- Review OP Transactions for a Drug (cont.) ; 29 Aug 94
2 ;;3.0; CONTROLLED SUBSTANCES ;**18,26,55**;13 Feb 97
3 ;
4 ;References to ^PSD(58.8, covered by DBIA2711
5 ;References to DD(58.81 and ^PSD(58.81 are covered by DBIA2808
6 ;References to ^PSDRUG( are covered by DBIA221
7 ;References to ^PSRX( are covered by DBIA986
8 S CNT=0 W !!,"You may select one, several, or ^ALL drugs."
9CHKD F S DIC="^PSD(58.8,+PSDLOC,1,",DIC(0)="AEQ",DIC("A")="Please Select "_PSDLOCN_"'s Drug: ",DIC("S")="I $S($G(^(""I"")):$G(^(""I""))>DT,1:1)" W ! D ^DIC K DIC G:X'="^ALL"&(Y<1)&('CNT) END Q:Y<0 D
10 .I '$O(^PSD(58.81,"F",+Y,0)) W !!,"There have been no transactions for this drug.",!! Q
11 .S PSD=$P($G(^PSDRUG(+Y,0)),U),CNT=CNT+1
12 .S PSD=$S(PSD]"":PSD,1:"UNKNOWN DRUG #"_+Y)
13 .S ^TMP("PSD",$J,PSD,+Y)="" K PSD
14 I X="^ALL" F S PSDU=$O(^PSD(58.8,+PSDLOC,1,PSDU)) Q:'PSDU D
15 .Q:'$O(^PSD(58.81,"F",PSDU,0))
16 .S PSD=$P($G(^PSDRUG(PSDU,0)),U)
17 .S PSD=$S(PSD]"":PSD,1:"UNKNOWN DRUG #"_PSDU)
18 .S ^TMP("PSD",$J,PSD,PSDU)="" K PSD
19 S DIR(0)="S^1:Sort by Rx #;2:Sort by Date Posted;3:Sort by Date Filled (Not Posted)"
20 S DIR("A")="Within Drug, Sort by",DIR("B")=1
21 S DIR("?")="For each drug, do you want the transactions listed in the order they were posted, by Rx #, or by fill date (not posted)?"
22 D ^DIR K DIR G:$D(DIRUT) END G:Y=1 ^PSDOPTX G:Y=3 ^PSDOPTN
23 S DIR(0)="DA^2910501:NOW:AEPT"
24 S DIR("A")="Beginning date@time posted: ",DIR("?")="I will list Outpatient transactions for your selected drug(s) within your selected date@time range. Please don't enter a date@time in the future" W ! D ^DIR G:Y<1 END
25 S (PSDT,PSDTB)=Y,PSDTB(2)=Y(0)
26 S DIR(0)="DA^"_PSDT_":NOW:AET"
27 S DIR("A")="Ending date@time posted: "
28 S DIR("?")=$G(DIR("?"))_" or before "_$G(PSDTB(2))
29 W ! D ^DIR K DIR G:Y<1 END S PSDTB(1)=Y,PSDTB(3)=Y(0)
30 S:'$P(PSDTB(1),".",2) PSDTB(1)=PSDTB(1)+.999999
31 S Y=$P($G(^PSD(58.8,+PSDLOC,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
32DEV ;device
33 K IO("Q") N %ZIS,IOP,POP S %ZIS="Q",%ZIS("B")=PSDEV W ! D ^%ZIS I POP W !,"NO DEVICE SELECTED OR OUTPUT PRINTED!" Q
34 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSDOPTS",ZTDESC="Drug OP transaction review" D SAVE D ^%ZTLOAD,HOME^%ZIS S PSDOUT=1 G END
35START ;compiles
36 U IO N PSDR,PG S (PG,PSDOUT)=0 K LN D HEADER S PSDU=0
37 F S PSDU=$O(^TMP("PSD",$J,PSDU)) Q:PSDU']"" S PSDU(1)=$O(^TMP("PSD",$J,PSDU,0)) D G:PSDOUT END S PSDT=PSDTB,PSDT(1)=0
38 .;DAVE B (PSD*3*26 16MAY00)
39LOOP .F S PSDT=$O(^PSD(58.81,"ACT",PSDT)) W:$E(IOST)="C" "." Q:'PSDT!(PSDT>PSDTB(1)) S L=0 F S L=$O(^PSD(58.81,"ACT",PSDT,L)) Q:L="" D:L=PSDLOC&($O(^PSD(58.81,"ACT",PSDT,L,0))=PSDU(1))&($O(^PSD(58.81,"ACT",PSDT,L,+PSDU(1),6,0))) Q:PSDOUT
40 ..S PSDR(3)=+$O(^PSD(58.81,"ACT",PSDT,PSDLOC,+PSDU(1),6,0))
41 ..S PSDR(2)=$G(^PSD(58.81,PSDR(3),0))
42 ..S PSDR(4)=$G(^PSD(58.81,PSDR(3),6))
43 ..D:$Y+6>IOSL HEADER Q:PSDOUT
44 ..S PSDT(1)=$G(PSDT(1))+1 W:PSDT(1)=1 !,PSDU
45 ..W:$P(PSDR(4),U,6)&($P(PSDR(2),U,7)'=$P(PSDR(4),U,6)) ?54,"RPH=> ",$E($P($G(^VA(200,+$P(PSDR(4),U,6),0)),U),1,20)
46 ..S Y=$E($P(PSDR(2),U,4),1,12) X ^DD("DD") W !!,Y,?19
47 ..S DFN=$P($G(^PSRX(+$P(PSDR(4),U),0)),U,2)
48 ..N C S Y=DFN,C=$P(^DD(58.81,73,0),U,2) D Y^DIQ
49 ..W $P(PSDR(4),U,5),?28,Y
50 ..D PID^VADPT6 W " ("_VA("BID")_")",?60
51 ..I $P(PSDR(4),U,2) S Y=$P($G(^PSRX(+$P(PSDR(4),U),1,+$P(PSDR(4),U,2),0)),U,18) X ^DD("DD") W Y
52 ..I $P(PSDR(4),U,4) S Y=$P($G(^PSRX(+$P(PSDR(4),U),"P",+$P(PSDR(4),U,4),0)),U,19) X ^DD("DD") W Y
53 ..I '$P(PSDR(4),U,2)&('$P(PSDR(4),U,4)) S Y=$P($G(^PSRX(+$P(PSDR(4),U),2)),U,13) X ^DD("DD") W Y
54 ..W !,"Qty: ",$P(PSDR(2),U,6)," Bal: ",$P(PSDR(2),U,10)-$P(PSDR(2),U,6),?22,"RPH=> ",$P($G(^VA(200,+$P(PSDR(2),U,7),0)),U),?60
55 ..W $S($P(PSDR(4),U,2):"Refill #"_$P(PSDR(4),U,2),$P(PSDR(4),U,4):"Partial #"_$P(PSDR(4),U,4),1:"Original")
56 ..W !,LN,!
57END W:$E(IOST)'="C" @IOF
58 I $E(IOST)="C",'PSDOUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
59 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@"
60 D KVAR^VADPT K IO("Q"),VA("PID"),VA("BID"),^TMP("PSD",$J)
61 Q
62HEADER I $E(IOST,1,2)'="P-",PG S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
63 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSDOUT=1
64 W:$Y @IOF S $P(LN,"-",81)="",PG=PG+1 W !,"Outpatient Activity from ",PSDTB(2)," to ",PSDTB(3),?70,"PAGE: ",PG,!,LN,!,"Date Posted",?19,"Rx#",?28,"Patient",?60,"Date Released",!,LN W:$G(PSDT(1)) !,PSDU," (continued)",!
65 Q
66SAVE ;
67 S ZTSAVE("^TMP(""PSD"",$J,")=""
68 S (ZTSAVE("PSDT"),ZTSAVE("PSDLOC"),ZTSAVE("PSDTB"),ZTSAVE("PSDTB("))=""
69 Q
Note: See TracBrowser for help on using the repository browser.