source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORY216.m@ 810

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

initial load of WorldVistAEHR

File size: 2.1 KB
RevLine 
[613]1ORY216 ;SLC/MKB - Clean-up existing Allergy orders ;3/16/04 14:28
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**216**;Dec 17, 1997
3 ;
4POST ; -- postinit
5 N ORDG,ORX S ORDG=+$O(^ORD(100.98,"B","ALG",0)) Q:ORDG'>0
6 S $P(^ORD(100.98,ORDG,0),U,4)="" ;clear Default Dialog
7 S ORX("GMRAOR ALLERGY ENTER/EDIT")="" D EN^ORYDLG(216,.ORX)
8 D TASK
9 Q
10 ;
11TASK ; -- queue job to complete ART orders
12 Q:$G(^XTMP("ORGMRA","PAT"))<0 ;already done
13 N ZTDESC,ZTRTN,ZTIO,ZTSAVE,ZTDTH,ZTSK,ORMSG
14 S ORMSG(1)="A background job has been queued to complete any currently active"
15 S ORMSG(2)="Allergy/Adverse Reaction orders." D MES^XPDUTL(.ORMSG)
16 S ZTDESC="Mark ART orders as complete",ZTRTN="EN^ORY216"
17 S ZTIO="",ZTDTH=$H,ZTSAVE("DUZ")="" D ^%ZTLOAD K ORMSG
18 S ORMSG="Task "_$S($G(ZTSK):"#"_ZTSK,1:"not")_" started."
19 D MES^XPDUTL(ORMSG)
20 I '$G(ZTSK) D BMES^XPDUTL("Use TASK^ORY216 to queue this job to complete ART orders as soon as possible!")
21 Q
22 ;
23EN ; -- main loop to complete ART orders on:
24 ; ^OR(100,"ACT",ORVP,invORLOG,ORDG,ORIFN)
25 ;
26 N ORDG,ORNOW,ORVP,ORLOG,ORIFN
27 S ORDG=+$O(^ORD(100.98,"B","ALG",0)) Q:ORDG'>0
28 S ORNOW=+$E($$NOW^XLFDT,1,12),ORVP=$G(^XTMP("ORGMRA","PAT")) I '$D(^(0)) D
29 . S ^XTMP("ORGMRA",0)=$$FMADD^XLFDT(ORNOW,90)_U_ORNOW_"^ART orders completion"
30 F S ORVP=$O(^OR(100,"ACT",ORVP)) Q:ORVP="" D Q:$G(ZTSTOP)
31 . S ORLOG=0 F S ORLOG=$O(^OR(100,"ACT",ORVP,ORLOG)) Q:ORLOG'>0 D
32 .. S ORIFN=0 F S ORIFN=+$O(^OR(100,"ACT",ORVP,ORLOG,ORDG,ORIFN)) Q:ORIFN'>0 D
33 ... Q:$P($G(^OR(100,ORIFN,3)),U,3)=2 ;already completed
34 ... D STATUS^ORCSAVE2(ORIFN,2) S $P(^OR(100,ORIFN,6),U,6)=ORNOW
35 . S ^XTMP("ORGMRA","PAT")=ORVP
36 . I $D(ZTQUEUED) S:$$S^%ZTLOAD ZTSTOP=1 Q:$G(ZTSTOP)
37 I '$G(ZTSTOP) S ^XTMP("ORGMRA","PAT")=-1 D MAIL ;done
38 Q
39 ;
40MAIL ; -- Send completion message to user who initiated conversion
41 N XMSUB,XMTEXT,XMDUZ,XMY,XMZ,XMMG,ORTXT,DIFROM
42 S XMDUZ="PATCH OR*3*216 ART ORDERS COMPLETION",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
43 S ORTXT(1)="The task triggered by patch OR*3*216"_$S($G(ZTSK):" (Task #"_ZTSK_")",1:"")_" to complete ART orders"
44 S ORTXT(2)="finished at "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
45 S XMTEXT="ORTXT(",XMSUB="PATCH OR*3*216 ART ORDERS COMPLETED"
46 D ^XMD
47 Q
Note: See TracBrowser for help on using the repository browser.