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

AGMPHLU1.m

Go to the documentation of this file.
AGMPHLU1 ; IHS/SD/TPF - MPI HLO UTILITIES ; 12/15/2007
 ;;7.2;IHS PATIENT REGISTRATION;**1,6**;JAN 07, 2011;Build 23
 Q
 ;
 ;OIT PROGRAMMER USE ONLY - NO OPTION
LOADTST(EVENT,START,LASTCNT) ;EP - TEST MPI LOAD
 ; 9/18/2017 - GCD - CR 7705 - Disabled this because it should never be run in the field.
 Q
 ;
 N IEN,COUNT,CNT
 S COUNT=0
 S IEN=$G(START)
 S:IEN="" IEN=0
 F CNT=1:1 S IEN=$O(^DPT(IEN)) Q:'IEN!(COUNT>LASTCNT)  D
 .Q:$P($G(^DPT(IEN,"MPI")),U)'=""  ;DURING TESTING DON'T SEND IF ALREADY SENT
 .Q:$D(^DPT(IEN,-9))
 .Q:'$O(^AUPNPAT(IEN,41,0))
 .I $$DEMOPAT^AGMPHLU($G(IEN)) Q  ; 9/13/2017 - GCD - CR 7713 - Don't upload demo patients.
 .S COUNT=COUNT+1
 .I '(CNT#100) W "."
 .D NOW^%DTC S NOW=%
 .I EVENT="A01" D CREATE^AGMPHL01(4,IEN,NOW) Q
 .I EVENT="A03" D CREATE^AGMPHL03(1,IEN,"T"_NOW) Q
 .D CREATMSG^AGMPIHLO(IEN,EVENT)
 W !,"TOTAL "_EVENT_" MESSAGES SENT: ",COUNT
 Q
 ;
FINDERR ;EP - SEACH FOR ERR IN ^HLA
FROMERR ;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 FROMERR=Y
TOERR ;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="") FROMERR
 S TOERR=Y_".999999"
 I FROMERR>TOERR D  G FROMERR
 .W !!,"FROM DATE CAN NOT BE GREATER THAN TO DATE!!" H 2
 S FROMERR=FROMERR-.00001
SHOW ;EP
 K DIR
 S DIR(0)="YO"
 S DIR("A")="Display originating message"
 S DIR("B")="N"
 D ^DIR
 G:$D(DTOUT)!$D(DUOUT)!$D(DIROUT)!(Y="") TOERR
 S SHOW=Y
 W !!,"FINDING ERR SEGMENTS IN HLA"
 N COUNT,MSG,DASH
 S COUNT=0
 D DOCOUNT(.COUNT)
 W !!,"THERE WERE "_COUNT_" ERR ERRORS FOUND"
 I COUNT=0 D  Q
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 S %ZIS="MQ"
 W !
 D ^%ZIS
 Q:POP
 I $D(IO("Q")) D QUEERR Q
 U IO
QUEPRINT ;EP ENTER FROM TASKMAN
 S $P(DASH,"-",81)=""
 N CODECNT
 S TOTCOUNT=0
 S ESC=0
 S PAGE=1
 D NOW^%DTC S Y=% X ^DD("DD") S PRTDATE=Y
 D HDRERR
 S MSGDATE=FROMERR-.0001
 F  S MSGDATE=$O(^HLA("B",MSGDATE)) Q:MSGDATE=""!(ESC)  D
 .Q:+MSGDATE>TOERR!(+MSGDATE<FROMERR)
 .S MSGIEN=""
 .F  S MSGIEN=$O(^HLA("B",MSGDATE,MSGIEN)) Q:MSGIEN=""!(ESC)  D
 ..S LINK=$P($G(^HLB(MSGIEN,0)),U,5)
 ..Q:LINK'="MPI"
 ..;W !,MSGDATE
 ..Q:$P($G(^HLA(MSGIEN,1,3,0)),U)'="ERR"
 ..S ENTRYDT=$P($G(^HLA(MSGIEN,0)),U)
 ..S ACKCODE=$P($G(^HLA(MSGIEN,1,1,0)),U,2)
 ..S MSGID=$P($G(^HLA(MSGIEN,1,1,0)),U,3)
 ..S OMSGIEN=$P(MSGID," ",2)
 ..S LOCALID=$P($P($G(^HLA(OMSGIEN,1,3,0)),"|",3),"~")
 ..S TOTCOUNT=TOTCOUNT+1
 ..I $Y>(IOSL-4),(IO=IO(0)),'$D(IO("S")) K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=$G(X)=U Q:ESC  D HDRERR
 ..I $Y>(IOSL-4),$D(ZTQUEUED) D HDRERR
 ..W !!,DASH
 ..W !,"PATIENT DFN: ",LOCALID
 ..W !,"HLA IEN: ",MSGIEN
 ..W !,"MSG ID: ",MSGID
 ..W !,"ORIGINATING MSG IEN: ",OMSGIEN
 ..W !,"ACK CODE: ",ACKCODE
 ..W !,$G(^HLA(MSGIEN,1,3,0))
 ..S CODECNT(ACKCODE)=$G(CODECNT(ACKCODE))+1
 ..I SHOW D LISTOMSG(OMSGIEN)
 D PRTERRCD(.CODECNT)
 W !!!,"TOTAL ERRORS: ",TOTCOUNT
 I '$D(ZTQUEUED) D
 .U 0
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 D ^%ZISC
 Q
 ;
HDRERR ;EP - HEADER
 W @IOF
 W !,$$C^XBFUNC("MSG ERR REPORT",IOM)
 W ?70,"PAGE ",PAGE
 S PAGE=PAGE+1
 W !,$$CJ^XLFSTR("DATE PRINTED: "_PRTDATE,IOM)
 W !,$$CJ^XLFSTR("PRINTED BY: "_$P($G(^VA(200,DUZ,0)),U),IOM)
 W !,DASH,!!
 Q
 ;
PRTERRCD(CODECNT) ;EP
 N ACKCODE
 S ACKCODE=""
 F  S ACKCODE=$O(CODECNT(ACKCODE)) Q:ACKCODE=""  D
 .W !,"TOTAL "_ACKCODE_" ERRS: ",CODECNT(ACKCODE)
 Q
 ;
QUEERR ; EP - QUE AE ERROR REPORT
 S ZTRTN="QUEPRINT^AGMPHLU1"
 S ZTDESC="HLO AE ERROR MESSAGE REPORT"
 S ZTSAVE("FROMERR")=""
 S ZTSAVE("TOERR")=""
 S ZTSAVE("SHOW")=""
 D ^%ZTLOAD
 I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
 E  W !!?5,"Report task #: ",$G(ZTSK)
 D HOME^%ZIS
 Q
 ;
DOCOUNT(COUNT) ;EP - GET COUNT OF ERR MSGS
 S MSGIEN=0 F  S MSGIEN=$O(^HLA(MSGIEN)) Q:'MSGIEN  D
 .S ENTRYDT=$P($G(^HLA(MSGIEN,0)),U)
 .Q:ENTRYDT>TOERR!(ENTRYDT<FROMERR)
 .Q:$P($G(^HLA(MSGIEN,1,3,0)),U)'="ERR"
 .S COUNT=COUNT+1
 Q
 ;
LISTOMSG(OMSGIEN) ;EP - LIST ORIGINATING MESSAGE
 N DATA
 W !!,"ORINATING MESSAGE:"
 S REC=0
 F  S REC=$O(^HLA(OMSGIEN,1,REC)) Q:'REC  D
 .S DATA=$G(^HLA(OMSGIEN,1,REC,0))
 .Q:DATA=""
 .W !,DATA
 Q
 ;
FINDSEG(SEG,SHOW) ;EP - FIND SEG SEGMENT IN MESSAGE
 ;YOU CAN USE THIS FOR ANY EN MASSE CHANGES
 ;OIT PROGRAMMER USE ONLY - NO OPTION
 N IEN,REC,MSGTYPE,FOUND
 S FOUND=0
 I SEG="MSH" S GLOREF="^HLB"
 E  S GLOREF="^HLA"
 S IEN=0
 F  S IEN=$O(@GLOREF@(IEN)) Q:'IEN  D
 .I SEG'="MSH" D
 ..S REC=0
 ..F  S REC=$O(@GLOREF@(IEN,1,REC)) Q:'REC  D
 ...Q:$P($G(@GLOREF@(IEN,1,REC,0)),U)'=SEG
 ...;PLACE ANY EDITS NEEDED HERE
 ...W !,@GLOREF@(IEN,1,REC,0)
 ...S TEMP=$P(@GLOREF@(IEN,1,REC,0),U,45)
 ...S DATE=$P(TEMP," ")
 ...S TIME=$P(TEMP," ",2)
 ...W !,"DATE: ",DATE
 ...W !,"TIME: ",TIME
 ...S FOUND=FOUND+1
 ...S FOUND(IEN)=""
 .E  D   ;EDITS TO MSH HEADER
 ..Q:$P($G(@GLOREF@(IEN,0)),U,4)'="O"  ;ONLY OUTGOING
 ..;PLACE ANY EDITS NEEDED HERE
 ..W !!!,"IEN: ",IEN
 ..W !,$G(@GLOREF@(IEN,1))
 ..W !,$P($G(@GLOREF@(IEN,1)),U,6)
 ..;S TEMP=$P($G(@GLOREF@(IEN,1)),U,6)
 ..;I $P(TEMP,"~")="8990" Q
 ..;S $P(TEMP,"~")="8990"
 ..;B "S+"
 ..;S $P(@GLOREF@(IEN,1),U,6)=TEMP
 ..S FOUND=FOUND+1
 ..S FOUND(IEN)=""
 W !,"FOUND "_FOUND_" "_SEG_" IN MESSAGE"
 ;ZW FOUND
 Q
 ;
ASKEVN ;EP - ASK EVENT
 N EVENT,MSGTYPE,ACKCODE,ONLYCNT
 K DIR
 S DIR(0)="SO^A28:ADD A PATIENT;A08:UPDATE A PATIENT;A40:MERGE PATIENTS"
 S DIR(0)=DIR(0)_";A01:ADMIT/CHECKIN A PATIENT;A03:DISCHARGE/CHECK OUT A PATIENT"
 S DIR(0)=DIR(0)_";M05:TREATING FACILITY UPDATE"  ;OR MFN?
 S DIR("A")="ENTER EVENT"
 D ^DIR
 Q:$D(DTOUT)!$D(DUOUT)!(Y="")
 S EVENT=Y
ASKTYPE ;EP - ASK MSG TYPE
 K DIR
 S DIR(0)="SO^ADT:ADMIT DISCHARGE TRANSFER;ACK:ACKNOWLEDGEMENTS;MFN:TREATING FACILITY UPDATE"
 S DIR("A")="ENTER MSG TYPE"
 D ^DIR
 G:$D(DTOUT)!$D(DUOUT)!(Y="") ASKEVN
 S MSGTYPE=Y
 ;B "S+"
 S ACKCODE=""
 I MSGTYPE="ACK" D  Q:$D(DTOUT)!$D(DUOUT)!(Y="")
 .K DIR
 .S DIR(0)="SO^AA:APPLICATION ACCEPT;AE:APPLICATION ERROR;AR:APPLICATION REJECT"
 .S DIR(0)=DIR(0)_";CA:COMMIT ACCEPT;CE:COMMIT ERROR;CR:COMMIT REJECT"  ;OR MFN?
 .S DIR("A")="ENTER ACK CODE"
 .D ^DIR
 .S ACKCODE=Y
ASKCNT ;EP - ASK IF ONLY A COUNT IS NEEDED
 K DIR
 S DIR(0)="YO"
 S DIR("A")="TOTALS ONLY"
 D ^DIR
 G:$D(DTOUT)!$D(DUOUT)!(Y="") ASKTYPE
 S ONLYCNT=Y=1
 S %ZIS="MQ"
 W !
 D ^%ZIS
 Q:POP
 I $D(IO("Q")) D QUEEVN Q
 U IO
FINDEVN ;EP - FIND EVENT
 ;FINDEVN("A28","ACK","CA")
 N IEN,REC,FOUND,DASH
 S $P(DASH,"-",81)=""
 D NOW^%DTC S Y=% X ^DD("DD") S PRTDATE=Y
 S PAGE=1
 D HDREVN
 S ESC=0
 S FOUND=0
 S IEN=0
 F  S IEN=$O(^HLA(IEN)) Q:'IEN!ESC  D
 .I EVENT'="" Q:$P($G(^HLA(IEN,0)),U,4)'=EVENT
 .I MSGTYPE'="" Q:$P($G(^HLA(IEN,0)),U,3)'=MSGTYPE
 .Q:$G(^HLA(IEN,1,1,0))'[ACKCODE
 .I $Y>(IOSL-4),(IO=IO(0)),'$D(IO("S")) K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=$G(X)=U Q:ESC  D HDREVN
 .I $Y>(IOSL-4),$D(ZTQUEUED) D HDREVN
 .I 'ONLYCNT D
 ..W !!,IEN_" *** "_$G(^HLA(IEN,0))
 ..D LISTOMSG(IEN)
 .S FOUND=FOUND+1
 W !,"FOUND "_FOUND_" '"_EVENT_"' EVENTS IN ^HLA WITH MSGTPYE '"_MSGTYPE
 I $G(ACKCODE)'="" W "' AND ACKCODE '"_ACKCODE_"'"
 D ^%ZISC
 I '$D(ZTQUEUED) D
 .U 0
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 Q
 ;
QUEEVN ;EP -
 S ZTRTN="FINDEVN^AGMPHLU1"
 S ZTDESC="MPI FIND EVENT/TYPE/ACK REPORT"
 S ZTSAVE("EVENT")="",ZTSAVE("MSGTYPE")="",ZTSAVE("ACKCODE")=""
 D ^%ZTLOAD
 I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
 E  W !!?5,"Report task #: ",$G(ZTSK)
 D HOME^%ZIS
 Q
 ;
HDREVN ;EP -
 W @IOF
 W !,$$C^XBFUNC("MPI FIND EVENT/TYPE/ACK REPORT",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 !,DASH,!!
 S PAGE=PAGE+1
 Q
 ;
RPTBYDT ;EP - REPORT OF MSG TYPE AND EVENT BY DATE RANGE
 N MSGTYPE,EVENT,FROM,TO,MSGDATE,REC,MSGTYPCT,EVENTCNT,TOTMSG,TYPEEVNT,DASH,ESC
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
REPEAT ;EP -
 S TYPEEVNT="" F  S TYPEEVNT=$O(TYPEEVNT(TYPEEVNT)) Q:TYPEEVNT=""  S TYPEEVNT(TYPEEVNT)=0
 S ESC=0
 S TOTMSG=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 MSGTYPE=$P($G(^HLA(REC,0)),U,3)
 ..S EVENT=$P($G(^HLA(REC,0)),U,4)
 ..S TYPEEVNT=EVENT_U_MSGTYPE
 ..S TYPEEVNT(TYPEEVNT)=$G(TYPEEVNT(TYPEEVNT))+1
 ..S TOTMSG=TOTMSG+1
 D NOW^%DTC S Y=% X ^DD("DD") S PRTDATE=Y
 S PAGE=1
 S ESC=0
 S $P(DASH,"-",81)=""
 D BYDTHDR
 S FIRST=""
 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 ?25,$J($FN(TYPEEVNT(TYPEEVNT)/TOTMSG*100,",",2),10)
 W !,"---------------------------------------"
 W !!,"TOTAL MSGS: ",$J(TOTMSG,10)
 I '$D(ZTQUEUED) D  S ESC=X=U Q:ESC
 .U 0
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 I '$D(ZTQUEUED) G REPEAT
 Q
 ;
BYDTHDR ;EP - RPTBYDT HEADER
 W @IOF
 W !,$$C^XBFUNC("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)
 W !,DASH,!!
 W !!,"EVENT^TYPE",?16,"TOTAL",?25,"% OF TOTAL"
 W !,"---------------------------------------"
 S PAGE=PAGE+1
 Q
 ;
NUMICNS ;EP - NUMBER OF ICNS POPULATED
 ; 8/31/2017 - CR 7708 - GCD - Added ability to run in summary mode. Moved totals to bottom of report. Moved header from OPTION file to here.
 N IEN,POP,NOTPOP,HASCHART,PATS,DIR,DETAIL,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,AG
 S DIR(0)="SB^S:SUMMARY;D:DETAIL"
 S DIR("A")="RUN IN SUMMARY OR DETAIL MODE"
 S DIR("B")="S"
 D ^DIR
 I "SD"'[Y Q
 S DETAIL=(Y="D")
 S AG("RPT")="",X="AGMP MPI ICN REPORT" D HDR^AG
 S (POP,NOTPOP,HASCHART)=0
 S IEN=0
 F  S IEN=$O(^DPT(IEN)) Q:'IEN  D
 .Q:$D(^DPT(IEN,-9))
 .Q:'$O(^AUPNPAT(IEN,41,0))
 .I $$DEMOPAT^AGMPHLU(IEN) Q  ; 9/13/2017 - GCD - CR 7713 - Don't count demo patients.
 .S HASCHART=0
 .S DUZ2=0
 .F  S DUZ2=$O(^AUPNPAT(IEN,41,DUZ2)) Q:'DUZ2  D
 ..Q:$P($G(^AGFAC(DUZ2,0)),U,21)'="Y"
 ..S HASCHART=1
 .Q:'HASCHART  ;DON'T COUNT IF PT HAS NO CHARTS
 .I $P($G(^DPT(IEN,"MPI")),U)'="" S POP=POP+1
 .E  S NOTPOP=NOTPOP+1 S:DETAIL PATS(IEN)=""
 I DETAIL,NOTPOP>0 D
 .W !!,"PATIENTS NOT POPULATED"
 .W !,"----------------------"
 .S IEN=""
 .F  S IEN=$O(PATS(IEN)) Q:'IEN  D
 ..W !,$P($G(^DPT(IEN,0)),U)
 W !!,"NUMBER OF ICNs POPULATED: ",POP
 W !,"NUMBER NOT POPULATED: ",NOTPOP
 I '$D(ZTQUEUED) D
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 Q
 ;
FINDMFK ;EP - FIND MFK MSG WITH AN UNSUCCESFUL MFE
 N MSGIE,REC,COUNT,DASH
 S %ZIS="MQ"
 W !
 D ^%ZIS
 Q:POP
 I $D(IO("Q")) D QUEMFK Q
 U IO
PRTMFK ;EP - ENTRY POINT FOR TASKING
 S $P(DASH,"-",81)=""
 D NOW^%DTC S Y=% X ^DD("DD") S PRTDATE=Y
 S $P(DASH,"-",81)=""
 S PAGE=1
 S ESC=0
 D HDRMFK
 S COUNT=0
 S MSGIEN=0
 F  S MSGIEN=$O(^HLA(MSGIEN)) Q:'MSGIEN!ESC  D
 .Q:$P($G(^HLA(MSGIEN,0)),U,3)'="MFK"
 .S REC=0
 F  S MSGIEN=$O(^HLA(MSGIEN)) Q:'MSGIEN!ESC  D
 .Q:$P($G(^HLA(MSGIEN,0)),U,3)'="MFK"
 .S REC=0
 .F  S REC=$O(^HLA(MSGIEN,1,REC)) Q:'REC!ESC  D
 ..Q:$P($G(^HLA(MSGIEN,1,REC,0)),U)'="MFA"
 ..S RESULT=$P($G(^HLA(MSGIEN,1,REC,0)),U,5)
 ..Q:RESULT="S"
 ..S MSGID=$P($G(^HLA(MSGIEN,0)),U)
 ..S COUNT=COUNT+1
 ..I $Y>(IOSL-4),(IO=IO(0)),'$D(IO("S")) K DIR S DIR(0)="E" D:'$D(ZTQUEUED) ^DIR S ESC=$G(X)=U Q:ESC  D HDRMFK
 ..I $Y>(IOSL-4),$D(ZTQUEUED) D HDRMFK
 ..W !!,DASH
 ..W !,"HLA IEN: ",MSGIEN
 ..W !,"MSG ID: ",MSGID
 ..W !!,$G(^HLA(MSGIEN,1,REC-2,0))
 ..W !,$G(^HLA(MSGIEN,1,REC,0))
 W !!!,"COUNT OF UNSUCCESSFUL MFE: ",COUNT
 D ^%ZISC
 I '$D(ZTQUEUED) D
 .U 0
 .W !
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 Q
 ;
HDRMFK ;EP - HEADER
 W @IOF
 W !,$$C^XBFUNC("UNSUCCESSFUL MFE REPORT",IOM)
 W ?60,"PAGE ",PAGE
 S PAGE=PAGE+1
 W !,$$CJ^XLFSTR("DATE PRINTED: "_PRTDATE,IOM)
 W !,$$CJ^XLFSTR("PRINTED BY: "_$P($G(^VA(200,DUZ,0)),U),IOM)
 W !,DASH,!!
 Q
 ;
QUEMFK ; EP - QUE MFE ERROR REPORT
 S ZTRTN="PRTMFK^AGMPHLU1"
 S ZTDESC="HLO MFE ERROR MESSAGE REPORT"
 D ^%ZTLOAD
 I $D(ZTSK)[0 W !!?5,"Report Cancelled!"
 E  W !!?5,"Report task #: ",$G(ZTSK)
 D HOME^%ZIS
 Q
 ;
RESETICN ;EP - CLEAR INTEGRATION CONTROL NUMBER
 ; 9/18/2017 - GCD - CR 7705 - Disabled this because it should never be run in the field.
 Q
 ;
 ;OIT PROGRAMMER ONLY OPTION
 ;THIS IS USED IF A SITE NEEDS TO BE RELOADED INTO THE MPI
 ;FOR SOME REASON. PARTICULARLY WHEN A BETA SITE IS RELOADED AND THEREFORE
 ;PATIET ARE ASSIGNED NEW EUID BY THE MPI
ONE ;EP - RESET JUST ONE PATIENT
 W !!,"USE THIS OPTION TO CLEAR THE INTEGRATION CONTROL NUMBER"
 W !,"THIS CAN BE USED WHEN A SITE NEEDS TO BE RELOADED INTO THE MPI"
 W !,"IF A SITE IS RELOADED THEN NEW EUIDs WILL BE ASSIGNED."
 W !!
 N DIR,DIC,DIE,DA,DR
 S DIR(0)="YO"
 S DIR("A")="RESET ALL PATIENTS"
 Q:$D(DTOUT)!($D(DUOUT))!(Y="")
 I Y="Y" D ALLRESET Q
 W !,"ENTER PATIENT TO RESET"
 D PTLK^AG
 Q:'$D(DFN)
 I '$D(^DPT(DFN,"MPI")) D  G ONE
 .W !!,"PATIENT HAS NO ICN"
 .K DIR
 .S DIR(0)="E"
 .D ^DIR
 S DA=DFN
 S DIE="^DPT("
 S DR="991.01///@;991.02///@"
 D ^DIE
 Q
ALLRESET ;EP - RESET ALL ICNs THAT ARE POPULATED
 ; 9/18/2017 - GCD - CR 7705 - Disabled this because it should never be run in the field.
 Q
 ;
 ;OIT PROGRAMMER ONLY OPTION
 N DIR,DIC,DIE,DA,DR
 S DIE="^DPT("
 S DR="991.01///@;991.02///@"
 S DA=0
 F  S DA=$O(^DPT(DA)) Q:'DA  D
 .Q:'$D(^DPT(DA,"MPI"))
 .D ^DIE
 Q
 ;
CLEARALL ;EP - RESET ALL FOR RETESTING SESSION
 ;OIT PROGRAMMER ONLY OPTION
 ;D CLEAR
 ;D ALLRESET
 ;K ^DGCN(391.91)
 ;S ^DGCN(391.91,0)="TREATING FACILITY LIST^391.91PI^^"
 Q
 ;CLEAR HLO MESSAGE GLOBALS
CLEAR ;EP - CLEAR HLO MESSAGE GLOBALS
 ;OIT PROGRAMMER ONLY OPTION
 ;K ^HLA,^HLB,^HLC,^HLTMP
 ;S ^HLA(0)="HLO MESSAGE BODY^777DI^^"
 ;S ^HLB(0)="HLO MESSAGES^778O^^"
 Q
 ;
QUEVSENT ;EP - MSGS IN QUEUE VS TOTAL MSGS
 G QUEVSENT^AGMPHLU2 ; 9/25/2017 - GCD - Moved to reduce routine size