Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: APCLRX91

APCLRX91.m

Go to the documentation of this file.
APCLRX91 ; IHS/CMI/LAB - RX'S DISPENSED BY DATE/TIME ;
 ;;2.0;IHS PCC SUITE;;MAY 14, 2009
 ;APCL1 = Before 8:00
 ;APCL2 = 8:00 - 8:59
 ;APCL3 = 9:00 - 9:59
 ;APCL4 = 10:00 - 10:59
 ;APCL5 11:00 - 11:59
 ;APCL6 12:00 - 12:59
 ;APCL7 1:00 - 1:159
 ;APCL8 2:00 - 2:59
 ;APCL9 3:00 - 3:59
 ;APCL10 4:00 - 4:59
 ;APCL11 5:00 - 5:59
 ;APCL12 6:00 - 6:59
 ;APCL13 7:00 - 7:59
 ;APCL14 8:00 - 8:59
 ;APCL15 9:00 - 9:59
 ;APCL16 10:00 - 10:59
 ;APCL17 11:00 - 11:59
 ;
START ;
 S APCLBT=$H,APCLJOB=$J,APCL1=0,APCL2=0,APCL3=0,APCL4=0,APCL5=0,APCL6=0,APCL7=0,APCL8=0,APCL9=0,APCLG=0,APCLGO=0,APCL10=0,APCL11=0,APCL12=0
 S APCL13=0,APCL14=0,APCL15=0,APCL16=0,APCL17=0,APCLGTOT=0
 K ^XTMP("APCLCV",APCLJOB,APCLBT)
V ; Run by visit date
 S APCLSD=APCLSD_".9999" F  S APCLSD=$O(^PSRX("AL",APCLSD)) Q:APCLSD=""!((APCLSD\1)>APCLED)  D V1
 ;
XIT ;
 D EOJ
 S APCLET=$H
 Q
V1 ;
 ;S APCLVIEN="" F  S APCLVIEN=$O(^PSRX("AL",APCLSD,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  I $D(^PSRX(APCLVIEN,0)) S APCLVREC=^(0) D PROC
 ;
 ;Commented above line and added lines below to look at both original
 ;fills and refills....dloz 8-23-01
 ;
 S APCLVIEN="" F  S APCLVIEN=$O(^PSRX("AL",APCLSD,APCLVIEN)) Q:APCLVIEN'=+APCLVIEN  D
 .S APCLVBZL="" F  S APCLVBZL=$O(^PSRX("AL",APCLSD,APCLVIEN,APCLVBZL)) Q:APCLVBZL=""  D
 ..I $D(^PSRX(APCLVIEN,0)) S APCLVREC=^(0)
 ..I APCLVBZL'=0 D PROC1 Q
 ..E  D PROC
 Q
 ;
PROC1 ;Captures refill release date stats
 I APCLLOC]"",APCLLOC'=$P(^PSRX(APCLVIEN,1,APCLVBZL,0),U,9) Q
 S DFN=$P(APCLVREC,U,2)
 Q:$$DEMO^APCLUTL(DFN,$G(APCLDEMO))
 S APCLRXTM=$P(^PSRX(APCLVIEN,1,APCLVBZL,0),U,18)
 S APCLRXHR=$E(APCLRXTM,9,12)
 D DOCOUNT
 Q
 ;End of modifications...dloz
PROC ;
 I APCLLOC]"",APCLLOC'=$P(^PSRX(APCLVIEN,2),U,9) Q   ;Quit if not Division = 9th piece
 S DFN=$P(APCLVREC,U,2) ;Patient = 2nd piece
 Q:$P(^DPT(DFN,0),U)="DEMO,PATIENT"
 ;
HRSTART ;Start Hour Counts <8>8>9>10>11 8 hour day
 ;S APCLGTOT=APCLGTOT+1 ; Grand Total
 S APCLRXTM=$P(^PSRX(APCLVIEN,2),U,13) ; Release Date/time
 S APCLRXHR=$E(APCLRXTM,9,12) ; Military Time Extraction
 ;
DOCOUNT ;Start Count by hour
 Q:'$D(APCLRXHR)
 S APCLGTOT=APCLGTOT+1 ; GRAND TOTAL
 I APCLRXHR<"0800" D TBEFORE Q
 I APCLRXHR>"0799"&(APCLRXHR<"0900") D T0800 Q
 I APCLRXHR>"0899"&(APCLRXHR<"1000") D T0900 Q
 I APCLRXHR>"0999"&(APCLRXHR<"1100") D T1000 Q
 I APCLRXHR>"1099"&(APCLRXHR<"1200") D T1100 Q
 I APCLRXHR>"1199"&(APCLRXHR<"1300") D T1200 Q
 I APCLRXHR>"1299"&(APCLRXHR<"1400") D T1300 Q
 I APCLRXHR>"1399"&(APCLRXHR<"1500") D T1400 Q
 I APCLRXHR>"1499"&(APCLRXHR<"1600") D T1500 Q
 I APCLRXHR>"1599"&(APCLRXHR<"1700") D T1600 Q
 I APCLRXHR>"1699"&(APCLRXHR<"1800") D T1700 Q
 I APCLRXHR>"1799"&(APCLRXHR<"1900") D T1800 Q
 I APCLRXHR>"1899"&(APCLRXHR<"2000") D T1900 Q
 I APCLRXHR>"1999"&(APCLRXHR<"2100") D T2000 Q
 I APCLRXHR>"2099"&(APCLRXHR<"2200") D T2100 Q
 I APCLRXHR>"2199"&(APCLRXHR<"2300") D T2200 Q
 I APCLRXHR>"2299" D TAFTER Q
 Q
 ;
TBEFORE ;Before 8:00 am RX's
 S APCL1=APCL1+1 ; Count the RX on First Hour Type
 Q
 ;
T0800 ;Counts for 8:00 to 9:00 RX's
 S APCL2=APCL2+1 ; COUNT ANOTHER TIMEFRAME
 Q
 ;
T0900 ;Counts 9:00 - 10:00
 S APCL3=APCL3+1
 Q
 ;
T1000 ;Counts 10:00-11:00
 S APCL4=APCL4+1
 Q
 ;
T1100 ;Counts 11:00-12:00
 S APCL5=APCL5+1
 Q
 ;
T1200 ;Counts 12:00-1:00
 S APCL6=APCL6+1
 Q
 ;
T1300 ;Counts 1:00 - 2:00
 S APCL7=APCL7+1
 Q
 ;
T1400 ;Counts 2:00 - 3:00
 S APCL8=APCL8+1
 Q
 ;
T1500 ;Counts 3:00 - 4:00
 S APCL9=APCL9+1
 Q
 ;
T1600 ;Counts 4:00 - 5:00
 S APCL10=APCL10+1
 Q
 ;
T1700 ;Counts 5:00 - 6:00
 S APCL11=APCL11+1
 Q
 ;
T1800 ;Counts 6:00 - 7:00
 S APCL12=APCL12+1
 Q
 ;
T1900 ;Counts 7:00- 8:00
 S APCL13=APCL13+1
 Q
 ;
T2000 ;Counts 8:00-9:00
 S APCL14=APCL14+1
 Q
 ;
T2100 ;Counts 9:00 - 10:00
 S APCL15=APCL15+1
 Q
 ;
T2200 ;Counts 10:00-11:00
 S APCL16=APCL16+1
 Q
 ;
TAFTER ;Counts 11:00-11:59
 S APCL17=APCL17+1
 Q
EOJ K APCLVLOC,APCLVREC,APCLSKIP,APCLAP,APCLDISC,APCLDPTR,APCLLOCC,APCLCLN
 K X,X1,X2
 Q
 ;
 ;