source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORMTIM01.m@ 1361

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

initial load of WorldVistAEHR

File size: 3.4 KB
Line 
1ORMTIM01 ; SLC-ISC/RJS - PROCESS TIME BASED EVENT ;2/01/00 10:30 [8/3/05 7:19am]
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**31,40,190,232**;Dec 17, 1997;Build 19
3 ;
4SCAN ;
5 S OCXORMTR="ORMTIME: scan"
6 N OCXNOW,OCXDATE,OCXTMT,OCXORD S OCXNOW=$$IDATE("NOW"),OCXTMT=$$IDATE("N+1H")
7 ;
8 ; Expire orders
9 ;
10 S OCXORMTR="ORMTIME: scan expiring orders"
11 S OCXDATE=0 F S OCXDATE=$O(^OR(100,"AE",OCXDATE)) Q:'OCXDATE I '((+OCXDATE)>OCXNOW) D
12 .S OCXORD=0 F S OCXORD=$O(^OR(100,"AE",OCXDATE,OCXORD)) Q:'OCXORD D
13 ..D EXP^OCXOTIME(OCXDATE,OCXORD)
14 ..I $G(^OR(100,"AE",OCXDATE,OCXORD)),(^OR(100,"AE",OCXDATE,OCXORD)>OCXNOW) Q
15 ..S ^OR(100,"AE",OCXDATE,OCXORD)=OCXTMT
16 ..N OCXORMTR S OCXORMTR=" Executing: D EXP^ORMEVNT("_OCXORD_","_OCXDATE_")"
17 ..D EXP^ORB3F1(OCXDATE,OCXORD)
18 ..D EXP^ORMEVNT(OCXORD,OCXDATE)
19 ..S:$D(^OR(100,"AE",OCXDATE,OCXORD)) ^OR(100,"AE",OCXDATE,OCXORD)=""
20 D DELEXP^ORB3F1 ;delete old expired orders from ^XTMP("ORAE"
21 ;
22 ; Activate orders
23 ;
24 S OCXORMTR="ORMTIME: scan activating orders"
25 S OCXDATE=0 F S OCXDATE=$O(^OR(100,"AD",OCXDATE)) Q:'OCXDATE I '((+OCXDATE)>OCXNOW) D
26 .S OCXORD=0 F S OCXORD=$O(^OR(100,"AD",OCXDATE,OCXORD)) Q:'OCXORD D
27 ..D ACT^OCXOTIME(OCXDATE,OCXORD)
28 ..I $G(^OR(100,"AD",OCXDATE,OCXORD)),(^OR(100,"AD",OCXDATE,OCXORD)>OCXNOW) Q
29 ..S ^OR(100,"AD",OCXDATE,OCXORD)=OCXTMT
30 ..N OCXORMTR S OCXORMTR=" Executing: D ACTIVE^ORMEVNT("_OCXORD_","_OCXDATE_")"
31 ..D ACTIVE^ORMEVNT(OCXORD,OCXDATE)
32 ..S:$D(^OR(100,"AD",OCXDATE,OCXORD)) ^OR(100,"AD",OCXDATE,OCXORD)=""
33 ;
34 ; Trigger Task/Time-driven Notifications
35 ;
36 S OCXORMTR=" Executing: D TNOTIFS^ORB3TIM1"
37 D TNOTIFS^ORB3TIM1
38 ;
39 ; Run Order Check Purges
40 ;
41 I $L($T(^OCXOPURG)) D
42 .S OCXORMTR="ORMTIME: Run purge for order checking"
43 .D EN^OCXOPURG
44 ;
45 ; ^ORYX("ORERR" CPRS Errors Purge
46 ;
47 I $O(^ORYX("ORERR",0)) D
48 .N %DT,ORD0,ORDATE,ORKILL,ORLIMIT,ORNODE,X,Y
49 .;
50 .S ORLIMIT=$$GET^XPAR("ALL","ORPF ERROR DAYS") S:(ORLIMIT<1) ORLIMIT=2
51 .S X="TODAY-"_ORLIMIT,%DT="" D ^%DT S ORLIMIT=Y
52 .;
53 .I '$O(^ORYX("ORERR","B",0)) S ORD0=0 F S ORD0=$O(^ORYX("ORERR",ORD0)) Q:'ORD0 D
54 ..S ^ORYX("ORERR","B",+$G(^ORYX("ORERR",ORD0,0)),ORD0)=""
55 .;
56 .S ORDATE="" F S ORDATE=$O(^ORYX("ORERR","B",ORDATE)) Q:'$L(ORDATE) D
57 ..S ORD0=0 F S ORD0=$O(^ORYX("ORERR","B",ORDATE,ORD0)) Q:'ORD0 D
58 ...S ORNODE=$G(^ORYX("ORERR",ORD0,0))
59 ...I (+ORNODE<ORLIMIT) K ^ORYX("ORERR",ORD0) S ORKILL=1
60 ..I (ORDATE<ORLIMIT) K ^ORYX("ORERR","B",ORDATE) S ORKILL=1
61 .;
62 .S ORLIMIT=10000 ; **NOTE** This limit is on the number of entries in the CPRS error log
63 .;
64 .I $G(ORKILL)!($P(^ORYX("ORERR",0),U,4)>ORLIMIT) D
65 ..N ORD0,ORD1,ORPREV,ORCNT
66 ..S ORD0=0 F ORCNT=0:1 S ORPREV=ORD0,ORD0=$O(^ORYX("ORERR",ORD0)) Q:'ORD0
67 ..S $P(^ORYX("ORERR",0),U,3,4)=ORPREV_U_ORCNT
68 ..;
69 ..S ORD0=0 F ORD1=ORLIMIT:1:ORCNT S ORPREV=ORD0,ORD0=$O(^ORYX("ORERR",ORD0)) Q:'ORD0 D
70 ...S ORNODE=$G(^ORYX("ORERR",ORD0,0))
71 ...K ^ORYX("ORERR",ORD0),^ORYX("ORERR","B",+ORNODE)
72 ..S $P(^ORYX("ORERR",0),U,3,4)=ORPREV_U_ORLIMIT
73 ;
74 ; Time Based Events for Order Checking
75 ;
76 I $L($T(^OCXOTIME)) D
77 .S OCXORMTR="ORMTIME: scan time based events for order checking"
78 .D EN^OCXOTIME
79 ;
80 S OCXORMTR="Finish Job #: "_$J_" at: "_$$EDATE($$IDATE("N"))
81 ;
82 ; Clean up cache of Remote Order Checking Data
83 ;
84 D CLEANUP^ORRDI2
85 ;
86 Q
87 ;
88EDATE(Y) X ^DD("DD") S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
89 ;
90IDATE(X) N %DT,Y S %DT="TF" D ^%DT Q Y
91 ;
92TIME(X) N M,H S M=$E(100+(X#60),2,3),H=$E(100+(X\60),2,3) Q H_M
93 ;
Note: See TracBrowser for help on using the repository browser.