source: WorldVistAEHR/trunk/r/EQUIPMENT_TURN_IN_REQUEST-PRCN/PRCN109.m@ 861

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1PRCN109 ;WOIFO/SU-Extract Equipment Turn-In user counts ; 04/09/2001 03:30 PM
2V ;;1.0;PRCN;**9**;Sep 13, 1996
3 ;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5POST ;
6 ;
7 NEW I,J,K,STA,PSTA,LC,FDT,XMSUB,XMTEXT,XMY
8 NEW DIFROM
9 S U="^",DT=$$DT^XLFDT
10 K ^TMP("PRCN109")
11 S PSTA=$$GET1^DIQ(4,$$KSP^XUPARAM("INST")_",",99)
12EQP ;
13 ; Equipment Committee
14 S I=0,STA=PSTA F S I=$O(^PRCN(413.2,"B",I)) Q:'I D SETP(1)
15 ;
16CNCROFF ;
17 ; Concurrence Officials
18 S I=0 F S I=$O(^PRCN(413.3,"B",I)) Q:'I D SETP(2)
19 ;
20KEYCHK ;
21 ; Find user with security key
22 S I=0 F S I=$O(^VA(200,I)) Q:'I D
23 . ; Staff pick up turn-in requests
24 . I $D(^XUSEC("PRCNWHSE",I)) D SETP(5)
25 . ; Examiner of new/turn-in requests
26 . I $D(^XUSEC("PRCNEN",I)) D SETP(6)
27 ;
28CMROFC ;
29 ; CMR Officials
30 S J=0 F S J=$O(^ENG(6914,"AD",J)) Q:'J D
31 . ; get station number
32 . S STA=+$P($G(^ENG(6914.1,J,0)),"^",7)
33 . I STA'?3N S STA=PSTA
34 . Q:STA=""
35 . ; Responsible Official
36 . S I=$P($G(^ENG(6914.1,J,0)),"^",2) I I D SETP(3) I $D(^XUSEC("PRCNCMR",I)) D SETP(4)
37 . ; Alternate Responsible Official
38 . S I=+$G(^ENG(6914.1,J,20)) I I D SETP(3) I $D(^XUSEC("PRCNCMR",I)) D SETP(4)
39 ;
40 D RPT
41EXIT ;
42 K ^TMP("PRCN109")
43 Q
44 ;
45RPT ;
46 ; Generate report from ^TMP("PRCN109")
47 ; 1. count from ^TMP
48 S STA=0 F S STA=$O(^TMP("PRCN109",$J,STA)) Q:'STA D
49 . K FDT S (FDT,I)=0
50 . F S I=$O(^TMP("PRCN109",$J,STA,I)) Q:'I S J=$G(^(I)) D
51 .. F K=1:1:6 I $P(J,"^",K) S FDT(K)=$G(FDT(K))+1
52 .. S FDT=FDT+1
53 . F K=1:1:6 D
54 .. S $P(^TMP("PRCN109",$J,STA),"^",K)=$G(FDT(K))
55 . S $P(^TMP("PRCN109",$J,STA),"^",7)=FDT
56 ; 2. message for user before report
57 K FDT S FDT(1)="Counts are only broken out by station for CMR Official and CMR"
58 S FDT(2)="Official with PRCNCMR key as the files and security keys used"
59 S FDT(3)="in the analysis of the other roles do not distinguish users"
60 S FDT(4)="by station. For the latter, the users are reported in totals"
61 S FDT(5)="for the main station of the VistA installation."
62 ; 3. format report using local array
63 F J=6,7 S FDT(J)=""
64 S LC=8,FDT(LC)="$REPORT"
65 S STA=0 F S STA=$O(^TMP("PRCN109",$J,STA)) Q:'STA S I=$G(^(STA)) D
66 . I LC>1 F J=1:1:3 S LC=LC+1,FDT(LC)=""
67 . S LC=LC+1,FDT(LC)=" EQUIPMENT TURN-IN USERS BY ROLE"
68 . S LC=LC+1,FDT(LC)=" STATION #: "_STA
69 . S LC=LC+1,FDT(LC)=" Role"_$J("Count",53)
70 . F K=1:1:6 D
71 .. S J=$P($T(FORMAT+K),";;",2)
72 .. S LC=LC+1,FDT(LC)=" "_J_$J(+$P(I,"^",K),57-$L(J))
73 . S LC=LC+1,J="Total Unique Equipment Turn-In Users"
74 . S FDT(LC)=" "_J_$J(+$P(I,"^",7),61-$L(J))
75 ;
76 ; $DATA
77 ; Equipment Turn-In data
78 S LC=LC+1,FDT(LC)="$DATA(Equipment Turn-In)"
79 S STA=0 F S STA=$O(^TMP("PRCN109",$J,STA)) Q:'STA S J=^(STA) D
80 . S K="" F I=1:1:6 S K=K_+$P(J,"^",I)_","
81 . S LC=LC+1,FDT(LC)="Station"_STA_","_K_+$P(J,"^",7)
82 S LC=LC+1,FDT(LC)="$END"
83 ;
84MAIL ;
85 ; Send report to mail group member and patch installer
86 X ^%ZOSF("UCI") S J=^%ZOSF("PROD")
87 S:J'["," Y=$P(Y,",")
88 ; send report to mail group for PRODUCTION UCI only
89 I Y=J F I=1:1 S J=$T(MAILGRP+I),J=$P(J,";;",2) Q:J="" S XMY(J)=""
90 ; mail to user who install patch 9
91 I $G(DUZ),$D(^VA(200,DUZ)) S XMY(DUZ)=""
92 S STA=$$GET1^DIQ(4,$$KSP^XUPARAM("INST")_",",.01)
93 I STA="" S STA="UNKNOWN"
94 S XMSUB="Extract Equipment Turn-In Users by Role ("_STA_")"
95 S XMTEXT="FDT("
96 D ^XMD
97 Q
98MAILGRP ;
99 ;;G.coreFLS VistA Stats@FORUM.VA.GOV
100 ;;
101 Q
102FORMAT ;
103 ;;Equipment Committee
104 ;;Concurrence Officials
105 ;;CMR Official
106 ;;CMR Official with PRCNCMR key
107 ;;Staff who assign pickups for turn-in Requests
108 ;;Engineering staff who examine new/turn-in Requests
109 ;;
110SETP(PC) ;
111 ; set value into ^TMP, STA -- station number, I -- DUZ
112 ; If termination date is smaller than today's date
113 I $P($G(^VA(200,I,0)),"^",11),DT>$P(^(0),"^",11) Q
114 I '$P($G(^TMP("PRCN109",$J,STA,I)),"^",PC) S $P(^(I),"^",PC)=1
115 Q
Note: See TracBrowser for help on using the repository browser.