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

EAS155P1.m

Go to the documentation of this file.
  1. EAS155P1 ;;ALB/SCK - MT LETTERS BAD POINTERS CLEAN UP ;07/22/2004
  1. ;;1.0;ENROLLMENT APPLICATION SYSTEM;**55**;MAR 15,2001
  1. ;
  1. ; This routine was initally run as the post-install for patch EAS*1*55
  1. ; Running this routine from programmer mode will initiate another
  1. ; reporting cycle. You should not run this routine unless advised
  1. ; by customer support.
  1. Q
  1. ;
  1. EN ; Entry point from programmer mode
  1. N MSG,XCNT,DIR,X,Y,DIRUT
  1. ;
  1. F XCNT=1:1 S LINE=$P($T(TEXT+XCNT),";;",2) Q:LINE="$$END" S MSG(XCNT)=LINE
  1. W @IOF
  1. S XCNT=0 F S XCNT=$O(MSG(XCNT)) Q:'XCNT W !?3,MSG(XCNT)
  1. W !
  1. I '$$CHKPREV Q
  1. ;
  1. S DIR(0)="Y",DIR("B")="YES",DIR("A")="Continue with scan"
  1. S DIR("?")="Press ENTER to continue, enter ""NO"" to exit."
  1. D ^DIR K DIR
  1. I Y D QUE Q
  1. W !?3,"Exiting scan..."
  1. Q
  1. ;
  1. QUE ;
  1. K ZTRTN,ZTDESC,ZTSAVE
  1. S ZTRTN="BLD^EAS155P1"
  1. S ZTDESC="EAS MT LTR BAD PTR SCAN"
  1. S ZTSAVE("DUZ")=""
  1. S ZTIO=""
  1. D ^%ZTLOAD
  1. I $D(ZTSK)[0 D
  1. . W:'$G(EASQ) !!?3,"Scan canceled"
  1. E D
  1. . I $G(EASQ) D BMES^XPDUTL("Scan Queued: "_ZTSK)
  1. . E W !!?3,"Scan Queued: "_ZTSK
  1. Q
  1. ;
  1. BLD ; Entry point scan and cleanup. Do not call directly, call from the EN entry point.
  1. D SCAN,CLNUP,ALERT
  1. S ^XTMP("EASBADPTRS",0,"END")=$H
  1. Q
  1. ;
  1. POST ; Post Install entry point. This entry point is intended to be called from the KIDS build.
  1. N MSG,XCNT,EASQ
  1. ;
  1. F XCNT=1:1 S LINE=$P($T(TEXT+XCNT),";;",2) Q:LINE="$$END" D
  1. . S MSG(XCNT)=LINE
  1. D MES^XPDUTL(.MSG)
  1. S EASQ=1 D QUE
  1. Q
  1. ;
  1. SCAN ; Begin scanning for any bad pointers in the MT Letter Files
  1. N EAIEN
  1. ;
  1. K ^XTMP("EASBADPTRS")
  1. S ^XTMP("EASBADPTRS",0)=$$FMADD^XLFDT($$DT^XLFDT,30)_U_$$DT^XLFDT_U_"EAS MT LETTERS BAD POINTERS SCAN"
  1. S ^XTMP("EASBADPTRS",0,"START")=$H,^XTMP("EASBADPTRS",0,"DUZ")=DUZ
  1. S EAIEN=0
  1. F S EAIEN=$O(^EAS(713.2,"AC",0,EAIEN)) Q:'EAIEN D
  1. . I $$GET1^DIQ(713.2,EAIEN,2)']"" S ^XTMP("EASBADPTRS",EAIEN)=""
  1. S ^XTMP("EASBADPTRS",0,"SCAN COMPLETE")=$H
  1. Q
  1. ;
  1. CLNUP ; Disable letters in MT Letter Status file with suspicious pointers
  1. ; Do not delete, but flag as "bad"
  1. N EAIEN,EAFDA,ERR,DIE,DA,DR
  1. ;
  1. S EAIEN=0
  1. F S EAIEN=$O(^XTMP("EASBADPTRS",EAIEN)) Q:'EAIEN D
  1. . S DIE="^EAS(713.2,",DA=EAIEN
  1. . S DR="4///YES;5///TODAY;6////.5;7///LETTER DISABLED, BAD POINTERS?;9///NO;12///NO;18///NO"
  1. . D ^DIE K DIE,DR,DA
  1. ;
  1. S ^XTMP("EASBADPTRS",0,"CLEANUP COMPLETE")=$H
  1. Q
  1. ;
  1. ALERT ; Send an alert to user that the scan has completed.
  1. K XQA,XQAMSG,XQAOPT,XQAROU,XQAID,XQDATA,XQAFLAG
  1. ;
  1. S XQA(DUZ)="",XQAID="EAS",XQAROU="REPORT^EAS155P1"
  1. S XQAMSG="EAS MT LTRs Bad Pointers Scan Complete, Print Report"
  1. D SETUP^XQALERT
  1. Q
  1. ;
  1. REPORT ; Print Bad Pointers Report setup
  1. K ZTSAVE S ZTSAVE("DUZ")=""
  1. D EN^XUTMDEVQ("P^EAS155P1","Print EAS Bad Pointers Report",.ZTSAVE)
  1. Q
  1. ;
  1. P ; Print report
  1. N LINE,EAIEN,PAGE,EAX,DFN
  1. ;
  1. S (PAGE,EAIEN)=0
  1. D HDR
  1. F S EAIEN=$O(^XTMP("EASBADPTRS",EAIEN)) Q:'EAIEN D Q:$G(EASABRT)
  1. . S LINE=""
  1. . S LINE=$$SETSTR^VALM1(EAIEN,"",20,15)
  1. . S EAX=$$GET1^DIQ(713.2,EAIEN,2,"I")
  1. . S LINE=$$SETSTR^VALM1(EAX,LINE,40,15)
  1. . S DFN=$$GET1^DIQ(713.1,EAX,.01,"I")
  1. . S LINE=$$SETSTR^VALM1(DFN,LINE,60,15)
  1. . W !,LINE
  1. . I $Y+5>IOSL D Q:$G(EASABRT)
  1. . . I $E(IOST,1,2)="C-" D Q:$G(EASABRT)
  1. . . . S DIR(0)="E" D ^DIR K DIR
  1. . . . I 'Y S EASABRT=1 Q
  1. . . D HDR
  1. Q
  1. ;
  1. HDR ; PRINT REPORT HEADER
  1. N LINE,DDASH,TEXT,TEXT1
  1. ;
  1. S PAGE=PAGE+1
  1. W:$E(IOST,1,2)="C-" @IOF
  1. W "Results of Possible Bad Pointers Report for EAS MT Letters"
  1. S TEXT="Date Scan Run: "_$$HTE^XLFDT(^XTMP("EASBADPTRS",0,"END"))
  1. S TEXT1="Run by: "_$$GET1^DIQ(200,^XTMP("EASBADPTRS",0,"DUZ"),.01)
  1. S SPACE=(IOM-($L(TEXT)+$L(TEXT1)))
  1. S $P(LINE," ",SPACE-2)=""
  1. W !,TEXT,LINE,TEXT1
  1. ;
  1. S TEXT="Print Date: "_$$FMTE^XLFDT($$NOW^XLFDT)
  1. S TEXT1="Page: "_PAGE
  1. S SPACE=(IOM-($L(TEXT)+$L(TEXT1)))
  1. S $P(LINE," ",SPACE-2)=""
  1. W !,TEXT,LINE,TEXT1,!
  1. ;
  1. S $P(DDASH,"=",IOM-10)=""
  1. S LINE=$$SETSTR^VALM1("File IEN's","",5,12)
  1. S LINE=$$SETSTR^VALM1("713.2",LINE,20,5)
  1. S LINE=$$SETSTR^VALM1("713.1",LINE,40,5)
  1. S LINE=$$SETSTR^VALM1("DFN",LINE,60,5)
  1. W !,LINE
  1. W !?5,DDASH
  1. Q
  1. ;
  1. CHKPREV() ; Check for a previous scan in XTMP
  1. N RSLT,EASDUZ
  1. ;
  1. S RSLT=1
  1. I $D(^XTMP("EASBADPTRS")) D
  1. . I '$D(^XTMP("EASBADPTRS",0,"END")) D
  1. . . W !?3,$CHAR(7),"The EAS MT LTRs Bad Pointer scan is currently running."
  1. . . S EASDUZ=$G(^XTMP("EASBADPTRS",0,"DUZ"))
  1. . . I EASDUZ>0 W !?3,"started by ",$$GET1^DIQ(200,EASDUZ,.01)
  1. . . I $D(^XTMP("EASBADPTRS",0,"START")) W " on ",$$HTE^XLFDT(^XTMP("EASBADPTRS",0,"START"))
  1. . . S RSLT=0
  1. . E D
  1. . . W !?3,"Data from a previous scan exists. "
  1. . . I $D(^XTMP("EASBADPTRS",0,"END")) W "Last Run: ",$$HTE^XLFDT(^XTMP("EASBADPTRS",0,"END"))
  1. . . W !?3,"Answering ""YES"" will cause this data to be erased and a new"
  1. . . W !?3,"scan started!",!
  1. Q $G(RSLT)
  1. ;
  1. TEXT ;
  1. ;;Running this routine will scan the EAS MT PATIENT STATUS File (#713.1)
  1. ;;and the EAS MT LETTER STATUS File (#713.2) for any bad pointers
  1. ;;linking to the PATIENT File (#2). This routine WILL NOT clean up
  1. ;;these pointers, but will flag the appropriate MT Letter entry as
  1. ;;'MT RETURNED' and enter a comment of 'Bad Pointer'. Your local
  1. ;;IRM may take additional cleanup actions.
  1. ;;
  1. ;;Data from this scan will be retained in the ^XTMP("EASBADPTRS")
  1. ;;global for 30 days. You may run REPORT^EAS155P1 at a programmer
  1. ;;prompt to re-print a formatted report. You will be alerted when the
  1. ;;scan is complete.
  1. ;;$$END
  1. Q