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

OR3P453.m

Go to the documentation of this file.
  1. OR3P453 ;SLC/RBD - Post Install 453 ;Nov 04, 2020@18:43:11
  1. ;;3.0;ORDER ENTRY/RESULTS REPORTING;**453**;Dec 17, 1997;Build 47
  1. ;
  1. ;
  1. POST ; Post-Install for OR*3.0*453
  1. ; Rebuild EPRTRDT cross reference
  1. D BMES^XPDUTL("Rebuilding 'EPRTRDT' cross-reference.")
  1. D RBRDT
  1. D BMES^XPDUTL("'EPRTRDT' cross-reference rebuild completed.")
  1. N ORMSG
  1. S ORMSG(1)="This patch will create a new New Style cross reference"
  1. S ORMSG(2)="called 'EPRACDT' which will be at the ORDER file level"
  1. S ORMSG(3)="but on PROVIDER & DATE/TIME ORDERED sub-fields of the"
  1. S ORMSG(4)="ORDER ACTIONS Multiple."
  1. S ORMSG(5)=" "
  1. S ORMSG(6)="Creation of 'EPRACDT' will now go forward in the"
  1. S ORMSG(7)="Background."
  1. S ORMSG(8)=" "
  1. S ORMSG(9)="You will be given a TaskMan task # to check on or,"
  1. S ORMSG(10)="alternately, you can check your mail on MailMan for a"
  1. S ORMSG(11)="message expressing Completion of this Task with"
  1. S ORMSG(12)="appropriate details."
  1. S ORMSG(13)=" "
  1. S ORMSG(14)="Note Install of this Patch cannot be considered"
  1. S ORMSG(15)="Complete unless and until this Task is Completed."
  1. S ORMSG(16)=" "
  1. S ORMSG(17)="Note also that the Status of the 'EPRACDT' Creation"
  1. S ORMSG(18)="can be checked by requesting IT to run 'D CHECK^OR3P453'"
  1. S ORMSG(19)="at the Command Prompt."
  1. S ORMSG(20)=" "
  1. D BMES^XPDUTL(.ORMSG)
  1. I $D(^XTMP("OR3P453","START")) D
  1. . D MES^XPDUTL("Task to Create 'EPRACDT' Already Begun "_$$HTE^XLFDT(^XTMP("OR3P453","START"))_".")
  1. . D MES^XPDUTL("")
  1. I $D(^XTMP("OR3P453","FINISH")) D Q
  1. . D MES^XPDUTL("...and Completed "_$$HTE^XLFDT(^XTMP("OR3P453","FINISH"))_".")
  1. . D MES^XPDUTL("")
  1. I $D(^XTMP("OR3P453","STOPPED")) D G SKPQUIT
  1. . D MES^XPDUTL("...and Stopped "_$$HTE^XLFDT(^XTMP("OR3P453","STOPPED"))_".")
  1. . D MES^XPDUTL(""),MES^XPDUTL("...Resuming 'EPRACDT' Creation."),MES^XPDUTL("")
  1. Q:$D(^XTMP("OR3P453"))
  1. SKPQUIT ;
  1. S ZTRTN="SETXREF^OR3P453",ZTIO="",ZTDTH=$H
  1. S ZTDESC="Creation of New Style X-Ref 'EPRACDT' in ORDER file" D ^%ZTLOAD
  1. I $G(ZTSK) D MES^XPDUTL("Task #"_ZTSK_" queued to start "_$$HTE^XLFDT($G(ZTSK("D")))) I 1
  1. E D MES^XPDUTL("***** UNABLE TO QUEUE CREATION OF 'EPRACDT' ORDER FILE X-REF *****")
  1. K ZTRTN,ZTIO,ZTDTH,ZTDESC,ZTSK
  1. Q
  1. ;
  1. SETXREF ; Set new EPRACDT New Style cross reference for old data
  1. N CNT,CNT2,DA,DIK,LASTREC,ORIEN,STOP,XTMPCNT,XTMPMSG,ZTREQ
  1. S U="^" S STOP=0 I $G(^XTMP("OR3P453","STOPPED"))]"" D G RESUME
  1. . K ^XTMP("OR3P453","STOPPED") S XTMPCNT=$O(^XTMP("OR3P453"," "),-1)
  1. K ^XTMP("OR3P453")
  1. S ^XTMP("OR3P453",0)=$$FMADD^XLFDT($$DT^XLFDT(),90)
  1. S ^XTMP("OR3P453","START")=$H
  1. S ^XTMP("OR3P453","RECTOTAL")=$P($G(^OR(100,0)),U,4)
  1. S XTMPCNT=0
  1. S XTMPCNT=XTMPCNT+1
  1. S XTMPMSG="Creation of 'EPRACDT' X-Ref for ORDER file Started "
  1. S XTMPMSG=XTMPMSG_$$HTE^XLFDT(^XTMP("OR3P453","START"))_"."
  1. S ^XTMP("OR3P453",XTMPCNT)=XTMPMSG
  1. S XTMPCNT=XTMPCNT+1,^XTMP("OR3P453",XTMPCNT)=" "
  1. RESUME ; Possibly resume here if previously stopped
  1. S LASTREC=$G(^XTMP("OR3P453","LAST_REC_PROCESSED"))
  1. S ORIEN=$P(LASTREC,U,1),CNT=$P(LASTREC,U,2)
  1. I ORIEN="" S ORIEN=" ",CNT=0 K ^OR(100,"EPRACDT")
  1. F S ORIEN=$O(^OR(100,ORIEN),-1) Q:'ORIEN D I STOP Q
  1. . S DIK="^OR(100,"_ORIEN_",8,",DIK(1)=".01^EPRACDT",DA(1)=ORIEN D ENALL^DIK
  1. . S CNT=CNT+1,^XTMP("OR3P453","LAST_REC_PROCESSED")=ORIEN_U_CNT
  1. . I '(CNT#100000) D I STOP Q ;pause after every 100,000 records
  1. .. F CNT2=1:1:300 H 1 S STOP=$$REQ2STOP() I STOP Q ;pause for 5 minutes
  1. . S STOP=$$REQ2STOP() I STOP Q
  1. I STOP Q
  1. S XTMPMSG="Creation of 'EPRACDT' X-Ref Completed."
  1. S XTMPCNT=XTMPCNT+1,^XTMP("OR3P453",XTMPCNT)=XTMPMSG
  1. S XTMPCNT=XTMPCNT+1,^XTMP("OR3P453",XTMPCNT)=" "
  1. S ^XTMP("OR3P453","FINISH")=$H
  1. S XTMPMSG="Background Task Finished "
  1. S XTMPMSG=XTMPMSG_$$HTE^XLFDT(^XTMP("OR3P453","FINISH"))_"."
  1. S XTMPCNT=XTMPCNT+1,^XTMP("OR3P453",XTMPCNT)=XTMPMSG
  1. ;
  1. ; Send Mail to installer to notify of completion
  1. S XMSUB="OR*3.0*453 post install has run to completion."
  1. S XMDUZ="Patch OR*3.0*453"
  1. S XTMPCNT=0
  1. XRFLOOP S XTMPCNT=$O(^XTMP("OR3P453",XTMPCNT)) G:XTMPCNT'?1N.N FIN
  1. S ^TMP($J,"OR3P453",XTMPCNT,0)=^XTMP("OR3P453",XTMPCNT)
  1. G XRFLOOP
  1. ;
  1. FIN S XMTEXT="^TMP($J,""OR3P453"","
  1. S XMY(DUZ)="" D ^XMD K ^TMP($J,"OR3P453") S ZTREQ="@"
  1. K XMDUZ,XMSUB,XMTEXT,XMY
  1. Q
  1. ;
  1. REQ2STOP() ;
  1. ; Check for task stop request
  1. ; Returns 1 if stop request made.
  1. N STATUS,X
  1. S STATUS=0
  1. I '$D(ZTQUEUED) Q 0
  1. S X=$$S^%ZTLOAD()
  1. I X D ;
  1. . S STATUS=1
  1. . S X=$$S^%ZTLOAD("Received shutdown request")
  1. ;
  1. I STATUS S ^XTMP("OR3P453","STOPPED")=$H
  1. Q STATUS
  1. ;
  1. CHECK ; Check the Status of the Task by looking at XTMP information
  1. S U="^" N CNT,PCNT,RECTOTAL
  1. I '$D(^XTMP("OR3P453")) D Q
  1. . D MES^XPDUTL("Task to Create 'EPRACDT' has either not started or has")
  1. . D MES^XPDUTL("automatically purged from the system.")
  1. . D MES^XPDUTL("")
  1. I $D(^XTMP("OR3P453","START")) D
  1. . D MES^XPDUTL("Task to Create 'EPRACDT' Begun "_$$HTE^XLFDT(^XTMP("OR3P453","START"))_".")
  1. . D MES^XPDUTL("")
  1. I $D(^XTMP("OR3P453","FINISH")) D Q
  1. . D MES^XPDUTL("...and Completed "_$$HTE^XLFDT(^XTMP("OR3P453","FINISH"))_".")
  1. . D MES^XPDUTL("")
  1. I $D(^XTMP("OR3P453","STOPPED")) D
  1. . D MES^XPDUTL("...and Stopped "_$$HTE^XLFDT(^XTMP("OR3P453","STOPPED"))_".")
  1. . D MES^XPDUTL("")
  1. S CNT=$P($G(^XTMP("OR3P453","LAST_REC_PROCESSED")),U,2)
  1. I +$G(CNT)'>0 Q
  1. S RECTOTAL=$G(^XTMP("OR3P453","RECTOTAL"))
  1. S PCNT=$P(((CNT/RECTOTAL)*100),".",1)
  1. D MES^XPDUTL("...Currently, "_PCNT_"% of Records have been Processed.")
  1. D MES^XPDUTL("")
  1. Q
  1. RBRDT ;
  1. N ORS1,ORS2,ORS3,ORS4
  1. S ORS1=0
  1. F S ORS1=$O(^OR(100,"EPRTRDT",ORS1)) Q:'ORS1 D
  1. . S ORS2=0
  1. . F S ORS2=$O(^OR(100,"EPRTRDT",ORS1,ORS2)) Q:'ORS2 D
  1. .. S ORS3=0
  1. .. F S ORS3=$O(^OR(100,"EPRTRDT",ORS1,ORS2,ORS3)) Q:'ORS3 D
  1. ... S ORS4=0
  1. ... F S ORS4=$O(^OR(100,"EPRTRDT",ORS1,ORS2,ORS3,ORS4)) Q:'ORS4 D
  1. .... K ^OR(100,"EPRTRDT",ORS1,ORS2,ORS3,ORS4)
  1. .... S DIK="^OR(100,ORS3,11,",DIK(1)=".03^EPRTRDT",DA=ORS4,DA(1)=ORS3 D EN1^DIK
  1. Q
  1. ;