source: WorldVistAEHR/trunk/r/DSS_EXTRACTS-ECX/ECXAPAS.m@ 701

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

initial load of WorldVistAEHR

File size: 3.3 KB
Line 
1ECXAPAS ;ALB/JAP - PAS Extract Audit Report ;Oct 16, 1997
2 ;;3.0;DSS EXTRACTS;**8**;Dec 22, 1997
3 ;
4EN ;entry point for PAS extract audit report
5 N %X,%Y,X,Y,DIC,DA,DR,DIQ,DIR
6 S ECXERR=0
7 ;ecxaud=0 for 'extract' audit
8 S ECXHEAD="PAS",ECXAUD=0
9 W !!,"Setup for ",ECXHEAD," Extract Audit Report --",!!
10 ;select extract
11 D AUDIT^ECXUTLA(ECXHEAD,.ECXERR,.ECXARRAY,ECXAUD)
12 Q:ECXERR
13 ;currently, quasar does not accommodate multi-divisional sites
14 S ECXALL=1
15 D PAS^ECXDVSN(.ECXDIV,ECXALL,.ECXERR)
16 I ECXERR=1 D Q
17 .W !!,?5,"Try again later... exiting.",!
18 .D AUDIT^ECXKILL
19 ;determine output device and queue if requested
20 W !
21 S ECXPGM="PROCESS^ECXAPAS",ECXDESC="PAS Extract Audit Report"
22 S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXALL")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")=""
23 W !
24 D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
25 I ECXSAVE("POP")=1 D Q
26 .W !!,?5,"Try again later... exiting.",!
27 .D AUDIT^ECXKILL
28 I ECXSAVE("ZTSK")=0 D
29 .K ECXSAVE,ECXPGM,ECXDESC
30 .D PROCESS^ECXAPAS
31 I IO'=IO(0) D ^%ZISC
32 D HOME^%ZIS
33 D AUDIT^ECXKILL
34 Q
35 ;
36PROCESS ;process data in file #727.823
37 N X,Y,W,DATA,DATE,DIV,IEN,QQFLG,CNT
38 K ^TMP($J,"ECXAUD")
39 S (CNT,QQFLG)=0
40 S ECXEXT=ECXARRAY("EXTRACT"),ECXDEF=ECXARRAY("DEF")
41 S X=ECXARRAY("START") D ^%DT S ECXSTART=Y S X=ECXARRAY("END") D ^%DT S ECXEND=Y
42 ;get run date in external format
43 D NOW^%DTC S Y=$E(%,1,12) D DD^%DT S ECXRUN=Y
44 ;get extract records in date range
45 S IEN="" F S IEN=$O(^ECX(727.823,"AC",ECXEXT,IEN)) Q:IEN="" D Q:QQFLG
46 .S DATA=^ECX(727.823,IEN,0),DATE=$P(DATA,U,9),DIV=$P(DATA,U,4)
47 .;currently the 4th piece of extract record is always null for pai
48 .S:DIV="" DIV=1
49 .;convert free text date to fm internal format date
50 .S $E(DATE,1,2)=$E(DATE,1,2)-17
51 .Q:$L(DATE)<7 Q:(DATE<ECXSTART) Q:(DATE>ECXEND)
52 .I $D(ECXDIV(DIV)) D
53 ..I '$D(^TMP($J,"ECXAUD",DIV)) S ^TMP($J,"ECXAUD",DIV)=0
54 ..S ^(DIV)=^TMP($J,"ECXAUD",DIV)+1,CNT=CNT+1
55 ..I $D(ZTQUEUED),(CNT>499),'(CNT#500),$$S^%ZTLOAD S QQFLG=1,ZTSTOP=1 K ZTREQ
56 ;print the report
57 D PRINT
58 D AUDIT^ECXKILL
59 Q
60 ;
61PRINT ;print pai data by site
62 N JJ,SS,LN,P,DIV,DIVNM,GTOT,PG,QFLG,DIR,DIRUT,DTOUT,DUOUT
63 U IO
64 S (QFLG,PG)=0,$P(LN,"-",80)="",DIV=""
65 F S DIV=$O(ECXDIV(DIV)) Q:DIV="" D Q:QFLG
66 .S DIVNM=$P(ECXDIV(DIV),U,2)_" ("_$P(ECXDIV(DIV),U,3)_")" D HEADER
67 .S GTOT=$G(^TMP($J,"ECXAUD",DIV))
68 .D:($Y+3>IOSL) HEADER Q:QFLG
69 .W !!,"Total Patient Assessments extracted for date range: "_GTOT
70 I $E(IOST)'="C" D
71 .W @IOF S PG=PG+1
72 .W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
73 .W !,"DSS Extract Log #: "_ECXEXT
74 .W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
75 .W !,"Report Run Date/Time: "_ECXRUN,?68,"Page: ",PG
76 .W !!,LN,!!
77 .S DIC="^ECX(727.1,",DA=ECXARRAY("DEF"),DR="1" D EN^DIQ
78 I $E(IOST)="C",'QFLG D
79 .S SS=22-$Y F JJ=1:1:SS W !
80 .S DIR(0)="E" W ! D ^DIR K DIR
81 Q
82 ;
83HEADER ;header and page control
84 N JJ,SS
85 I $E(IOST)="C" D
86 .S SS=22-$Y F JJ=1:1:SS W !
87 .I PG>0 S DIR(0)="E" W ! D ^DIR K DIR S:'Y QFLG=1
88 Q:QFLG
89 W:$Y!($E(IOST)="C") @IOF S PG=PG+1
90 W !,ECXARRAY("TYPE")_" ("_ECXHEAD_") Extract Audit Report"
91 W !,"DSS Extract Log #: "_ECXARRAY("EXTRACT")
92 W !,"Date Range of Audit: "_ECXARRAY("START")_" to "_ECXARRAY("END")
93 W !,"Report Run Date/Time: "_ECXRUN
94 W !,"DSS Site: "_$P(ECXDIV(DIV),U,2)_" ("_$P(ECXDIV(DIV),U,3)_")",?68,"Page: "_PG
95 W !,LN,!
96 Q
Note: See TracBrowser for help on using the repository browser.