Ignore:
Timestamp:
Dec 4, 2009, 12:11:15 AM (14 years ago)
Author:
George Lilly
Message:

revised back to 6/30/08 version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORMTIME.m

    r613 r623  
    1 ORMTIME ; 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         ;
    4 EN      ; 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         ;
    23 SCAN    ; 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         ;
    30 EDATE(Y)        X ^DD("DD") S:(Y["@") Y=$P(Y,"@",1)_" at "_$P(Y,"@",2) Q Y
    31         ;
    32 IDATE(X)        N %DT,Y S %DT="F" D ^%DT Q Y
    33         ;
    34 IDATE2(X)       N %DT,Y S %DT="TF" D ^%DT Q Y
    35         ;
    36 REQUEUE(ORMQT)  ; Code formerly queued ORMTIME tasks in Taskman.
    37         ;
    38         ; (This tag kept for compatibility with outside calls.)
    39         ;
    40         Q
    41         ;
    42 STATUS  ; 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         ;
    57 BULL    ; 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         ;
     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 TracChangeset for help on using the changeset viewer.