Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: DGENUPA

DGENUPA.m

Go to the documentation of this file.
  1. DGENUPA ;ALB/CJM - API FOR UPLOAD AUDIT ; 04-APR-94
  1. ;;5.3;REGISTRATION;**147,1015**;08/13/93;Build 21
  1. ;
  1. STORE(AUDIT,ERROR) ;
  1. ;Description: Creates a new entry in the ENROLLMENT/ELIGIBILITY UPLOAD
  1. ;AUDIT file (#27.14).
  1. ;
  1. ;INPUT:
  1. ; AUDIT: an array containing the record to be stored. (pass by reference)
  1. ;Output:
  1. ; Function Value: the ien of the entry created, or 0 on failure
  1. ; ERROR: on failure, will return an error message (optional) (pass by reference)
  1. ;
  1. N DATA,ADD
  1. S ADD=$$CHECK(.AUDIT,.ERROR)
  1. I 'ADD G STEXIT
  1. S DATA(.01)=AUDIT("MSGID")
  1. S DATA(.02)=AUDIT("DATETIME")
  1. S DATA(.03)=AUDIT("DFN")
  1. S DATA(1)="AUDIT(""CHANGES"")"
  1. S ADD=$$ADD^DGENDBS(27.14,,.DATA,.ERROR)
  1. ;
  1. STEXIT ;
  1. Q +ADD
  1. ;
  1. CREATE(DFN,WHEN,MSGID,AUDIT) ;
  1. ;Description: Creates an array containing the AUDIT object. There are
  1. ;no changes initially in the AUDIT object.
  1. ;
  1. ;Input:
  1. ; DFN - ien of record in the PATIENT file
  1. ; WHEN - date & time when the upload occurred (uses current date/time if not provided)
  1. K AUDIT
  1. S AUDIT("DFN")=$G(DFN)
  1. I '$G(WHEN) S WHEN=$$NOW^XLFDT
  1. S AUDIT("DATETIME")=$G(WHEN)
  1. S AUDIT("MSGID")=$G(MSGID)
  1. D ADDCHNG(.AUDIT,">>No Change <<")
  1. S AUDIT("CHANGES")=0
  1. Q
  1. ;
  1. CHECK(AUDIT,ERROR) ;
  1. ;Description: checks the validity of the AUDIT object
  1. ;
  1. ;Input:
  1. ; AUDIT - an array containing the AUDIT object (pass by reference)
  1. ;
  1. ;Output:
  1. ; Function Value - 1 if valid, 0 otherwise
  1. ; ERROR - if not valid, returns an error message (optional) (pass by reference)
  1. ;
  1. N OK
  1. S OK=1
  1. I '$G(AUDIT("DFN")) S OK=0,ERROR="NO PATIENT"
  1. I OK,'$D(^DPT(AUDIT("DFN"))) S OK=0,ERROR="PATIENT NOT FOUND"
  1. I OK,'$D(AUDIT("DATETIME")) S OK=0,ERROR="DATE/TIME OF UPLOAD NOT SPECIFIED"
  1. I OK,'$D(AUDIT("MSGID")) S OK=0,ERROR="MESSAGE ID NOT SPECIFIED"
  1. Q OK
  1. ;
  1. ADDCHNG(AUDIT,LINE) ;
  1. ;Description: Adds one line to the record of changes from an upload.
  1. ;
  1. ;Input:
  1. ; AUDIT - an array containing the AUDIT object. (pass by reference)
  1. ; LINE - the line to be added
  1. ;
  1. ;Output:
  1. ; AUDIT - the updated array containing the AUDIT object (pass by reference)
  1. ;
  1. S AUDIT("CHANGES")=1+$G(AUDIT("CHANGES"))
  1. S AUDIT("CHANGES",AUDIT("CHANGES"))=$G(LINE)
  1. Q
  1. AUDITID(IEN) ;
  1. W "DT/TM UPLOADED: "_$P(^DGENA(27.14,IEN,0),"^",2)
  1. W " MSG ID: "_$P(^DGENA(27.14,IEN,0),"^",2)
  1. Q