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

Last change on this file since 613 was 613, checked in by George Lilly, 14 years ago

initial load of WorldVistAEHR

File size: 2.4 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,243**;Dec 17, 1997;Build 242
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 D TASK^ORTSKLPS
28 Q
29 ;
30EDATE(Y) X ^DD("DD") S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
31 ;
32IDATE(X) N %DT,Y S %DT="F" D ^%DT Q Y
33 ;
34IDATE2(X) N %DT,Y S %DT="TF" D ^%DT Q Y
35 ;
36REQUEUE(ORMQT) ; Code formerly queued ORMTIME tasks in Taskman.
37 ;
38 ; (This tag kept for compatibility with outside calls.)
39 ;
40 Q
41 ;
42STATUS ; Check status of last ORMTIME run.
43 ;
44 N ORMLAST
45 ;
46 ; Get date/time of last ORMTIME run:
47 S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
48 S ORMLAST=$$EDATE(ORMLAST) ; Convert to external format for display.
49 ;
50 ; Present information to user:
51 W !
52 W !," ORMTIME last ran "_ORMLAST_"."
53 W !
54 ;
55 Q
56 ;
57BULL ; Send a bulletin if ORMTIME's last run is greater than 24 hours.
58 ;
59 N DIC,ORMMSG,X,XMSUB,XMTEXT,XMY,XMZ,Y,ORMLAST
60 ;
61 ; Don't send bulletin if ORMTIME STATUS mail group does not exist:
62 S DIC=3.8,DIC(0)="",X="ORMTIME STATUS"
63 D ^DIC Q:(+Y<0)
64 ;
65 S ORMLAST=$$GET^XPAR("SYS","ORM ORMTIME LAST RUN",1,"I")
66 I $$FMDIFF^XLFDT($$IDATE2("NOW"),ORMLAST,2)>86400 D
67 .S XMY("G.ORMTIME STATUS")=""
68 .S XMSUB=" ORMTIME Warning"
69 .S ORMMSG(1,0)=" "
70 .S ORMMSG(2,0)=" The ORMTIME process last ran more than 24 hours ago. "
71 .S ORMMSG(3,0)=" "
72 .S ORMMSG(4,0)=" The ORMTIME background job handles activating and expiring orders,"
73 .S ORMMSG(5,0)=" some time based notifications, as well as purging of temporary CPRS"
74 .S ORMMSG(6,0)=" data. It is important that it runs regularly."
75 .S ORMMSG(7,0)=" "
76 .S ORMMSG(8,0)=" Assure that the scheduled option, ORMTIME RUN, is correctly implemented."
77 .S ORMMSG(9,0)=" "
78 .S XMTEXT="ORMMSG("
79 .D ^XMD
80 Q
81 ;
Note: See TracBrowser for help on using the repository browser.