PSGWBOIP ;BHAM ISC/CML-Print Backorder Report by Specific Item (Single or Multiple) - CONTINUED ; 03 Sep 93 / 12:25 PM
;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
PRT1 ;
S $P(LN,"-",81)="",PG=0,%DT="",(DNM,ANM,QFLG)="" S HDT=$$PSGWDT^PSGWUTL1 D HDR
I '$D(^TMP("PSGWBOI",$J)) W !?17,"***** NO DATA AVAILABLE FOR THIS REPORT *****" S QFLG=1 G DONE
F LL=0:0 S TOT=0,DNM=$O(^TMP("PSGWBOI",$J,DNM)) Q:DNM="" D:$Y+6>IOSL PRTCHK Q:QFLG W !!,"=> ",DNM D PRT2 Q:QFLG
DONE ;
D:'QFLG INACT I $E(IOST)'="C" W @IOF
I $E(IOST)="C" D:'QFLG SS^PSGWUTL1
QUIT ;
K %DT,%,%H,%I,BO,BODA,BODT,CURBO,DIC,DNM,DRGDA,ITMDA,JJ,LOC,TOT,AOU,ANM,HDT,INACT,LL,LN,LNS,QQ,PG,X,Y,ANS,QFLG
K ^TMP("PSGWBOI",$J),^TMP("PSGWQ",$J),PSGWIO,ZTSK,ZTIO,DA,HDRFLG,IO("Q") D ^%ZISC
Q
PRT2 F LL=0:0 S ANM=$O(^TMP("PSGWBOI",$J,DNM,ANM)) Q:QFLG D ANMCHK Q:ANM="" F BODT=0:0 S BODT=$O(^TMP("PSGWBOI",$J,DNM,ANM,BODT)) Q:'BODT D DATA Q:QFLG
Q
DATA ;DATA LINES
S LOC=$P(^TMP("PSGWBOI",$J,DNM,ANM,BODT),"^"),CURBO=$P(^(BODT),"^",2),TOT=TOT+CURBO Q:CURBO<1 I $Y+6>IOSL D PRTCHK Q:QFLG
S:ANM["**" INACT=1 S Y=$E(BODT,1,12) X ^DD("DD") W !?7,ANM,?40,LOC,?54,Y,?73,$J(CURBO,6)
Q
ANMCHK ;
I ANM="ZZZ" W ?48,"<NO CURRENT BACKORDERS>" S ANM="" Q
I ANM="",TOT<1 W ?48,"<NO CURRENT BACKORDERS>" Q
I ANM="" D:$Y+6>IOSL PRTCHK Q:QFLG W !?72,"-------",!?66,"TOTAL:",?72,$J(TOT,7) Q
Q
HDR ;HEADER
S INACT=0 W:$Y @IOF S PG=PG+1 I HDRFLG="S" W !?24,"PHARMACY SINGLE ITEM BACKORDER LIST"
I HDRFLG="M" W !?22,"PHARMACY MULTIPLE ITEMS BACKORDER LIST"
W ?71,"PAGE: ",PG,!?28,"PRINTED: ",HDT,!!,"=> ITEM",?56,"DATE/TIME FOR",?72,"CURRENT",!?12,"AOU",?42,"LOCATION",?58,"BACKORDER",?71,"BACKORDER",!,LN
Q
INACT I INACT F LNS=1:1:((IOSL-$Y)-3) W !
I W "** Indicates an Inactive AOU"
Q
PRTCHK ;
D INACT I $E(IOST)="C" 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
PSGWBOIP ;BHAM ISC/CML-Print Backorder Report by Specific Item (Single or Multiple) - CONTINUED ; 03 Sep 93 / 12:25 PM
+1 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
PRT1 ;
+1 SET $PIECE(LN,"-",81)=""
SET PG=0
SET %DT=""
SET (DNM,ANM,QFLG)=""
SET HDT=$$PSGWDT^PSGWUTL1
DO HDR
+2 IF '$DATA(^TMP("PSGWBOI",$JOB))
WRITE !?17,"***** NO DATA AVAILABLE FOR THIS REPORT *****"
SET QFLG=1
GOTO DONE
+3 FOR LL=0:0
SET TOT=0
SET DNM=$ORDER(^TMP("PSGWBOI",$JOB,DNM))
IF DNM=""
QUIT
IF $Y+6>IOSL
DO PRTCHK
IF QFLG
QUIT
WRITE !!,"=> ",DNM
DO PRT2
IF QFLG
QUIT
DONE ;
+1 IF 'QFLG
DO INACT
IF $EXTRACT(IOST)'="C"
WRITE @IOF
+2 IF $EXTRACT(IOST)="C"
IF 'QFLG
DO SS^PSGWUTL1
QUIT ;
+1 KILL %DT,%,%H,%I,BO,BODA,BODT,CURBO,DIC,DNM,DRGDA,ITMDA,JJ,LOC,TOT,AOU,ANM,HDT,INACT,LL,LN,LNS,QQ,PG,X,Y,ANS,QFLG
+2 KILL ^TMP("PSGWBOI",$JOB),^TMP("PSGWQ",$JOB),PSGWIO,ZTSK,ZTIO,DA,HDRFLG,IO("Q")
DO ^%ZISC
+3 QUIT
PRT2 FOR LL=0:0
SET ANM=$ORDER(^TMP("PSGWBOI",$JOB,DNM,ANM))
IF QFLG
QUIT
DO ANMCHK
IF ANM=""
QUIT
FOR BODT=0:0
SET BODT=$ORDER(^TMP("PSGWBOI",$JOB,DNM,ANM,BODT))
IF 'BODT
QUIT
DO DATA
IF QFLG
QUIT
+1 QUIT
DATA ;DATA LINES
+1 SET LOC=$PIECE(^TMP("PSGWBOI",$JOB,DNM,ANM,BODT),"^")
SET CURBO=$PIECE(^(BODT),"^",2)
SET TOT=TOT+CURBO
IF CURBO<1
QUIT
IF $Y+6>IOSL
DO PRTCHK
IF QFLG
QUIT
+2 IF ANM["**"
SET INACT=1
SET Y=$EXTRACT(BODT,1,12)
XECUTE ^DD("DD")
WRITE !?7,ANM,?40,LOC,?54,Y,?73,$JUSTIFY(CURBO,6)
+3 QUIT
ANMCHK ;
+1 IF ANM="ZZZ"
WRITE ?48,"<NO CURRENT BACKORDERS>"
SET ANM=""
QUIT
+2 IF ANM=""
IF TOT<1
WRITE ?48,"<NO CURRENT BACKORDERS>"
QUIT
+3 IF ANM=""
IF $Y+6>IOSL
DO PRTCHK
IF QFLG
QUIT
WRITE !?72,"-------",!?66,"TOTAL:",?72,$JUSTIFY(TOT,7)
QUIT
+4 QUIT
HDR ;HEADER
+1 SET INACT=0
IF $Y
WRITE @IOF
SET PG=PG+1
IF HDRFLG="S"
WRITE !?24,"PHARMACY SINGLE ITEM BACKORDER LIST"
+2 IF HDRFLG="M"
WRITE !?22,"PHARMACY MULTIPLE ITEMS BACKORDER LIST"
+3 WRITE ?71,"PAGE: ",PG,!?28,"PRINTED: ",HDT,!!,"=> ITEM",?56,"DATE/TIME FOR",?72,"CURRENT",!?12,"AOU",?42,"LOCATION",?58,"BACKORDER",?71,"BACKORDER",!,LN
+4 QUIT
INACT IF INACT
FOR LNS=1:1:((IOSL-$Y)-3)
WRITE !
+1 IF $TEST
WRITE "** Indicates an Inactive AOU"
+2 QUIT
PRTCHK ;
+1 DO INACT
IF $EXTRACT(IOST)="C"
WRITE !!,"Press <RETURN> to Continue or ""^"" to Exit: "
READ ANS:DTIME
IF '$TEST
SET ANS="^"
IF ANS?1."?"
DO HELP^PSGWUTL1
IF ANS="^"
SET QFLG=1
QUIT
+2 DO HDR
QUIT