source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCICMSP.m@ 1742

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

initial load of FOIAVistA 6/30/08 version

File size: 7.5 KB
Line 
1IBCICMSP ;DSI/JSR - ClaimsManager STATUS REPORT ;6-APR-2001
2 ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;; ** Program Description **
5 ; This routine has only 1 entry point EN.
6 ; This routine is invoked when ^IBCICMS is run from the menu option.
7 ; ^IBCICMS is and extraction routine which collects claims which
8 ; the user defined report extracted for reporting purposes.
9 ; This routine ^IBCICMSP is the print routine which permits the
10 ; user to print the report to the screen or to queue as a background
11 ; job which can be stopped at any time using TaskManager.
12 ; Variables
13 ; IBCIPXT = (0 or 1) halts job if report is stopped.
14 ; SORT1 = will always be a 1
15 ; SORT2 = will always be a 1
16 ; SORT3 = "1" or the Assigned to person name
17 ; SORT4 = a space concatenated with whatever data the user is
18 ; sorting by (terminal digit, Insurance company name,
19 ; patient last name, negative charge amount, or bill#.
20 ; SORT5 = 1 will always be a 1
21 ; MAXCNT = Kernel determines the Max Lines per Page for each device
22 ; CRT = Determines if output is sent to screen.
23 ; RPTTYP = Identifies type of report being compiled.
24EN ; this is the only entry point
25 N ASSIGN,AUDIT,COMMEN,CRT,DATE,EFLAG,ERRSEQ,GROUPBY,I,IBCI1,IBCI10
26 N IBCI2,IBCI3,IBCI4,IBCI5,IBCI6,IBCI7,IBCI8,IBCI9,IBCIARR
27 N IBCIBEG,IBCIDATA,IBCIDT,IBCIEND,IBCIPGCT,IBCIARR,IBCIEMN
28 N IBCIRUN,IBCISEQ,IBCITXT,IBCIX,IBIFN,MAXCNT,PREV
29 N IBCIPXT,RPTTYP,SORT1,SORT2,SORT3,SORT4,SORT5,Y,Z,X,STOP,NAME
30 S ASSIGN=RPTSPECS("ASNSORT") ; PRIMARY SORT BY ASSIGN TO PERSON 1 YES 0 NO
31 S COMMEN=RPTSPECS("IBCICOMM") ; FLAG PRINT COMMENT 1 YES 0 NO
32 S GROUPBY=RPTSPECS("SORTBY") ;TYPE 2=INS LOGIC DIFF SORT4
33 S IBCIBEG=RPTSPECS("BEGDATE")
34 S DATE=RPTSPECS("DATYP")
35 S IBCIEND=RPTSPECS("ENDDATE")
36 S (IBCIPXT,IBCIPGCT)=0 ; flags quit and header
37 S Z=($P($G(^IBA(351.91,0)),U,4))
38 F I=1:1:Z S (IBCIARR(I))=$P($G(^IBA(351.91,I,0)),U,2) ; CM status
39 S RPTTYP(1)="Terminal Digit"
40 S RPTTYP(2)="Insurance Company"
41 S RPTTYP(3)="Patient Last Name"
42 S RPTTYP(4)="Dollar Impact"
43 S RPTTYP(5)="Bill Number" ; jsr 6/12/01
44 ;
45 I IOST["C" S MAXCNT=IOSL-4,CRT=1
46 E S MAXCNT=IOSL-6,CRT=0
47 I RPTSPECS("TYPE")="D" D PRINT ;Detailed report ;DSI/DJW 3/21/02
48 D PRINT2
49 I CRT,IBCIPGCT>0,'$D(ZTQUEUED),IBCIPXT=0 S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S IBCIPXT=1 Q
50 I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
51 G XIT
52 Q
53PRINT ; prints data extracted
54 I '$D(^TMP($J,IBCIRTN)) D HEADER W ?35,"N O D A T A F O U N D",!!
55 S SORT1="" F S SORT1=$O(^TMP($J,IBCIRTN,SORT1)) Q:SORT1=""!(IBCIPXT=1)!($G(ZTSTOP)) D
56 . S SORT2="" F S SORT2=$O(^TMP($J,IBCIRTN,SORT1,SORT2)) Q:SORT2=""!(IBCIPXT=1)!($G(ZTSTOP)) D
57 . . S SORT3="" F S SORT3=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3)) Q:SORT3=""!(IBCIPXT=1)!($G(ZTSTOP)) D
58 . . . I ASSIGN D HEADER
59 . . . S SORT4="" F S SORT4=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4)) Q:SORT4=""!(IBCIPXT=1)!($G(ZTSTOP)) D
60 . . . . S PREV=SORT4
61 . . . . I GROUPBY=2,IBCIPXT=0,IBCIPGCT>0 D HEAD2
62 . . . . S SORT5="" F S SORT5=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5)) Q:SORT5=""!(IBCIPXT=1)!($G(ZTSTOP)) D
63 . . . . . S NAME="" F S NAME=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME)) Q:NAME=""!(IBCIPXT=1)!($G(ZTSTOP)) D
64 . . . . . . S IBIFN="" F S IBIFN=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)) Q:IBIFN=""!(IBCIPXT=1)!($G(ZTSTOP)) D
65 . . . . . . . D DATA
66 . . . . . . . D LINE
67 . . . . . . . I COMMEN D COMM
68 ; Exit from the PRINT procedure
69 Q
70 ;
71PRINT2 ; Print the totals by CM status at the end of the report
72 ; esg - 5/22/01
73 ;
74 I RPTSPECS("TYPE")="D" G PR2 ; detailed report
75 D HEADER
76 I '$D(^TMP($J,IBCIRTN)) W ?35,"N O D A T A F O U N D",!! G PRX
77PR2 ;
78 I $D(IBCISCNT),'$G(IBCIPXT),'$G(ZTSTOP) D TOTALS
79 ;
80PRX ; Exit from the PRINT2 procedure
81 Q
82 ;
83 ;
84HEADER ; header for main report
85 I CRT,IBCIPGCT>0,'$D(ZTQUEUED),IBCIPXT=0 S DIR(0)="E" D ^DIR K DIR I $D(DTOUT)!($D(DUOUT)) S IBCIPXT=1 Q
86 I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
87 S IBCIPGCT=IBCIPGCT+1
88 W @IOF,!,"ClaimsManager Status Report sort by "_RPTTYP(GROUPBY)_" for "
89 W $E(IBCIBEG,4,5)_"/"_$E(IBCIBEG,6,7)_"/"_$E(IBCIBEG,2,3)_" thru "_$E(IBCIEND,4,5)_"/"_$E(IBCIEND,6,7)_"/"_$E(IBCIEND,2,3)
90 W ?100,"Page :"_IBCIPGCT,!
91 I RPTSPECS("TYPE")="S" W "Summary Report"
92 E W "Detailed Report"
93 S Y=$$NOW^XLFDT X ^DD("DD") S IBCIRUN=Y
94 W ?100,"Run Date: "_IBCIRUN,!!
95 ;
96 ; skip the column headings for the summary report
97 I RPTSPECS("TYPE")="S" G HEADERX
98 ;
99 I DATE=1 W ?8,"BILL NO.",?18,"PATIENT NAME",?44,"PID",?50," EVENT",?60,"BILLER",?68,"CODER",?76,"ASSIGN",?84,"ERROR CODES",?102,"TYPE",?108,"CHARGES",?116,"CM STATUS"
100 E W ?8,"BILL NO.",?18,"PATIENT NAME",?44,"PID",?50," ENTER",?60,"BILLER",?68,"CODER",?76,"ASSIGN",?84,"ERROR CODES",?102,"TYPE",?108,"CHARGES",?116,"CM STATUS"
101 N X S $P(X,"=",130)="" W !,X,!
102HEADERX ;
103 Q
104 ;
105HEAD2 ; only printed when insurance is a selected sort
106 Q:GROUPBY'=2
107 Q:IBCIPXT=1
108 I $Y+4>MAXCNT,IBCIPXT=0 D HEADER
109 I $Y=6,IBCIPXT=0 W ?2,"INSURANCE: "_SORT4,!
110 E W:IBCIPXT=0 !,?2,"INSURANCE: "_SORT4,!
111 Q
112DATA ; formats line item data - note claims with same edit error mnemonic
113 ; may print mulitple times if the HFCA line item is an unique line
114 ; with the same error type. The report prints the error mnemonic and
115 ; the HCFA line # as it relates to IB.
116 S IBCIDATA=^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)
117 S IBCI1=$P(IBCIDATA,U,1) ; [1] External Bill#
118 S IBCI2=$P(IBCIDATA,U,2) ; [2] Patient SSN
119 S IBCI3=$P(IBCIDATA,U,3) ; ck logic [3] EventDate or Bill
120 S IBCIDT=$E(IBCI3,4,5)_"/"_$E(IBCI3,6,7)_"/"_$E(IBCI3,2,3)
121 S IBCI4=$P(IBCIDATA,U,4) ; [4] Biller name
122 S IBCI5=$P(IBCIDATA,U,5) ; [5] Coder name
123 S IBCI6=$P(IBCIDATA,U,6) ; [6] Assigned to person name
124 S IBCI7=$P(IBCIDATA,U,7) ;[7] inpatient/outpatient flag
125 S IBCI8=$P(IBCIDATA,U,8) ;[8] Charges
126 S IBCI9=$P(IBCIDATA,U,9) ;[9] ien of current ClaimsManager
127 S IBCI10=$P(IBCIDATA,U,10) ;[10] String of error code mne
128 S IBCIX=(IBCIARR(IBCI9))
129 Q
130COMM ; print CM user comments these comments are keyed by the user
131 I '$D(^IBA(351.9,IBIFN,2,0)) W ! Q ; JSR 6/13/01 line feed correction
132 I $Y+2>MAXCNT,IBCIPXT=0 D HEADER
133 Q:IBCIPXT=1
134 W ?10,$$CMTINFO^IBCIUT5(IBIFN),!
135 S IBCISEQ=0 F S IBCISEQ=$O(^IBA(351.9,IBIFN,2,IBCISEQ)) Q:'IBCISEQ!(IBCIPXT=1) D
136 . S IBCITXT=$G(^IBA(351.9,IBIFN,2,IBCISEQ,0))
137 . I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
138 . Q:IBCIPXT=1
139 . W ?28,IBCITXT,!
140 W !
141 Q
142LINE ; print report detail line
143 Q:IBCIPXT=1
144 I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
145 I IBCIPGCT=0,IBCIPXT=0 D HEADER D HEAD2
146 Q:IBCIPXT=1
147 W ?8,IBCI1,?19,$E(NAME,1,23),?44,$E(IBCI2,6,9),?50,IBCIDT
148 W ?60,$E(IBCI4,1,6),?68,$E(IBCI5,1,6),?76,$E(IBCI6,1,6),?84,IBCI10
149 W ?102,IBCI7,?108,$J($FN(IBCI8,",",0),6),?116,IBCIX,!
150 Q
151XIT ; one exit point
152 Q
153 ;
154 ;
155TOTALS ; Print totals - esg - 5/22/01
156 NEW CMDESC,CMSTS
157 I $Y+5>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
158 W !!?32,"ClaimsManager Bill Totals by ClaimsManager Status",!
159 S CMDESC=""
160 F S CMDESC=$O(^IBA(351.91,"B",CMDESC)) Q:CMDESC="" D Q:IBCIPXT!$G(ZTSTOP)
161 . S CMSTS=0
162 . F S CMSTS=$O(^IBA(351.91,"B",CMDESC,CMSTS)) Q:'CMSTS D Q:IBCIPXT!$G(ZTSTOP)
163 .. I '$D(IBCISCNT(1,CMSTS)) Q ; no bill with this status on report
164 .. I $Y+3>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
165 .. W !?22,$P(^IBA(351.91,CMSTS,0),U,1),?63,$J(IBCISCNT(1,CMSTS),6)
166 .. W ?76,$J("$"_$FN(IBCISCNT(2,CMSTS),",",0),12)
167 .. Q
168 . Q
169 Q:IBCIPXT!$G(ZTSTOP)
170 I $Y+4>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
171 W !?62,"-------",?75,"-------------"
172 W !?22,"GRAND TOTAL",?63,$J(IBCISCNT(1),6)
173 W ?76,$J("$"_$FN(IBCISCNT(2),",",0),12)
174 Q
175 ;
Note: See TracBrowser for help on using the repository browser.