source: WorldVistAEHR/trunk/r/ORDER_ENTRY_RESULTS_REPORTING-OR-OCX--ORRC--ORRJ/ORY260.m@ 1608

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

initial load of WorldVistAEHR

File size: 4.3 KB
RevLine 
[613]1ORY260 ; SLC/STAFF - Patch OR*3.0*260 post init ;8/21/06 13:13
2 ;;3.0;ORDER ENTRY/RESULTS REPORTING;**260**;Dec 17, 1997;Build 26
3POST ; post-init to patch OR*3.0*260
4 ; fix any string formatted date/times in CR index
5 ; remove Treatment type from graphing
6 N DA,DIR,ORMSG,ZTDESC,ZTDTH,ZTIO,ZTRTN,ZTSAVE K DIR,ORMSG
7 S ORMSG(1)="A task is being queued in the background to identify"
8 S ORMSG(2)="any Start or Start dates where times have trailing zeros."
9 S ORMSG(3)=""
10 S ORMSG(4)="These indexes will be reset with the correct canonic"
11 S ORMSG(5)="values by this background job. A mail message will be"
12 S ORMSG(6)="sent to the initiator of this patch at completion."
13 S ORMSG(7)=""
14 S ORMSG(8)=""
15 S ZTRTN="DQ^ORY260",ZTIO=""
16 S ZTDESC="Clean up - Patch 260",ZTDTH=$H,ZTSAVE("DUZ")=""
17 D ^%ZTLOAD
18 S ORMSG(9)="The task number is "_$G(ZTSK)
19 D MES^XPDUTL(.ORMSG) I '$D(ZTQUEUED) D
20 . N DIR,Y
21 . S DIR(0)="E",DIR("A")="Press return - installation is complete."
22 . D ^DIR
23 Q
24 ;
25DQ ; dequeued
26 N BEGIN,CNT,DFN,ITEM,NODE,OK,START,STOP K ^TMP("ORPXRM",$J),^TMP("ORTXT",$J)
27 S BEGIN=$$NOW^XLFDT
28 S CNT=0
29 S DFN=0
30 F S DFN=$O(^PXRMINDX(100,"PI",DFN)) Q:DFN<1 D
31 . S ITEM=0
32 . F S ITEM=$O(^PXRMINDX(100,"PI",DFN,ITEM)) Q:ITEM<1 D
33 .. S START=""
34 .. F S START=$O(^PXRMINDX(100,"PI",DFN,ITEM,START)) Q:START="" D
35 ... S STOP=""
36 ... F S STOP=$O(^PXRMINDX(100,"PI",DFN,ITEM,START,STOP)) Q:STOP="" D
37 .... S OK=1
38 .... I START'=+START S OK=0
39 .... I OK,$E(STOP)'="U",STOP'=+STOP S OK=0
40 .... I OK Q
41 .... S NODE=""
42 .... F S NODE=$O(^PXRMINDX(100,"PI",DFN,ITEM,START,STOP,NODE)) Q:NODE="" D
43 ..... S ^TMP("ORPXRM",$J,NODE)=DFN_U_ITEM_U_START_U_STOP
44 ..... S CNT=CNT+1
45 ..... ;W !,NODE,?20,$P($G(^OR(100,+NODE,0)),U,8),?35,$P($G(^OR(100,+NODE,0)),U,9),?55,START
46 S ^TMP("ORTXT",$J,4)="-- "_CNT_" nodes to check --" ; overwrite on finish
47 S ^TMP("ORTXT",$J,5)=" "
48 S CNT=5
49 S NODE=""
50 F S NODE=$O(^TMP("ORPXRM",$J,NODE)) Q:NODE="" D
51 . D FIX(NODE,.CNT)
52 S ^TMP("ORTXT",$J,4)="-- "_(CNT-5)_" changes made --"
53 K ^TMP("ORPXRM",$J)
54 D TREMOVE("ORWG GRAPH VIEW") ; removes treatment type from graphing
55 D MAIL(BEGIN)
56 K ^TMP("ORTXT",$J)
57 Q
58 ;
59FIX(NODE,CNT) ;
60 N DA,DATE1,DATE2,DFN,DIE,DR,ITEM,LINE,START,STOP,VALUES,ZERO
61 S VALUES=$G(^TMP("ORPXRM",$J,NODE))
62 S DFN=$P(VALUES,U)
63 S ITEM=$P(VALUES,U,2)
64 S DATE1=$P(VALUES,U,3)
65 S DATE2=$P(VALUES,U,4)
66 K ^PXRMINDX(100,"PI",DFN,ITEM,DATE1,DATE2,NODE)
67 K ^PXRMINDX(100,"IP",ITEM,DFN,DATE1,DATE2,NODE)
68 S DIE="^OR(100,"
69 S DA=+NODE
70 S ZERO=$G(^OR(100,DA,0))
71 S START=+$P(ZERO,U,8) I START=0 S START="@"
72 S STOP=+$P(ZERO,U,9) I STOP=0 S STOP="@"
73 S DR=""
74 I START'=DATE1 S DR="21///"_START
75 I START="@",$P(ZERO,U,8)="" S DR=""
76 I STOP'=DATE2 D
77 . I STOP="@",$E(DATE2)="U" Q
78 . I $L(DR) S DR=DR_";22///"_STOP Q
79 . S DR="22///"_STOP Q
80 I '$L(DR) Q
81 S LINE="Node: "_NODE
82 I DR["21///" S LINE=LINE_"; Start: "_DATE1_" -> "_START
83 I DR["22///" S LINE=LINE_"; Stop: "_DATE2_" -> "_STOP
84 D ^DIE
85 S CNT=CNT+1
86 S ^TMP("ORTXT",$J,CNT)=LINE
87 Q
88 ;
89TREMOVE(PARAM) ;
90 N ENTITY,INST,LINES,OK,VALUES K LINES,VALUES
91 D XENVAL^ORWGAPIX(.VALUES,PARAM)
92 I '$L($O(VALUES(""))) Q
93 S ENTITY=""
94 F S ENTITY=$O(VALUES(ENTITY)) Q:ENTITY="" D
95 . S INST=""
96 . F S INST=$O(VALUES(ENTITY,INST)) Q:INST="" D
97 .. D XGETWP^ORWGAPIX(.LINES,ENTITY,PARAM,INST)
98 .. D FIXLINES(.LINES,.OK)
99 .. I 'OK D FIXIT(.LINES,ENTITY,PARAM,INST)
100 Q
101 ;
102FIXLINES(LINES,OK) ;
103 N I,LINE,NLINE,NLINES,NNUM,NUM,PART K NLINES
104 S OK=1,NNUM=0
105 S NUM=0
106 F S NUM=$O(LINES(NUM)) Q:NUM<1 D
107 . S LINE=$G(LINES(NUM,0))
108 . I '$L(LINE) Q
109 . S NLINE=LINE
110 . I LINE["~9000010.15" D
111 .. S NLINE="",OK=0
112 .. F I=1:1:999 S PART=$P(LINE,"|",I) Q:PART="" D
113 ... I PART["~9000010.15" Q
114 ... S NLINE=NLINE_PART_"|"
115 . I NLINE="" Q
116 . S NNUM=NNUM+1
117 . S NLINES(NNUM,0)=NLINE
118 I OK Q
119 K LINES
120 M LINES=NLINES
121 Q
122 ;
123FIXIT(LINES,ENTITY,PARAM,INST) ;
124 D XDEL^ORWGAPIX(ENTITY,PARAM,INST)
125 I $L($O(LINES(""))) D XEN^ORWGAPIX(ENTITY,PARAM,INST,.LINES)
126 Q
127 ;
128MAIL(BEGIN) ; -- Send completion message to user who initiated cleanup
129 N TIMES,XMSUB,XMTEXT,XMDUN,XMDUZ,XMY,XMZ K XMY
130 S XMDUZ="PATCH OR*3.0*260 CLEAN-UP",XMY(.5)="" S:$G(DUZ) XMY(DUZ)=""
131 S TIMES="Started: "_$$FMTE^XLFDT(BEGIN)_"; Completed: "_$$FMTE^XLFDT($$NOW^XLFDT)_"."
132 S ^TMP("ORTXT",$J,1)="Clean up for patch OR*3.0*260"
133 S ^TMP("ORTXT",$J,2)=TIMES
134 S ^TMP("ORTXT",$J,3)="Order Node Date Cleanup:"
135 S XMTEXT="^TMP(""ORTXT"","_$J_","
136 S XMSUB="PATCH OR*3.0*260 Clean Up COMPLETED"
137 D ^XMD
138 Q
Note: See TracBrowser for help on using the repository browser.