source: WorldVistAEHR/trunk/r/SCHEDULING-SD-SC/SCMCGU.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 
1SCMCGU ;ALB/JLU;General PCMM utilities;7/1/99 ; 3/29/00 12:34pm
2 ;;5.3;Scheduling;**195,177,212**;AUG 13, 1993
3 ;
4NEWPERSN(IEN,ARY) ;This function takes an internal value/DUZ of the
5 ;person you wish info on and performs a silent FM call to retrieve
6 ;the data. DBIA #10060
7 ;
8 ;INPUTS
9 ; IEN - the internal entry number of the user you want in
10 ; VA(200. (REQUIRED)
11 ; ARY - the closed array reference the data is to be returned in.
12 ; This must be a clean array. This API will not issue any
13 ; kills with this structure.(OPTIONAL)
14 ; If no array is entered ^TMP("PCMM_PERSON",$J,IEN) will be used.
15 ;
16 ;OUTPUTS
17 ; ARY(IEN)=Piece Structure below
18 ; 1 - User Name (EXTERNAL)
19 ; 2 - Office Phone number
20 ; 3 - Room
21 ; 4 - Service/Section (EXTERNAL)
22 ; 5 - Voice Pager number
23 ; 6 - Social Security number
24 ;
25 ;If successful 1 is return as the results of the function.
26 ;If not successfull 0^reason is returned.
27 ;
28 N STOP
29 S STOP=0
30 D PARCHK G:STOP MNQ
31 D GETDATA
32MNQ Q $S(STOP=0:1,1:0_U_$P(STOP,U,2))
33 ;
34PARCHK ;Checks the parameters that are passed in.
35 ;
36 I '+$G(IEN) S STOP="1^Bad pointer value to file 200"
37 I $G(ARY)']"" S ARY="^TMP(""PCMM_PERSON"",$J)"
38 Q
39 ;
40GETDATA ;Make the FM calls and formats the return array.
41 ;
42 N BLDERR
43 K ^TMP("SCMC_BLD_PERSON",$J)
44 D GETS^DIQ(200,IEN,".01;.132;.137;.141;29;9","EI","^TMP(""SCMC_BLD_PERSON"","_$J_")","BLDERR")
45 ;only reporting the first one
46 I $D(BLDERR) S STOP=1_U_BLDERR("DIERR",1,"TEXT",1) Q
47 S $P(@ARY@(IEN),U,1)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",.01,"E")
48 S $P(@ARY@(IEN),U,2)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",.132,"E")
49 S $P(@ARY@(IEN),U,3)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",.141,"E")
50 S $P(@ARY@(IEN),U,4)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",29,"E")
51 S $P(@ARY@(IEN),U,5)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",.137,"E")
52 S $P(@ARY@(IEN),U,6)=^TMP("SCMC_BLD_PERSON",$J,200,IEN_",",9,"E")
53 K ^TMP("SCMC_BLD_PERSON",$J)
54 Q
55 ;
56PDAT(SCPATCH,SCERROR) ;
57 ; alb/rpm Patch 212
58 ; This function is used to retrieve the PATCH install date when
59 ; passed the PATCH name. The PATCH install date is found in the
60 ; subfile #9.4901 field #.02.
61 ;
62 ; DBIA:#10048 indicates that Package(#9.4) file is open for read
63 ; only with FM.
64 ;
65 ; Input:
66 ; SCPATCH - Patch designation (i.e. SD*5.3*177)
67 ; SCERROR (optional) - Variable stores user named variable
68 ; to return error text. Passing ""
69 ; is treated the same as no parameter.
70 ;
71 ; Output:
72 ; Function value - Date patch installed on success, otherwise 0
73 ; on failure.
74 ; SCERROR - Variable stores error text explaining function
75 ; failure. Only output if user passes second
76 ; parameter to function and an error occurs.
77 ;
78 ; Validate input
79 I $L(SCPATCH,"*")'=3 D Q 0
80 . S:$G(SCERROR)]"" @SCERROR="Invalid input parameter"
81 ; Verify patch is loaded
82 I '$$PATCH^XPDUTL(SCPATCH) D Q 0
83 . S:$G(SCERROR)]"" @SCERROR="Patch "_SCPATCH_" not loaded"
84 ; Initialize locals
85 NEW SCDATE,SCFILE,SCI,SCERR,SCIEN,SCPAT
86 ; Search for Patch designation in #9.4 and subfiles (#9.49, #9.4901)
87 S SCIEN=""
88 F SCI=1:1:3 D Q:$D(SCERR)!'SCIEN(SCI)
89 . S SCFILE=$S(SCI=1:9.4,SCI=2:9.49,1:9.4901)
90 . S SCPAT=$P(SCPATCH,"*",SCI)
91 . S SCIEN(SCI)=$$FIND1^DIC(SCFILE,SCIEN,"MX",SCPAT,"","","SCERR")
92 . ; Check for alternate form of patch name (i.e. "176 SEQ #158")
93 . I SCI=3,'SCIEN(SCI) S SCPAT=SCPAT_" SEQ" D
94 . . S SCIEN(SCI)=$$FIND1^DIC(SCFILE,SCIEN,"M",SCPAT,"","","SCERR")
95 . Q:$D(SCERR)!'SCIEN(SCI)
96 . S SCIEN=$S(SCI<3:",",1:"")_SCIEN(SCI)_$S(SCI=1:",",1:"")_SCIEN
97 ; Check for search errors
98 I 'SCIEN(SCI) S:$G(SCERROR)]"" @SCERROR="Search failed" Q 0
99 I $D(SCERR) S:$G(SCERROR)]"" @SCERROR=$G(SCERR("DIERR",1,"TEXT",1)) Q 0
100 ;
101 ; Retrieve date
102 S SCDATE=$$GET1^DIQ(SCFILE,SCIEN,.02,"I","","SCERR")
103 I $D(SCERR) S:$G(SCERROR)]"" @SCERROR=$G(SCERR("DIERR",1,"TEXT",1)) Q 0
104 ;
105 D CLEAN^DILF
106 Q SCDATE
Note: See TracBrowser for help on using the repository browser.