source: WorldVistAEHR/trunk/r/CONTROLLED_SUBSTANCES-PSD/PSDADJD.m@ 1717

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

initial load of WorldVistAEHR

File size: 4.1 KB
RevLine 
[613]1PSDADJD ;BIR/LTL-Review Adjustment Transactions for a Drug; 2 Nov 94 [ 11/02/94 3:53 PM ]
2 ;;3.0; CONTROLLED SUBSTANCES ;**18,36**;13 Feb 97
3 ;
4 ;References to ^PSD(58.8, covered by DBIA2711
5 ;References to PSD(58.81 are covered by DBIA2808
6 ;References to ^PSDRUG( are covered by DBIA221
7 N PSDOUT I '$D(PSDSITE) D ^PSDSET I '$D(PSDSITE) S PSDOUT=1 G END
8 N C,CNT,DIC,DIR,DTOUT,DUOUT,PSD,PSDA,PSDC,PSDEV,PSDR,PSDU,PSDLOC,PSDLOCN,PSDT,PSDTB,X,Y S PSDOUT=1,(CNT,PSDU)=0,PSDCHO=2
9 D DT^DICRW
10 S PSDLOC=$P(PSDSITE,U,3),PSDLOCN=$P(PSDSITE,U,4)
11 G:$P(PSDSITE,U,5) CHKD
12LOOK S DIC="^PSD(58.8,",DIC(0)="AEQ",DIC("A")="Select Dispensing Site: "
13 S DIC("S")="I $P($G(^(0)),U,3)=+PSDSITE,$S($P($G(^(0)),U,2)[""M"":1,$P($G(^(0)),U,2)[""S"":1,1:0),($S('$D(^(""I"")):1,+^(""I"")>DT:1,'^(""I""):1,1:0))"
14 S DIC("B")=$P(PSDSITE,U,4)
15 W ! D ^DIC K DIC G:Y<0 END S PSDLOC=+Y,PSDLOCN=$P(Y,U,2)
16 S $P(PSDSITE,U,3)=+Y,$P(PSDSITE,U,4)=$P(Y,U,2)
17 W !!,"You may select one, several, or ^ALL drugs."
18CHKD F S DIC="^PSD(58.8,+PSDLOC,1,",DIC(0)="AEMQZ",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 S PSD(Y(0,0))=+Y,PSDA(+Y)=Y(0,0),CNT=CNT+1
19 I CNT=1,'$O(^PSD(58.81,"F",+PSD($O(PSD(0))),"")) W !!,"There have been no adjustments for this drug.",!! G END
20 I X="^ALL" F S PSDU=$O(^PSD(58.8,+PSDLOC,1,PSDU)) Q:'PSDU S:$P($G(^PSDRUG(PSDU,0)),U)]"" PSD($P(^(0),U))=PSDU,PSDA(PSDU)=$P(^(0),U)
21 S DIR(0)="D^::AEPT",DIR("A")="Beginning date",DIR("?")="Adjustments will be listed for the selected drug(s) within the selected date range" W ! D ^DIR G:Y<1 END
22 S (PSDT,PSDTB)=Y,PSDTB(2)=Y(0),DIR(0)="DA^"_PSDT_":NOW:AEPT"
23 S DIR("A")="Ending date: ",DIR("B")="Now"
24 W ! D ^DIR K DIR G:Y<1 END S PSDTB(1)=Y,PSDTB(3)=Y(0)
25 S:'$P(PSDTB(1),".",2) PSDTB(1)=PSDTB(1)+.999999
26 D G:Y<1 END
27 .S DIR(0)="S^1:DATE/DRUG (132 column;2:DRUG/DATE (80 column, browser)"
28 .S DIR("B")=1,DIR("?")="^S XQH=""PSD BALANCE ADJUSTMENT REPORT"" D EN^XQH" D ^DIR K DIR S PSDCHO=Y
29 S Y=$P($G(^PSD(58.8,+PSDLOC,2)),"^",9),C=$P(^DD(58.8,24,0),"^",2) D Y^DIQ S PSDEV=Y
30DEV ;asks device and queueing info
31 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
32 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN=$S(PSDCHO=2:"START^PSDADJD",1:"START^PSDADJW"),ZTDESC="Drug adjustment transaction review",ZTSAVE("PSD*")="" D ^%ZTLOAD,HOME^%ZIS S PSDOUT=1 G END
33 ;PSD*3*36 (11oct01 - USE SELECTED DEVICE Dave B.)
34 U IO
35 ;Eop36
36 G:PSDCHO=1 ^PSDADJW
37 ;(PSD*3*18 - Dave B changed next line to FM calls per SQA)
38 I $E(IOST)="C" D CHK I $G(GOOD)'<21,$$TEST^DDBRT W !!,"Getting ready to browse...",!! G ^PSDADJB
39START ;compiles and prints output
40 N LN,PSDR,PG S (PG,PSDOUT)=0 D HEADER S PSDU=0
41 F S PSDU=$O(PSD(PSDU)) Q:PSDU']"" D G:PSDOUT END S PSDT=PSDTB,PSDT(1)=0
42LOOP .F S PSDT=$O(^PSD(58.81,"ACT",PSDT)) W:$E(IOST)="C" "." Q:'PSDT!(PSDT>PSDTB(1)) D:$O(^PSD(58.81,"ACT",PSDT,0))=PSDLOC&($O(^PSD(58.81,"ACT",PSDT,PSDLOC,0))=PSD(PSDU))&($O(^PSD(58.81,"ACT",PSDT,PSDLOC,PSD(PSDU),9,0))) Q:PSDOUT
43 ..S PSDR(2)=$G(^PSD(58.81,+$O(^PSD(58.81,"ACT",PSDT,PSDLOC,PSD(PSDU),9,0)),0))
44 ..D:$Y+7>IOSL HEADER Q:PSDOUT
45 ..S PSDT(1)=$G(PSDT(1))+1 W:PSDT(1)=1 !,PSDU,!
46 ..S Y=$E($P(PSDR(2),U,4),1,12) X ^DD("DD") W !,Y," "," -> "
47 ..W $P(PSDR(2),U,6)," adjusted by ",$P($G(^VA(200,+$P(PSDR(2),U,7),0)),U),!!
48 ..W "Reason: ",$P(PSDR(2),U,16),!
49END W:$E(IOST)'="C" @IOF
50 I $E(IOST)="C",'PSDOUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
51 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q")
52 Q
53HEADER ;prints header info
54 I $E(IOST,1,2)'="P-",PG S DIR(0)="E" D ^DIR K DIR I 'Y S PSDOUT=1 Q
55 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSDOUT=1
56 W:$Y @IOF S $P(LN,"-",80)="",PG=PG+1 W !,"Adjustments from ",PSDTB(2)," to ",PSDTB(3),?70,"PAGE: ",PG,!,LN W:$G(PSDT(1)) !,PSDU," (continued)",!
57 ;
58CHK ;(DAVE B 26OCT99)
59 ;PSD*3*18 Had to change looking at 9.4 directly to FM calls (BS)
60 ;
61 S DIC="^DIC(9.4,",DIC(0)="QZ",X="VA FILEMAN" D ^DIC I +Y'>0 S GOOD=0 Q
62 S GOOD=$$GET1^DIQ(9.4,+Y,13,"I")
63 Q
Note: See TracBrowser for help on using the repository browser.