source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SDSCUSR.m@ 623

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

initial load of WorldVistAEHR

File size: 4.6 KB
Line 
1SDSCUSR ;ALB/JAM/RBS - ASCD User Total Report ; 1/19/07 1:28pm
2 ;;5.3;Scheduling;**495**;Aug 13, 1993;Build 50
3 ;;MODIFIED FOR NATIONAL RELEASE from a Class III software product
4 ;;known as Service Connected Automated Monitoring (SCAM).
5 ;
6 ;**Program Description**
7 ; This report gives a total of the number of encounters that meet
8 ; the criteria: SC='Yes', auto-verified, and changed
9 Q
10EN ; Entry Point
11 N DIR,X,Y,SDSCDVSL,SDSCDVLN,ZTQUEUED,POP,ZTRTN,ZTDTH,ZTDESC,ZTSAVE
12 ; Get start and end date for report
13 D GETDATE^SDSCOMP I SDSCTDT="" G EXIT
14 ; Get Divisions
15 D DIV^SDSCUTL
16 D ^DIR
17 I $G(DTOUT)!($G(DUOUT)) G EXIT
18 S SDSCDVSL=Y,SDSCDVLN=SCLN
19 K %ZIS,IOP,IOC,ZTIO S %ZIS="MQ" D ^%ZIS G:POP EXIT
20 I $D(IO("Q")) D G EXIT
21 . S ZTRTN="BEG^SDSCUSR",ZTDTH=$H,ZTDESC="ASCD User Total Report"
22 . S ZTSAVE("SDSCBDT")="",ZTSAVE("SDSCEDT")="",ZTSAVE("SDSCDVSL")=""
23 . S ZTSAVE("SDSCDVLN")="",ZTSAVE("GROUP")="",ZTSAVE("SDEDT")="",ZTSAVE("SDSCTDT")=""
24 . K IO("Q") D ^%ZTLOAD W !,"REQUEST QUEUED"
25 ;
26BEG ; Begin report
27 N P,L,SDABRT,CT,SDSCDIV,SDSCDNM,THDR,SDI
28 S (P,L,SDABRT,CT)=0
29 S SDSCDIV=$S(SDSCDVSL'[SDSCDVLN:SDSCDVSL,1:"")
30 I SDSCDIV="" S SDSCDNM="ALL" D FND G EXT
31 I SDSCDIV'="" D
32 . S THDR=""
33 . F SDI=1:1:$L(SDSCDVSL,",") S SDSCDIV=$P(SDSCDVSL,",",SDI) Q:SDSCDIV="" D Q:$G(SDABRT)=1
34 .. S SDSCDNM=$P(^DG(40.8,SDSCDIV,0),"^",1),THDR=THDR_SDSCDNM_",",CT=CT+1 D FND
35 G EXT
36 ;
37FND ;
38 N SDORG,SDOEDT,SDOE,EDNM,SDSCDATA,UIEN,UNAME,TYP,TOTAL,LEV1,COL,AMT
39 K ^TMP("SDSCUSR",$J)
40 S SDOEDT=SDSCTDT
41 F S SDOEDT=$O(^SDSC(409.48,"AE",SDOEDT)) Q:SDOEDT\1>SDEDT!(SDOEDT="") D
42 . S SDOE=""
43 . F S SDOE=$O(^SDSC(409.48,"AE",SDOEDT,SDOE)) Q:SDOE="" D
44 .. I SDSCDIV'="" Q:$P(^SDSC(409.48,SDOE,0),U,12)'=SDSCDIV
45 .. S EDNM=0,SDORG=$P($$SCHNG^SDSCUTL(SDOE),U,2)
46 .. F S EDNM=$O(^SDSC(409.48,SDOE,1,EDNM)) Q:'EDNM D
47 ... S SDSCDATA=^SDSC(409.48,SDOE,1,EDNM,0),UNAME=""
48 ... S UIEN=$P(SDSCDATA,U,3) I UIEN'="" S UNAME=$$UP^XLFSTR($$NAME^XUSER(UIEN,"F"))
49 ... I $P(SDSCDATA,U,6)=1 D STORE("REVIEW")
50 ... I $P(SDSCDATA,U,5)=SDORG D STORE("NO CHANGE") Q
51 ... I SDORG,$P(SDSCDATA,U,5)=0 D STORE("SCNSC") Q
52 ... I 'SDORG,$P(SDSCDATA,U,5) D STORE("NSCSC")
53 ;
54PRT ; Print
55 K TOTAL
56 S SDHDR="User Summary Data Report"
57 D HDR Q:$G(SDABRT)=1
58 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S TOTAL(TYP)=0
59 S LEV1=""
60 F S LEV1=$O(^TMP("SDSCUSR",$J,LEV1)) Q:LEV1="" D Q:$G(SDABRT)=1
61 . I L+4>IOSL D HDR Q:$G(SDABRT)=1
62 . W !,LEV1 S L=L+1
63 . S COL=30 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
64 .. S AMT=+$G(^TMP("SDSCUSR",$J,LEV1,TYP)),DTOT(LEV1,TYP)=$G(DTOT(LEV1,TYP))+AMT,TOTAL(TYP)=$G(TOTAL(TYP))+AMT
65 .. W ?COL,$J(AMT,7)
66 I $G(SDABRT)=1 Q
67 S COL=30,L=L+1 W ! I L+4>IOSL D HDR Q:$G(SDABRT)=1
68 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
69 . W ?COL,"-------"
70 S COL=30,L=L+1 W !,"TOTAL"
71 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
72 . W ?COL,$J($G(TOTAL(TYP)),7)
73 Q
74 ;
75EXT ;
76 I CT>1,$G(SDABRT)'=1 D PRTT
77 D RPTEND^SDSCRPT1
78 ;
79EXIT ;
80 K SDNWPV,SDPVCN,SDSCBDT,SDSCEDT,SDSCDATA,SDSCDIV,SDSCDNM,DIV,EDIV,TOTAL
81 K SDHDR,SDSCTDT,SDEDT,I,L,P,SUBTOT,Y,POP,GROUP,SCLN,DTOUT,DUOUT,DTOT
82 K ^TMP("SDSCUSR",$J) K LEV1,TYP
83 Q
84 ;
85STORE(VAL) ; Total up and Store
86 S ^TMP("SDSCUSR",$J,UNAME,VAL)=$G(^TMP("SDSCUSR",$J,UNAME,VAL))+1
87 S ^TMP("SDSCUSR",$J,UNAME,VAL,SDOE)=""
88 K VAL
89 Q
90 ;
91HDR ; Header
92 U IO D STDHDR^SDSCRPT2 Q:$G(SDABRT)=1
93 S SDNWPV=1
94 W SDHDR,?67,"PAGE: ",P
95 W !,?5,"For Encounters Dated ",$$FMTE^XLFDT(SDSCTDT,2)," THRU ",$$FMTE^XLFDT(SDEDT,2)_" By Division: "_SDSCDNM
96 W !?35,"SET to REVIEW",?50,"SC to NSC",?61,"NSC to SC",?72,"SC KEPT",!
97 F I=1:1:79 W "-"
98 Q
99 ;
100HDR1 ;
101 N HHDR,HHDR1,HHDR2,HHDR3,HHDR4,I
102 U IO D STDHDR^SDSCRPT2 Q:$G(SDABRT)=1
103 I $E(THDR,$L(THDR))="," S THDR=$E(THDR,1,$L(THDR)-1)
104 W SDHDR,?67,"PAGE: ",P
105 S HHDR1="For Encounters Dated "_$$FMTE^XLFDT(SDSCTDT,2)_" THRU "_$$FMTE^XLFDT(SDEDT,2)_" TOTAL for "
106 S HHDR2=THDR
107 I $L(HHDR1)+$L(HHDR2)>IOM D
108 . S HHDR3=$P(HHDR2,",",1),HHDR4=$P(HHDR2,",",2,99)
109 . S HHDR=HHDR1_HHDR3
110 . I HHDR4'="" S HHDR=HHDR_","
111 I $L(HHDR1)+$L(HHDR2)'>IOM D
112 . S HHDR=HHDR1_HHDR2
113 W !,HHDR
114 I $G(HHDR4)'="" W !,?5,HHDR4
115 W !?40," REVIEW",?50,"SC CHNG",?60,"SC KEPT",!
116 F I=1:1:79 W "-"
117 Q
118 ;
119PRTT ;
120 D HDR1 Q:$G(SDABRT)=1
121 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S TOTAL(TYP)=0
122 S LEV1=""
123 F S LEV1=$O(DTOT(LEV1)) Q:LEV1="" D
124 . I L+4>IOSL D HDR1 Q:$G(SDABRT)=1
125 . W !,LEV1 S L=L+1
126 . S COL=30 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
127 .. S AMT=DTOT(LEV1,TYP),TOTAL(TYP)=$G(TOTAL(TYP))+AMT
128 .. W ?COL,$J(AMT,7)
129 S COL=30,L=L+1 W ! I L+4>IOSL D HDR1 Q:$G(SDABRT)=1
130 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
131 . W ?COL,"-------"
132 S COL=30,L=L+1 W !,"TOTAL"
133 F TYP="REVIEW","SCNSC","NSCSC","NO CHANGE" S COL=COL+10 D
134 . W ?COL,$J($G(TOTAL(TYP)),7)
135 Q
Note: See TracBrowser for help on using the repository browser.