source: WorldVistAEHR/trunk/r/DRUG_ACCOUNTABILITY-PSA/PSACONW.m@ 841

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

initial load of WorldVistAEHR

File size: 2.5 KB
Line 
1PSACONW ;BIR/LTL-Display Connected Drug and Procurement History - CONT'D ;7/23/97
2 ;;3.0; DRUG ACCOUNTABILITY/INVENTORY INTERFACE;**15**; 10/24/97
3 ;This routine contains the history of warehoused drugs. It is called
4 ;by PSACON.
5 ;
6 ;References to $$INVNAME^PRCPUX1 are covered by IA #259
7 ;References to ^PSDRUG( are covered by IA #2095
8 ;References to ^PRCP( are covered by IA #214
9 ;
10 N PSAI,PSAD,PSAN,PSAQ S (PSAI,PSAOUT)=0
11 W !!,"The Supply Warehouse is the mandatory source for this item.",!
12 I '$O(^PRCP(445.2,"AD",+PSAW,+PSA(1),"")) W !!,"NO HISTORY!" Q
13 W !,"There is a procurement history."
14 S DIR(0)="D",DIR("A")="How far back in time would you like to view",DIR("B")="T-3M" W ! D ^DIR K DIR S PSAD=Y I $D(DIRUT) S PSAOUT=1 G QUIT
15 X ^DD("DD") S PSAD(2)=Y
16 D NOW^%DTC S X1=X,X2=PSAD D ^%DTC S PSAD(1)=$S(X/30>0:X/30,1:1)
17 K IO("Q") N %ZIS,IOP,POP S %ZIS="Q" W ! D ^%ZIS
18 I POP W !,"NO DEVICE SELECTED OR OUTPUT PRINTED!" S PSAOUT=1 G QUIT
19 I $D(IO("Q")) N ZTDESC,ZTIO,ZTRTN,ZTSAVE,ZTDTH,ZTSK S ZTRTN="LOOP^PSACONW",ZTDESC="Drug Issue history",ZTSAVE("PSA*")="" D ^%ZTLOAD,HOME^%ZIS S PSAOUT=1 G QUIT
20LOOP N PSALN,PSAPG S PSAPG=0 D HEADER
21 F S PSAI=$O(^PRCP(445.2,"AD",+PSAW,+PSA(1),+PSAI)) Q:PSAOUT!('PSAI) D:$Y+4>IOSL HEADER G:PSAOUT QUIT I $P($G(^PRCP(445.2,PSAI,0)),U,2)?1"R".N S PSAN=$G(^(0)) D:$G(PSAN)&($P($G(PSAN),U,17)'<PSAD)
22 .S Y=$P($P(PSAN,U,17),".") D DD^%DT W !!,Y
23 .W ?14,$P(PSAN,U,19),?33,$J(-$P(PSAN,U,7),3) S PSAQ=$G(PSAQ)-$P(PSAN,U,7)
24 .W ?39,$P(PSAN,U,6)
25 .S X=$P(PSAN,U,9),X2="2$",X3=5 D COMMA^%DTC S PSAN(1)=X
26 .S X=$P(PSAN,U,9)*-$P(PSAN,U,7),X2="2$",X3=10 D COMMA^%DTC S PSAN(2)=X,PSAN(3)=$G(PSAN(3))+($P(PSAN,U,9)*-$P(PSAN,U,7))
27 .W ?47,PSAN(1),?55,PSAN(2)
28 .W ?66,$E($$INVNAME^PRCPUX1($P(PSAN,U,18)),1,14)
29 S X=$G(PSAQ)/PSAD(1),X2=1,X3=5 D COMMA^%DTC W !,PSALN,!!,"Average ord/mon: ",X,?24,"TOT ORD: ",$J($G(PSAQ),3),?49,"TOTAL $: " S X=$G(PSAN(3)),X2="2$",X3=4 D COMMA^%DTC W X
30QUIT W:$E(IOST)'="C" @IOF
31 I $E(IOST,1,2)="C-",'PSAOUT S DIR(0)="EA",DIR("A")="END OF HISTORY! Press <RET> to return to the option." W ! D ^DIR K DIR
32 D ^%ZISC S:$D(ZTQUEUED) ZTREQ="@" K IO("Q") D HOME^%ZIS
33 Q
34HEADER I $E(IOST,1,2)'="P-",PSAPG S DIR(0)="E" D ^DIR K DIR I 'Y S PSAOUT=1 Q
35 I $$S^%ZTLOAD W !!,"Task #",$G(ZTSK),", ",$G(ZTDESC)," was stopped by ",$P($G(^VA(200,+$G(DUZ),0)),U),"." S PSAOUT=1 Q
36 W:$Y @IOF S $P(PSALN,"-",81)="",PSAPG=PSAPG+1
37 W !,$E($P($G(^PSDRUG(+PSA,0)),U),1,40),"=> from ",PSAD(2),?60,"PAGE: ",PSAPG,!,PSALN,!?2,"DATE",?16,"TRANSACTION",?33,"QTY",?39,"PKG",?47,"UNIT $",?57,"TOTAL $",?66,"INVENTORY",!,PSALN
Note: See TracBrowser for help on using the repository browser.