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