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

ECUNTRPT.m

Go to the documentation of this file.
  1. ECUNTRPT ;ALB/DHE DSS Units Errors Report ;3/7/18 15:25
  1. ;;2.0;EVENT CAPTURE;**107,119,139**;8 May 96;Build 7
  1. ;
  1. ;This report displays DSS Units with any Associated Stop Codes
  1. ;with any errors or warnings.
  1. ;
  1. ;Routine entry point, START if from roll and scroll, EN if
  1. ;from GUI
  1. ;
  1. ;need to set up output device and taskman
  1. START ;
  1. W @IOF,!!,"This option displays DSS Units with Associated Stop Code Errors.",!!
  1. S %ZIS="QM" D ^%ZIS G EXIT:POP
  1. I $D(IO("Q")) D Q
  1. . N ZTRTN,ZTDESC
  1. . S ZTRTN="EN^ECUNTRPT",ZTDESC="DSS Units with Assoc Stop Codes"
  1. . D ^%ZTLOAD D HOME^%ZIS K IO("Q") Q
  1. U IO
  1. EN ;
  1. N I,CNTR,DATE,ECERR,ECNAME,ECOUT,ECRDT,ECSTOP,ECSTOP1,ERR,INACT,LN
  1. N PG,RTYPE,STR,UNITNM,UNT,CNT ;119
  1. ;
  1. S %H=$H,ECRDT=$$HTE^XLFDT(%H,"5M"),ECOUT=0
  1. S CNTR=0,PG=1,UNT=0,$P(LN,"-",80)=""
  1. I $G(ECPTYP)'="E" D HEAD ;119
  1. I $G(ECPTYP)="E" S CNT=1,^TMP($J,"ECRPT",CNT)="DSS UNIT #^DSS UNIT NAME^STOP CODE^STOP CODE NAME^ERROR #1^ERROR #2^ERROR #3" ;119
  1. F S UNT=$O(^ECD(UNT)) Q:'UNT D I ECOUT Q
  1. .Q:'$D(^ECD(UNT,0))
  1. .;check to see if unit is inactive
  1. .I $P(^ECD(UNT,0),"^",6)=1 Q
  1. .;get associated stop code
  1. .S ECSTOP=$P(^ECD(UNT,0),"^",10) Q:$G(ECSTOP)=0!(ECSTOP="")
  1. .;
  1. .S UNITNM=$P($G(^ECD(UNT,0)),U),ERR=0
  1. .S STR=$G(^DIC(40.7,ECSTOP,0))
  1. .I $G(STR)="" S ERR=ERR+1,ECERR(ERR)="CODE DOES NOT EXIST IN FILE 40.7",ECNAME="" Q
  1. .S ECNAME=$P(STR,U),ECSTOP1=$P(STR,U,2),INACT=$P(STR,U,3),RTYPE=$P(STR,U,6)
  1. .I $L(ECSTOP1)'=3 S ERR=ERR+1,ECERR(ERR)="CODE MUST BE 3 DIGITS"
  1. .I $G(INACT),((DT>INACT)!(DT=INACT)) S ERR=ERR+1,ECERR(ERR)="INACTIVE CODE"
  1. .I (RTYPE'=("P"))&(RTYPE'=("E")) S ERR=ERR+1,ECERR(ERR)="SECONDARY CODE"
  1. .I $P(^ECD(UNT,0),U,14)="OOS" D ;139
  1. ..I '$$EX^SDCOU2(ECSTOP,DT) S ERR=ERR+1,ECERR(ERR)="INVALID OR INACTIVE STOP CODE ASSOCIATED WITH AN OOS DSS UNIT" ;139
  1. .I $G(ECPTYP)'="E" I ($Y+4)>IOSL D PAGE Q:ECOUT D HEAD ;119
  1. .;if errors, loop through array, write, then kill
  1. .I ERR D S ERR=0 K ECERR
  1. ..I $G(ECPTYP)="E" D EXPORT Q ;119
  1. ..W !!,"DSS Unit: ",?12,UNT,?19,UNITNM
  1. ..W !,"Stop Code: ",?12,ECSTOP1,?19,ECNAME
  1. ..F I=1:1:ERR W !,"Reason: ",ECERR(I) ;119
  1. Q
  1. EXIT ;
  1. K POP,QUIT,ZTQUEUED
  1. Q
  1. ;
  1. W:$E(IOST,1,2)="C-"!(PG>1) @IOF
  1. W !!,"DSS UNITS WITH ANY ASSOCIATED STOP CODE ERRORS"
  1. W !,"Page: ",PG,?53,"Run Date: ",ECRDT,!,LN
  1. S PG=PG+1
  1. Q
  1. PAGE ;
  1. N SS,JJ
  1. I $D(PG),$E(IOST,1,2)="C-" D
  1. .S SS=22-$Y F JJ=1:1:22 W !
  1. .S DIR(0)="E" W ! D ^DIR K DIR I 'Y S ECOUT=1
  1. Q
  1. ;
  1. STRTGUI ; if called from GUI, enter routine here
  1. D EN
  1. Q
  1. ;
  1. EXPORT ;Section added in 119, puts data in exportable format
  1. N I
  1. S CNT=CNT+1,^TMP($J,"ECRPT",CNT)=UNT_U_UNITNM_U_ECSTOP1_U_ECNAME
  1. F I=1:1:ERR S ^TMP($J,"ECRPT",CNT)=^TMP($J,"ECRPT",CNT)_U_ECERR(I)
  1. Q