source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORMORG.m@ 1046

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

initial load of WorldVistAEHR

File size: 1.8 KB
Line 
1ORMORG ; SLC/MKB - Receive Generic Orders messages ; 08 May 2002 2:12 PM
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**3,79,141**;Dec 17, 1997
3 ;
4EN ; -- entry point for ORG msgs
5 I '$L($T(@ORDCNTRL)) S ORERR="Invalid order control code" Q
6 I 'ORIFN!('$D(^OR(100,+ORIFN,0))) S ORERR="Invalid OE/RR order number" Q
7 D @ORDCNTRL
8 Q
9 ;
10XO ; -- edited order
11NW ; -- new order
12 N OR0,OR3,ORSTS,ORSTRT,ORSTOP,ORIG,ORTYP,ORNOW,OREVT
13 S ^OR(100,+ORIFN,4)=+ORIFN,OR0=$G(^(0)),OR3=$G(^(3))
14 S ORNOW=+$E($$NOW^XLFDT,1,12),ORSTRT=$P(OR0,U,8),OREVT=+$P(OR0,U,17)
15 I 'ORSTRT S ORSTRT=ORNOW D DATES^ORCSAVE2(+ORIFN,ORSTRT)
16 S ORSTS=$S(ORSTRT>ORNOW:8,1:6) D STATUS^ORCSAVE2(+ORIFN,ORSTS)
17 ;I OREVT,$P($G(^ORE(100.2,OREVT,0)),U,4)=+ORIFN,$G(^(1)) D COMP^ORCSAVE2(ORIFN)
18 S ORIG=+$P(OR3,U,5),ORTYP=$P(OR3,U,11) I ORIG,ORTYP D ;edit or renewal
19 . S (ORSTOP,ORSTS)=""
20 . S:ORTYP=1 ORSTOP=ORNOW,ORSTS=12 I ORTYP=2 D
21 .. N STOP,STS S STOP=$P($G(^OR(100,ORIG,0)),U,9),STS=$P($G(^(3)),U,3)
22 .. I "^1^2^7^12^13^"[(U_STS_U),STOP'>ORNOW Q ;already terminated
23 .. S ORSTOP=$S(STOP'>ORNOW:"",ORSTRT<ORNOW:ORNOW,1:ORSTRT)
24 .. S ORSTS=$S("^1^2^7^12^13^"[(U_STS_U):"",ORSTOP>ORNOW:15,1:7)
25 . D:ORSTOP DATES^ORCSAVE2(ORIG,,ORSTOP)
26 . D:ORSTS STATUS^ORCSAVE2(ORIG,ORSTS)
27 . S:'OREVT OREVT=+$P($G(^OR(100,ORIG,0)),U,17)
28 . I OREVT,$P($G(^ORE(100.2,OREVT,0)),U,4)=ORIG,'$G(^(1)) D
29 .. K ^ORE(100.2,"AO",OREVT,ORIG)
30 .. S $P(^ORE(100.2,OREVT,0),U,4)=+ORIFN,^ORE(100.2,"AO",OREVT,+ORIFN)=""
31 .. S:'$P(OR0,U,17) $P(^OR(100,+ORIFN,0),U,17)=OREVT,^OR(100,"AEVNT",ORVP,OREVT,+ORIFN)=""
32 Q
33 ;
34CA ; -- cancel
35DC ; -- discontinue
36 D STATUS^ORCSAVE2(+ORIFN,1) ;also sets stop date
37 Q
38 ;
39HD ; -- hold
40 D STATUS^ORCSAVE2(+ORIFN,3)
41 Q
42 ;
43RL ; -- release hold
44 N STS,NOW,ORSTRT,ORSTOP
45 S ORSTRT=$P(^OR(100,+ORIFN,0),U,8),ORSTOP=$P(^(0),U,9),NOW=$$NOW^XLFDT
46 S STS=$S(ORSTRT>NOW:8,'ORSTOP:6,ORSTOP'>NOW:7,1:6)
47 D STATUS^ORCSAVE2(+ORIFN,STS)
48 Q
Note: See TracBrowser for help on using the repository browser.