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

BLRERRTR.m

Go to the documentation of this file.
BLRERRTR ; IHS/MSC/MKK - IHS Lab ERRor Trap Report ;   September 2, 2011
 ;;5.2;IHS LABORATORY;**1031**;NOV 01, 1997
 ;
EEP ; EP -- Ersatz Entry Point
 D EEP^BLRGMENU
 Q
 ;
PEP ; EP
EP ; EP 
 NEW BLRMMENU,BLRVERN
 ;
 D SETMENU
 ;
 ; Main Menu driver
 D MENUDRFM^BLRGMENU("RPMS Lab Module","Error Trap Report Routines")
 ;
 ; The temp global data are deleted to prevent reports being
 ; generated by "old" data.
 K ^TMP("BLRERRTR",$J)
 Q
 ;
SETMENU ; EP -- Main Menu
 S BLRVERN=$P($P($T(+1),";")," ")
 ;
 D ADDTMENU^BLRGMENU("COMPMENU^BLRERRTR","Compilation...")
 D ADDTMENU^BLRGMENU("REPTMENU^BLRERRTR","Reports...")
 ;
 Q
 ;
COMPMENU ; EP - Compilation Sub-Menu
 NEW BLRMMENU,BLRVERN,MENU3
 ;
 D CSETMENU
 ;
 ; Main Menu driver
 S MENU3=$$CJ^XLFSTR("Compilation of Data",IOM)
 D MENUDRFM^BLRGMENU("RPMS Lab Module","Error Trap Routines",MENU3)
 ;
 Q
 ;
CSETMENU ; EP
 S BLRVERN=$P($P($T(+1),";")," ")
 ;
 D ADDTMENU^BLRGMENU("COMPILE^BLRERRTR","Compile ALL Errors For Reports")
 D ADDTMENU^BLRGMENU("COMPDATE^BLRERRTR","Compile Date Range Errors For Reports")
 Q
 ;
REPTMENU ; EP - Reports Sub-Menu
 NEW BLRMMENU,BLRVERN,MENU3
 ;
 D RSETMENU
 ;
 ; Main Menu driver
 S MENU3=$$CJ^XLFSTR("Reports",IOM)
 D MENUDRFM^BLRGMENU("RPMS Lab Module","Error Trap Routines",MENU3)
 ;
 Q
 ;
RSETMENU ; EP
 S BLRVERN=$P($P($T(+1),";")," ")
 ;
 D ADDTMENU^BLRGMENU("DETAILED^BLRERRTR","Date/Time Errors Report")
 D ADDTMENU^BLRGMENU("NODATES^BLRERRTR","Non Date Specific Errors Report")
 D ADDTMENU^BLRGMENU("LABDET^BLRERRTR","Lab Only Date/Time Errors Report")
 D ADDTMENU^BLRGMENU("LNODATES^BLRERRTR","Lab Only Non Date Specific Errors Report")
 Q
 ;
COMPILE ; EP - Compilation of data
 NEW ERROR,ERRDATE,ERRDNUM,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,PKGIEN,PKGNAME,ROUTINE,STR
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 D INITVARS
 ;
 D HEADERDT^BLRGMENU
 W !,?4
 ;
 K ^TMP("BLRERRTR",$J)
 ;
 F  S HDT=$O(^%ZTER(1,HDT))  Q:HDT<1  D
 . S:$G(^TMP("BLRERRTR",$J,-1))="" ^TMP("BLRERRTR",$J,-1)=HDT
 . S ^TMP("BLRERRTR",$J,-2)=HDT
 . D STORERRS
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
INITVARS ; EP - Initialize variables
 S (HDT,ERRDNUM)=0
 S HEADER(1)="Error Trap Report"
 S HEADER(2)="Compilation"
 ;
 Q
 ;
STORERRS ; EP - Store Errors into ^TMP global
 S ERRDNUM=0
 F  S ERRDNUM=$O(^%ZTER(1,HDT,1,ERRDNUM))  Q:ERRDNUM<1  D
 . S STR=$P($G(^%ZTER(1,HDT,1,ERRDNUM,"ZE"))," ")
 . W "."  W:$X>74 !,?4
 . Q:$L(STR)<1
 . ;
 . S ERROR=$P(STR,">")_">"
 . S STR=$P(STR,">",2)              ; Reset STR to make it more manageable
 . S LINETAG=$P(STR,"^")
 . S:$L(LINETAG)<1 LINETAG="<NO LINETAG>"
 . S ROUTINE=$$TRIM^XLFSTR($P(STR,"^",2),"LR"," ")
 . S:$L(ROUTINE)<1 ROUTINE="<UNK>"
 . ;
 . ; Get Package Name
 . S PACKAGE=$$TRIM^XLFSTR($P($G(^ROUTINE(ROUTINE,0,2)),";",4),"LR"," ")
 . I $L(PACKAGE)>0,$L(PACKAGE)<4 D
 .. Q:ROUTINE["UNK"
 .. S PKGIEN=+$O(^DIC(9.4,"C",PACKAGE,0))
 .. I PKGIEN>0 S PKGNAME=$P($G(^DIC(9.4,PKGIEN,0)),"^")
 .. S:$L(PKGNAME) PACKAGE=PKGNAME
 . S:$L(PACKAGE)<1 PACKAGE="<NO PACKAGE>"
 . ;
 . ; Store data
 . S ^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE)=1+$G(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))
 . S ^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE)=1+$G(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))
 . ;
 . ; Store Lab data
 . I $E(ROUTINE,1,2)="LR"!($E(ROUTINE,1,2)="LA")!($E(ROUTINE,1,3)="BLR") D
 .. S ^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE)=1+$G(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))
 .. S ^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE)=1+$G(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))
 Q
 ;
COMPDATE ; EP - Compilation of data
 NEW ERROR,ERRDATE,ERRDNUM,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,ROUTINE,STR
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 Q:$$DRINITVS()="Q"
 ;
 D HEADERDT^BLRGMENU
 W !,?4
 ;
 S HDT=LRSDT-1
 F  S HDT=$O(^%ZTER(1,HDT))  Q:HDT<1!(HDT>LRLDT)  D
 . D STORERRS
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
DRINITVS() ; EP - Initialize variables
 S (HDT,ERRDNUM)=0
 S HEADER(1)="Error Trap Report"
 S HEADER(2)="Compilation"
 ;
 D HEADERDT^BLRGMENU
 D B^LRU
 ;
 I +$G(LRSDT)<1!(+$G(LRLDT)<1) D  Q "Q"
 . W !,?4,"Invalid/No Date Range Entered.  Compilation Ends.",!
 . D PRESSKEY^BLRGMENU(9)
 ;
 S HEADER(3)=$$CJ^XLFSTR("Date Range:"_$$FMTE^XLFDT(LRSDT,"2Z")_" thru "_$$FMTE^XLFDT(LRLDT,"2Z"),IOM)
 ;
 S LRSDT=$P($$FMTH^XLFDT(LRSDT),",")
 S LRLDT=$P($$FMTH^XLFDT(LRLDT),",")
 ;
 K ^TMP("BLRERRTR",$J)
 S ^TMP("BLRERRTR",$J,-1)=LRSDT
 S ^TMP("BLRERRTR",$J,-2)=LRLDT
 ;
 Q "OK"
 ;
DETAILED ; EP - Report
 NEW ERROR,ERRDATE,ERRDNUM,ERRTOT,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,ROUTINE,STR,TOTAL
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 Q:$$ISDATA()="Q"
 ;
 D DETVINIT
 ;
 F  S HDT=$O(^TMP("BLRERRTR",$J,"DETAILED",HDT),-1)  Q:HDT<1!(QFLG="Q")  D
 . F  S PACKAGE=$O(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE))  Q:PACKAGE=""!(QFLG="Q")  D
 .. F  S ERROR=$O(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR))  Q:ERROR=""!(QFLG="Q")  D
 ... F  S LINETAG=$O(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR,LINETAG))  Q:LINETAG=""!(QFLG="Q")  D
 .... F  S ROUTINE=$O(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))  Q:ROUTINE=""!(QFLG="Q")  D
 ..... D DETLINER
 ;
 W:QFLG'="Q" !!,?10,"Total Number of Errors = ",TOTAL,!!
 ;
 D ^%ZISC
 ;
 Q:QFLG="Q"
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
ISDATA() ; EP - Report Data Exists
 I $D(^TMP("BLRERRTR",$J))>0 Q "OK"
 ;
 W !,?4,"No Data Exists.  Need to compile first."
 D PRESSKEY^BLRGMENU(9)
 Q "Q"
 ;
DETVINIT ; EP - Report Variables Initialization
 NEW BEGDT,ENDDT
 ;
 K HEADER
 S HEADER(1)="Error Trap Report"
 ;
 S BEGDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-1)),"5DZ")
 S ENDDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-2)),"5DZ")
 ;
 S HEADER(2)="Date Range: "_BEGDT_" thru "_ENDDT
 ;
 D OPENIO
 ;
 S HEADER(3)=" "
 S $E(HEADER(4),68)="Error"
 S $E(HEADER(4),78)="#"
 S HEADER(5)="Package"
 S $E(HEADER(5),30)="Routine"
 S $E(HEADER(5),40)="Error"
 S $E(HEADER(5),55)="Line Tag"
 S $E(HEADER(5),68)="Date"
 S $E(HEADER(5),77)="Errs"
 ;
 S (HDT,PACKAGE,HDT,ERROR,LINETAG,ROUTINE)=""
 Q
 ;
DETLINER ; EP - Output line of data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HD1)  Q:QFLG="Q"
 ;
 S ERRTOT=$G(^TMP("BLRERRTR",$J,"DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))
 S TOTAL=TOTAL+ERRTOT
 ;
 W $E($$TRIM^XLFSTR(PACKAGE,"LR"," "),1,27)
 W ?29,$E(ROUTINE,1,8)
 W ?39,$E(ERROR,1,13)
 W ?54,$E(LINETAG,1,11)
 W ?67,$$HTE^XLFDT(HDT,"2DZ")
 W ?77,$J(ERRTOT,3)
 W !
 S LINES=LINES+1
 Q
 ;
OPENIO ; EP
 D HEADERDT^BLRGMENU
 D HEADONE(.HD1)
 W !
 ;
 D ^%ZIS
 U IO
 ;
 S MAXLINES=IOSL-4
 S LINES=MAXLINES+10
 S QFLG="NO"
 S (HDT,PG,TOTAL)=0
 S (PACKAGE,ERROR,LINETAG,ROUTINE)=""
 ;
 Q
 ;
HEADONE(HD1) ; EP -- Asks if user wants only 1 header line
 D ^XBFMK
 S DIR("A")="One Header Line ONLY"
 S DIR("B")="NO"
 S DIR(0)="YO"
 D ^DIR
 S HD1=$S(+$G(Y)=1:"YES",1:"NO")
 Q
 ;
NODATES ; EP - No Date Report
 NEW ERROR,ERRDATE,ERRDNUM,ERRTOT,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,ROUTINE,STR,TOTAL
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 Q:$$ISDATA()="Q"
 ;
 D NODVINIT
 ;
 F  S PACKAGE=$O(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE))  Q:PACKAGE=""!(QFLG="Q")  D
 . F  S ERROR=$O(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR))  Q:ERROR=""!(QFLG="Q")  D
 .. F  S LINETAG=$O(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR,LINETAG))  Q:LINETAG=""!(QFLG="Q")  D
 ... F  S ROUTINE=$O(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))  Q:ROUTINE=""!(QFLG="Q")  D
 .... D NODLINER
 ;
 W:QFLG'="Q" !!,?10,"Total Number of Errors = ",TOTAL,!!
 ;
 D ^%ZISC
 ;
 Q:QFLG="Q"
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
NODVINIT ; EP - Report Variables Initialization
 NEW BEGDT,ENDDT
 ;
 K HEADER
 S HEADER(1)="Error Trap Report"
 ;
 S BEGDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-1)),"5DZ")
 S ENDDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-2)),"5DZ")
 ;
 S HEADER(2)="Date Range: "_BEGDT_" thru "_ENDDT
 ;
 D OPENIO
 ;
 S HEADER(3)=" "
 S HEADER(4)="Package"
 S $E(HEADER(4),30)="Routine"
 S $E(HEADER(4),40)="Error"
 S $E(HEADER(4),55)="Line Tag"
 S $E(HEADER(4),75)="# Errs"
 ;
 Q
 ;
NODLINER ; EP - Output line of data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HD1)  Q:QFLG="Q"
 ;
 S ERRTOT=$G(^TMP("BLRERRTR",$J,"NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))
 S TOTAL=TOTAL+ERRTOT
 ;
 W $E($$TRIM^XLFSTR(PACKAGE,"LR"," "),1,28)
 W ?29,ROUTINE
 W ?39,ERROR
 W ?54,LINETAG
 W ?74,$J(ERRTOT,6)
 W !
 S LINES=LINES+1
 Q
 ;
LABDET ; EP - Lab Only Detailed Report
 NEW ERROR,ERRDATE,ERRDNUM,ERRTOT,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,ROUTINE,STR,TOTAL
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 Q:$$ISDATA()="Q"
 ;
 D LDETVINI
 ;
 F  S HDT=$O(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT),-1)  Q:HDT<1!(QFLG="Q")  D
 . F  S PACKAGE=$O(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE))  Q:PACKAGE=""!(QFLG="Q")  D
 .. F  S ERROR=$O(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR))  Q:ERROR=""!(QFLG="Q")  D
 ... F  S LINETAG=$O(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR,LINETAG))  Q:LINETAG=""!(QFLG="Q")  D
 .... F  S ROUTINE=$O(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))  Q:ROUTINE=""!(QFLG="Q")  D
 ..... D LDETLINR
 ;
 W:QFLG'="Q" !!,?10,"Total Number of Errors = ",TOTAL,!!
 ;
 D ^%ZISC
 ;
 Q:QFLG="Q"
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
LDETVINI ; EP - Lab Only - Detailed Report Variables Initialization
 NEW BEGDT,ENDDT
 ;
 K HEADER
 S HEADER(1)="Error Trap Report"
 ;
 S BEGDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-1)),"5DZ")
 S ENDDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-2)),"5DZ")
 ;
 S HEADER(2)="Date Range: "_BEGDT_" thru "_ENDDT
 S HEADER(3)=$$CJ^XLFSTR("LAB ONLY Errors",IOM)
 ;
 D OPENIO
 ;
 S $E(HEADER(4),68)="Error"
 S $E(HEADER(4),78)="#"
 S HEADER(5)="Package"
 S $E(HEADER(5),30)="Routine"
 S $E(HEADER(5),40)="Error"
 S $E(HEADER(5),55)="Line Tag"
 S $E(HEADER(5),68)="Date"
 S $E(HEADER(5),77)="Errs"
 ;
 S (HDT,PACKAGE,HDT,ERROR,LINETAG,ROUTINE)=""
 Q
 ;
LDETLINR ; EP - Lab only - Output line of data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HD1)  Q:QFLG="Q"
 ;
 S ERRTOT=$G(^TMP("BLRERRTR",$J,"LAB","DETAILED",HDT,PACKAGE,ERROR,LINETAG,ROUTINE))
 S TOTAL=TOTAL+ERRTOT
 ;
 W $E($$TRIM^XLFSTR(PACKAGE,"LR"," "),1,27)
 W ?29,ROUTINE
 W ?39,ERROR
 W ?54,LINETAG
 W ?67,$$HTE^XLFDT(HDT,"2DZ")
 W ?77,$J(ERRTOT,3)
 W !
 S LINES=LINES+1
 Q
 ;
LNODATES ; EP - Lab Only - No Date Report
 NEW ERROR,ERRDATE,ERRDNUM,ERRTOT,HDT,LINETAG,LRLDT,LRSDT,PACKAGE,ROUTINE,STR,TOTAL
 NEW HD1,HEADER,LINES,MAXLINES,PG,QFLG
 ;
 Q:$$ISDATA()="Q"
 ;
 D LNODVINI
 ;
 F  S PACKAGE=$O(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE))  Q:PACKAGE=""!(QFLG="Q")  D
 . F  S ERROR=$O(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR))  Q:ERROR=""!(QFLG="Q")  D
 .. F  S LINETAG=$O(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR,LINETAG))  Q:LINETAG=""!(QFLG="Q")  D
 ... F  S ROUTINE=$O(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))  Q:ROUTINE=""!(QFLG="Q")  D
 .... D LNODLINR
 ;
 W:QFLG'="Q" !!,?10,"Total Number of Errors = ",TOTAL,!!
 ;
 D ^%ZISC
 ;
 Q:QFLG="Q"
 ;
 D PRESSKEY^BLRGMENU(4)
 Q
 ;
LNODVINI ; EP - Lab Only - No Date - Report Variables Initialization
 NEW BEGDT,ENDDT
 ;
 K HEADER
 S HEADER(1)="Error Trap Report"
 ;
 S BEGDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-1)),"5DZ")
 S ENDDT=$$HTE^XLFDT($G(^TMP("BLRERRTR",$J,-2)),"5DZ")
 ;
 S HEADER(2)="Date Range: "_BEGDT_" thru "_ENDDT
 S HEADER(3)=$$CJ^XLFSTR("LAB ONLY",IOM)
 S HEADER(4)=" "
 ;
 D HEADERDT^BLRGMENU
 D HEADONE(.HD1)
 ;
 S HEADER(5)="Package"
 S $E(HEADER(5),30)="Routine"
 S $E(HEADER(5),40)="Error"
 S $E(HEADER(5),55)="Line Tag"
 S $E(HEADER(5),75)="# Errs"
 ;
 D ^%ZIS
 U IO
 S MAXLINES=IOSL-4
 S LINES=MAXLINES+10
 S QFLG="NO"
 ;
 S (HDT,PG,TOTAL)=0
 S (PACKAGE,ERROR,LINETAG,ROUTINE)=""
 Q
 ;
LNODLINR ; EP - Output line of data
 I LINES>MAXLINES D HEADERPG^BLRGMENU(.PG,.QFLG,HD1)  Q:QFLG="Q"
 ;
 S ERRTOT=$G(^TMP("BLRERRTR",$J,"LAB","NODETAIL",PACKAGE,ERROR,LINETAG,ROUTINE))
 S TOTAL=TOTAL+ERRTOT
 ;
 W $E($$TRIM^XLFSTR(PACKAGE,"LR"," "),1,28)
 W ?29,ROUTINE
 W ?39,ERROR
 W ?54,LINETAG
 W ?74,$J(ERRTOT,6)
 W !
 S LINES=LINES+1
 Q