source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMOWP.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.7 KB
RevLine 
[613]1SDAMOWP ;ALB/CAW - Appointment Waiting Time Print Routine ; 12/1/91
2 ;;5.3;Scheduling;**12**;Aug 13, 1993
3 ;
4PRINT ; -- print arrays
5 ; var defined:
6 ; SDSUB2 := top level sort after Division (clinic,stop cd,patient)
7 ; SDSUB3 := next level sort
8 ;
9 U IO N SDQUIT,SDDIV,SDROU,SDCLN,SDPAT,SDSTP,SDNO,LEVEL1
10 S (SDQUIT,SDDIV,SDCLN,SDPAT,SDATE,SDSTP)=""
11 I $O(^TMP("SDWAIT",$J,SDDIV))="" S LEVEL1=0,SDNO=1 D HDR^SDAMOWP1 D G PRINTQ
12 .W !!?5,"No appointments to report."
13 .D:$E(IOST,1,2)="C-" PAUSE^VALM1
14 ;
15 F S SDDIV=$O(^TMP("SDWAIT",$J,SDDIV)) Q:SDDIV=""!(SDQUIT) D SORT(SDDIV,SDSORT) G:SDQUIT PRINTQ
16 D PAUSE G:SDQUIT PRINTQ
17 S SDDIV=0 D HDRD^SDAMOWP1 W !,SDASH D HDRT^SDAMOWP1() D
18 .F S SDDIV=$O(^TMP("SDWTTOTD",$J,SDDIV)) Q:SDDIV=""!(SDQUIT) D TOT^SDAMOWP1("DIV",$P($G(^DG(40.8,SDDIV,0)),U),SDDIV) W !,SDASH
19 .D TOT^SDAMOWP1("GRAND","TOTAL"),LEGEND^SDAMOWP1
20PRINTQ Q
21 ;
22SORT(DIV,SORT) ; sort
23 ;
24 Q:SDSEL=2&(SORT=5)
25 S (LEVEL1,LEVEL2,LEVEL3,LEVEL4)=0
26 I SDSEL=2 D TOTP^SDAMOWP1(SORT,DIV,LEVEL1) G SORTQ
27 I SORT=5 S LEVEL1=$O(^TMP("SDWAIT",$J,DIV,LEVEL1)) D HDR^SDAMOWP1 S LEVEL1=""
28 F S LEVEL1=$O(^TMP("SDWAIT",$J,DIV,LEVEL1)) Q:LEVEL1=""!(SDQUIT) D:SORT'=5 HDR^SDAMOWP1 D
29 .F S LEVEL2=$O(^TMP("SDWAIT",$J,DIV,LEVEL1,LEVEL2)) Q:LEVEL2=""!(SDQUIT) D
30 ..F S LEVEL3=$O(^TMP("SDWAIT",$J,DIV,LEVEL1,LEVEL2,LEVEL3)) Q:LEVEL3=""!(SDQUIT) D
31 ...I SORT=3!(SORT=4) F S LEVEL4=$O(^TMP("SDWAIT",$J,DIV,LEVEL1,LEVEL2,LEVEL3,LEVEL4)) Q:LEVEL4=""!(SDQUIT) D SET(SORT,LEVEL1,LEVEL2,LEVEL3,LEVEL4),CHECK S SDATA=^TMP("SDWAIT",$J,DIV,LEVEL1,LEVEL2,LEVEL3,LEVEL4) Q:'$$PRT
32 ...Q:SORT=3!(SORT=4)
33 ...S SDATA=^(LEVEL3) D SET(SORT,LEVEL1,LEVEL2,LEVEL3,LEVEL4),CHECK Q:SDQUIT Q:'$$PRT
34 .Q:SDQUIT
35 .I SORT'=5 N TOTAL,TOTAL1,TOTAL2,TOTAL3,TOTAL4 D
36 ..S TOTAL=$G(^TMP("SDWTTOT",$J,DIV,LEVEL1,"PRIM")),TOTAL1=$P(TOTAL,U,1),TOTAL2=$P(TOTAL,U,2),TOTAL3=$P(TOTAL,U,3),TOTAL4=$P(TOTAL,U,4)
37 ..D TOT
38 .I SORT'=5 D PAUSE Q:SDQUIT
39 I SDSORT=5&(SDSEL=1) N TOTAL,TOTAL1,TOTAL2,TOTAL3,TOTAL4 D
40 .S TOTAL=$G(^TMP("SDWTTOTD",$J,SDDIV,"DIV")),TOTAL1=$P(TOTAL,U,1),TOTAL2=$P(TOTAL,U,2),TOTAL3=$P(TOTAL,U,3),TOTAL4=$P(TOTAL,U,4)
41 .D TOT
42SORTQ Q
43PRT() ; -- print appt
44 ; return: continue processing [ 1|yes 0|no ]
45 ; ^TMP("SDWAIT") nodes setup:
46 ;SDCLIN^SDSTOP^SDDAY^SDDIV^DFN^SDCHKIN^SDCHKOUT^SDWTTIME^SDOTTIME^SDTTTIME
47 ; 1 2 3 4 5 6 7 8 9 10
48 ;
49 N Y,VA,SDREQ,SDVAR,SDTIME
50 S DFN=$P(SDATA,U,5) D PID^VADPT6
51 W !,$E($P($G(^DPT(DFN,0)),U,1),1,17),?20,VA("BID"),?26,$S("^3^4^5^"[(U_SDSORT_U):$E(SDCLN,1,20),1:"")
52 W ?46,$E($$FDTTM^VALM1($P(SDATA,U,6)),1,14),?62,$E($$FDTTM^VALM1(SDATE),1,14),?78,$$HRS($P(SDATA,U,8))
53 W ?92,$E($$FDTTM^VALM1($P(SDATA,U,7)),1,14),?109,$$HRS($P(SDATA,U,9)),?120,$$HRS($P(SDATA,U,10))
54 S Y=1
55PRTQ Q Y
56 ;
57CHECK ; check to see if header should be printed
58 I 'SDPAGE D HDR^SDAMOWP1 Q
59 I $E(IOST,1,2)="C-",($Y+6)>IOSL D PAUSE^VALM1 D:Y HDR^SDAMOWP1 I 'Y S SDQUIT=1 Q
60 I ($Y+6)>IOSL D HDR^SDAMOWP1
61 Q
62 ;
63PAUSE ; pause for CRT
64 ;
65 I $E(IOST,1,2)="C-" D PAUSE^VALM1 I 'Y S SDQUIT=1
66 Q
67 ;
68SET(SORT,LEVEL1,LEVEL2,LEVEL3,LEVEL4) ;
69 I SORT=1 S SDCLN=LEVEL1,SDPAT=LEVEL2,SDATE=LEVEL3
70 I SORT=2 S SDCLN=LEVEL1,SDATE=LEVEL2,SDPAT=LEVEL3
71 I SORT=3 S SDSTP=LEVEL1,SDCLN=LEVEL2,SDPAT=LEVEL3,SDATE=LEVEL4
72 I SORT=4 S SDSTP=LEVEL1,SDPAT=LEVEL2,SDCLN=LEVEL3,SDATE=LEVEL4
73 I SORT=5 S SDPAT=LEVEL1,SDATE=LEVEL2,SDCLN=LEVEL3
74 Q
75 ;
76TOT ; Totals Print
77 ;
78 W !,SDASH1,!,?62,"Total:",?78,$$HRS(TOTAL2),?109,$$HRS(TOTAL3),?120,$$HRS(TOTAL4),!,?60,"Average:",?78,$$HRS($P((TOTAL2/TOTAL1),".")),?109,$$HRS($P((TOTAL3/TOTAL1),".")),?120,$$HRS($P((TOTAL4/TOTAL1),".")) D LEGEND^SDAMOWP1
79TOTQ Q
80 ;
81HRS(MIN) ;Convert minutes to hours
82 ;
83 N HRS,HRS1
84 S HRS=MIN/60,HRS1=$P(HRS,"."),MIN=MIN-(HRS1*60)
85 Q $S(HRS1:HRS1_"hr ",1:"")_MIN_"min"
Note: See TracBrowser for help on using the repository browser.