source: FOIAVistA/trunk/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGENUPA.m@ 1528

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

initial load of FOIAVistA 6/30/08 version

File size: 2.2 KB
Line 
1DGENUPA ;ALB/CJM - API FOR UPLOAD AUDIT ; 04-APR-94
2 ;;5.3;REGISTRATION;**147**;08/13/93
3 ;
4STORE(AUDIT,ERROR) ;
5 ;Description: Creates a new entry in the ENROLLMENT/ELIGIBILITY UPLOAD
6 ;AUDIT file (#27.14).
7 ;
8 ;INPUT:
9 ; AUDIT: an array containing the record to be stored. (pass by reference)
10 ;Output:
11 ; Function Value: the ien of the entry created, or 0 on failure
12 ; ERROR: on failure, will return an error message (optional) (pass by reference)
13 ;
14 N DATA,ADD
15 S ADD=$$CHECK(.AUDIT,.ERROR)
16 I 'ADD G STEXIT
17 S DATA(.01)=AUDIT("MSGID")
18 S DATA(.02)=AUDIT("DATETIME")
19 S DATA(.03)=AUDIT("DFN")
20 S DATA(1)="AUDIT(""CHANGES"")"
21 S ADD=$$ADD^DGENDBS(27.14,,.DATA,.ERROR)
22 ;
23STEXIT ;
24 Q +ADD
25 ;
26CREATE(DFN,WHEN,MSGID,AUDIT) ;
27 ;Description: Creates an array containing the AUDIT object. There are
28 ;no changes initially in the AUDIT object.
29 ;
30 ;Input:
31 ; DFN - ien of record in the PATIENT file
32 ; WHEN - date & time when the upload occurred (uses current date/time if not provided)
33 K AUDIT
34 S AUDIT("DFN")=$G(DFN)
35 I '$G(WHEN) S WHEN=$$NOW^XLFDT
36 S AUDIT("DATETIME")=$G(WHEN)
37 S AUDIT("MSGID")=$G(MSGID)
38 D ADDCHNG(.AUDIT,">>No Change <<")
39 S AUDIT("CHANGES")=0
40 Q
41 ;
42CHECK(AUDIT,ERROR) ;
43 ;Description: checks the validity of the AUDIT object
44 ;
45 ;Input:
46 ; AUDIT - an array containing the AUDIT object (pass by reference)
47 ;
48 ;Output:
49 ; Function Value - 1 if valid, 0 otherwise
50 ; ERROR - if not valid, returns an error message (optional) (pass by reference)
51 ;
52 N OK
53 S OK=1
54 I '$G(AUDIT("DFN")) S OK=0,ERROR="NO PATIENT"
55 I OK,'$D(^DPT(AUDIT("DFN"))) S OK=0,ERROR="PATIENT NOT FOUND"
56 I OK,'$D(AUDIT("DATETIME")) S OK=0,ERROR="DATE/TIME OF UPLOAD NOT SPECIFIED"
57 I OK,'$D(AUDIT("MSGID")) S OK=0,ERROR="MESSAGE ID NOT SPECIFIED"
58 Q OK
59 ;
60ADDCHNG(AUDIT,LINE) ;
61 ;Description: Adds one line to the record of changes from an upload.
62 ;
63 ;Input:
64 ; AUDIT - an array containing the AUDIT object. (pass by reference)
65 ; LINE - the line to be added
66 ;
67 ;Output:
68 ; AUDIT - the updated array containing the AUDIT object (pass by reference)
69 ;
70 S AUDIT("CHANGES")=1+$G(AUDIT("CHANGES"))
71 S AUDIT("CHANGES",AUDIT("CHANGES"))=$G(LINE)
72 Q
73AUDITID(IEN) ;
74 W "DT/TM UPLOADED: "_$P(^DGENA(27.14,IEN,0),"^",2)
75 W " MSG ID: "_$P(^DGENA(27.14,IEN,0),"^",2)
76 Q
Note: See TracBrowser for help on using the repository browser.