source: WorldVistAEHR/trunk/r/DSS_EXTRACTS-ECX/ECXCPRO.m@ 1240

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

initial load of WorldVistAEHR

File size: 5.6 KB
Line 
1ECXCPRO ;ALB/JAP - PRO Extract YTD Report ; 8/23/05 1:36pm
2 ;;3.0;DSS EXTRACTS;**21,24,33,84**;Dec 22, 1997
3 ;accumulates extract data by hcpcs code for all extracts in fiscal year date range
4 ;if an extract has been purged, then totals will be falsely low
5 ;if more than 1 extract exists for a particular month, then totals will be falsely high
6 ;if site is multidivisional, then user can generate report for
7 ; any one division - data stored under divisional station# (e.g., 326 or 326AB)
8 ; or for entire facility - data stored under primary station# (e.g., 326) but includes data from all subdivisions
9 ;if site is non-divisional, then data stored under facility station#
10 ;
11 ;
12EN ;setup & queue
13 N DIC,DA,DR,DIQ,DIR,DIRUT,DTOUT,DUOUT,DIV,LAST,OUT
14 S ECXERR=0
15 S ECXHEAD="PRO"
16 W !!,"Setup for PRO Extract YTD HCPCS Report --",!
17 ;determine primary division
18 W !,"If you belong to more than one Primary Division, you must"
19 W !,"select a Primary Division for the report.",!
20 S ECXPRIME=$$PDIV^ECXPUTL
21 I ECXPRIME=0 D ^ECXKILL Q
22 S DA=ECXPRIME,DIC="^DIC(4,",DIQ(0)="I",DIQ="ECXDIC",DR=".01;99" D EN^DIQ1
23 S ECXPRIME=ECXPRIME_U_$G(ECXDIC(4,DA,99,"I"))_U_$G(ECXDIC(4,DA,.01,"I"))
24 ;select 1 or more prosthetics divisions for report
25 D PRO^ECXDVSN2(DUZ,ECXPRIME,.ECXDIV,.ECXALL,.ECXERR)
26 I ECXERR D Q
27 .D ^ECXKILL W !!,?5,"Try again later... exiting.",!
28 ;determine fiscal year of report
29 S DIR(0)="SMBA^C:CURRENT;P:PREVIOUS",DIR("A")="Select C(urrent) or P(revious) Fiscal Year: ",DIR("B")="CURRENT"
30 W ! K X,Y D ^DIR K DIR
31 I $D(DUOUT)!($D(DTOUT)) D Q
32 .D ^ECXKILL W !!,?5,"Try again later... exiting.",!
33 I Y="C" D
34 .S X=$$CYFY^ECXUTL1(DT),ECXARRAY("START")=$P(X,U,3),ECXARRAY("END")=$P(X,U,4)
35 I Y="P" D
36 .S YR=$E(DT,1,3),MON=$E(DT,4,5) S:+MON<10 YR=YR-1 S X1=YR_"0930"
37 .S X=$$CYFY^ECXUTL1(X1),ECXARRAY("START")=$P(X,U,3),ECXARRAY("END")=$P(X,U,4)
38 .K C,MON,YR,X1
39 ;setup variables for taskmanager
40 S ECXPGM="PROCESS^ECXCPRO",ECXDESC="PRO Extract YTD Lab Report"
41 S ECXSAVE("ECXHEAD")="",ECXSAVE("ECXDIV(")="",ECXSAVE("ECXARRAY(")="",ECXSAVE("ECXPRIME")="",ECXSAVE("ECXALL")=""
42 ;determine output device and queue if requested
43 W !!,"Please note: The PRO Extract YTD HCPCS Report requires 132 columns."
44 W !," Select an appropriate device for output."
45 W ! D DEVICE^ECXUTLA(ECXPGM,ECXDESC,.ECXSAVE)
46 I ECXSAVE("POP")=1 W ! D ^ECXKILL Q
47 I ECXSAVE("ZTSK")=0 D
48 .K ECXSAVE,ECXPGM,ECXDESC
49 .D PROCESS
50 ;clean-up and close
51 I IO'=IO(0) D ^%ZISC
52 D HOME^%ZIS
53 Q
54 ;
55PROCESS ;begin processing
56 N DIVISION,E,EXTRACT,REC,NODE0,NODE1,LASTDAY
57 K ^TMP($J,"ECXP") S LASTDAY=""
58 ;determine which extracts contain data for report
59 S (EXTRACT,E)=0
60 F S E=$O(^ECX(727,"E",ECXHEAD,E)) Q:'E D
61 .Q:'$D(^ECX(727,E,0))
62 .Q:$P($G(^ECX(727,E,0)),U,4)<ECXARRAY("START")
63 .Q:$P($G(^ECX(727,E,0)),U,4)>ECXARRAY("END")
64 .Q:$G(^ECX(727,E,"DIV"))'=+ECXPRIME
65 .S EXTRACT(E)=^ECX(727,E,0)
66 .I $P(EXTRACT(E),U,5)>LASTDAY S LASTDAY=$P(EXTRACT(E),U,5)
67 ;setup array of station numbers included in report
68 F DIV=0:0 S DIV=$O(ECXDIV(DIV)) Q:'DIV S ECXSTAT=$P(ECXDIV(DIV),U,2),DIVISION(ECXSTAT)=ECXDIV(DIV)
69 ;get the extract data
70 S E=0 F S E=$O(EXTRACT(E)) Q:'E S REC=0 I $D(^ECX(727.826,"AC",E)) F S REC=$O(^ECX(727.826,"AC",E,REC)) Q:'REC D
71 .S NODE0=$G(^ECX(727.826,REC,0)),NODE1=$G(^ECX(727.826,REC,1)) Q:NODE0=""
72 .S (ECXCTAMT,ECXLLC,ECXLMC)=0
73 .S ECXFELOC=$P(NODE0,U,10),ECXFEKEY=$P(NODE0,U,11)
74 .S ECXHCPC=$P(NODE0,U,33),ECXTYPE=$E(ECXFEKEY,6),ECXSRCE=$E(ECXFEKEY,7)
75 .S ECXQTY=$P(NODE0,U,12),ECXCTAMT=$P(NODE0,U,25),ECXGRPR=$P(NODE1,U,4)
76 .I ECXFELOC["NONL" S ECXSTAT=$P(ECXFELOC,"NONL",1),ECXFORM="NONL"
77 .;if this station is lab requesting station, then count lab transaction
78 .I ECXFELOC["ORD" D
79 ..S ECXSTAT=$P(ECXFELOC,"ORD",1),ECXFORM="ORD"
80 ..S ECXLLC=$P(NODE0,U,26),ECXLMC=$P(NODE0,U,27)
81 .;ignore record for receiving station feeder location
82 .Q:ECXFELOC["LAB"
83 .;ignore record if division not included in this report
84 .Q:ECXSTAT="" Q:'$D(DIVISION(ECXSTAT))
85 .;if combining data from all subdivisions, then set in ^tmp using primary station#
86 .I ECXALL=1 S ECXSTAT=$P(ECXPRIME,U,2)
87 .;be sure there's no padding on cost variables
88 .S ECXCTAMT=+$TR(ECXCTAMT," ",0),ECXLLC=+$TR(ECXLLC," ",0),ECXLMC=+$TR(ECXLMC," ",0)
89 .;tmp global holds - com qty^com cost^va nonlab qty^va nonlab cost^lab qty^lab labor cost^lab matrl cost
90 .I '$D(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC)) S ^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC)="0^0^0^0^0^0^0"
91 .I ECXSRCE="C",ECXFORM="NONL" D
92 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,1)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,1)+ECXQTY
93 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,2)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,2)+ECXCTAMT
94 .I ECXSRCE="V",ECXFORM="NONL" D
95 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,3)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,3)+ECXQTY
96 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,4)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,4)+ECXCTAMT
97 .I ECXFORM="ORD" D
98 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,5)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,5)+ECXQTY
99 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,6)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,6)+ECXLLC
100 ..S $P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,7)=$P(^TMP($J,"ECXP",ECXSTAT,ECXTYPE,ECXHCPC),U,7)+ECXLMC
101 ;setup hcpcs descriptions
102 D HCPCS
103 ;print report
104 D PRINT^ECXCPRO1
105 ;cleanup
106 D AUDIT^ECXKILL
107 Q
108 ;
109HCPCS ;setup hcpcs cross-reference
110 N H,HCPCS,CODE,CPTNM,DESC
111 S H=0
112 F S H=$O(^RMPR(661.1,H)) Q:+H<1 D
113 .;don't skip inactive hcpcs in case doing previous fy
114 .S HCPCS="",HCPCS=$P(^RMPR(661.1,H,0),U,1)
115 .S CODE=$$CPT^ICPTCOD(HCPCS)
116 .I +CODE>0 S CPTNM=$P(CODE,U,2),DESC=$E($P(CODE,U,3),1,26)
117 .Q:CPTNM=""
118 .S ^TMP($J,"HCPCS",CPTNM)=DESC
119 Q
Note: See TracBrowser for help on using the repository browser.