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

AGMPHLU2.m

Go to the documentation of this file.
AGMPHLU2 ; IHS/SD/TPF - MPI HLO UTILITIES ; 12/15/2007
 ;;7.2;IHS PATIENT REGISTRATION;**1,6**;JAN 07, 2011;Build 23
 Q
MSGSTAT ;UNSUCCESSFUL STATUS REPORT
 N MSGIEN,STATUS,STATTYP,CLEAR,EESC,TOTMSG,MSGDATE,TOTCLEAR,DATES
ASKFROM ;EP
 K DIR
 S DIR(0)="DO^::E"
 S DIR("A")="Enter from Date"
 S DIR("B")="T"
 D ^DIR
 Q:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="")
 S FROM=Y
ASKTO ;EP
 K DIR
 S DIR(0)="DO^::E"
 S DIR("A")="Enter to Date"
 S DIR("B")="T"
 D ^DIR
 G:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="") ASKFROM
 S TO=Y_".999999"
 I FROM>TO D  G ASKFROM
 .W !!,"FROM DATE CAN NOT BE GREATER THAN TO DATE!!" H 2
ASKCLEAR ;EP
 K DIR
 S DIR(0)="YO"
 S DIR("A")="Do you wish to set unsuccessful statuses to successful"
 S DIR("B")="N"
 D ^DIR
 G:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="") ASKTO
 S CLEAR=Y
REPEAT ;EP -
 S TYPEEVNT="" F  S TYPEEVNT=$O(TYPEEVNT(TYPEEVNT)) Q:TYPEEVNT=""  S TYPEEVNT(TYPEEVNT)=0
 S ESC=0
 D NOW^%DTC S Y=% X ^DD("DD") S PRTDATE=Y
 K DATES
 S $P(DASH,"-",81)=""
 S PAGE=1
 S (TOTMSG,TOTCLEAR)=0
 S MSGDATE=FROM-.01
 F  S MSGDATE=$O(^HLA("B",MSGDATE)) Q:MSGDATE=""!(ESC)  D
 .Q:+MSGDATE>TO!(+MSGDATE<FROM)
 .S REC=""
 .F  S REC=$O(^HLA("B",MSGDATE,REC)) Q:REC=""  D
 ..S LINK=$P($G(^HLB(REC,0)),U,5)
 ..Q:LINK'="MPI"
 ..S STATUS=$P($G(^HLB(REC,0)),U,20)
 ..Q:STATUS="SU"
 ..S DIREC=$P($G(^HLB(REC,0)),U,4)
 ..;Q:DIREC'="I"  ;ONLY CARE ABOUT INcoming
 ..S TOTMSG=TOTMSG+1
 ..S DATES=$P(MSGDATE,".")
 ..S DATES(DATES)=$G(DATES(DATES))+1
 ..I CLEAR S $P(^HLB(REC,0),U,20)="SU" S TOTCLEAR=TOTCLEAR+1 Q
 ..S MSGBOD=$P($P($G(^HLB(REC,0)),U)," ",2)
 ..S MSGTYPE=$P($G(^HLA(MSGBOD,0)),U,3)
 ..S EVENT=$P($G(^HLA(MSGBOD,0)),U,4)
 ..S TYPEEVNT=EVENT_U_MSGTYPE
 ..S TYPEEVNT(TYPEEVNT)=$G(TYPEEVNT(TYPEEVNT))+1
 ..S SEG=$G(^HLA(MSGBOD,1,1,0))
 ..;W !!,MSGDATE
 ..;W !,REC,"  ",DIREC
 ..;W !,MSGTYPE," ",EVENT
 ..;W !,"SEGMENT: ",SEG
 D BYDTHDR
 S TYPEEVNT=""
 F CNT=1:1 S TYPEEVNT=$O(TYPEEVNT(TYPEEVNT)) Q:TYPEEVNT=""!ESC  D
 .I CNT'=1,(FIRST'=$P(TYPEEVNT,U)) W !!
 .S FIRST=$P(TYPEEVNT,U)
 .W !,TYPEEVNT,?12,$J(TYPEEVNT(TYPEEVNT),10)
 .W:TOTMSG ?25,$J($FN(TYPEEVNT(TYPEEVNT)/TOTMSG*100,",",2),10)
 W !?16,"-------"
 W !?13,$J(TOTMSG,10)
 I CLEAR W !,"CLEARED: ",TOTCLEAR
 Q
 ;
BYDTHDR ;EP - RPTBYDT HEADER
 W @IOF
 W !,$$C^XBFUNC("UNSUCCESSFUL MESSAGE REPORT BY DATE",IOM)
 W ?70,"PAGE ",PAGE
 W !,$$CJ^XLFSTR("DATE PRINTED: "_PRTDATE,IOM)
 W !,$$CJ^XLFSTR("PRINTED BY: "_$P($G(^VA(200,DUZ,0)),U),IOM)
 W !,$$CJ^XLFSTR("AT FACILITY: "_$P($G(^DIC(4,DUZ(2),0)),U),IOM)
 S Y=FROM X ^DD("DD") S EXFROM=Y
 S Y=TO X ^DD("DD") S EXTO=Y
 W !,$$CJ^XLFSTR("FOR MESSAGES FROM "_EXFROM_" TO "_EXTO,IOM)
  S DATES=""
 F  S DATES=$O(DATES(DATES)) Q:'DATES  D
 .S Y=DATES X ^DD("DD") S EXDATE=Y
 .W !,"TOTAL MSGS FOR ",EXDATE," IS ",DATES(DATES)
 W !,DASH,!!
 W !!,"EVENT^TYPE",?16,"TOTAL",?25,"% OF TOTAL"
 W !,"---------------------------------------"
 S PAGE=PAGE+1
 Q
 ;
QUEVSENT ;EP - MSGS IN QUEUE VS TOTAL MSGS
 W @IOF
 N HLOG,PORT,MPILINK,REC,OUTCOUNT,TOTCOUNT,INCOUNT,MSGTYPE,EVENT,MPIIEN,ESC
 S ESC=0
 S HLOG=$O(^HLCS(870,"B","MPI",""))  ;MPI LOGICAL LINK
 S PORT=$$GET1^DIQ(870,HLOG_",",400.08,"E")  ;TCP/IP PORT (OPTIMIZED)
 S MPILINK="MPI:"_PORT
 S (TOTCOUNT,OUTCOUNT,INCOUNT)=0
 S TRANDATE=""
 F  S TRANDATE=$O(^HLB("QUEUE","IN",TRANDATE)) Q:'TRANDATE  D
 .S MSGTYPE=""
 .F  S MSGTYPE=$O(^HLB("QUEUE","IN",TRANDATE,"RPMS-MPI",MSGTYPE)) Q:MSGTYPE=""  D
 ..S EVENT=""
 ..F  S EVENT=$O(^HLB("QUEUE","IN",TRANDATE,"RPMS-MPI",MSGTYPE,EVENT)) Q:EVENT=""  D
 ...S MPIIEN=""
 ...F  S MPIIEN=$O(^HLB("QUEUE","IN",TRANDATE,"RPMS-MPI",MSGTYPE,EVENT,MPIIEN)) Q:MPIIEN=""  D
 ....S INCOUNT=INCOUNT+1
 S MPIIEN=""
 F  S MPIIEN=$O(^HLB("QUEUE","OUT",MPILINK,"MPI RPMS",MPIIEN)) Q:'MPIIEN  D
 .S OUTCOUNT=OUTCOUNT+1
 S MPIIEN=0
 F  S MPIIEN=$O(^HLB(MPIIEN)) Q:'MPIIEN  D
 .S LINK=$P($G(^HLB(MPIIEN,0)),U,5)
 .Q:LINK'="MPI"
 .S TOTCOUNT=TOTCOUNT+1
 W !!,"     MESSAGES IN THE IN QUEUE: ",$J($FN(INCOUNT,","),9)
 W !,"        MESSAGES IN OUT QUEUE: ",$J($FN(OUTCOUNT,","),9)
 W !,"TOTAL MESSAGES IN HLO GLOBALS: ",$J($FN(TOTCOUNT,","),9)
 I '$D(ZTQUEUED) D  Q:ESC
 .U 0
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 .S ESC=X=U
 I '$D(ZTQUEUED) G QUEVSENT
 Q