VistA-FOIAVistA/r/AUTO_REPLENISHMENT_WARD_STO.../PSGWNU1.m

29 lines
1.9 KiB
Mathematica

PSGWNU1 ;BHAM ISC/PTD,CML-Print Drugs (Items) with NO Usage for Selected Date Range - CONTINUED ; 23 Mar 93 / 12:54 PM
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
PRINT ;PRINT ZERO USAGE REPORT FOR ALL DRUGS BY AOU
S PGCT=1,(AOU,QFLG)="" D NOW^%DTC S CURDT=$P(%,".") I $O(^TMP("PSGWNU",$J,AOU))']"" D HDR W !,"NO ITEMS WITH ZERO USAGE FOR SELECTED DATE RANGE." G DONE
AOULP S AOU=$O(^TMP("PSGWNU",$J,AOU)) G:'AOU DONE D PRTCHK G:QFLG END W !,"==> ",$P(^PSI(58.1,AOU,0),"^") S DRG=0
DRLP S DRG=$O(^TMP("PSGWNU",$J,AOU,DRG)) D:DRG=""&($E(IOST)'="C") MSG G:DRG="" AOULP D:$Y+7>IOSL PRTCHK G:QFLG END
S LOC=^TMP("PSGWNU",$J,AOU,DRG),AR=$P(LOC,"^"),OD=$P(LOC,"^",2),LSTDT=$S((AR'<OD):AR,(OD'<AR):OD,1:""),RET=$P(LOC,"^",3)
W ! I LSTDT'="" S X1=CURDT,X2=LSTDT D ^%DTC S ASTER=X\90 S:ASTER<0 ASTER=0 I ASTER>0 F J=1:1:ASTER W "*"
W ?8,DRG I LSTDT'="" S Y=LSTDT X ^DD("DD") W ?48,$P(Y,"@") W:RET="Y" ?64,"INCLUDES RETURNS" G DRLP
I LSTDT="" W ?48,"NO DISPENSE DATES FOUND" G DRLP
;
DONE I $E(IOST)'="C" W @IOF
I $E(IOST)="C" D:'QFLG SS^PSGWUTL1
END K ^TMP("PSGWNU",$J),AOU,ALL,BDT,DRG,DRGDA,DRGNAME,DRGNM,DRGQD,EDT,INVDA,INVDT,INVN,J,ODA,ODT,PGCT,QD,RETDT,AR,ARDT,LOC,LSTDT,OD,RET,RFLG,JJ,AOULP,ASTER,CURDT,PSGWIO,ZTSK,X,Y,ANS,QFLG
K %,%I,%H,ZTIO,DA,G,SEL,IGDA,IO("Q") D ^%ZISC
S:$D(ZTQUEUED) ZTREQ="@" Q
;
HDR ;PRINT REPORT HEADER
W:$Y @IOF W !,"ITEMS WITH ZERO USAGE FROM " S Y=BDT X ^DD("DD") W Y," TO " S Y=EDT X ^DD("DD") W Y,?70,"PAGE ",PGCT I $D(SEL),SEL="I",$D(IGDA) W !,"FOR INVENTORY GROUP - ",$P(^PSI(58.2,IGDA,0),"^")
W !!,"AREA OF USE",?55,"DATE: ",$$PSGWDT^PSGWUTL1
W !?8,"NO USAGE FOR:",?45,"DATE LAST DISPENSED:",! S PGCT=PGCT+1 F J=1:1:80 W "-"
Q
;
MSG W !!!,"For each ""*"" printed, 90 days have passed from",!,"the date item was last dispensed to current date."
Q
PRTCHK ;
I PGCT>1&($E(IOST)="C") D MSG W !!,"Press <RETURN> to Continue or ""^"" to Exit: " R ANS:DTIME S:'$T ANS="^" D:ANS?1."?" HELP^PSGWUTL1 I ANS="^" S QFLG=1 Q
D HDR Q