source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDAMOCP1.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.9 KB
Line 
1SDAMOCP1 ;IOFO BAY PINES/TEH - Detail Print for Cancelled Statistics;4/15/92 ; Compiled January 25, 2007 12:00:46
2 ;;5.3;Scheduling;**487,496**;Aug 13, 1993;Build 11
3 ;
4HDR ;Report Header
5 ;
6 N SDSTOP
7 I SDPAGE>1,$E(IOST,1,2)="C-" D PAUSE^VALM1 I 'Y S SDSTOP=1 Q
8HDR1 W @IOF
9 W !,?50,"Cancelled Clinic Report - Detail"
10 W !,?50,"Date Range: ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
11 D NOW^%DTC
12 W !,?54,"Run Date: ",$E($$FDTTM^VALM1(%),1,14)
13 W !,?62,"Page: ",SDPAGE S SDPAGE=SDPAGE+1
14 W !,"Division"
15 W !,SDASH,!
16 W "Status",?8,"Patient",?30,"SSN",?39,"Appt Date",?61,"Clinic",?81,"Cancel Date",?106,"User",!
17 W SDASH
18 Q
19 ;
20BLD ;Build output from ^TMP global
21 ;
22 N SDTOT,SDTOTT,SDCL,SDDATE,SDUSER,SDCDT
23 D HDR
24 I IOST["P-" K DIRUT
25 S (SDSTOP,SDTOTT,SDFLG)=0,SDDV="" F S SDDV=$O(^TMP("SDAMCD",$J,SDDV)) Q:SDDV=""!(SDSTOP) D CHK D
26 .S SDDVNM=$P($G(^DG(40.8,SDDV,0)),U) W !,SDDVNM
27 .S SDCR="" F S SDCR=$O(^TMP("SDAMCD",$J,SDDV,SDCR)) Q:SDCR=""!($D(DIRUT)) S SDTOT(SDCR)=0 D W !!,"SUBTOTAL:",$J(SDTOT(SDCR),4),!
28 ..S SDCL="" F S SDCL=$O(^TMP("SDAMCD",$J,SDDV,SDCR,SDCL)) Q:SDCL=""!($D(DIRUT)) D
29 ...S SDDATE="" F S SDDATE=$O(^TMP("SDAMCD",$J,SDDV,SDCR,SDCL,SDDATE)) Q:SDDATE=""!($D(DIRUT)) D
30 ....S SDDFN="" F S SDDFN=$O(^TMP("SDAMCD",$J,SDDV,SDCR,SDCL,SDDATE,SDDFN)) Q:SDDFN=""!($D(DIRUT)) D
31 .....S SDDATA=$G(^TMP("SDAMCD",$J,SDDV,SDCR,SDCL,SDDATE,SDDFN))
32 .....S Y=$P(SDDATA,";",2) D DD^%DT S SDAPDT=Y
33 .....D GETS^DIQ(2,SDDFN_",",".01;.09",,"SDRES","SDMES") S SDNM=$E($G(SDRES(2,SDDFN_",",.01)),1,20),SDSSN=$E($G(SDRES(2,SDDFN_",",.09)),6,9)
34 .....S Y=$P(SDDATA,U,14) D DD^%DT S SDCDT=Y S SDUSER=$P(SDDATA,U,12)
35 .....S SDUSERNM=$$GET1^DIQ(200,SDUSER_",",.01,,"SDRES","SDMES")
36 .....S SDCLNM=$$GET1^DIQ(44,SDCL_",",.01,,"SDRES","SDMES")
37 .....W !,SDCR,?8,$E(SDNM,1,22),?30,SDSSN,?39,SDAPDT,?61,$E(SDCLNM,1,18),?81,SDCDT,?106,$E(SDUSERNM,1,26)
38 .....K SDRES,SDMES ;SD/496
39 .....D CHK I $D(DIRUT) Q
40 .....S SDTOT(SDCR)=$G(SDTOT(SDCR))+1,SDTOTT=SDTOTT+1
41 W !!,"TOTAL CANCELLATIONS:",$J(SDTOTT,14)
42 W !!,"End of Report!"
43 K SDUSERNM,SDSSN,SDAPDT,SDCLNM,SDRES,SDNM,SDCR,SDDDATE,SDDFN,SDDATA,SDDVNM,SDCLNM
44 I IOST["P-" S DIRUT=1
45BLDQ Q
46 ;
47MCTOT ;
48 N SDFLG,SDDV,SDNXT
49 S SDFLG=1,SDDV="" D HDR F S SDDV=$O(^TMP("SDAMS",$J,SDDV)) Q:SDDV="" D Q:SDSTOP
50 .W !,$P($G(^DG(40.8,SDDV,0)),U)
51 .K SDTOT,SDCNT D TOTAL
52 .W ?124,$J(SDTOT,8)
53 .D CHK Q:SDSTOP
54 .S SDNXT=$O(^TMP("SDAMS",$J,SDDV)) W:SDNXT'="" !,SDASH
55 .K SDTOT,SDCNT
56 W !,SDTDASH,!,"TOTAL" F SDI=1:1:11 S SDCNT(SDI)=+$G(SDAT("SDAMS",$J,SDI)),SDTOT=$G(SDTOT)+$G(SDCNT(SDI))
57 D CNT
58 W ?124,$J(SDTOT,8) K SDTOT,SDCNT D CHK I SDSTOP G MCTOTQ
59 W !! D LEGEND
60MCTOTQ Q
61CNT ;Place no-show/no-show auto rebook & cancel/cancel auto-rebook together
62 S SDCNT(4)=+$G(SDCNT(4))+(+$G(SDCNT(6))),SDCNT(13)=+$G(SDCI(+SDCL,4))+(+$G(SDCI(+SDCL,6)))
63 S SDCNT(5)=+$G(SDCNT(5))+(+$G(SDCNT(7))),SDCNT(14)=+$G(SDCI(+SDCL,5))+(+$G(SDCI(+SDCL,7)))
64 F SDI=1,2,3,4,13,6,5,14,7,8 D
65 .W ?$$COL(SDI),$J($S($D(SDCNT(SDI)):SDCNT(SDI),1:0),$$LEN(SDI))
66 Q
67 ;
68CHK ;Check to pause on screen
69 N SDY
70 I $E(IOST,1,2)="C-",($Y+8)>IOSL D PAUSE^VALM1 S SDY=Y D:SDY HDR1 I 'SDY S SDSTOP=1 Q
71 I ($Y+8)>IOSL D HDR1
72 Q
73TOTAL ;Totals
74 F SDI=1:1:11 S SDCNT(SDI)=+$G(SDCL("SDAMS",$J,SDDV,SDI)),SDTOT=$G(SDTOT)+$G(SDCNT(SDI))
75 D CNT
76 K SDCNT
77 Q
78 ;
79LEGEND ;Legend on bottom of output
80 ;
81 W !,?5,"o CI=Checked In ; RB=Rebooked"
82 W !,?5,"o 'Cancelled' appointments only reflect appointments cancelled using 'Cancel Clinic Availability'."
83 W !,?5,"o 'Checked-In' does not include no-shows or cancelled appointments that have been checked in."
84 Q
85 ;
86COL(SDI) ;Column placement of appt. status
87 ;
88 ;input - SDI (appt. type)
89 ;output - column placement
90 Q $S(SDI=1:34,SDI=2:48,SDI=3:63,SDI=4:81,SDI=5:97,SDI=6:92,SDI=7:108,SDI=8:114,SDI=13:87,SDI=14:103)
91 ;
92LEN(SDI) ;Length of column
93 ;
94 ;input - SDI (appt. type)
95 ;output - length of column
96 Q $S(SDI=1:10,SDI=2:11,SDI=3:15,SDI=4:5,SDI=6:4,SDI=5:5,SDI=7:4,SDI=8:9,SDI=13:4,SDI=14:4)
97 ;
Note: See TracBrowser for help on using the repository browser.