source: WorldVistAEHR/trunk/r/SURGERY-SR/SRORIN.m@ 1259

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

initial load of WorldVistAEHR

File size: 3.5 KB
Line 
1SRORIN ;B'HAM ISC/MAM - INITIALIZE UTILIZATION TIMES ; [ 07/27/98 2:33 PM ]
2 ;;3.0; Surgery ;**50**;24 Jun 93
3 N SRINST S SRSOUT=0,X="",SRMSG=1,(SRFLAG,SRMSG1)=0,SRSDATE=SRSD D DAY F S SRSDATE=SRSDATE+1 Q:'SRSDATE!(SRSDATE>SRED1)!(SRSOUT) S SRMSG1=0 D DAY
4 I 'SRFLAG S SRYN="Y" Q
5STILL W !!!,"The start and end times for each operating room for the above dates have been",!,"entered with default start and end times. Do you still want to print the"
6 W !,"report even though the start and end times might be inaccurate ? NO// " R SRYN:DTIME I '$T!(SRYN["^") S SRYN="N" Q
7 S SRYN=$E(SRYN) S:SRYN="" SRYN="N"
8 I "YyNn"'[SRYN W !!,"Enter RETURN if you want to update the start and end times to accurately",!,"reflect utilization, or 'YES' to print the report with the days listed"
9 I "YyNn"'[SRYN W !,"having the default start and end times.",!! G STILL
10 Q
11DAY I $E(SRSDATE,6,7)>28 S X=SRSDATE,%DT="" D ^%DT I Y<0 D DATE
12 S Y=SRSDATE D D^DIQ S SRDT=Y
13 I '$D(^SRU(SRSDATE)) K DA,DIC,DD,DO,DINUM,SRTN S (X,DINUM)=SRSDATE,DIC="^SRU(",DIC(0)="L",DLAYGO=131.8 D FILE^DICN K DIC,DLAYGO S SRMSG1=1
14 S:'$D(^SRU(SRSDATE,1)) ^SRU(SRSDATE,1,0)="^131.81PA^0^0" ;S:'$D(^SRU(SRSDATE,2)) ^SRU(SRSDATE,2,0)="^131.82PA^0^0"
15 S X=SRSDATE D H^%DTC S SRDAY=%Y,(SROR,SRSS,SRMG)=0
16 F S SROR=$O(^SRS(SROR)) Q:'SROR I $$ORDIV^SROUTL0(SROR,SRDIV),'$P(^SRS(SROR,0),"^",6),'$D(^SRU(SRSDATE,1,SROR)) D SETOR D S SRMG=1
17 .S ^SRU(SRSDATE,1,SROR,0)=SROR_"^"_SRTMS,X=$P(^SRU(SRSDATE,1,0),"^",4),$P(^(0),"^",3)=SROR,$P(^(0),"^",4)=X+1
18 S:SRMG SRMSG1=1
19 ;F S SRSS=$O(^SRO(137.45,SRSS)) Q:'SRSS I '$D(^SRU(SRSDATE,2,SRSS)) D SETSP S ^SRU(SRSDATE,2,SRSS,0)=SRSS_"^"_SRTMS,X=$P(^SRU(SRSDATE,2,0),"^",4),$P(^(0),"^",3)=SRSS,$P(^(0),"^",4)=X+1
20 I $Y+9>IOSL D PAGE I SRSOUT Q
21MSG I SRMSG,SRMSG1 W @IOF,"The following dates are missing start and end times for all operating rooms.",!,"The times will be automatically entered.",! S SRMSG=0,SRFLAG=1 F LINE=1:1:80 W "-"
22 I $D(^HOLIDAY(SRSDATE,0)) W !!,SRDT,?16,"This date is a holiday, some/all Operating Rooms and Specialties",!,?16,"may have been inactivated." S SRFLAG=1 Q
23 I SRMSG1 W !!,SRDT,?17,"Start Times and End Times Entered."
24 Q
25PAGE W !!,"Press RETURN to continue " R X:DTIME I '$T!(X["^") S SRSOUT=1,SRFLAG=0,SRYN="N" W !!,"The Utilization Report can not be generated with incomplete dates.",!!,"Press RETURN to exit the option " R X:DTIME Q
26 W @IOF
27 Q
28DATE ; correct date
29 I $E(SRSDATE,4,5)=12 S SRSDATE=$E(SRSDATE,1,3)_"0101"+10000 Q
30 S SRNEWM=$E(SRSDATE,4,5)+1 S:$L(SRNEWM)=1 SRNEWM="0"_SRNEWM S SRNEWM=SRNEWM_"01",SRSDATE=$E(SRSDATE,1,3)_SRNEWM
31 Q
32SETSP ; set information in global
33 S SRHOLID=0 I $D(^HOLIDAY(SRSDATE,0)) S SRHOLID=1 S SRINST=0 F S SRINST=$O(^SRO(133,SRINST)) Q:'SRINST I $D(^SRO(133,SRINST,3,SRSDATE,0)) S SRHOLID=0
34 I $D(^HOLIDAY(SRSDATE,0)),SRHOLID S SRTMS="^^Y" Q
35 S SRTMS=SRSDATE_".07^"_SRSDATE_".17^"_"N"
36 Q
37SETOR ; set information for OR in global
38 S SRINST=$P(^SC($P(^SRS(SROR,0),"^"),0),"^",4) S:SRINST SRINST=$O(^SRO(133,"B",SRINST,0))
39 I $D(^HOLIDAY(SRSDATE,0)),SRINST,'$D(^SRO(133,SRINST,3,SRSDATE,0)) S SRTMS="^^Y" Q
40 I $D(^HOLIDAY(SRSDATE,0)),'SRINST S SRTMS="^^Y" Q
41 S (SRET,SRST,SRACT)="",SRWD=$O(^SRS(SROR,4,"B",SRDAY,0)) I 'SRWD S SRTMS=SRSDATE_".07^"_SRSDATE_".17^N" Q
42 I $P(^SRS(SROR,4,SRWD,0),"^",2) S SRST=SRSDATE_"."_$P(^(0),"^",2),SRST=+SRST
43 I SRST,$P(^SRS(SROR,4,SRWD,0),"^",3) S SRET=SRSDATE_"."_$P(^(0),"^",3),SRET=+SRET
44 I SRST,'SRET S SRST=""
45 I $P(^SRS(SROR,4,SRWD,0),"^",4) S SRACT="Y"
46 I SRACT'="Y",'SRST S SRST=SRSDATE_".07",SRET=SRSDATE_".17"
47 S SRTMS=SRST_"^"_SRET_"^"_SRACT
48 Q
Note: See TracBrowser for help on using the repository browser.