source: FOIAVistA/trunk/r/CLINICAL_CASE_REGISTRIES-ROR/RORTSK12.m@ 1154

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

initial load of FOIAVistA 6/30/08 version

File size: 2.9 KB
Line 
1RORTSK12 ;HCIOFO/SG - REPORT STATS UTILITIES ; 7/15/05 12:00pm
2 ;;1.5;CLINICAL CASE REGISTRIES;;Feb 17, 2006
3 ;
4 Q
5 ;
6 ;***** CLEARS THE STATISTICS
7 ;
8 ; REGIEN Registry IEN
9 ;
10 ; [RPTCODE] Report Code. By default ($G(RPTCODE)'>0),
11 ; all statistic data is deleted.
12 ;
13CLEAR(REGIEN,RPTCODE) ;
14 N DA,DIK,IENS,NODE,RPIEN
15 S DA(1)=+REGIEN,IENS=","_DA(1)_","
16 S DIK=$$ROOT^DILFD(798.12,IENS)
17 S NODE=$$CREF^DILF(DIK)
18 ;
19 ;--- Clear the report stats
20 I $G(RPTCODE)>0 D Q
21 . S RPIEN=$$RPIEN^RORUTL08(RPTCODE) Q:RPIEN'>0
22 . L +@NODE@(RPTCODE):5
23 . S DA=$$FIND1^DIC(798.12,IENS,"QX",RPIEN,"B",,"RORMSG")
24 . D:DA>0 ^DIK
25 . L -@NODE@(RPTCODE)
26 ;
27 ;--- Clear all stats
28 L +@NODE:5
29 S DA=0 F S DA=$O(@NODE@(DA)) Q:DA'>0 D ^DIK
30 L -@NODE
31 Q
32 ;
33 ;***** INCREMENT THE NUMBER OF REPORT RUNS
34 ;
35 ; REGIEN Registry IEN
36 ;
37 ; RPTCODE Report Code
38 ;
39 ; [VAL] Increment value. By default ($G(VAL)'>0),
40 ; the counter is incremented by 1.
41 ;
42INC(REGIEN,RPTCODE,VAL) ;
43 N IEN,IENS,NODE,RORBUF,RORFDA,RORMSG,RPIEN,TMP
44 S:$G(VAL)'>0 VAL=1
45 ;
46 ;--- Get IEN of the report parameters
47 S RPIEN=$$RPIEN^RORUTL08(RPTCODE) Q:RPIEN'>0
48 ;
49 ;--- Lock the report stats
50 S IENS=","_(+REGIEN)_","
51 S NODE=$$ROOT^DILFD(798.12,IENS,1)
52 L +@NODE@(RPTCODE):5
53 D
54 . ;--- Find and load the report stats
55 . S TMP="@;.02"
56 . D FIND^DIC(798.12,IENS,TMP,"QX",RPIEN,2,"B",,,"RORBUF","RORMSG")
57 . D:$G(DIERR) DBS^RORERR("RORMSG",-9,,,798.12,IENS)
58 . Q:$G(RORBUF("DILIST",0))>1
59 . S IEN=+$G(RORBUF("DILIST",2,1))
60 . ;--- Increment the counter
61 . S IENS=$S(IEN>0:IEN,1:"?+1")_","_(+REGIEN)_","
62 . S RORFDA(798.12,IENS,.01)=RPIEN
63 . S RORFDA(798.12,IENS,.02)=$G(RORBUF("DILIST","ID",1,.02))+VAL
64 . D UPDATE^DIE(,"RORFDA",,"RORMSG")
65 . D:$G(DIERR) DBS^RORERR("RORMSG",-9,,,798.12,IENS)
66 ;
67 ;--- Unlock the report stats
68 L -@NODE@(RPTCODE)
69 Q
70 ;
71 ;***** RETURNS THE REPORT RUN STATISTICS
72 ;
73 ; REGIEN Registry IEN
74 ;
75 ; .STATS Reference to a local array where the statistics
76 ; (collected since the last successful data
77 ; transmission) will be returned to.
78 ;
79 ; STATS( Report Statistics Summary
80 ; ^01: Total number of report runs
81 ; RptCode) Report run statistics
82 ; ^01: Number of report runs
83 ;
84 ; Return Values:
85 ; <0 Error code
86 ; 0 Ok
87 ;
88STATS(REGIEN,STATS) ;
89 N IR,RORBUF,RORMSG,RPTCODE,TMP
90 K STATS S STATS="0"
91 ;--- Load the statistics
92 S TMP=","_(+REGIEN)_","
93 D LIST^DIC(798.12,TMP,".01I;.02","Q",,,,"B",,,"RORBUF","RORMSG")
94 Q:$G(DIERR) $$DBS^RORERR("RORMSG",-9,,,798.12,TMP)
95 ;--- Process the statistics
96 S IR=0
97 F S IR=$O(RORBUF("DILIST","ID",IR)) Q:IR'>0 D
98 . ;--- Get the IEN of the report parameters
99 . S TMP=+$G(RORBUF("DILIST","ID",IR,.01)) Q:TMP'>0
100 . ;--- Get the report code
101 . S RPTCODE=$$RPCODE^RORUTL08(TMP) Q:RPTCODE'>0
102 . ;--- Get the report statistics
103 . S TMP=+$G(RORBUF("DILIST","ID",IR,.02))
104 . S $P(STATS(RPTCODE),U)=TMP
105 . S $P(STATS,U)=$P(STATS,U)+TMP
106 ;---
107 Q 0
Note: See TracBrowser for help on using the repository browser.