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

FBPAID3B.m

Go to the documentation of this file.
  1. FBPAID3B ;DSS/SCR - Utilities to support FEE BASIS PAID TO IB Process ;3/28/1012
  1. ;;3.5;FEE BASIS;**135**;JAN 30, 1995;Build 3
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. EPFBPRV() ;EP FROM OPTION [FB PROVIDER TO IB]
  1. ;
  1. ;REPORTING OPTION FOR FB PAID TO IB AUTOMATIC INTERFACE TO IB NON/OTHER VA BILLING PROVIDER FILE
  1. ;
  1. N DUOUT,DIRUT,DTOUT,FBQUIT,DIR,FBFROM,FBTO,FBDATE,FBIEN,FBNODE,FBPROG,FBNPI,FBNPISRT,Y,X1,X2,X,FBQUIT1
  1. N FBTODATE
  1. ;
  1. S FBQUIT1=0
  1. F Q:FBQUIT1 D
  1. .K ^TMP($J,"FBPAID3B")
  1. .S FBQUIT=0
  1. .D CLEAR()
  1. .S DIR("A")="ENTER FIRST date to include in reports"
  1. .S DIR(0)="D"
  1. .D ^DIR
  1. .I $D(DUOUT) S FBQUIT1=1 ;DEFINED IF USER ENTERS ONE UP ARROW
  1. .I $D(DIRUT) S FBQUIT1=1 ;DEFINED IF USER ENTERS TWO UP ARROWS
  1. .I $D(DTOUT) S FBQUIT1=1 ;DEFINED IF USER TIMES OUT
  1. .W:'FBQUIT1 " "_Y(0)
  1. .I 'FBQUIT1 D
  1. ..S FBFROM=+Y
  1. ..S DIR("A")="ENTER LAST date to include in reports"
  1. ..S DIR(0)="D"
  1. ..D ^DIR
  1. ..I $D(DUOUT) S FBQUIT1=1 ;DEFINED IF USER ENTERS ONE UP ARROW
  1. ..I $D(DIRUT) S FBQUIT1=1 ;DEFINED IF USER ENTERS TWO UP ARROWS
  1. ..I $D(DTOUT) S FBQUIT1=1 ;DEFINED IF USER TIMES OUT
  1. ..W:'FBQUIT1 " "_Y(0)
  1. .I 'FBQUIT1 D
  1. ..S FBTO=+Y
  1. ..S X1=FBFROM
  1. ..S X2=-1
  1. ..D C^%DTC ;SUBTRACT ONE DAY FROM THE 'START' DATE FOR $O
  1. ..S FBDATE=X
  1. ..;FIRST GATHER THE SORTED DATA TO BE REPORTED IN A TMP ARRAY
  1. ..F S FBDATE=$O(^FB(161.9,"AC",FBDATE)) Q:(FBDATE>FBTO)!(FBDATE="") D
  1. ...S FBIEN=0
  1. ...F S FBIEN=$O(^FB(161.9,"AC",FBDATE,FBIEN)) Q:FBIEN="" D
  1. ....S FBNODE=^FB(161.9,FBIEN,0)
  1. ....S FBPROG=$P(FBNODE,U,2)
  1. ....S FBNPI=$P(FBNODE,U,8)
  1. ....S:FBNPI'="" ^TMP($J,"FBPAID3B",FBDATE,FBPROG,FBNPI,FBIEN)=FBNODE ;only include processed records
  1. ..I '$D(^TMP($J,"FBPAID3B")) W !,"No Processed Entries in Date Range" Q
  1. ..;NOW SET UP FILTERING IN A LOOP so more than one report can be generated from it
  1. ..F Q:FBQUIT D
  1. ...D CLEAR()
  1. ...S DIR("A")="SELECT PROGRAM TYPE to include"
  1. ...S DIR(0)="S^3:OUTPATIENT;9:CIVIL HOSPITAL;0:BOTH"
  1. ...D ^DIR
  1. ...I $D(DUOUT) S FBQUIT=1 ;DEFINED IF USER ENTERS ONE UP ARROW
  1. ...I $D(DIRUT) S FBQUIT=1 ;DEFINED IF USER ENTERS TWO UP ARROWS
  1. ...I $D(DTOUT) S FBQUIT=1 ;DEFINED IF USER TIMES OUT
  1. ...Q:FBQUIT
  1. ...S FBPROG=+Y
  1. ...S DIR("A")="SELECT NPI STATUS to include"
  1. ...S DIR(0)="S^0:FOR NO NPI UPDATES ATTEMPTED;1:NPI DATA INVALID;2:NPI MATCHED ACTIVE, NO UPDATES;"
  1. ...S DIR(0)=DIR(0)_"3:NPI MATCHED INACTIVE, NO UPDATES;4:NPI MATCHED ACTIVE, IB UPDATED;5:NPI NEW, IB RECORD CREATED;"
  1. ...S DIR(0)=DIR(0)_"99:ALL"
  1. ...D ^DIR
  1. ...I $D(DUOUT) S FBQUIT=1 ;DEFINED IF USER ENTERS ONE UP ARROW
  1. ...I $D(DIRUT) S FBQUIT=1 ;DEFINED IF USER ENTERS TWO UP ARROWS
  1. ...I $D(DTOUT) S FBQUIT=1 ;DEFINED IF USER TIMES OUT
  1. ...Q:FBQUIT
  1. ...S FBNPISRT=+Y
  1. ...D DISPLAY(FBPROG,FBNPISRT,FBFROM,FBTO)
  1. K ^TMP($J,"FBPAID3B")
  1. Q
  1. DISPLAY(FBPROG,FBNPISRT,FBFROM,FBTO) ;DISPLAYS SUBSET OF SORTED INFO IN ^TMP
  1. ;
  1. ; INPUT : FBPROG - a number identifying the selected program
  1. ; FBNPISRT - a number indentifying the selected NPI sort value
  1. ; FBFROM - the "FROM DATE" selected by user
  1. ; FBTO - The "TO DATE" selected by user
  1. ;
  1. N FBNDATE,FBTYPE1,FBNPI1,FBIEN,FBPATIEN,FBICTRL,FBLINUM,FBPTYPE,FBIBPNTR,FBQUIT,FBERR,FBHDSTG,FBHDSTG1
  1. N FBICNTRL,FBPAT,FBTXY,FBVNDR,FBINVDT,FBHDSTG2,FBDAT1,FBDAT2,DO,DD,X,%,%H,%I,FBNOW,FBFIRST,%ZIS,FBPINFO
  1. ;
  1. D NOW^%DTC
  1. S Y=%
  1. D DD^%DT
  1. S FBNOW=Y
  1. S FBQUIT=0
  1. S FBFIRST=1
  1. S %ZIS("A")="OUTPUT DEVICE: "
  1. D ^%ZIS
  1. I POP S FBQUIT=1
  1. Q:FBQUIT
  1. S FBNDATE=0
  1. S Y=FBFROM
  1. D DD^%DT
  1. S FBDAT1=Y
  1. S Y=FBTO
  1. D DD^%DT
  1. S FBDAT2=Y
  1. W !
  1. W ?10,"**** FEE BASIS PROVIDER TO IB REPORT ****"
  1. W !,?20,FBNOW
  1. W !,?8,"PROCESS DATES: "_FBDAT1_" - "_FBDAT2
  1. W !,?8,"PROGRAM: "_$S(FBPROG=0:"BOTH",FBPROG=3:"OUTPATIENT",FBPROG=9:"CIVIL HOSPITAL",1:"")_" NPI SORT: "_$S(FBNPISRT=99:"ALL",1:$$GTNPIVAL(FBNPISRT))
  1. W !
  1. F S FBNDATE=$O(^TMP($J,"FBPAID3B",FBNDATE)) Q:(FBNDATE=""!FBQUIT) D
  1. .S Y=FBNDATE
  1. .D DD^%DT
  1. .S FBHDSTG="PROCESS DATE: "_Y
  1. .S FBTYPE1=""
  1. .F S FBTYPE1=$O(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1)) Q:(FBTYPE1=""!FBQUIT) D
  1. ..I FBPROG'=0&(FBTYPE1'=FBPROG) Q ;NOT A PROGRAM TYPE WE WANT TO REPORT ON
  1. ..S:FBTYPE1=3 FBHDSTG1="OUTPATIENT"
  1. ..S:FBTYPE1=9 FBHDSTG1="CIVIL HOSPITAL"
  1. ..S FBNPI1=""
  1. ..S FBFIRST=1
  1. ..F S FBNPI1=$O(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1)) Q:(FBNPI1=""!FBQUIT) D
  1. ...I (FBNPISRT'=99)&(FBNPISRT'=FBNPI1) Q ;NOT AN NPI UPDATE VALUE WE WANT TO REPORT ON
  1. ...S FBHDSTG2=$$GTNPIVAL(FBNPI1)
  1. ...I ((IOT="VTRM")&'FBFIRST) D
  1. ....S DIR("A")="PRESS ENTER TO CONTINUE"
  1. ....S DIR(0)="FO"
  1. ....D ^DIR
  1. ....I $D(DUOUT) S FBQUIT=1 ;DEFINED IF USER ENTERS ONE UP ARROW
  1. ....I $D(DTOUT) S FBQUIT=1 ;DEFINED IF USER TIMES OUT
  1. ...Q:FBQUIT
  1. ...S FBIEN=0
  1. ...W !,?3,FBHDSTG_" "_FBHDSTG1_" "_FBHDSTG2,!
  1. ...F S FBIEN=$O(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN)) Q:FBIEN="" D
  1. ....S FBPATIEN=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,1)
  1. ....S FBICNTRL=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,3)
  1. ....S FBLINUM=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,5)
  1. ....S FBPTYPE=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,6)
  1. ....S FBIBPNTR=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,7)
  1. ....S FBTXY=$P(^TMP($J,"FBPAID3B",FBNDATE,FBTYPE1,FBNPI1,FBIEN),U,9)
  1. ....;NOW GET INFO FROM THE FEE BASIS PAYMENT FILE IF THIS IS A TYPE 3
  1. ....I FBTYPE1=3 S FBPINFO=$$GTPYMNT(FBICNTRL)
  1. ....W:FBTYPE1=3 !,?5,$P(FBPINFO,U,1)_" => "_$P(FBPINFO,U,2)_" => "
  1. ....W:FBTYPE1=3 !,?8,$P(FBPINFO,U,3)_" => "_$P(FBPINFO,U,4)
  1. ....W:FBTYPE1=9 !,?5,"INVOICE: "_FBICNTRL
  1. ....W !,?5,"IB PROVIDER NAME: "_$$GTIBNAM(FBIBPNTR)
  1. ....W !,?8,$$GTTXYVAL(FBIEN)
  1. ....W !,?5,"PROVIDER TYPE: "_$$GTPRVTYP(FBIEN)
  1. ....W:FBLINUM>0 " "_"(LI) "_FBLINUM
  1. ....W !
  1. ....S FBFIRST=0
  1. Q
  1. ;
  1. GTPRVTYP(FBIEN) ;RETURNS EXTERNAL VALUE FOR A CODE IN A SET
  1. ;
  1. Q:FBIEN="" ""
  1. Q $$GET1^DIQ(161.9,FBIEN_",",.06,"","","FBERR")
  1. ;
  1. GTIBNAM(FBIBPNTR) ;RETURNS EXTERNAL VALUE FOR NAME OF IB NON/OTHER VA BILLING PROVIDER
  1. ; INPUT : FBIBPNTR - pointer to the IB NON/OTHER VA BILLING PROVIDER FILE - 355,93
  1. N FBERR
  1. Q:FBIBPNTR="" ""
  1. Q $$GET1^DIQ(355.93,FBIBPNTR_",",.01,"","","FBERR")
  1. ;
  1. GTTXYVAL(FBIEN) ;RETURNS EXTERNAL VALUE FOR TAXONOMY UPDATE CODE
  1. ; INPUT : FBIEN - pointer to the FEE BASIS PAID TO IB file - 161.9
  1. N FBERR
  1. Q:FBIEN=""
  1. Q $$GET1^DIQ(161.9,FBIEN_",",.09,"","","FBERR")
  1. ;
  1. GTNPIVAL(FBNPI1) ;RETURNS EXTERNAL VALUE FOR A SET OF SORT CODES
  1. ; INPUT : FBNPI1 - USER SELECTED value from set of code
  1. N FBERR
  1. Q:FBNPI1="" ""
  1. Q:FBNPI1=0 "NO NPI UPDATES ATTEMPTED"
  1. Q:FBNPI1=1 "NPI DATA INVALID"
  1. Q:FBNPI1=2 "NPI MATCHED ACTIVE, NO UPDATES"
  1. Q:FBNPI1=3 "NPI MATCHED INACTIVE, NO UPDATES"
  1. Q:FBNPI1=4 "NPI MATCHED ACTIVE, IB UPDATED"
  1. Q:FBNPI1=5 "NPI NEW, IB RECORD CREATED"
  1. Q -1
  1. ;
  1. GTPYMNT(FBICNTRL) ;Get info from FEE BASIS PAYMENT
  1. ;INPUT : FBICNTRL - a four piece ';' delimitated string representing a sub record
  1. N FBIENS,FBPAT,FBVNDR,FBINVDT,FBPROC
  1. ;
  1. S FBIENS=$P(FBICNTRL,";",1)_","
  1. S FBPAT=$$GET1^DIQ(162,FBIENS,.01,"","","FBERR")
  1. S FBIENS=$P(FBICNTRL,";",2)_","_FBIENS
  1. S FBVNDR=$$GET1^DIQ(162.01,FBIENS,.01,"","","FBERR")
  1. S FBIENS=$P(FBICNTRL,";",3)_","_FBIENS
  1. S FBINVDT=$$GET1^DIQ(162.02,FBIENS,.01,"","","FBERR")
  1. S FBIENS=$P(FBICNTRL,";",4)_","_FBIENS
  1. S FBPROC=$$GET1^DIQ(162.03,FBIENS,.01,"","","FBERR")
  1. Q FBPAT_"^"_FBVNDR_"^"_FBINVDT_"^"_FBPROC
  1. ;
  1. CLEAR() ;CLEARS A SPACE ON SCREEN AFTER REPORT
  1. N FBLINE
  1. F FBLINE=1:1:10 W !
  1. Q