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

PSODEARL.m

Go to the documentation of this file.
PSODEARL ;FO-OAKAND/REM - EPCS Logical Access Control Audit Rpt; [5/7/02 5:53am] ;12/2/21  11:00
 ;;7.0;OUTPATIENT PHARMACY;**545**;DEC 1997;Build 270
 ;External reference to DEA NUMBERS file (#8991.9) is supported by DBIA 7002
 ;External reference to XUEPCS DATA file (#8991.6) is supported by DBIA 7015
 ;External reference to XUEPCS PSDRPH AUDIT file (#8991.7) is supported by DBIA 7016
 ;External reference to KEYS sub-file (#200.051) is supported by DBIA 7054
 ;
 Q
GUI ; EPCS Entry point
 N AUDDATA,AUDDATE,AUDIEN,DEA,EPCSDUZ,EPCSSITE,EPCSDIV,AUDSITE,DIV
 S AUDDATA=$NA(^TMP($J,"EPCSAUDITDATA")) K @AUDDATA
 S DIV("ALL")="all divisions"
 ; Get the Audit data and build the ^TMP global
 S AUDDATE=EPCSSD F  S AUDDATE=$O(^DIA(100.7,"C",AUDDATE)) Q:AUDDATE=""!(AUDDATE>EPCSED)  D
 .S AUDIEN=0 F  S AUDIEN=$O(^DIA(100.7,"C",AUDDATE,AUDIEN)) Q:AUDIEN=""  D
 ..N AUDNAME,AUDACT,AUDTEXT,AUDFIELD,AUDOUT,AUDCOUNT,ORITM
 ..S AUDFIELD=$P($G(^DIA(100.7,AUDIEN,0)),U,3)
 ..S AUDNAME=$P($G(^DIA(100.7,AUDIEN,3.1)),U)
 ..S:$G(AUDNAME)="" AUDNAME=$P($G(^DIA(100.7,AUDIEN,2.1)),U)
 ..;S:AUDFIELD="1,.01" EPCSDIV=$$HASDIV^ORUTL(AUDNAME,.DIV) Q:EPCSDIV=""
 ..I AUDFIELD="1,.01" D  Q:EPCSDIV=""
 ...S EPCSDIV=$$HASDIV^ORUTL(AUDNAME,.DIV)
 ..I $D(^DIA(100.7,AUDIEN,2.1))=1 D
 ...I '$D(^DIA(100.7,AUDIEN,3.1)) S AUDACT="Disabled",AUDNAME(1)=$G(^DIA(100.7,AUDIEN,2))
 ...I $D(^DIA(100.7,AUDIEN,3.1))=1 D
 ....I AUDFIELD=.02 S AUDACT=$S($G(^DIA(100.7,AUDIEN,2))="YES":"Disabled",1:"Enabled")
 ....E  S AUDACT="Modified"
 ....S AUDNAME(1)=$G(^DIA(100.7,AUDIEN,3))
 ..I '$D(^DIA(100.7,AUDIEN,2.1)) D
 ...I $D(^DIA(100.7,AUDIEN,3.1))=1 S AUDACT="Enabled",AUDNAME(1)=$G(^DIA(100.7,AUDIEN,3))
 ..I AUDFIELD=.01 S $P(@AUDDATA@("TOP",$P($G(^DIA(100.7,AUDIEN,0)),U)),U,3)=AUDNAME(1) Q
 ..S AUDNAME("USER")=$$GET1^DIQ(200,$P($G(^DIA(100.7,AUDIEN,0)),U,4)_",",.01)
 ..S:AUDNAME("USER")="" AUDNAME("USER")="User #"_$P($G(^DIA(100.7,AUDIEN,0)),U,4)
 ..S AUDTEXT=AUDACT_" on "_$$FMTE^XLFDT(AUDDATE)_" by "_AUDNAME("USER")
 ..I $P($G(^DIA(100.7,AUDIEN,4.1)),U)'="" D
 ...S AUDTEXT=AUDTEXT_" with option "_$$GET1^DIQ(19,$P($G(^DIA(100.7,AUDIEN,4.1)),U)_",",.01)
 ..I AUDFIELD=.02,AUDACT="Modified" D
 ...S AUDTEXT=AUDTEXT_" from "_$G(^DIA(100.7,AUDIEN,2))_" to "_AUDNAME(1)_"."
 ..I AUDFIELD="1,.01" S AUDOUT=$NA(@AUDDATA@(EPCSDIV,AUDNAME,AUDIEN))
 ..E  S AUDOUT=$NA(@AUDDATA@("TOP",$P($G(^DIA(100.7,AUDIEN,0)),U),AUDIEN))
 ..S ORITM=1+$P($G(@($P(AUDOUT,","_AUDIEN_")")_")")),U,2)
 ..S AUDTEXT=$$PAD^ORUTL(ORITM,3)_ORITM_": "_AUDTEXT
 ..D WRAP^ORUTL(AUDTEXT,AUDOUT)
 ..S AUDCOUNT=@AUDOUT
 ..S AUDOUT=$P(AUDOUT,","_AUDIEN_")")_")"
 ..S $P(@AUDOUT,U)=AUDCOUNT+$G(@AUDOUT)
 ..S $P(@AUDOUT,U,2)=1+$P($G(@AUDOUT),U,2)
 ..S:AUDFIELD'=.02 $P(@AUDOUT,U,3)=AUDNAME(1)
 ; Loop through the OE/RR EPCS PARAMETERS file (#100.7), but print from the ^TMP global 
 D HEADER
 S AUDSITE(1)=$O(^ORD(100.7,0)),AUDSITE=$$GET1^DIQ(100.7,AUDSITE(1)_",",.01)
 S:AUDSITE="" AUDSITE=$P(@AUDDATA@("TOP",AUDSITE(1)),U,3)
 W "SITE: "_AUDSITE
 S AUDIEN=0 F  S AUDIEN=$O(@AUDDATA@("TOP",AUDSITE(1),AUDIEN)) Q:AUDIEN=""  D
 .N DETLINE
 .S DETLINE=0 F  S DETLINE=$O(@AUDDATA@("TOP",AUDSITE(1),AUDIEN,DETLINE)) Q:DETLINE=""  D
 ..W !,@AUDDATA@("TOP",AUDSITE(1),AUDIEN,DETLINE)
 S EPCSDIV="" F  S EPCSDIV=$O(@AUDDATA@(EPCSDIV)) Q:EPCSDIV=""  D
 .Q:EPCSDIV="TOP"
 .W !!,"DIVISION: "_EPCSDIV
 .S EPCSDUZ=0 F  S EPCSDUZ=$O(@AUDDATA@(EPCSDIV,EPCSDUZ)) Q:EPCSDUZ=""  D
 ..N EPCSIEN,EPCSUSER
 ..S EPCSUSER=$$GET1^DIQ(200,EPCSDUZ_",",.01)
 ..S:EPCSUSER="" EPCSUSER=$P(@AUDDATA@(EPCSDIV,EPCSDUZ),U,3)
 ..W !,"USER: "_EPCSUSER
 ..S EPCSIEN=0 F  S EPCSIEN=$O(@AUDDATA@(EPCSDIV,EPCSDUZ,EPCSIEN)) Q:EPCSIEN=""  D
 ...N EPCSLINE
 ...S EPCSLINE=0 F  S EPCSLINE=$O(@AUDDATA@(EPCSDIV,EPCSDUZ,EPCSIEN,EPCSLINE)) Q:EPCSLINE=""  D
 ....W !,@AUDDATA@(EPCSDIV,EPCSDUZ,EPCSIEN,EPCSLINE)
 K @AUDDATA
 S:$D(ZTQUEUED) ZTREQ="@"
 Q
 N NOW
 S NOW=$$UP^XLFSTR($$HTE^XLFDT($H)),NOW=$P(NOW,"@",1)_"  "_$P($P(NOW,"@",2),":",1,2)
 W "LOGICAL ACCESS CONTROL AUDIT REPORT",?47,NOW_"   PAGE 1",!
 Q