VistA-WorldVistAEHR/r/AUTO_REPLENISHMENT_WARD_STO.../PSGWATR1.m

32 lines
2.2 KiB
Mathematica

PSGWATR1 ;BHAM ISC/CML-Print Item Activity Inquiry (80 column) ; 23 Mar 93 / 12:44 PM
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
S (PG,QFLG)=0,Y=BDT X ^DD("DD") S HBDT=Y,Y=EDT X ^DD("DD") S HEDT=Y S HDT=$$PSGWDT^PSGWUTL1,$P(LN,"-",80)="",DRGDA=+^PSI(58.1,AOU,1,ITEM,0),$P(LN2,"-",65)="" D INV I 'QFLG D OND I 'QFLG D RET
DONE I $E(IOST)'="C" W @IOF
I $E(IOST)="C" D:'QFLG SS^PSGWUTL1
QUIT K ^TMP("PSGWATR",$J) K ZTSK,%,%H,%I,%W,ADT,ANS,AOU,ARDT,BDT,C,DRGDA,EDT,HBDT,HDT,HEDT,INVDA,ITEM,LN,LN2,NODE,OD,ODDA,ODDT,PG,QD,QFLG,RET,RETDT,TYPE,X,Y,G,PSGWIO
D ^%ZISC
S:$D(ZTQUEUED) ZTREQ="@" Q
INV ;PRINT INVENTORIES
D HDR,IHDR I '$O(^TMP("PSGWATR",$J,"AR",0)) W !?15,"** THERE IS NO INVENTORY DATA FOR THIS DATE RANGE **" Q
F ADT=0:0 S ADT=$O(^TMP("PSGWATR",$J,"AR",ADT)) Q:'ADT S NODE=^(ADT),QFLG=0 D:$Y+5>IOSL PRTCHK Q:QFLG D:$Y+5>IOSL HDR,IHDR W !?15,"ID #",+NODE," - " S Y=ADT X ^DD("DD") W Y,?60,$J($P(NODE,"^",2),7)
Q
OND ;PRINT ON-DEMANDS
D PRTCHK Q:QFLG D HDR,OHDR I '$O(^TMP("PSGWATR",$J,"OD",0)) W !?15,"** THERE IS NO ON-DEMAND DATA FOR THIS DATE RANGE **" Q
F OD=0:0 S OD=$O(^TMP("PSGWATR",$J,"OD",OD)) Q:'OD S QD=+^(OD),QFLG=0 D:$Y+5>IOSL PRTCHK Q:QFLG D:$Y+5>IOSL HDR,OHDR S Y=OD X ^DD("DD") W !?17,Y,?60,$J(QD,7)
Q
RET ;PRINT RETURNS
D PRTCHK Q:QFLG D HDR,RHDR I '$O(^TMP("PSGWATR",$J,"RET",0)) W !?15,"** THERE IS NO RETURNS DATA FOR THIS DATE RANGE **" Q
F RET=0:0 S RET=$O(^TMP("PSGWATR",$J,"RET",RET)) Q:'RET S QD=+^(RET),QFLG=0 D:$Y+5>IOSL PRTCHK Q:QFLG D:$Y+5>IOSL HDR,RHDR S Y=RET X ^DD("DD") W !?17,Y,?60,$J(QD,7)
Q
HDR ;
S PG=PG+1 W:$Y @IOF W !,"ITEM ACTIVITY INQUIRY for period ",HBDT," to ",HEDT,?72,"Page: ",PG,!,"Printed ",HDT,!!,"AOU : ",$P(^PSI(58.1,AOU,0),"^"),!,"ITEM: ",$P(^PSDRUG(DRGDA,0),"^"),!,LN Q
PRTCHK ;
I $E(IOST)="C" W !!,"Press <RETURN> to Continue or ""^"" to Exit: " R ANS:DTIME S:'$T ANS="^" D:ANS["?" HELP^PSGWUTL1 I ANS="^" S QFLG=1 Q
Q
IHDR ;INVENTORY SUBHEADER
W !,"INVENTORIES:",!!?15,"ID # - DATE/TIME FOR INVENTORY",?55,"QUANTITY DISPENSED",!?15,LN2 Q
OHDR ;ON-DEMAND HEADERS
W !,"ON-DEMAND REQUESTS:",!!?15,"ON-DEMAND REQUEST DATE/TIME",?55,"QUANTITY DISPENSED",!?15,LN2 Q
RHDR ;RETURNS HEADER
W !,"RETURNS:",!!?15,"RETURN DATE/TIME",?55,"QUANTITY RETURNED",!?15,LN2 Q