source: WorldVistAEHR/trunk/r/AUTO_REPLENISHMENT_WARD_STOCK-PSGW/PSGWRAC.m@ 975

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

initial load of WorldVistAEHR

File size: 2.9 KB
Line 
1PSGWRAC ;BHAM ISC/CML-Print AOU Status for AMIS - Inpatient Site, Returns, and AMIS Count ; 19 Mar 93 / 8:35 AM
2 ;;2.3; Automatic Replenishment/Ward Stock ;;4 JAN 94
3 D NOW^%DTC S PSGWDT=$P(%,".")
4 W !!,"This option prints a list of active AOUs displaying the following data:",!!?5,"1. INPATIENT SITE",!?5,"2. RETURNS CREDITED TO",!?5,"3. COUNT ON AMIS"
5 W !!,"Right margin for this report is 80 columns.",!,"You may queue the report to print at a later time.",!!
6 I '$O(^PSI(58.1,0)) W !,"You MUST create AOUs before running this report!" K %,%I,%H,PSGWDT Q
7DEV K %ZIS,IOP S %ZIS="QM",%ZIS("B")="" D ^%ZIS I POP W !,"NO DEVICE SELECTED OR REPORT PRINTED!" G QUIT
8 I $D(IO("Q")) K IO("Q") S PSGWIO=ION,ZTIO="" K ZTSAVE,ZTDTH,ZTSK S ZTRTN="ENQ^PSGWRAC",ZTDESC="Compile Data for AOU AMIS Status Report",ZTSAVE("PSGWIO")="",ZTSAVE("PSGWDT")=""
9 I D ^%ZTLOAD,HOME^%ZIS K ZTSK G QUIT
10 U IO
11 ;
12ENQ ;ENTRY POINT WHEN QUEUED
13AOU K ^TMP("PSGWRAC",$J) F AOU=0:0 S AOU=$O(^PSI(58.1,AOU)) G:('AOU)&($D(ZTQUEUED)) PRTQUE G:'AOU PRINT D BUILD
14 ;
15BUILD ;BUILD DATA ELEMENTS
16 I $D(^PSI(58.1,AOU,"I")),^("I"),^("I")'>DT Q
17 I $D(^PSI(58.1,AOU,0)) S LOC=^(0),AOUNM=$S($P(LOC,"^")]"":$P(LOC,"^"),1:"AOU NAME MISSING"),RET=$S($P(LOC,"^",2)="A":"AR",$P(LOC,"^",2)="W":"WS",1:"N/A"),ACNT=$S(+$P(LOC,"^",3):"NO",$P(LOC,"^",3)="":"N/A",1:"YES") D SETGL
18 Q
19SETGL ;
20 S SITE="" I $D(^PSI(58.1,AOU,"SITE")) S SITE=^("SITE") I SITE,$D(^PS(59.4,SITE,0)),$P(^(0),"^")]"" S SITE=$P(^(0),"^")
21 S SITE=$S(+SITE:"ZZSITE",SITE="":"ZZSITE",1:SITE),^TMP("PSGWRAC",$J,SITE,AOUNM)=RET_"^"_ACNT
22 Q
23 ;
24PRTQUE ;AFTER DATA IS COMPILED, QUEUE THE PRINT
25 K ZTSAVE,ZTIO S ZTIO=PSGWIO,ZTRTN="PRINT^PSGWRAC",ZTDESC="Print AOU Status for AMIS",ZTDTH=$H,ZTSAVE("^TMP(""PSGWRAC"",$J,")=""
26 D ^%ZTLOAD K ^TMP("PSGWRAC",$J) G QUIT
27PRINT ;
28 S $P(LN,"-",80)="",PG=0,%DT="",(SITE,AOUNM,QFLG)="",X="T" D ^%DT X ^DD("DD") S HDT=Y D HDR
29 I '$D(^TMP("PSGWRAC",$J)) W !?17,"***** NO DATA AVAILABLE FOR THIS REPORT *****" G QUIT
30 F LL=0:0 S SITE=$O(^TMP("PSGWRAC",$J,SITE)) Q:QFLG!(SITE="") F LL=0:0 S AOUNM=$O(^TMP("PSGWRAC",$J,SITE,AOUNM)) Q:AOUNM="" S RET=$P(^TMP("PSGWRAC",$J,SITE,AOUNM),"^"),ACNT=$P(^(AOUNM),"^",2) D WRTDATA Q:QFLG
31DONE I $E(IOST)'="C" W @IOF
32 I $E(IOST)="C" D:'QFLG SS^PSGWUTL1
33QUIT ;
34 K %,%H,%I,%DT,PSGWIO,ACNT,AOU,AOUNM,HDT,LL,LN,LOC,PG,PSGWDT,RET,SITE,X,Y,ZTSK,ZTIO,DA,IO("Q"),ANS,QFLG
35 K ^TMP("PSGWRAC",$J) D ^%ZISC
36 S:$D(ZTQUEUED) ZTREQ="@" Q
37WRTDATA ;DATA LINES
38 D:$Y+5>IOSL PRTCHK Q:QFLG W !,AOUNM,?31,$S(SITE="ZZSITE":"NONE LISTED",1:SITE),?64,RET,?74,ACNT
39 Q
40HDR ;HEADER
41 W:$Y @IOF S PG=PG+1 W !?22,"AOU LISTING - RETURNS AND AMIS COUNT",?70,"PAGE: ",PG,!?31,"PRINTED: ",HDT,!!?74,"COUNT",!?62,"RETURNS",?74,"ON",!,"AREA OF USE (AOU)",?33,"INPATIENT SITE",?60,"CREDITED TO AMIS?",!,LN
42 Q
43PRTCHK ;
44 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
45 D HDR Q
Note: See TracBrowser for help on using the repository browser.