source: Scheduling/trunk/m/BSDX05.m@ 855

Last change on this file since 855 was 854, checked in by Sam Habiel, 14 years ago

More changes

File size: 1.9 KB
Line 
1BSDX05 ; IHS/OIT/HMW - WINDOWS SCHEDULING RPCS ; 7/11/10 6:28pm
2 ;;2.0;IHS WINDOWS SCHEDULING;;NOV 01, 2007
3 ;
4 ;
5APBLKOV(BSDXY,BSDXSTART,BSDXEND,BSDXRES) ;EP
6 ;Called by BSDX APPT BLOCKS OVERLAP
7 ;(Duplicates old qryAppointmentBlocksOverlapB)
8 ;BSDXRES is resource name
9 ;
10 ;Test lines:
11 ;D APBLKOV^BSDX05(.RES,"11-8-2000","11-8-2004","WHITT") ZW RES
12 ;BSDX APPT BLOCKS OVERLAP^11-8-2000^11-8-2004^WHITT
13 ;S ^HW("BSDXD05")=BSDXSTART_U_BSDXEND_U_BSDXRES
14 ;
15 N BSDXERR,BSDXIEN,BSDXDEP,BSDXBS,BSDXI,BSDXNEND,BSDXNSTART,BSDXPEND,BSDXRESD,BSDXRESN,BSDXS,BSDXAD,BSDXNOD
16 K ^BSDXTMP($J)
17 S BSDXERR=""
18 S BSDXY="^BSDXTMP("_$J_")"
19 S ^BSDXTMP($J,0)="D00030START_TIME^D00030END_TIME"_$C(30)
20 D
21 . S BSDXBS=0
22 . S BSDXEND=BSDXEND+.9999 ;Go to end of day
23 . S BSDXRESN=BSDXRES
24 . Q:BSDXRESN=""
25 . Q:'$D(^BSDXRES("B",BSDXRESN))
26 . S BSDXRESD=$O(^BSDXRES("B",BSDXRESN,0))
27 . Q:'+BSDXRESD
28 . Q:'$D(^BSDXAPPT("ARSRC",BSDXRESD))
29 . D STRES(BSDXRESD,BSDXSTART,BSDXEND)
30 . Q
31 ;
32 S BSDXI=$G(BSDXI)+1
33 S ^BSDXTMP($J,BSDXI)=$C(31)
34 Q
35 ;
36STRES(BSDXRESD,BSDXSTART,BSDXEND) ;
37 ;$O THRU "ARSRC" XREF OF ^BSDXAPPT
38 ;Start at the beginning of the day -- appts can't overlap days
39 S BSDXS=$P(BSDXSTART,"."),BSDXS=BSDXS-.0001
40 S BSDXI=0
41 F S BSDXS=$O(^BSDXAPPT("ARSRC",BSDXRESD,BSDXS)) Q:'+BSDXS Q:BSDXS>BSDXEND D
42 . S BSDXAD=0 F S BSDXAD=$O(^BSDXAPPT("ARSRC",BSDXRESD,BSDXS,BSDXAD)) Q:'+BSDXAD D STCOMM(BSDXAD) ;BSDXAD Is the AppointmentID
43 . Q
44 Q
45 ;
46STCOMM(BSDXAD) ;
47 S BSDXNEND=0,BSDXNSTART=0,BSDXPEND=0
48 Q:'$D(^BSDXAPPT(BSDXAD,0))
49 S BSDXNOD=^BSDXAPPT(BSDXAD,0)
50 Q:$P(BSDXNOD,U,10)=1 ;NO-SHOW Flag
51 Q:$P(BSDXNOD,U,12)]"" ;CANCELLED APPT
52 Q:$P(BSDXNOD,U,13)="y" ;WALKIN
53 S BSDXNSTART=$P(BSDXNOD,U)
54 S BSDXNEND=$P(BSDXNOD,U,2)
55 I BSDXNEND'>BSDXSTART Q ;End is less than start
56 S Y=BSDXNSTART X ^DD("DD") S BSDXNSTART=$TR(Y,"@"," ")
57 S Y=BSDXNEND X ^DD("DD") S BSDXNEND=$TR(Y,"@"," ")
58 S BSDXI=BSDXI+1
59 S ^BSDXTMP($J,BSDXI)=BSDXNSTART_U_BSDXNEND_$C(30)
60 Q
Note: See TracBrowser for help on using the repository browser.