Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: IBCICMSP

IBCICMSP.m

Go to the documentation of this file.
  1. IBCICMSP ;DSI/JSR - ClaimsManager STATUS REPORT ;6-APR-2001
  1. ;;2.0;INTEGRATED BILLING;**161**;21-MAR-94
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. ;; ** Program Description **
  1. ; This routine has only 1 entry point EN.
  1. ; This routine is invoked when ^IBCICMS is run from the menu option.
  1. ; ^IBCICMS is and extraction routine which collects claims which
  1. ; the user defined report extracted for reporting purposes.
  1. ; This routine ^IBCICMSP is the print routine which permits the
  1. ; user to print the report to the screen or to queue as a background
  1. ; job which can be stopped at any time using TaskManager.
  1. ; Variables
  1. ; IBCIPXT = (0 or 1) halts job if report is stopped.
  1. ; SORT1 = will always be a 1
  1. ; SORT2 = will always be a 1
  1. ; SORT3 = "1" or the Assigned to person name
  1. ; SORT4 = a space concatenated with whatever data the user is
  1. ; sorting by (terminal digit, Insurance company name,
  1. ; patient last name, negative charge amount, or bill#.
  1. ; SORT5 = 1 will always be a 1
  1. ; MAXCNT = Kernel determines the Max Lines per Page for each device
  1. ; CRT = Determines if output is sent to screen.
  1. ; RPTTYP = Identifies type of report being compiled.
  1. EN ; this is the only entry point
  1. N ASSIGN,AUDIT,COMMEN,CRT,DATE,EFLAG,ERRSEQ,GROUPBY,I,IBCI1,IBCI10
  1. N IBCI2,IBCI3,IBCI4,IBCI5,IBCI6,IBCI7,IBCI8,IBCI9,IBCIARR
  1. N IBCIBEG,IBCIDATA,IBCIDT,IBCIEND,IBCIPGCT,IBCIARR,IBCIEMN
  1. N IBCIRUN,IBCISEQ,IBCITXT,IBCIX,IBIFN,MAXCNT,PREV
  1. N IBCIPXT,RPTTYP,SORT1,SORT2,SORT3,SORT4,SORT5,Y,Z,X,STOP,NAME
  1. S ASSIGN=RPTSPECS("ASNSORT") ; PRIMARY SORT BY ASSIGN TO PERSON 1 YES 0 NO
  1. S COMMEN=RPTSPECS("IBCICOMM") ; FLAG PRINT COMMENT 1 YES 0 NO
  1. S GROUPBY=RPTSPECS("SORTBY") ;TYPE 2=INS LOGIC DIFF SORT4
  1. S IBCIBEG=RPTSPECS("BEGDATE")
  1. S DATE=RPTSPECS("DATYP")
  1. S IBCIEND=RPTSPECS("ENDDATE")
  1. S (IBCIPXT,IBCIPGCT)=0 ; flags quit and header
  1. S Z=($P($G(^IBA(351.91,0)),U,4))
  1. F I=1:1:Z S (IBCIARR(I))=$P($G(^IBA(351.91,I,0)),U,2) ; CM status
  1. S RPTTYP(1)="Terminal Digit"
  1. S RPTTYP(2)="Insurance Company"
  1. S RPTTYP(3)="Patient Last Name"
  1. S RPTTYP(4)="Dollar Impact"
  1. S RPTTYP(5)="Bill Number" ; jsr 6/12/01
  1. ;
  1. I IOST["C" S MAXCNT=IOSL-4,CRT=1
  1. E S MAXCNT=IOSL-6,CRT=0
  1. I RPTSPECS("TYPE")="D" D PRINT ;Detailed report ;DSI/DJW 3/21/02
  1. D PRINT2
  1. 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
  1. I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
  1. G XIT
  1. Q
  1. PRINT ; prints data extracted
  1. I '$D(^TMP($J,IBCIRTN)) D HEADER W ?35,"N O D A T A F O U N D",!!
  1. S SORT1="" F S SORT1=$O(^TMP($J,IBCIRTN,SORT1)) Q:SORT1=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . S SORT2="" F S SORT2=$O(^TMP($J,IBCIRTN,SORT1,SORT2)) Q:SORT2=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . S SORT3="" F S SORT3=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3)) Q:SORT3=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . . I ASSIGN D HEADER
  1. . . . S SORT4="" F S SORT4=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4)) Q:SORT4=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . . . S PREV=SORT4
  1. . . . . I GROUPBY=2,IBCIPXT=0,IBCIPGCT>0 D HEAD2
  1. . . . . S SORT5="" F S SORT5=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5)) Q:SORT5=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . . . . S NAME="" F S NAME=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME)) Q:NAME=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . . . . . S IBIFN="" F S IBIFN=$O(^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)) Q:IBIFN=""!(IBCIPXT=1)!($G(ZTSTOP)) D
  1. . . . . . . . D DATA
  1. . . . . . . . D LINE
  1. . . . . . . . I COMMEN D COMM
  1. ; Exit from the PRINT procedure
  1. Q
  1. ;
  1. PRINT2 ; Print the totals by CM status at the end of the report
  1. ; esg - 5/22/01
  1. ;
  1. I RPTSPECS("TYPE")="D" G PR2 ; detailed report
  1. D HEADER
  1. I '$D(^TMP($J,IBCIRTN)) W ?35,"N O D A T A F O U N D",!! G PRX
  1. PR2 ;
  1. I $D(IBCISCNT),'$G(IBCIPXT),'$G(ZTSTOP) D TOTALS
  1. ;
  1. PRX ; Exit from the PRINT2 procedure
  1. Q
  1. ;
  1. ;
  1. 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
  1. I $D(ZTQUEUED),$$S^%ZTLOAD() S ZTSTOP=1 Q
  1. S IBCIPGCT=IBCIPGCT+1
  1. W @IOF,!,"ClaimsManager Status Report sort by "_RPTTYP(GROUPBY)_" for "
  1. 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)
  1. W ?100,"Page :"_IBCIPGCT,!
  1. I RPTSPECS("TYPE")="S" W "Summary Report"
  1. E W "Detailed Report"
  1. S Y=$$NOW^XLFDT X ^DD("DD") S IBCIRUN=Y
  1. W ?100,"Run Date: "_IBCIRUN,!!
  1. ;
  1. ; skip the column headings for the summary report
  1. I RPTSPECS("TYPE")="S" G HEADERX
  1. ;
  1. 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"
  1. 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"
  1. N X S $P(X,"=",130)="" W !,X,!
  1. HEADERX ;
  1. Q
  1. ;
  1. HEAD2 ; only printed when insurance is a selected sort
  1. Q:GROUPBY'=2
  1. Q:IBCIPXT=1
  1. I $Y+4>MAXCNT,IBCIPXT=0 D HEADER
  1. I $Y=6,IBCIPXT=0 W ?2,"INSURANCE: "_SORT4,!
  1. E W:IBCIPXT=0 !,?2,"INSURANCE: "_SORT4,!
  1. Q
  1. DATA ; formats line item data - note claims with same edit error mnemonic
  1. ; may print mulitple times if the HFCA line item is an unique line
  1. ; with the same error type. The report prints the error mnemonic and
  1. ; the HCFA line # as it relates to IB.
  1. S IBCIDATA=^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)
  1. S IBCI1=$P(IBCIDATA,U,1) ; [1] External Bill#
  1. S IBCI2=$P(IBCIDATA,U,2) ; [2] Patient SSN
  1. S IBCI3=$P(IBCIDATA,U,3) ; ck logic [3] EventDate or Bill
  1. S IBCIDT=$E(IBCI3,4,5)_"/"_$E(IBCI3,6,7)_"/"_$E(IBCI3,2,3)
  1. S IBCI4=$P(IBCIDATA,U,4) ; [4] Biller name
  1. S IBCI5=$P(IBCIDATA,U,5) ; [5] Coder name
  1. S IBCI6=$P(IBCIDATA,U,6) ; [6] Assigned to person name
  1. S IBCI7=$P(IBCIDATA,U,7) ;[7] inpatient/outpatient flag
  1. S IBCI8=$P(IBCIDATA,U,8) ;[8] Charges
  1. S IBCI9=$P(IBCIDATA,U,9) ;[9] ien of current ClaimsManager
  1. S IBCI10=$P(IBCIDATA,U,10) ;[10] String of error code mne
  1. S IBCIX=(IBCIARR(IBCI9))
  1. Q
  1. COMM ; print CM user comments these comments are keyed by the user
  1. I '$D(^IBA(351.9,IBIFN,2,0)) W ! Q ; JSR 6/13/01 line feed correction
  1. I $Y+2>MAXCNT,IBCIPXT=0 D HEADER
  1. Q:IBCIPXT=1
  1. W ?10,$$CMTINFO^IBCIUT5(IBIFN),!
  1. S IBCISEQ=0 F S IBCISEQ=$O(^IBA(351.9,IBIFN,2,IBCISEQ)) Q:'IBCISEQ!(IBCIPXT=1) D
  1. . S IBCITXT=$G(^IBA(351.9,IBIFN,2,IBCISEQ,0))
  1. . I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
  1. . Q:IBCIPXT=1
  1. . W ?28,IBCITXT,!
  1. W !
  1. Q
  1. LINE ; print report detail line
  1. Q:IBCIPXT=1
  1. I $Y+1>MAXCNT,IBCIPXT=0 D HEADER
  1. I IBCIPGCT=0,IBCIPXT=0 D HEADER D HEAD2
  1. Q:IBCIPXT=1
  1. W ?8,IBCI1,?19,$E(NAME,1,23),?44,$E(IBCI2,6,9),?50,IBCIDT
  1. W ?60,$E(IBCI4,1,6),?68,$E(IBCI5,1,6),?76,$E(IBCI6,1,6),?84,IBCI10
  1. W ?102,IBCI7,?108,$J($FN(IBCI8,",",0),6),?116,IBCIX,!
  1. Q
  1. XIT ; one exit point
  1. Q
  1. ;
  1. ;
  1. TOTALS ; Print totals - esg - 5/22/01
  1. NEW CMDESC,CMSTS
  1. I $Y+5>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
  1. W !!?32,"ClaimsManager Bill Totals by ClaimsManager Status",!
  1. S CMDESC=""
  1. F S CMDESC=$O(^IBA(351.91,"B",CMDESC)) Q:CMDESC="" D Q:IBCIPXT!$G(ZTSTOP)
  1. . S CMSTS=0
  1. . F S CMSTS=$O(^IBA(351.91,"B",CMDESC,CMSTS)) Q:'CMSTS D Q:IBCIPXT!$G(ZTSTOP)
  1. .. I '$D(IBCISCNT(1,CMSTS)) Q ; no bill with this status on report
  1. .. I $Y+3>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
  1. .. W !?22,$P(^IBA(351.91,CMSTS,0),U,1),?63,$J(IBCISCNT(1,CMSTS),6)
  1. .. W ?76,$J("$"_$FN(IBCISCNT(2,CMSTS),",",0),12)
  1. .. Q
  1. . Q
  1. Q:IBCIPXT!$G(ZTSTOP)
  1. I $Y+4>MAXCNT D HEADER Q:IBCIPXT!$G(ZTSTOP)
  1. W !?62,"-------",?75,"-------------"
  1. W !?22,"GRAND TOTAL",?63,$J(IBCISCNT(1),6)
  1. W ?76,$J("$"_$FN(IBCISCNT(2),",",0),12)
  1. Q
  1. ;