source: FOIAVistA/tag/r/SCHEDULING-SD-SC/SDAMOS1.m@ 1096

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

initial load of FOIAVistA 6/30/08 version

File size: 3.7 KB
Line 
1SDAMOS1 ;ALB/SCK - AM MGT REPORTS STATISTICS OUTPUT ; 5/14/93
2 ;;5.3;Scheduling;;Aug 13, 1993
3 ;
4BLD ; build report from data stored in TMP global
5 N I,SDFIN,STATUS
6 S (TC,TA,TI,SDCO,SDAR,SDIP,SDTOT,SDFIN,TCOCNT,TARCNT,TIPCNT)=0,PAGE=1
7 S SDLST="",SDLST=$O(^TMP("SDAMS",$J,SDLST)),SDFIN=$$HDR(SDLST)
8 S SDNXT="" F S SDNXT=$O(^TMP("SDAMS",$J,SDNXT)) Q:SDNXT="" D G:SDFIN BLDQ
9 . I SDNXT'=SDLST S SDFIN=$$HDR(SDNXT) Q:SDFIN S SDLST=SDNXT,(TC,TI,TA)=0
10 . S NXTSC="" F S NXTSC=$O(^TMP("SDAMS",$J,SDNXT,NXTSC)) Q:NXTSC="" D Q:SDFIN
11 .. S STATUS=0 F S STATUS=$O(^TMP("SDAMS",$J,SDNXT,NXTSC,STATUS)) Q:'STATUS D Q:SDFIN
12 ... S SDFIN=$$STCNT(STATUS,+^(STATUS)) ; ref to tmp(sdams,$j,div,stocode,status)
13 .. S SDFIN=$$SUBTOT(NXTSC)
14 . D TOTALS
15 D TDIV
16BLDQ K SDCO,SDAR,SDIP,SDTOT,TCOCNT,TARCNT,TIPCNT,SDLST,LSTSC,SDNXT,NXTSC,ACTION,QFLAG,TC,TI,TA,TOT,PAGE,SDFIN,%
17 Q
18 ;
19STCNT(STAT,COUNT) ; increment action count for stopcode
20 ; sdar = action req by stop code
21 ; sdco = checked out by stop code
22 ; sdip = in-pat by stop code
23 ;
24 N Y S Y=0
25 S:STAT=14 SDAR=SDAR+COUNT
26 S:STAT=2 SDCO=SDCO+COUNT
27 S:STAT=8 SDIP=SDIP+COUNT
28 Q (Y)
29 ;
30SUBTOT(SDCODE) ; totals by stopcode
31 ; tcocnt = checked out total by division (per page)
32 ; tarcnt = action req tot by div/page
33 ; tipcnt = In-pat tot by div/page
34 ;
35 N Y,SDFIN
36 S Y=0
37 I $Y+5>IOSL D G:SDFIN SUBTOTQ
38 . D TOTALS
39 . S SDFIN=$$HDR(SDNXT) Q:SDFIN
40 I SDSEL=5 W !,SDCODE,?34,SDCO,?53,SDAR,?64,SDIP,?77,SDCO+SDAR+SDIP
41 S TCOCNT=TCOCNT+SDCO,TARCNT=TARCNT+SDAR,TIPCNT=TIPCNT+SDIP
42 S (SDCO,SDAR,SDIP)=0
43SUBTOTQ Q (Y)
44 ;
45TOTALS ; total of actions by stopcode for division
46 ; tc = check out total for division
47 ; ta = action required tot for div.
48 ; ti = in-pat tot for div.
49 ;
50 N SDIV
51 I SDSEL=5 W !,SDTDASH,!,"TOTAL",?34,TCOCNT,?53,TARCNT,?64,TIPCNT,?77,TCOCNT+TARCNT+TIPCNT
52 S TC=TC+TCOCNT,TA=TA+TARCNT,TI=TI+TIPCNT
53 S TOT(SDNXT)=TC_U_TA_U_TI
54 S (TCOCNT,TARCNT,TIPCNT)=0
55 Q
56 ;
57HDR(SDIV) ; page header
58 N Y
59 S Y=0
60 G:SDSEL'=5 HDRQ
61 D PAUSE
62 W !!,"Statistics Report by Stop Code"
63 W !,"Division: ",SDIV,?40,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
64 D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: ",PAGE S PAGE=PAGE+1
65 W !," Stop Code",?25,"Checked-Out",?40,"Action Required",?58,"Inpatient",?75,"Total",!,SDASH
66HDRQ Q (Y)
67 ;
68TDIV ; final totals by division for med center
69 ; reuse tc for check out total by med ctr
70 ; ta for action req tot
71 ; ti for in-pat tot
72 ; tcd = check out totals by div
73 ; tad = action req totals by div
74 ; tip = in-pat totals by div
75 ;
76 N SDIV,TC,TA,TI,TCD,TAD,TID
77 S (TC,TA,TI,TCD,TAD,TID)=0
78 D PAUSE
79 W !!,"Statistics Report Totals by Division"
80 W !,"MEDICAL CENTER",?40,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
81 D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: ",PAGE S PAGE=PAGE+1
82 W !," Division",?25,"Checked-Out",?40,"Action Required",?58,"Inpatient",?75,"Total"
83 S SDIV="" F S SDIV=$O(TOT(SDIV)) Q:SDIV="" D
84 . W !,SDASH
85 . S TCD=$P(TOT(SDIV),U),TAD=$P(TOT(SDIV),U,2),TID=$P(TOT(SDIV),U,3)
86 . W !,SDIV,?34,TCD,?54,TAD,?65,TID,?75,TCD+TAD+TID
87 . S TC=TC+TCD,TA=TA+TAD,TI=TI+TID
88 W !,SDTDASH
89 W !,"TOTAL",?34,TC,?54,TA,?65,TI,?75,TC+TA+TI
90 K TCD,TAD,TID
91TDIVQ Q
92 ;
93PAUSE ;
94 I $E(IOST,1,2)="C-" D
95 . S DIR(0)="FO",DIR("A")="Press RETURN to continue or '^' to exit"
96 . D ^DIR K DIR I $D(DUOUT)!($D(DTOUT)) Q
97 . W @IOF
98 E W @IOF
99PAUSEQ Q
100 ;
101NOREP ; report if no data in TMP global
102 W !!,"Statistics Report by Stop Code"
103 W !,"Date Range ",$$FDATE^VALM1(SDBEG)_" to "_$$FDATE^VALM1(SDEND)
104 D NOW^%DTC W ?95,"Run Date: ",$E($$FDTTM^VALM1(%),1,14),?125,"Page: 1"
105 W !,SDASH
106 W !!?10,"No data found matching sort parameters"
107 Q
Note: See TracBrowser for help on using the repository browser.