source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMOWP1.m@ 1270

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

initial load of WorldVistAEHR

File size: 4.2 KB
Line 
1SDAMOWP1 ;ALB/CAW - Appointment Waiting Time Print Routine ; 12/1/91
2 ;;5.3;Scheduling;**12,20**;Aug 13, 1993
3 ;
4HDR ; -- print header
5 ;
6 N Y
7 D HDRD
8 ;
9 I $D(SDNO) D NO G HDR1
10 I SDSORT=1!(SDSORT=2) W !,?70," Clinic: ",$E(LEVEL1,1,23)
11 I SDSORT=3!(SDSORT=4) W !,?70,"Stop Code: ",$E(LEVEL1,1,23)
12 ;
13HDR1 W !,"Sorted By: ",$P($T(SORT1+SDSORT),";;",2)
14 I SDSORT'=5,$D(^TMP("SDWTTOT",$J,+SDDIV,LEVEL1,"PRIM")) W ?70," Total: ",+^("PRIM")
15 I SDSORT=5,$D(^TMP("SDWTTOTD",$J,+SDDIV,"DIV")) W ?70," Total: ",+^("DIV")
16 ;
17 W !,SDASH
18 I SDSEL=1 W !,"Patient",?20,"ID",?26,$S("^3^4^5^"[(U_SDSORT_U):"Clinic",1:""),?46,"Check-In",?62,"Appointment",?78,"Elapsed",?92,"Check-Out",?109,"Elapsed",?120,"Total"
19 I SDSEL=1 W !,?46,"Date/Time",?62,"Date/Time",?78,"Time",?92,"Date/Time",?109,"Time",?120,"Time",!,SDASH
20HDRQ Q
21 ;
22HDRD ; Print header with dates
23 ;
24 W @IOF,"Appointment Waiting Time Report",?51,"Report Date: ",$P($$NOW^VALM1,":",1,2)
25 S SDPAGE=SDPAGE+1 W ?108,"Page: ",SDPAGE
26 W !,SDASH
27 ;
28 W !,"Dates : ",$$FDATE^VALM1(SDBEG)," to ",$$FDATE^VALM1(SDEND)
29 I $D(SDNO) D NODIV G HDRDQ
30 S SDDIVNAM=$E($S($D(^DG(40.8,+SDDIV,0)):$P(^(0),U),1:""),1,SDLEN)
31 I SDDIVNAM'="" W ?70," Division: ",SDDIVNAM
32HDRDQ Q
33 ;
34HDRT(SORT) ; Print header for totals
35 ;
36 N SRT S SRT=$G(SORT)
37 W !,$S("^1^2^"[(U_SRT_U):"Clinic","^3^4^"[(U_SRT_U):"Stop Code",1:"Division"),?40,"Appointments",?56,"Total CI Time",?71,"Total CO Time",?86,"Average Pre",?101,"Average Post",?116,"Average Total"
38 W !,?86,"Waiting Time",?101,"Waiting Time",?116,"Waiting Time"
39 W !,SDASH
40 Q
41TOT(WHAT,LEVEL1,DIV) ; Print totals
42 ;
43 N TOTAL,TOTAL1,TOTAL2,TOTAL3,TOTAL4
44 I WHAT="PRIM" S TOTAL=$G(^TMP("SDWTTOT",$J,+DIV,LEVEL1,"PRIM"))
45 I WHAT="DIV" S TOTAL=$G(^TMP("SDWTTOTD",$J,+DIV,"DIV"))
46 I WHAT="GRAND" S TOTAL=$G(^TMP("SDWTTOTG",$J,"GRAND"))
47 S TOTAL1=$P(TOTAL,U,1),TOTAL2=$P(TOTAL,U,2),TOTAL3=$P(TOTAL,U,3),TOTAL4=$P(TOTAL,U,4)
48 W !,$G(LEVEL1)
49 W ?40,TOTAL1
50 W ?56,$$HRS^SDAMOWP(TOTAL2)
51 W ?71,$$HRS^SDAMOWP(TOTAL3)
52 W ?86,$$HRS^SDAMOWP($P((TOTAL2/TOTAL1),"."))
53 W ?101,$$HRS^SDAMOWP($P((TOTAL3/TOTAL1),"."))
54 W ?116,$$HRS^SDAMOWP($P((TOTAL4/TOTAL1),"."))
55TOTQ Q
56 ;
57SORT1 ; -- hdr labels for sort
58 ;;DIVISION, CLINIC, PATIENT
59 ;;DIVISION, CLINIC, APPOINTMENT DATE/TIME
60 ;;DIVISION, STOP CODE, CLINIC
61 ;;DIVISION, STOP CODE, PATIENT
62 ;;DIVISION, PATIENT, APPOINTMENT DATE/TIME
63 ;;$$END
64 Q
65 ;
66TOTP(SORT,DIV,LEVEL1) ; Print totals
67 ;
68 D HDRD,HDRT(SORT)
69 F S LEVEL1=$O(^TMP("SDWTTOT",$J,+DIV,LEVEL1)) Q:LEVEL1=""!(SDQUIT) D
70 .D CHECK(SORT) Q:SDQUIT
71 .D TOT("PRIM",LEVEL1,DIV)
72 Q:SDQUIT
73 W !,SDASH1
74 D TOT("DIV","TOTAL",DIV),LEGEND
75 D PAUSE^SDAMOWP
76 Q
77 ;
78CHECK(SORT) ; check to see if header should be printed
79 I 'SDPAGE D HDRT(SORT) Q
80 I $E(IOST,1,2)="C-",($Y+6)>IOSL D PAUSE^VALM1 I 'Y S SDQUIT=1 Q
81 I ($Y+6)>IOSL W @IOF D HDRT(SORT)
82 Q
83 ;
84LEGEND ; Print legend on bottom
85 ;
86 W !!,?5,"o Check-In Date/Time - Time the patient first checks in at the clinic reception area."
87 W !,?5,"o Appointment Date/Time - Time of the veteran's scheduled appointment."
88 W !,?5,"o Elapsed Time(s) - 1. The elapsed period of time from the patient checking in at the clinic to the appointment time. "
89 W !,?5," (Appointment time minus Check-In time)"
90 W !,?5,"o 2. The elapsed period of time from the appointment time to the time the patient checks out."
91 W !,?5," (Check-Out time minus Appointment Time)"
92 W !,?5,"o Total Waiting Time - The elapsed period of time from the patient's check-in date/time to the time leaving the clinic"
93 W !,?5," after service is completed. (Check-Out time minus Check-In time)"
94LEGENDQ Q
95 ;
96NODIV ; Print divisions when no appts found
97 ;
98 N DIV S DIV="" W !,?70,"Division(s): "
99 I VAUTD=1 W "All" G NODIVQ
100 F S DIV=$O(VAUTD(DIV)) Q:DIV="" W ?83,VAUTD(DIV),!
101NODIVQ Q
102 ;
103NO ; Print stop code or clinic when no appts found
104 ;
105 N SDWHAT S SDWHAT="" W !,?72,$S(SDSORT=1!(SDSORT=2):"Clinic(s): ",SDSORT=3!(SDSORT=4):"Stop Code(s): ",1:"")
106 I SDSORT=1!(SDSORT=2),VAUTC=1 W "All" G NOQ
107 I SDSORT=1!(SDSORT=2) F S SDWHAT=$O(VAUTC(SDWHAT)) Q:SDWHAT="" W ?83,VAUTC(SDWHAT),!
108 I SDSORT=3!(SDSORT=4),VAUTS=1 W "All" G NOQ
109 I SDSORT=3!(SDSORT=4) F S SDWHAT=$O(VAUTS(SDWHAT)) Q:SDWHAT="" W ?87,VAUTS(SDWHAT),!
110NOQ Q
Note: See TracBrowser for help on using the repository browser.