source: WorldVistAEHR/trunk/r/TEXT_INTEGRATION_UTILITIES-GMRP-TIU/TIUPS185.m@ 1489

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1TIUPS185 ;SLC/TT - REPORT FOR TIU REASSIGNMENT DOCUMENTS; 03/17/04 [7/14/04 11:36am]
2 ;;1.0; TEXT INTEGRATION UTILITIES;**185**;Jun 20, 1997
3 Q
4EN ;
5 ;
6 K ^TMP("TIUPS185",$J) ;ENSURE FRESH START
7 N TIUSAVE,DRANGE
8 D ASKDATE(.DRANGE) Q:$G(DRANGE("EXIT"))="YES"
9 S TIUSAVE("*")=""
10 D EN^XUTMDEVQ("REPORT^TIUPS185","REPORT FOR TIU REASSIGNMENT DOCUMENTS",.TIUSAVE)
11 Q
12 ;
13ASKDATE(DRANGE) ; ASK USER FOR DATE RANGE
14 ; DRANGE - DATE RANGE FOR REPORT
15 ;
16 N %DT,DIR,X,Y,POP,CNT
17 S %DT="AE"
18 F CNT=1:1:2 D
19 .S %DT("A")=$S(CNT=1:"ENTER STARTING DATE: ",CNT=2:"ENTER ENDING DATE: ")
20 .S %DT("B")=$S(CNT=1:"JAN 01, 2003",CNT=2:$P($$HTE^XLFDT($H),"@"))
21 .D ^%DT
22 .I Y=-1 S CNT=2,DRANGE("EXIT")="YES" Q
23 .I CNT=1 D
24 ..I Y["0000" S Y=Y/10000,Y=Y_"0101"
25 ..S DRANGE("START")=Y
26 .I CNT=2 D
27 ..I Y["0000" S Y=Y/10000,Y=Y_"1231"
28 ..S DRANGE("END")=Y_".24"
29 Q
30 ;
31REPORT ; PRINT REPORT
32 ; AUDIEN - TIU AUDIT TRAIL IEN
33 ; REDT - REASSIGNMENT DATE/TIME
34 ; DOCIEN - TIU DOCUMENT IEN
35 ; INPAT - INITIAL PATIENT
36 ; POSTPAT - FINAL PATIENT
37 ; DNAME - TIU DOCUMENT NAME
38 ;
39 N REDT,DOCIEN,INPAT,POSTPAT,DNAME,TIME,COUNT,SEARCHN
40 S (DOCIEN,COUNT,SEARCHN)=0,TIME("START")=$$NOW^XLFDT
41 W:'$D(ZTQUEUED) !,"Searching...",!!
42 F S DOCIEN=$O(^TIU(8925.5,DOCIEN)) Q:DOCIEN'>0 S SEARCHN=SEARCHN+1 D
43 .Q:'$D(^TIU(8925.5,DOCIEN,0))
44 .Q:'$D(^TIU(8925.5,DOCIEN,1))
45 .S REDT=$P(^TIU(8925.5,DOCIEN,1),"^")
46 .I ((REDT'<DRANGE("START"))&(REDT'>DRANGE("END"))) D
47 ..S INPAT=$E($$GET1^DIQ(8925.5,DOCIEN,1.03),1,19)
48 ..S:INPAT="" INPAT="UNKNOWN"
49 ..S POSTPAT=$E($$GET1^DIQ(8925.5,DOCIEN,1.04),1,19)
50 ..S:POSTPAT="" POSTPAT="UNKNOWN"
51 ..S DNAME=$E($$GET1^DIQ(8925.5,DOCIEN,.01),1,15)
52 ..S:DNAME="" DNAME="UNKNOWN"
53 ..S COUNT=COUNT+1
54 ..S ^TMP("TIUPS185",$J,REDT)=DNAME_"^"_INPAT_"^"_POSTPAT
55 S TIME("STOP")=$$NOW^XLFDT,TIME("ELAP")=$FN($$FMDIFF^XLFDT(TIME("START"),TIME("STOP"),2)/60,"-")
56 I COUNT=0 W !!?20,"NO DOCUMENTS FOUND!"
57 E D
58 .D GENINFO
59 .D DISPLAY
60 Q
61 ;
62DISPLAY ;DISPLAY DATA
63 ;
64 I $E(IOST,1,2)'="C-" D HDR
65 N INP,FINALP,DATETM,STOP,DOCNM,LINECNT,DATA
66 S (DATETM,STOP,LINECNT)=0
67 F S DATETM=$O(^TMP("TIUPS185",$J,DATETM)) Q:(DATETM="") D Q:STOP
68 .S DATA=$G(^TMP("TIUPS185",$J,DATETM))
69 .S DOCNM=$P(DATA,"^",1),INP=$P(DATA,"^",2),FINALP=$P(DATA,"^",3)
70 .I $E(IOST,1,2)="C-" D
71 ..I 'LINECNT W @IOF D HDR
72 ..W !,DOCNM,?17,INP,?38,FINALP,?58,$$FMTE^XLFDT(DATETM)
73 ..S LINECNT=LINECNT+1
74 ..I LINECNT=17 W ! S STOP='$$PAUSE,LINECNT=0
75 .E W !,DOCNM,?17,INP,?38,FINALP,?58,$$FMTE^XLFDT(DATETM)
76 Q
77 ;
78HDR ; REPORT HEADER
79 ;
80 N TITLE
81 S TITLE="TIU REASSIGNMENT DOCUMENT REPORT"
82 W !?(IOM-$L(TITLE))/2,TITLE
83 W !!,"DOCUMENT NAME",?17,"INITIAL PATIENT",?38,"FINAL PATIENT",?58,"REASSIGNMENT DATE/TIME"
84 W !,"=============",?17,"===============",?38,"=============",?58,"======================"
85 Q
86 ;
87GENINFO ; GENERAL INFORMATION
88 ;
89 N LINE,TXT
90 F LINE=1:1 S TXT=$P($T(TEXT+LINE),";;",2) Q:TXT="EOT" W @TXT,!
91 Q
92 ;
93PAUSE() ;
94 N DIR,X,Y,DTOUT,DUOUT,DIRUT
95 S DIR(0)="E"
96 D ^DIR
97 Q $S(Y'=1:0,1:1)
98 ;
99TEXT ;
100 ;;"Date range searched: "_($$FMTE^XLFDT(DRANGE("START"),"D"))_" - "_($$FMTE^XLFDT(DRANGE("END"),"D"))
101 ;;"Number of records searched: "_SEARCHN
102 ;;"Number of records found: "_COUNT
103 ;;"Elapsed time: "_(TIME("ELAP")\1)_" minute(s) "_($FN((TIME("ELAP")#1)*60,"-",0))_" second(s)"
104 ;;"Current user: "_($$GET1^DIQ(200,+DUZ,.01))
105 ;;"Current date: "_($$HTE^XLFDT($H))
106 ;;EOT
107 Q
Note: See TracBrowser for help on using the repository browser.