source: FOIAVistA/tag/r/REGISTRATION-DGQE-DG-DPT-GRPX-VAD-VAF-VAS-VAT-VAU--VA-VIC--DGBT--DGJ--DGYA--VALM/DGHTRPT1.m@ 1590

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

initial load of FOIAVistA 6/30/08 version

File size: 4.9 KB
Line 
1DGHTRPT1 ;ALB/JRC - Home Telehealth Transmissions Report ; 10/14/05 12:38pm
2 ;;5.3;Registration;**644**;Aug 13, 1993;Build 11
3 ;
4EN ;entry point from option
5 ;Declare variable(s) and arrays
6 N DGSD,DGED,I,ZTDESC,ZTIO,ZTSAVE,FLAG,SORT
7 S FLAG=0
8 ;Get beginning and ending dates
9 D GETDATES Q:FLAG
10 ;Get sort
11 D GETSORT Q:FLAG
12 ;Queue Report
13 S ZTIO=""
14 S ZTDESC="Home Telehealth Transmission Report"
15 F I="DGSD","DGED","SORT" D
16 .S ZTSAVE(I)=""
17 D EN^XUTMDEVQ("EN1^DGHTRPT1",ZTDESC,.ZTSAVE)
18 Q
19 ;
20EN1 ;Tasked entry point
21 ;Input : DGSD - FM format report start date
22 ; DGED - FM format report end date
23 ;
24 ;Output : None
25 ;
26 ;Declare variables
27 N DGSD1,DGED1,CNT,ICNT,ACNT,LN,SCRNARR
28 N NODE,STOP,PAGENUM,FLAG
29 S DGED1=DGED+.9999,DGSD1=DGSD-.0001,(CNT,ACNT,ICNT,PAGENUM,STOP)=0
30 S SCRNARR="^TMP(""DGHT"",$J,""SCRNARR"")",FLAG=0
31 K @SCRNARR
32 D HEADER I STOP D EXIT Q
33 D GETDATA
34 I 'CNT D Q
35 .W !
36 .W !,"***********************************************"
37 .W !,"* NOTHING TO REPORT FOR SELECTED TIME FRAME *"
38 .W !,"***********************************************"
39 .D WAIT
40 D DETAIL I STOP D EXIT Q
41 D TOTAL
42 D EXIT
43 Q
44 ;
45GETDATES ;Prompt for start date
46 N DIR,DIRUT,X,Y
47 S DIR(0)="D^:NOW:EX"
48 S DIR("A")="Enter Report Start Date"
49 S DIR("B")=$$FMTE^XLFDT($$NOW^XLFDT,"1D")
50 D ^DIR
51 I $D(DIRUT) S FLAG=1 Q
52 S DGSD=Y
53 ;Prompt for end date
54 K DIR,DIRUT,X,Y
55 S DIR(0)="D^:NOW:EX"
56 S DIR("A")="Enter Report Ending Date"
57 S DIR("B")=$$FMTE^XLFDT($$NOW^XLFDT,"1D")
58 D ^DIR
59 I $D(DIRUT) S FLAG=1 Q
60 S DGED=Y
61 Q
62 ;
63GETSORT ;Select sort, 1 for patient or 2 for trans date
64 ;Declare variables
65 N DIR,X,Y,DIRUT,DIROUT,DTOUT,DUOUT
66 ;Get sort
67 S DIR(0)="SC^1:Patient;2:Transmission Date;"
68 S DIR("A")="Select sorting criteria"
69 D ^DIR
70 I $D(DIRUT) S FLAG=1 Q
71 S SORT=Y
72 Q
73 ;
74GETDATA ;Get data
75 ;Declare variables
76 N DG0,DG1,DGDA0,DGDA1,PATIENT,VENDOR,INACTDT,DATE,MSGTYPE,STATUS
77 F S DGSD1=$O(^DGHT(391.31,"C",DGSD1)) Q:(DGSD1>DGED1)!('DGSD1) D
78 .S DGDA0=0
79 .F S DGDA0=$O(^DGHT(391.31,"C",DGSD1,DGDA0)) Q:'DGDA0 D
80 ..S DGDA1=0
81 ..F S DGDA1=$O(^DGHT(391.31,"C",DGSD1,DGDA0,DGDA1)) Q:'DGDA1 D
82 ...;Get data nodes and icrement conunter
83 ...S DG0=$G(^DGHT(391.31,DGDA0,0))
84 ...Q:DG0=""
85 ...S DG1=$G(^DGHT(391.31,DGDA0,"TRAN",DGDA1,0))
86 ...;Quit if there is no transaction data or type = inactivation
87 ...Q:DG1=""
88 ...Q:$P(DG1,U,4)="I"
89 ...S PATIENT=$P(DG0,U,2),VENDOR=$P(DG0,U,3),INACTDT=$P(DG0,U,7)
90 ...S DATE=$P(DG1,U,1),MSGTYPE=$P(DG1,U,4)
91 ...I 'INACTDT S STATUS="Active"
92 ...;If there is an Inactivation date validate trans status
93 ...I INACTDT D
94 ....S DGDA1=$O(^DGHT(391.31,DGDA0,"TRAN",DGDA1))
95 ....S DG1=$G(^DGHT(391.31,DGDA0,"TRAN",DGDA1,0))
96 ....S STATUS=$S($P(DG1,U,7)="A":"Inactive",$P(DG1,U,7)="R":"Active",1:"Active")
97 ...;Resolve external values for PATIENT
98 ...S PATIENT=$$GET1^DIQ(2,PATIENT,.01,"E")
99 ...;Resolve external value for VENDOR
100 ...S VENDOR=$$GET1^DIQ(4,VENDOR,.01,"E")
101 ...;Resolve external value for COORD
102 ...;Increment counters and save for later
103 ...S CNT=CNT+1
104 ...I STATUS="Active" S ACNT=ACNT+1
105 ...I STATUS="Inactive" S ICNT=ICNT+1
106 ...S ^TMP("DGHT",$J,$S(SORT=1:PATIENT,1:DATE),CNT)=PATIENT_U_STATUS_U_DATE_U_VENDOR
107 Q
108HEADER ;print header
109 S PAGENUM=PAGENUM+1
110 S $P(LN,"-",80)=""
111 W @IOF
112 W !,"Home Telehealth Patient Summary Report ",?65,"Page: ",PAGENUM
113 W !!,"Report for ",$$FMTE^XLFDT(DGSD)," thru ",$$FMTE^XLFDT(DGED)
114 W !!,?1,"Patient",?25,"Status",?34,"Date of Last Change",?56,"HT Vendor"
115 W !?1,LN
116 Q
117 ;
118DETAIL ;Print detailed line
119 ;Input : ^TMP("DGHT",$J) full global reference
120 ; PATIENT - HTH Patient
121 ; STATUS - Registration Status
122 ; DATE - Event/Transmission Date
123 ; VENDOR - HTH Vendor Server
124 ;Output : None
125 ;Declare variables
126 N SORT,RECORD
127 S SORT=""
128 F S SORT=$O(^TMP("DGHT",$J,SORT)) Q:SORT="" D Q:STOP
129 .S RECORD=0 F S RECORD=$O(^TMP("DGHT",$J,SORT,RECORD)) Q:'RECORD!(STOP) D Q:STOP
130 ..S NODE=^TMP("DGHT",$J,SORT,RECORD)
131 ..W !,?1,$E($P(NODE,U,1),1,22),?25,$P(NODE,U,2),?34,$$FMTE^XLFDT($P(NODE,U,3),"2Z"),?56,$E($P(NODE,U,4),1,23)
132 ..I $Y>(IOSL-5) D WAIT Q:STOP D HEADER
133 Q
134 ;
135TOTAL ;Report totals
136 W !!?1,"Total Number of Active Patient Record(s): ",?45,$J($FNUMBER(ACNT,",",0),8)
137 W !?1,"Total Number of Inactive Patient Record(s): ",?45,$J($FNUMBER(ICNT,",",0),8)
138 W !?1,"Total Number of Patient Record(s): ",?45,$J($FNUMBER(CNT,",",0),8)
139 Q
140 ;
141WAIT ;End of page logic
142 ;Input ; None
143 ;Output ; STOP - Flag inidcating if printing should continue
144 ; 1 = Stop 0 = Continue
145 ;
146 S STOP=0
147 ;CRT - Prompt for continue
148 I $E(IOST,1,2)="C-"&(IOSL'>24) D Q
149 .F Q:$Y>(IOSL-3) W !
150 .N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
151 .S DIR(0)="E"
152 .D ^DIR
153 .S STOP=$S(Y'=1:1,1:0)
154 ;Background task - check taskman
155 S STOP=$$S^%ZTLOAD()
156 I STOP D
157 .W !,"*********************************************"
158 .W !,"* PRINTING OF REPORT STOPPED AS REQUESTED *"
159 .W !,"*********************************************"
160 Q
161EXIT ;Kill temp global
162 K ^TMP("DGHT",$J)
163 Q
Note: See TracBrowser for help on using the repository browser.