source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSAREVD.m@ 1169

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

initial load of WorldVistAEHR

File size: 3.1 KB
Line 
1PSAREVD ;BIR/LTL-Drug Receipt History Review ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
3 ;This routine reviews receipt transactions for a drug.
4 ;
5 ;References to ^PSDRUG( are covered by IA #2095
6 ;References to ^PRC( are covered by IA #214
7 ;References to ^PRCS( are covered by IA #198
8 ;
9 N DIC,DIR,DTOUT,DUOUT,PSA,PSACNT,PSALOCN,PSAR,PSAU,PSAOUT,PSAT,X,Y S PSAOUT=1,PSAU=0
10LOOK D ^PSADA I '$G(PSALOC) S PSAOUT=1 G END
11 I '$O(^PSD(58.8,PSALOC,1,0)) W !!,"There are no drugs in ",PSALOCN G END
12 S PSACNT=0 W !!,"You may select one, several, or ^ALL drugs.",!
13CHKD F S DIC="^PSD(58.8,+PSALOC,1,",DIC(0)="AEMQ",DIC("A")="Please Select "_PSALOCN_"'s Drug: ",DIC("S")="I $S($G(^(""I"")):$G(^(""I""))>DT,1:1)" W ! D ^DIC K DIC G:X'="^ALL"&(Y<1)&('PSACNT) END Q:Y<0 S PSA(+Y)="",PSACNT=PSACNT+1
14 I PSACNT=1&('$O(^PSD(58.81,"F",+$O(PSA(0)),0))) W !!,"There have been no receipts for this drug.",!! G END
15 I X="^ALL" F S PSAU=$O(^PSD(58.8,+PSALOC,1,PSAU)) Q:'PSAU S PSA(PSAU)=""
16 S DIR(0)="D:AEP",DIR("A")="How far back in time do you want to go? ",DIR("B")="T-6M",DIR("?")="I will list receipts for your selected drug(s) within the last six months if you press return" W ! D ^DIR K DIR G:$D(DIRUT) END
17 S PSAT=Y
18DEV ;asks device and queueing info
19 K IO("Q"),PSALOC N %ZIS,IOP,POP S %ZIS="Q" W ! D ^%ZIS I POP W !,"NO DEVICE SELECTED OR OUTPUT PRINTED!" Q
20 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="START^PSAREVD",ZTDESC="Drug receipt transaction review",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G END
21START ;compiles and prints output
22 N %DT,PSALN,PSAR,PSAPG,PSARPDT S (PSAPG,PSAOUT)=0,Y=DT,PSAR="" X ^DD("DD") S PSARPDT=Y,PSAU(1)=$O(PSA(0)) D HEADER S PSAU=0
23 F S PSAU=$O(PSA(PSAU)) Q:'PSAU K PSAR(1) D G:PSAOUT END I 'PSAR,$O(PSA(PSAU)) S PSAU(1)=$O(PSA(PSAU))
24LOOP .F S PSAR=$O(^PSD(58.81,"F",PSAU,PSAR)) Q:'PSAR D:$Y+6>IOSL HEADER Q:PSAOUT S PSAR(2)=$G(^PSD(58.81,+PSAR,0)) D:$P(PSAR(2),U,4)'<PSAT&($P(PSAR(2),U,2)=1)
25 ..S PSAR(1)=$G(PSAR(1))+1 W:PSAR(1)=1 $P($G(^PSDRUG(+PSAU,0)),U),!
26 ..I '$D(PSALOC) S PSALOC=$P(PSAR(2),U,3) W !,"Receiving Site: ",$P($G(^PSD(58.8,+PSALOC,0)),U),!
27 ..I $G(PSALOC)'=$P(PSAR(2),U,3) S PSALOC=$P(PSAR(2),U,3) W !,"Receiving site: ",$P($G(^PSD(58.8,+PSALOC,0)),U),!
28 ..S Y=$E($P(PSAR(2),U,4),1,12) X ^DD("DD") W !,Y," -> "
29 ..W $P(PSAR(2),U,6)," received by ",$P($G(^VA(200,+$P(PSAR(2),U,7),0)),U),!!
30 ..W:$P($G(^PRC(442,+$P(PSAR(2),U,9),0)),U) "PO#: ",$P($G(^(0)),U),?20
31 ..W:$P($G(^PRCS(410,+$P(PSAR(2),U,8),0)),U) "TR#: ",$P($G(^(0)),U)," "
32 ..W:$P($G(^PSD(58.81,+PSAR,8)),U)]"" "INV#: ",$P($G(^(8)),U)
33 ..W !,PSALN,!
34END W:$E(IOST)'="C" @IOF
35 I $E(IOST,1,2)="C-",'PSAOUT S DIR(0)="EA",DIR("A")="END OF REPORT! Press <RET> to return to the menu." D ^DIR
36 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q")
37 Q
38HEADER ;prints header info
39 I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
40 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
41 W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1 W !?2,"History of Drug Receipts",?50,PSARPDT,?70,"PAGE: ",PSAPG,!,PSALN,!
42 Q
Note: See TracBrowser for help on using the repository browser.