source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORMTIME.m@ 771

Last change on this file since 771 was 623, checked in by George Lilly, 15 years ago

revised back to 6/30/08 version

File size: 2.3 KB
Line 
1ORMTIME ; SLC/RJS - PROCESS TIME BASED EVENT ;9/29/99 09:35 [2/1/00 9:30am]
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**40,253**;Dec 17, 1997
3 ;
4EN ; Main entry tag.
5 ;
6 N OCXPSDT,OCXZTSK,OCXERR,OCXORMTR,OCXSTDT,OCXLOCK,OCXPAR
7 K ^TMP("OCXORMTIME",$J)
8 S OCXLOCK=0
9 S OCXORMTR="ORMTIME: Startup"
10 S OCXSTDT=$$EDATE($$IDATE("NOW"))
11 S ^TMP("OCXORMTIME",$J,"STATUS")="ORMTIME: Attempting to lock ^OR(100,""AE"") at "_OCXSTDT_"."
12 L +^OR(100,"AE"):10
13 I D
14 .S OCXLOCK=1
15 .D SCAN
16 .L -^OR(100,"AE")
17 .K ^TMP("OCXORMTIME")
18 .S OCXPAR=$$IDATE2("NOW")
19 .D PUT^XPAR("SYS","ORM ORMTIME LAST RUN",1,OCXPAR,.OCXERR)
20 S:'OCXLOCK ^TMP("OCXORMTIME",$J,"STATUS")="ORMTIME: Unable to lock ^OR(100,""AE"") at "_OCXSTDT_" attempt."
21 Q
22 ;
23SCAN ; Call ORMTIM01 for order checking, etc. ORMTIM02 for misc time based tasks
24 ;
25 D SCAN^ORMTIM01
26 D MISC^ORMTIM02
27 Q
28 ;
29EDATE(Y) X ^DD("DD") S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
30 ;
31IDATE(X) N %DT,Y S %DT="F" D ^%DT Q Y
32 ;
33IDATE2(X) N %DT,Y S %DT="TF" D ^%DT Q Y
34 ;
35REQUEUE(ORMQT) ; Code formerly queued ORMTIME tasks in Taskman.
36 ;
37 ; (This tag kept for compatibility with outside calls.)
38 ;
39 Q
40 ;
41STATUS ; Check status of last ORMTIME run.
42 ;
43 N ORMLAST
44 ;
45 ; Get date/time of last ORMTIME run:
46 S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
47 S ORMLAST=$$EDATE(ORMLAST) ; Convert to external format for display.
48 ;
49 ; Present information to user:
50 W !
51 W !," ORMTIME last ran "_ORMLAST_"."
52 W !
53 ;
54 Q
55 ;
56BULL ; Send a bulletin if ORMTIME's last run is greater than 24 hours.
57 ;
58 N DIC,ORMMSG,X,XMSUB,XMTEXT,XMY,XMZ,Y,ORMLAST
59 ;
60 ; Don't send bulletin if ORMTIME STATUS mail group does not exist:
61 S DIC=3.8,DIC(0)="",X="ORMTIME STATUS"
62 D ^DIC Q:(+Y<0)
63 ;
64 S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
65 I $$FMDIFF^XLFDT($$IDATE2("NOW"),ORMLAST,2)>86400 D
66 .S XMY("G.ORMTIME STATUS")=""
67 .S XMSUB=" ORMTIME Warning"
68 .S ORMMSG(1,0)=" "
69 .S ORMMSG(2,0)=" The ORMTIME process last ran more than 24 hours ago. "
70 .S ORMMSG(3,0)=" "
71 .S ORMMSG(4,0)=" The ORMTIME background job handles activating and expiring orders,"
72 .S ORMMSG(5,0)=" some time based notifications, as well as purging of temporary CPRS"
73 .S ORMMSG(6,0)=" data. It is important that it runs regularly."
74 .S ORMMSG(7,0)=" "
75 .S ORMMSG(8,0)=" Assure that the scheduled option, ORMTIME RUN, is correctly implemented."
76 .S ORMMSG(9,0)=" "
77 .S XMTEXT="ORMMSG("
78 .D ^XMD
79 Q
80 ;
Note: See TracBrowser for help on using the repository browser.