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

IBCICMS.m

Go to the documentation of this file.
  1. IBCICMS ;DSI/ESG - IBCI CLAIMSMANAGER STATUS REPORT ;2-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. ;
  1. NEW STOP,IBCIRTN,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,POP,RPTSPECS
  1. ;
  1. S STOP=0
  1. S IBCIRTN="IBCICMS"
  1. W @IOF
  1. W !?10,"ClaimsManager Status Report",!
  1. A10 D DATE I STOP G EXIT
  1. A20 D DTRANGE I STOP G:$$STOP EXIT G A10
  1. A30 D STATUS I STOP G:$$STOP EXIT G A20
  1. A40 D TYPE I STOP G:$$STOP EXIT G A30
  1. A50 D SELASN I STOP G:$$STOP EXIT G A40
  1. A60 D ASSIGN I STOP G:$$STOP EXIT G A50
  1. A70 D SORTBY I STOP G:$$STOP EXIT G A60
  1. A75 D COMMENTS I STOP G:$$STOP EXIT G A70
  1. A80 D DEVICE(IBCIRTN) I STOP G:$$STOP EXIT G:RPTSPECS("TYPE")="S" A40 G A75
  1. ;
  1. EXIT ;
  1. QUIT ; quit from routine
  1. ;
  1. COMPILE ; This entry point is called from EN^XUTMDEVQ in either
  1. ; direct mode or queued mode.
  1. NEW IBCISCNT
  1. D BUILD ; compile report
  1. I '$G(ZTSTOP) D EN^IBCICMSP ; print report
  1. D ^%ZISC ; close the device
  1. KILL ^TMP($J,IBCIRTN) ; kill scratch global
  1. I $D(ZTQUEUED) S ZTREQ="@" ; purge the task record
  1. COMPX ;
  1. QUIT ; quit from routine
  1. ;
  1. ;
  1. STOP() ; See if the user wants to exit out of the whole option
  1. W !
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to exit out of this option entirely"
  1. S DIR("B")="YES"
  1. S DIR("?",1)=" Enter YES to immediately exit out of this option."
  1. S DIR("?")=" Enter NO to return to the previous question."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S (STOP,Y)=1 G STOPX
  1. I 'Y S STOP=0
  1. STOPX ;
  1. Q Y
  1. ;
  1. DATE ;
  1. W !
  1. S DIR(0)="SO^1:Event Date (Date of Service);2:Entered Date (Date of Entry into VistA)"
  1. S DIR("A")="Select Date Range by"
  1. S DIR("B")="Event Date"
  1. S DIR("?",1)=" Please enter the type of date on which you would like to report."
  1. S DIR("?",2)=" The Event Date is the date on which the services were performed."
  1. S DIR("?")=" The Entered Date is the date on which the bill was Entered into VistA."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G DATEX
  1. S RPTSPECS("DATYP")=Y
  1. S RPTSPECS("DATYP1")=$S(Y=1:"Event",1:"Entered")
  1. DATEX ;
  1. Q
  1. ;
  1. DTRANGE ;
  1. NEW X,Y,%DT
  1. W !
  1. S %DT="AEX"
  1. S %DT("A")="Enter the beginning "_RPTSPECS("DATYP1")_" Date: "
  1. S %DT(0)="-NOW"
  1. D ^%DT
  1. I Y=-1!$D(DTOUT) S STOP=1 G DTRNGX
  1. S RPTSPECS("BEGDATE")=Y
  1. W !
  1. S %DT="AEX"
  1. S %DT("A")=" Enter the ending "_RPTSPECS("DATYP1")_" Date: "
  1. S %DT(0)=RPTSPECS("BEGDATE")
  1. D ^%DT
  1. I Y=-1!$D(DTOUT) S STOP=1 G DTRNGX
  1. S RPTSPECS("ENDDATE")=Y
  1. DTRNGX ;
  1. Q
  1. ;
  1. ;
  1. STATUS ;
  1. NEW CH,IEN,TXT
  1. W !
  1. S CH="1:All ClaimsManager Statuses;"
  1. S CH=CH_"2:One Specific ClaimsManager Status;"
  1. S CH=CH_"3:Any ClaimsManager Status (Bill is still Editable)"
  1. S DIR(0)="SO^"_CH
  1. S DIR("A")="Select the ClaimsManager Status Option"
  1. S DIR("B")=3
  1. S DIR("?",1)=" Option 1 - All ClaimsManager Statuses - indicates that all bills"
  1. S DIR("?",2)=" will be included on the report regardless of ClaimsManager"
  1. S DIR("?",3)=" status."
  1. S DIR("?",4)=" "
  1. S DIR("?",5)=" Option 2 - One Specific ClaimsManager Status - will allow you to"
  1. S DIR("?",6)=" choose a ClaimsManager status and only bills with this specific"
  1. S DIR("?",7)=" status will be included on the report."
  1. S DIR("?",8)=" "
  1. S DIR("?",9)=" Option 3 - Any ClaimsManager Status (Bill is still Editable) -"
  1. S DIR("?",10)=" will only select those bills that are still open for editing in"
  1. S DIR("?")=" the IB Enter/Edit Billing Information option."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G STATX
  1. S RPTSPECS("STATYP")=Y,RPTSPECS("IBCISTAT")=""
  1. I RPTSPECS("STATYP")'=2 G STATX
  1. ;
  1. ; Ask the user which status they want to report on
  1. W !
  1. S IEN=0,CH=""
  1. F S IEN=$O(^IBA(351.91,IEN)) Q:'IEN D
  1. . S TXT=$P($G(^IBA(351.91,IEN,0)),U,2)
  1. . I CH="" S CH=IEN_":"_TXT
  1. . E S CH=CH_";"_IEN_":"_TXT
  1. . Q
  1. S DIR(0)="SO^"_CH
  1. S DIR("A")="Please choose a ClaimsManager Status"
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G STATX
  1. S RPTSPECS("IBCISTAT")=Y
  1. STATX ;
  1. Q
  1. ;
  1. ;
  1. COMMENTS ;
  1. S RPTSPECS("IBCICOMM")=1 ; default
  1. I RPTSPECS("TYPE")="S" G COMMX ; don't ask if summary
  1. W !
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to see ClaimsManager comments associated with these bills"
  1. S DIR("B")="YES"
  1. S DIR("?",1)=" Enter YES if you would like to see the comments which are stored in the"
  1. S DIR("?",2)=" ClaimsManager file (#351.9) for each bill on this report."
  1. S DIR("?",3)=""
  1. S DIR("?")=" Enter NO if you do not want to see these comments."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G COMMX
  1. S RPTSPECS("IBCICOMM")=+Y
  1. COMMX ;
  1. Q
  1. ;
  1. ;
  1. SELASN ;
  1. W !
  1. S DIR(0)="F^1:1"
  1. S DIR("A",1)="Do you want to include one specific Assigned to person or All?"
  1. S DIR("A")="Please enter 1 or A"
  1. S DIR("B")="A"
  1. S DIR("?",1)=" Enter '1' to indicate that you only want to include one specific"
  1. S DIR("?",2)=" Assigned to person on this report. You will then be asked"
  1. S DIR("?",3)=" to select this person."
  1. S DIR("?",4)=""
  1. S DIR("?",5)=" Enter 'A' to indicate that you want to include all Assigned to"
  1. S DIR("?",6)=" people on this report. You will then be asked if you want"
  1. S DIR("?")=" to sort by the Assigned to person."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G SELASNX
  1. I '$F(".1.A.","."_Y_".") W *7," Invalid response ... Please enter '1' or 'A'" G SELASN
  1. S RPTSPECS("SELASN")=Y
  1. SELASNX ;
  1. Q
  1. ;
  1. ;
  1. ASSIGN ;
  1. NEW DIC,X,Y
  1. W !
  1. S RPTSPECS("ASNSORT")=0
  1. S RPTSPECS("ASNDUZ")=0
  1. I RPTSPECS("SELASN")="A" D G ASSIGNX
  1. . I RPTSPECS("TYPE")="S" Q ; don't ask this if summary
  1. . S DIR(0)="Y"
  1. . S DIR("A")="Do you want the primary sort by the Assigned To person"
  1. . S DIR("B")="YES"
  1. . S DIR("?",1)=" Enter YES if you would like the bills on this report primarily"
  1. . S DIR("?",2)=" sorted by the Assigned To person. If a bill is not assigned"
  1. . S DIR("?",3)=" to anyone, then the word ""UNASSIGNED"" will be used."
  1. . S DIR("?",4)=""
  1. . S DIR("?")=" Enter NO if you would like to choose a different primary sort."
  1. . D ^DIR K DIR
  1. . I $D(DIRUT) S STOP=1 Q
  1. . S RPTSPECS("ASNSORT")=+Y
  1. . Q
  1. ;
  1. ; At this point, we know that the user wants to include only one
  1. ; assigned to person. We need to select this person here.
  1. ;
  1. S DIC="^VA(200,"
  1. S DIC(0)="AEMQO"
  1. S DIC("A")="Enter the Assigned to person to include: "
  1. S DIC("S")="I $D(^IBA(351.9,""ASN"",+Y))"
  1. I $D(^IBA(351.9,"ASN",DUZ)) S DIC("B")=DUZ
  1. D ^DIC
  1. I Y<0 S STOP=1 G ASSIGNX
  1. S RPTSPECS("ASNDUZ")=+Y
  1. ASSIGNX ;
  1. Q
  1. ;
  1. ;
  1. SORTBY ;
  1. S RPTSPECS("SORTBY")=3 ; default
  1. I RPTSPECS("TYPE")="S" G SORTBYX ; don't ask if summary
  1. NEW CH,PS
  1. W !
  1. S CH="1:Terminal Digit;"
  1. S CH=CH_"2:Insurance Company Name;"
  1. S CH=CH_"3:Patient Last Name;"
  1. S CH=CH_"4:Total Charges;"
  1. S CH=CH_"5:Bill Number"
  1. S DIR(0)="SO^"_CH
  1. S PS=$S(RPTSPECS("ASNSORT"):"secondary",1:"primary")
  1. S DIR("A")="Please enter the "_PS_" sort criteria"
  1. S DIR("B")="Patient Last Name"
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G SORTBYX
  1. S RPTSPECS("SORTBY")=Y
  1. SORTBYX ;
  1. Q
  1. ;
  1. TYPE ;
  1. W !
  1. S DIR(0)="S^D:Detailed;S:Summary"
  1. S DIR("A")="Please enter the report type"
  1. S DIR("B")="Detailed"
  1. S DIR("?",1)=" The Detailed report will show the breakout of bills &"
  1. S DIR("?",2)=" a summary based on the criteria that you selected."
  1. S DIR("?",3)=""
  1. S DIR("?",4)=" The Summary report will show the total amount of bills"
  1. S DIR("?")=" based on the criteria that you selected."
  1. D ^DIR K DIR
  1. I $D(DIRUT) S STOP=1 G TYPEX
  1. S RPTSPECS("TYPE")=Y
  1. TYPEX ;
  1. Q
  1. ;
  1. DEVICE(IBCIRTN) ; Device Handler and possible TaskManager calls
  1. NEW ZTRTN,ZTDESC,ZTSAVE,POP
  1. W !!!,"*** This report is 132 characters wide ***",!
  1. S ZTRTN="COMPILE^"_IBCIRTN
  1. S ZTDESC="IBCI ClaimsManager Status Report"
  1. I IBCIRTN="IBCICME" S ZTDESC="IBCI ClaimsManager Error Report"
  1. S ZTSAVE("RPTSPECS(")=""
  1. S ZTSAVE("IBCIRTN")=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE)
  1. I POP S STOP=1
  1. DEVICEX ;
  1. Q
  1. ;
  1. ;
  1. BUILD ; Build the scratch global based on the selection and sort criteria
  1. ;
  1. NEW SUBSCRPT,RDT,IBIFN,CMDATA,IBDATA,CMSTATUS,BILLID,PATDATA
  1. NEW NAME,SSN,BILLER,CODER,OIFLG,ASSIGNED,CHARGES,ERR,ERRCODES
  1. NEW SORT1,SORT2,SORT3,SORT4,SORT5,RPTDATA,COUNT,ASNSUB,NAMESUB
  1. NEW INSNAME
  1. ;
  1. KILL ^TMP($J,IBCIRTN)
  1. ;
  1. S SUBSCRPT="D" ; for event date looping
  1. I RPTSPECS("DATYP")=2 S SUBSCRPT="APD" ; for entry date looping
  1. ;
  1. ; Get the starting date for looping purposes
  1. S RDT=$O(^DGCR(399,SUBSCRPT,RPTSPECS("BEGDATE")),-1)
  1. ;
  1. S COUNT=0
  1. ; Main loop....stop when we get to a date after the report end date
  1. F S RDT=$O(^DGCR(399,SUBSCRPT,RDT)) Q:'RDT!($P(RDT,".",1)>RPTSPECS("ENDDATE"))!$G(ZTSTOP) D
  1. . S IBIFN=0
  1. . F S IBIFN=$O(^DGCR(399,SUBSCRPT,RDT,IBIFN)) Q:'IBIFN!$G(ZTSTOP) D
  1. .. S COUNT=COUNT+1
  1. .. I $D(ZTQUEUED),COUNT#100=0,$$S^%ZTLOAD() S ZTSTOP=1 Q
  1. .. S CMDATA=$G(^IBA(351.9,IBIFN,0))
  1. .. I CMDATA="" Q
  1. .. S IBDATA=$G(^DGCR(399,IBIFN,0))
  1. .. I IBDATA="" Q
  1. .. ;
  1. .. ; If the user chose a specific ClaimsManager status to report
  1. .. ; on, then make sure this bill has the status they want.
  1. .. S CMSTATUS=$P(CMDATA,U,2)
  1. .. I RPTSPECS("STATYP")=2,CMSTATUS'=RPTSPECS("IBCISTAT") Q
  1. .. ;
  1. .. ; If the user wants to see bills that are still open for editing
  1. .. I RPTSPECS("STATYP")=3,'$F(".1.","."_$P(IBDATA,U,13)_".") Q ;DSI/DJW 3/21/02
  1. .. ;
  1. .. ; If the user wants to include a specific assigned to person,
  1. .. ; then make sure the assigned to person is the one they want.
  1. .. I RPTSPECS("ASNDUZ"),RPTSPECS("ASNDUZ")'=$P(CMDATA,U,12) Q
  1. .. ;
  1. .. ; At this point, we know we want to include this bill.
  1. .. D GETDATA^IBCICME1
  1. .. S ^TMP($J,IBCIRTN,SORT1,SORT2,SORT3,SORT4,SORT5,NAME,IBIFN)=RPTDATA
  1. .. Q
  1. . Q
  1. ;
  1. BUILDX ;
  1. Q
  1. ;
  1. ;