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

IBCNERPF.m

Go to the documentation of this file.
  1. IBCNERPF ;BP/YMG - IBCNE eIV AUTO UPDATE REPORT ;09-MAY-2023
  1. ;;2.0;INTEGRATED BILLING;**416,528,549,595,668,737,763,794**;21-MAR-94;Build 9
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. ; NOTE:
  1. ; IB*2.0*763 is a major re-write of this report. The comments from the previous patches
  1. ; have either been removed or modified to remove the patch number if the comment is relevant.
  1. ;
  1. ; Variables:
  1. ; IBCNESPC("BEGDT") = start date for date range
  1. ; IBCNESPC("ENDDT") = end date for date range
  1. ; IBCNESPC("IBOUT") = "R" for Report format or "E" for Excel format
  1. ; IBCNESPC("ICODETL") = 1 for displaying Ins Co Detail
  1. ; IBCNESPC("INSCO") = "A" (All ins. cos.) OR "S" (Selected ins. cos.)
  1. ; IBCNESPC("PYR",ien) - payer iens for report, if IBCNESPC("PYR")="A", then include all
  1. ; = (1) ^ (2)
  1. ; (1) Display insurance company detail - 0 = No / 1 = Yes
  1. ; (2) Display all or some insurance companies - A = All companies/
  1. ; S = Specified companies
  1. ; IBCNESPC("PYR",ien,coien) - payer iens and company ien for report
  1. ; = Count for insurance company
  1. ; IBCNESPC("PAT",ien) = patient iens for report, if IBCNESPC("PAT")="A", then include all
  1. ; IBCNESPC("TYPE") = report type: "S" - summary, "D" - detailed
  1. ;
  1. Q
  1. EN ; entry point
  1. N IBCNESPC,STOP,TYPE
  1. ;
  1. S STOP=0
  1. W @IOF
  1. W !,"eIV Auto Update Report"
  1. ;
  1. ; Report Type - Summary or Detailed
  1. TYPE ;Type of Report
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^S:Summary;D:Detailed"
  1. S DIR("A")="Run a (S)ummary or (D)etailed Report: "
  1. S DIR("B")="Summary"
  1. D ^DIR
  1. I $D(DIRUT)!$D(DIRUT)!$D(DTOUT)!$D(DUOUT) G EXIT
  1. S (TYPE,IBCNESPC("TYPE"))=Y
  1. I TYPE="S" G SUMMARY
  1. ;
  1. DETAIL ; Prompts in specific order for Detail report.
  1. S IBCNESPC("ICODETL")=1
  1. ;
  1. D10 ; Payer Selection parameter
  1. D PAYER I STOP G:$$STOP EXIT G TYPE
  1. ;
  1. D20 ; Date Range parameters
  1. D DTRANGE I STOP G:$$STOP EXIT G D10
  1. ;
  1. D30 ; Patient Selection parameter
  1. D PATIENT I STOP G:$$STOP EXIT G D20
  1. ;
  1. G IBOUT
  1. ;
  1. SUMMARY ;Prompts in specific order for Summary report
  1. ;
  1. S IBCNESPC("INSCO")="A" ;All insurance companies
  1. S IBCNESPC("PAT")="A" ;All Patients
  1. S IBCNESPC("PYR")="A" ;All Payers
  1. ;
  1. S10 ;Select Payer or Source of Information
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^P:Payer;S:Source of Information"
  1. S DIR("A")="Run for (P)ayer or (S)ource of Information: "
  1. S DIR("?",1)="When selecting '(P)ayer', the report displays the breakout of auto updated"
  1. S DIR("?",2)="entries based on the Payer name."
  1. S DIR("?",3)=""
  1. S DIR("?",4)="When selecting '(S)ource of Information', the report displays the breakout of"
  1. S DIR("?")="auto updated entries based on the Source of Information of the entry."
  1. D ^DIR I $D(DIRUT) G:$$STOP EXIT G TYPE
  1. S IBCNESPC("PS")=Y
  1. I Y="S" D G S40 ;Source of Information does not prompt for Ins Co or Payer.
  1. . S (IBCNESPC("PYR"),IBCNESPC("PAT"))="A"
  1. . S IBCNESPC("ICODETL")=1
  1. ;
  1. S20 ;Prompt for Insurance Company Detail
  1. D ICODETL I STOP G:$$STOP EXIT G S10
  1. ;
  1. S30 ;Prompt for Payer Selection
  1. D PAYER I STOP G:$$STOP EXIT G S20
  1. ;
  1. S40 ; Response Received Date
  1. D DTRANGE I STOP G:$$STOP EXIT G S10:(IBCNESPC("PS")="S") G S30
  1. ;
  1. IBOUT ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. S DIR(0)="SA^E:Excel;R:Report"
  1. S DIR("A")="(E)xcel Format or (R)eport Format: "
  1. S DIR("B")="Report"
  1. D ^DIR I $D(DIRUT) S STOP=1 G:$$STOP EXIT G S40:TYPE="S" G D30
  1. S IBCNESPC("IBOUT")=Y
  1. I Y="E" D
  1. . W !!,"For CSV output, turn logging or capture on now. To avoid undesired wrapping"
  1. . W !,"of the data saved to the file, please enter ""0;"_$S(TYPE="S":"132",1:"256")_";99999"" at the ""DEVICE:"""
  1. . W !,"prompt.",!
  1. I $G(IBCNESPC("TYPE"))="D" W:$G(IBCNESPC("IBOUT"))="R" !!!,"*** This report is 132 characters wide ***",!
  1. ;
  1. ; Select the output device
  1. DEVICE ; Device Handler and possible TaskManager calls
  1. ;
  1. ; Output params:
  1. ; STOP = Flag to stop routine
  1. ;
  1. ; Init vars
  1. N POP,ZTDESC,ZTRTN,ZTSAVE
  1. ;
  1. S ZTRTN="COMPILE^IBCNERPF(.IBCNESPC)"
  1. S ZTDESC="IBCNE eIV Auto Update Report"
  1. S ZTSAVE("IBCNESPC(")=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"QM",1)
  1. ;
  1. EXIT ;
  1. Q
  1. ;
  1. COMPILE(IBCNESPC) ;
  1. ; Entry point called from EN^XUTMDEVQ in either direct or queued mode.
  1. ; Input params:
  1. ; IBCNESPC = Array passed by ref of the report params
  1. ;
  1. ; Init scratch globals
  1. N ALLPAT,ALLPYR
  1. K ^TMP($J,"IBCNERPF")
  1. N IBOUT
  1. ; Compile
  1. S IBOUT=$G(IBCNESPC("IBOUT"))
  1. D EN^IBCNERPG(.IBCNESPC)
  1. ; Print
  1. I '$G(ZTSTOP) D PRINT^IBCNERPG(.IBCNESPC)
  1. ; Close device
  1. D ^%ZISC
  1. ; Kill scratch globals
  1. K ^TMP($J,"IBCNERPF")
  1. ; Purge task record
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. ;
  1. COMPILX ; COMPILE exit pt
  1. Q
  1. ;
  1. PAYER ;
  1. N DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,PIEN,X,Y
  1. W !
  1. S DIR("A")="Run for (A)ll Payers or (S)elected Payers: "
  1. S DIR("A",1)="PAYER SELECTION:"
  1. S DIR(0)="SA^A:All;S:Selected",DIR("B")="A"
  1. D ^DIR
  1. I $D(DIRUT) S STOP=1 Q
  1. S IBCNESPC("PYR")=Y I Y="A" Q ; "All Payers" selected
  1. S DIC(0)="ABEQ"
  1. W !
  1. S DIC("A")="Select Payer: "
  1. ; Only include payers with eIV Auto Update flag = Yes
  1. S DIC("S")="I $$AUTOUPDT^IBCNERPF($P($G(Y),U,1))"
  1. S DIC="^IBE(365.12,"
  1. ;
  1. PAYER1 ;
  1. D ^DIC
  1. I $D(DUOUT)!$D(DTOUT)!(Y=-1) S STOP=1 K IBCNESPC("PYR") Q
  1. S PIEN=$P(Y,U,1) K IBCNESPC("PYR",PIEN) S IBCNESPC("PYR",PIEN)=""
  1. I $G(IBCNESPC("ICODETL")) D GETCOMPS(PIEN,.IBCNESPC)
  1. W !
  1. I $$ANOTHER("Payer") W ! G PAYER1
  1. Q
  1. ;
  1. AUTOUPDT(PIEN) ; Lookup screen to determine if the Auto update flag for payer = Yes
  1. ; Input: PIEN - IEN of the Payer (file 365.12)
  1. ; Returns 1 - Auto update flag is set to 'Y', 0 otherwise
  1. N AUTOUPDT,IENS,MULT
  1. S AUTOUPDT=0
  1. S MULT=$$PYRAPP^IBCNEUT5("EIV",PIEN)
  1. I MULT D
  1. . S IENS=MULT_","_PIEN_","
  1. . S AUTOUPDT=$$GET1^DIQ(365.121,IENS,4.01,"I")
  1. Q AUTOUPDT
  1. ;
  1. GETCOMPS(PIEN,IBCNESPC) ; Get companies linked to payer
  1. ; Get associated insurance companies
  1. ; If user wants to display insurance companies, prompt only for those linked to payer
  1. ; Allow the user to select none, one, or multiple insurance companies associated with a given payer
  1. ;
  1. ; Input
  1. ; PIEN - Payer ID
  1. ; IBCNESPC - Array holding payer id and related insurance companies
  1. ; Output
  1. ; IBCNESPC - Array holding payer id and related insurance companies
  1. ; IBCNESPC("PYR",PIEN) = (1)
  1. ; (1) Display all or some insurance companies - A = All companies/ S = Specified companies
  1. ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. W !
  1. K DIR
  1. S DIR("A")="Run for (A)ll Insurance Companies or (S)elected Insurance Companies: "
  1. S DIR("B")="A"
  1. S DIR(0)="SA^A:All;S:Selected" D ^DIR
  1. Q:$D(DIRUT)
  1. S $P(IBCNESPC("PYR",PIEN),U)=Y
  1. I Y="A" Q ; Run for all companies
  1. S IBCNESPC("INSCO")="S"
  1. K ^TMP("IBCNILKA",$J)
  1. D EN^IBCNILK(2,PIEN,5)
  1. I $D(^TMP("IBCNILKA",$J)) D
  1. . M IBCNESPC("PYR",PIEN)=^TMP("IBCNILKA",$J)
  1. K ^TMP("IBCNILKA",$J)
  1. Q
  1. ;
  1. ICODETL ;Display Insurance Company Detail.
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,IBCNS,X,Y
  1. W !
  1. S DIR("A")="Do you want to display insurance company detail"
  1. S DIR("B")="NO"
  1. S DIR(0)="Y" D ^DIR
  1. I $D(DIRUT) S STOP=1 G ICODETLX
  1. S IBCNESPC("ICODETL")=Y=1
  1. ICODETLX ;
  1. Q
  1. ;
  1. DTRANGE ;
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,IBDT180
  1. ; Default start date to T-180
  1. T180 ;
  1. W !
  1. S IBDT180=$$FMADD^XLFDT($$DT^XLFDT(),-180)
  1. S DIR(0)="D^::EX",DIR("B")=$$FMTE^XLFDT(IBDT180,"D")
  1. S DIR("A")="Earliest Date Received"
  1. S DIR("A",1)="RESPONSE RECEIVED DATE RANGE SELECTION:"
  1. D ^DIR I $D(DIRUT) S STOP=1 Q
  1. I Y>DT W !!,"Future dates not allowed." G T180
  1. I Y<IBDT180 W !!,"Response must not be previous to "_$$FMTE^XLFDT(IBDT180,"D")_"." G T180
  1. S IBCNESPC("BEGDT")=Y
  1. ; End date
  1. DTRANGE1 ;
  1. S DIR("B")="Today"
  1. K DIR("A") S DIR("A")=" Latest Date Received"
  1. D ^DIR I $D(DIRUT) S STOP=1 Q
  1. I Y>DT W !!,"Future dates not allowed." G DTRANGE1
  1. I Y<IBCNESPC("BEGDT") W !," Latest Date must not precede the Earliest Date." G DTRANGE1
  1. S IBCNESPC("ENDDT")=Y
  1. Q
  1. ;
  1. PATIENT ;
  1. N DIC,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. ; summary report is always run for all patients
  1. I $G(IBCNESPC("TYPE"))="S" S IBCNESPC("PAT")="A" Q
  1. W !
  1. S DIR("A")="Run for (A)ll Patients or (S)elected Patients: "
  1. S DIR("A",1)="PATIENT SELECTION:"
  1. S DIR(0)="SA^A:All;S:Selected",DIR("B")="A"
  1. D ^DIR
  1. I $D(DIRUT) S STOP=1 Q
  1. I Y="A" S IBCNESPC("PAT")="A" Q ; "All Patients" selected
  1. S DIC(0)="AMEQ" ;IB*794/DTG change ABEQ to AMEQ to allow for ssn lookup (multi-indexes)
  1. S DIC("A")="Select Patient: "
  1. S DIC="^DPT("
  1. PATIENT1 ;
  1. D ^DIC
  1. I $D(DUOUT)!$D(DTOUT)!(Y=-1) S STOP=1 K IBCNESPC("PAT") Q
  1. S IBCNESPC("PAT",$P(Y,U,1))=""
  1. I $$ANOTHER("Patient") G PATIENT1
  1. Q
  1. ;
  1. ANOTHER(TYPE) ; "Select Another" prompt
  1. ; returns 1, if response was "YES", returns 0 otherwise
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR("A")="Select Another "_TYPE S DIR(0)="Y",DIR("B")="NO"
  1. D ^DIR I $D(DIRUT) S STOP=1
  1. Q Y
  1. ;
  1. STOP() ; Determine if user wants to exit out of the whole option
  1. ; Init vars
  1. N DIR,X,Y,DIRUT
  1. ;
  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)!$D(DTOUT) S (STOP,Y)=1 G STOPX
  1. I 'Y S STOP=0
  1. ;
  1. STOPX ; STOP exit pt
  1. Q Y
  1. ;