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

IBCRHRS.m

Go to the documentation of this file.
  1. IBCRHRS ;ALB/ARH - RATES: UPLOAD (RC) CHANGE SITE TYPE OPTION ; 25-JAN-13
  1. ;;2.0;INTEGRATED BILLING;**458**;21-MAR-94;Build 4
  1. ;;Per VHA Directive 2004-038, this routine should not be modified.
  1. ;
  1. ; Option that allows the user to change a divisions Facility Charge Type
  1. ; only allows the currently released version to be changed
  1. ;
  1. OPTION ; Option entry Change Reasonable Charge Facility Type
  1. N IBVERS,IBVERSDT,IBCMRG,IBHFRG,IBNWFT,IBNWDT,IBXRF1,IBDS,IBDONE S IBDONE=0 S IBDS="",$P(IBDS,"=",IOM+1)=""
  1. ;
  1. W !!,"Change Reasonable Charges Facility Type:",!
  1. W !,"This option allows the Facility Type of currently loaded Reasonable Charges"
  1. W !,"to be changed on a specified date. A Non-Provider Based Freestanding site"
  1. W !,"with only Professional charges may be changed to a Provider Based site with"
  1. W !,"both Institutional and Professional charges.",!
  1. W !,"This option will complete the following steps:"
  1. W !,"1. Uploads the current version of Reasonable Charges."
  1. W !,"2. Request the Region/Division to change, the new type and effective date."
  1. W !,"3. Calculate the charges for the Region with the new type and effective date."
  1. W !,"4. Request confirmation then update the permanent files in the Charge Master:"
  1. W !," inactivate the currently loaded charges for the region, update the "
  1. W !," Region's Type, and load the new charges into the Charge Master.",!
  1. W !,"Only CBO can approve a Facility Type change for a division. "
  1. W !,"Approval from CBO must be received before using this option to change charges.",!
  1. S DIR(0)="Y",DIR("A")="Approval Received to Change a Divisions Facility Type, Continue" D ^DIR K DIR,X I Y'=1 Q
  1. ;
  1. ;
  1. S IBVERS=+$$VERSTR^IBCRHBRV(1) I 'IBVERS G OPTIONQ ; get the current version
  1. S IBVERSDT=+$$VERSDT^IBCRHBRV(IBVERS) I 'IBVERSDT G OPTIONQ ; get effective date of current version
  1. ;
  1. W !,IBDS,!,"*** Set-Up process:",!
  1. ;
  1. D XTMPKL ; delete any existing upload files in XTMP
  1. I '$$XTMPHL(IBVERS) G OPTIONQ ; load current version load files into XTMP
  1. ;
  1. W !,IBDS,!,"*** Get specifications from user and check the change is valid",!
  1. ;
  1. S IBCMRG=$$ASKCMRG I 'IBCMRG G OPTIONQ ; get CM Billing Region from user (#363.31)
  1. S IBHFRG=$$GETHFRG(IBCMRG) I 'IBHFRG G OPTIONQ ; get HF Billing Region from Host Site File
  1. S IBNWFT=$$ASKNWFT(IBHFRG) I 'IBNWFT G OPTIONQ ; get the new Charge Type for the Billing Region
  1. S IBNWDT=$$ASKNWDT I 'IBNWDT G OPTIONQ ; get the effective date of the change from the user
  1. I '$$CHECK(IBVERS,IBVERSDT,IBNWDT,IBCMRG,IBHFRG,IBNWFT) G OPTIONQ
  1. ;
  1. W !,IBDS,!,"*** Calculate charges and update effective date based on user entry",!
  1. ;
  1. S $P(IBHFRG,U,5)=IBNWFT
  1. D CALCRC^IBCRHBS5(IBHFRG) ; calculate site charges with new type, create XTMP files
  1. I '$$XTMPDT(IBVERSDT,IBNWDT) G OPTIONQ ; update calculated charges dates in XTMP
  1. ;
  1. W !,IBDS,!,"*** Confirm Request to Update Charge Master",!
  1. ;
  1. I '$$ASKFNL(IBCMRG,IBNWDT,IBNWFT) G OPTIONQ ; get final confirmation for change from user
  1. ;
  1. W !,IBDS,!,"*** Complete Request - Update Charge Master",!
  1. ;
  1. I '$$CMINDT(IBCMRG,IBVERSDT,IBNWDT) G OPTIONQ ; inactivate existing charges in Charge Master
  1. S IBDONE=1
  1. D CMRGFT(IBCMRG,IBNWFT) ; update Facility Type in Charge Master
  1. D CMLOAD ; load the modifified charges into Charge Master
  1. ;
  1. OPTIONQ ;
  1. D XTMPKL ; delete any existing upload files in XTMP
  1. ;
  1. I +IBDONE W !,IBDS,!,"*** Process Complete, Charge Master Charges Updated.",!
  1. I 'IBDONE W !,IBDS,!,"*** Process Ended, No Permanent Changes.",!
  1. Q
  1. ;
  1. ;
  1. XTMPKL ; delete any existing RC Upload Files in XTMP
  1. N IBX
  1. W !,"Removing any existing temporary Upload files: ",!
  1. S IBX="IBCR RC" F S IBX=$O(^XTMP(IBX)) Q:IBX'["IBCR RC" K ^XTMP(IBX) W "."
  1. S IBX="IBCR UPLOAD RC" F S IBX=$O(^XTMP(IBX)) Q:IBX'["IBCR UPLOAD RC" K ^XTMP(IBX) W "."
  1. Q
  1. ;
  1. XTMPHL(VERS) ; load version of RC Host Files IBCR RC into XTMP (IBCRHBS1)
  1. N IBPATH,IBFILES,IBFILE,IBNODE,IBOK S IBOK=0 I '$G(VERS) G XTMPHLQ
  1. ;
  1. W !!,"Upload National Reasonable Charges v"_VERS_" Host Files to temporary local files:",!
  1. S IBPATH=$$PATH^IBCRHBS1 I IBPATH<0 G XTMPHLQ ; get path/directory
  1. D FILES^IBCRHBRV(.IBFILES,VERS) ; get list of files to be loaded
  1. I '$$FNDHOST^IBCRHBS1(.IBFILES,IBPATH) G XTMPHLQ ; check host files are available/found
  1. ;
  1. W !,"Loading National Reasonable Charges v"_VERS_" Host Files into temporary local file:"
  1. S IBOK=1,IBFILE="" F S IBFILE=$O(IBFILES(IBFILE)) Q:IBFILE="" D I 'IBOK Q
  1. . S IBNODE=IBFILES(IBFILE)
  1. . I $$LOAD^IBCRHBS2(IBPATH,IBFILE,$P(IBNODE,U,1),$P(IBNODE,U,2),VERS,$P(IBNODE,U,3)) Q
  1. . W !!," Error while processing host file, can not continue!",!! S IBOK=0
  1. I +IBOK W !!,"Upload of Reasonable Charges v"_VERS_" Host Files Complete.",!
  1. ;
  1. XTMPHLQ Q IBOK
  1. ;
  1. XTMPDT(VSDT,NWDT) ; update calculated charges IBCR UPLOAD effective date in XTMP, returns count changed
  1. N IBXRF1,IBSUB,IBX,IBLN,IBCNT S IBXRF1=0,IBCNT=0
  1. I ($G(VSDT)'?7N)!($G(NWDT)'?7N) G XTMPDTQ
  1. ;
  1. S IBSUB="IBCR UPLOAD RC" S IBXRF1=$O(^XTMP(IBSUB)) I IBXRF1'[IBSUB G XTMPDTQ
  1. ;
  1. W !!,"Changing Effective Date from ",$$FMTE^XLFDT(VSDT,2)," to ",$$FMTE^XLFDT(NWDT,2)," in Host Files."
  1. W !!,"Host Files ",IBXRF1,?55,"Count = ",$P($G(^XTMP(IBXRF1,0)),U,4),!
  1. ;
  1. ; loop through XTMP calculated charges and update the effective date
  1. S IBSUB="" F S IBSUB=$O(^XTMP(IBXRF1,IBSUB)) Q:IBSUB="" D
  1. . S IBX=0 F S IBX=$O(^XTMP(IBXRF1,IBSUB,IBX)) Q:'IBX D
  1. .. S IBLN=$G(^XTMP(IBXRF1,IBSUB,IBX))
  1. .. I +$P(IBLN,U,3),+$P(IBLN,U,3)<NWDT Q
  1. .. ;
  1. .. I $P(IBLN,U,2)=VSDT S $P(IBLN,U,2)=NWDT,^XTMP(IBXRF1,IBSUB,IBX)=IBLN S IBCNT=IBCNT+1
  1. . I +IBCNT W !,IBSUB,?25,IBCNT
  1. ;
  1. XTMPDTQ I IBCNT'=$P($G(^XTMP(IBXRF1,0)),U,4) S IBCNT=0 W !!,"Error: All dates not changed, can not continue!",!
  1. Q IBCNT
  1. ;
  1. ;
  1. CMINDT(CMRG,VSDT,NWDT) ; inactivate existing charges for selected Billing Region in Charge Master (#363.2)
  1. N IBCNT,IBINACT,IBCS,IBCS0,IBBR0,IBXRF,IBITM,IBCI,IBCI0,IBCHG,DD,DO,DLAYGO,DIC,DIE,DA,DR,X,Y S IBCNT=0
  1. I ($G(VSDT)'?7N)!($G(NWDT)'?7N) G CMINDTQ
  1. I $G(^IBE(363.31,+$G(CMRG),0))'["RC " G CMINDTQ
  1. ;
  1. S IBINACT=$$FMADD^XLFDT(NWDT,-1)
  1. ;
  1. W !!,"Inactivating ",$P(CMRG,U,2)," existing charges on ",$$FMTE^XLFDT(IBINACT,2),":",!,"Please wait...",!
  1. ;
  1. S IBCS=0 F S IBCS=$O(^IBE(363.1,IBCS)) Q:'IBCS D
  1. . S IBCS0=$G(^IBE(363.1,IBCS,0)) I $P(IBCS0,U,7)'=+CMRG Q
  1. . S IBBR0=$G(^IBE(363.3,+$P(IBCS0,U,2),0)) I $E(IBBR0,1,3)'="RC " Q
  1. . ;
  1. . S IBXRF="AIVDTS"_IBCS,IBCHG=0
  1. . S IBITM=0 F S IBITM=$O(^IBA(363.2,IBXRF,IBITM)) Q:'IBITM D
  1. .. S IBCI=0 F S IBCI=$O(^IBA(363.2,IBXRF,IBITM,-VSDT,IBCI)) Q:'IBCI D
  1. ... S IBCI0=$G(^IBA(363.2,IBCI,0))
  1. ... I +$P(IBCI0,U,4),IBINACT>+$P(IBCI0,U,4) Q
  1. ... ;
  1. ... S DR=".04///"_+IBINACT,DIE="^IBA(363.2,",DA=+IBCI D ^DIE K DIC,X,Y S IBCNT=IBCNT+1,IBCHG=1
  1. . I +IBCHG W !,$P(IBCS0,U,1),?35,IBCNT
  1. ;
  1. CMINDTQ I 'IBCNT W !!,"Unable to Inactivate current charges, can not continue!",!
  1. Q IBCNT
  1. ;
  1. CMRGFT(CMRG,NWFT) ; change the Billing Regions Facility Type in the Charge Master (#363.31,.03)
  1. N IBX,DD,DO,DLAYGO,DIC,DIE,DA,DR,X,Y S NWFT=+$G(NWFT)
  1. S IBX=+$P($G(^IBE(363.31,+$G(CMRG),0)),U,3)
  1. W !!,"Changing Billing Regions Facility Type: "
  1. ;
  1. I +IBX,+NWFT,IBX'=NWFT S DR=".03///"_NWFT,DIE="^IBE(363.31,",DA=+CMRG D ^DIE
  1. ;
  1. W !,"Billing Region ",$P($G(CMRG),U,2)," changed from ",IBX," to ",NWFT
  1. Q
  1. ;
  1. CMLOAD ; load charges into Charge Master
  1. ; queuing is not allowed to ensure the modified files are used and
  1. ; process completes fully.
  1. ;
  1. N ADD W !!,"Load modified charges into Charge Master:",!
  1. ;
  1. ; get the device
  1. W !,"Report requires 120 columns. Queuing not allowed to ensure process completes."
  1. S %ZIS="M",%ZIS("A")="OUTPUT DEVICE: " D ^%ZIS I POP QUIT
  1. ;
  1. S ADD=1 D RPT^IBCRHO
  1. Q
  1. ;
  1. ;
  1. ASKCMRG() ; ask user for Billing Region (#363.31), return Billing Region ifn ^ name ^ div/site ^ id/zip ^ chg type
  1. N IBRG,IBDV,IBX,IBY,DIC,X,Y
  1. W !,"Enter the Division to change the Reasonable Charges Facility Type:",!
  1. S DIC("S")="I $E(^(0),1,3)=""RC """
  1. S DIC="^IBE(363.31,",DIC(0)="AEMNQZ",DIC("A")="Select DIVISION/REGION: " D ^DIC I Y<1 S Y=0
  1. I +Y S Y=Y_U_$P(Y(0)," ",2)_U_$P(Y(0),U,2,3)
  1. ;
  1. I +Y D
  1. . W !!,"Billing Region: ",$P(Y,U,2),?50,"3-Zip: ",$P(Y,U,4),?65,"Type: ",$P(Y,U,5)
  1. . W !,"Division: " S IBRG=+Y,IBY=0 F S IBY=$O(^IBE(363.31,IBRG,11,IBY)) Q:'IBY D
  1. .. S IBDV=$G(^IBE(363.31,IBRG,11,IBY,0)) Q:'IBDV S IBX=$G(^DG(40.8,+IBDV,0)) W ?16,$P(IBX,U,2),?24,$P(IBX,U,1),!
  1. Q Y
  1. ;
  1. GETHFRG(CMRG) ; get the Host File Site of Region selection, return IBCR RC SITE ifn ^ div/site ^ site name ^ id/zip ^ chg type
  1. N IBX,IBS,IBY S IBX=0
  1. S IBS=$P($G(CMRG)," ",2)_" "
  1. S IBY=$O(^XTMP("IBCR RC SITE","B",IBS,0)),IBS=$G(^XTMP("IBCR RC SITE",+IBY))
  1. I +IBY,IBS'="" S IBX=IBY_U_IBS
  1. ;
  1. I 'IBX W !!,"Error: Site ",$P($G(CMRG)," ",2)," not found in Host Files, can not continue!",!!
  1. Q IBX
  1. ;
  1. ASKNWFT(HFRG) ; determine/confirm from user the Facility Type Change based on the current Host File setting
  1. N IBT,IBN,IBX,DIR,X,Y S IBX=0 S HFRG=$G(HFRG)
  1. S IBT=+$P(HFRG,U,5),IBN=$P(HFRG,U,2)_" - "_$P(HFRG,U,3)
  1. ;
  1. ; if currently Provider Based (1 or 2) then ask to confirm the change to Freestanding (3)
  1. I (IBT=1)!(IBT=2) D
  1. . W !!,IBN," is currently Provider Based ",$S(IBT=1:"INPT/SFN/OPT (1)",1:"Outpatient Only (2)"),!
  1. . S DIR("?")="Must change the Provider Type otherwise do not use this option."
  1. . S DIR("A")="Do you want to change this site to Freestanding (3)"
  1. . S DIR(0)="YO" D ^DIR I Y=1 S IBX=3
  1. ;
  1. ; if currently Freestanding (3) then ask if change to Provider Based Inpatient (1) or Outpatient (2)
  1. I IBT=3 D
  1. . W !!,IBN," is currently Non-Provider Based Freestanding (3)",!
  1. . S DIR("?")="Must change the Provider Type otherwise do not use this option."
  1. . S DIR("?",1)="Enter 'I' if Inpatient, SNF and Outpatient charges are required for the site."
  1. . S DIR("?",2)="Enter 'O' if Outpatient Only charges are required for the site."
  1. . S DIR("A")="Site will be changed to Provider Based, select Type"
  1. . S DIR(0)="SO^1:Inpatient/SNF/Outpatient;2:Outpatient" D ^DIR I Y>0 S IBX=+Y
  1. ;
  1. Q IBX
  1. ;
  1. ASKNWDT() ; ask the user for the effective date of the change, return date or 0
  1. N DIR,X,Y W !
  1. S DIR("?")="The date the new charges will become effective."
  1. S DIR("?",1)="Enter the Effective Date of the Facility Type change."
  1. S DIR("?",2)="This is the date the new charges become available."
  1. S DIR("?",3)="The old charges (existing) will be inactivated one day before this date."
  1. S DIR("A")="Effective Date of Facility Type Change"
  1. S DIR(0)="DO^::AEX" D ^DIR I Y'?7N S Y=0
  1. Q Y
  1. ;
  1. ;
  1. ASKFNL(CMRG,NWDT,NWFT) ; ask user if they really want to make the change, return true if yes
  1. N DIR,IBRG,IBDV,IBX,IBY,IBOK,X,Y S IBOK=0
  1. W !,"You have requested current charges for the following Region and Division "
  1. W !,"be changed from ",$S(NWFT'=3:"Freestanding",1:"Provider Based")," to ",$S(NWFT=3:"Freestanding",1:"Provider Based"),":",!
  1. ;
  1. W !,"Billing Region: ",$P(CMRG,U,2),?50,"3-Zip: ",$P(CMRG,U,4),?65,"Type: ",$P(CMRG,U,5)
  1. W !,"Division: " S IBRG=+CMRG,IBY=0 F S IBY=$O(^IBE(363.31,IBRG,11,IBY)) Q:'IBY D
  1. . S IBDV=$G(^IBE(363.31,IBRG,11,IBY,0)) Q:'IBDV S IBX=$G(^DG(40.8,+IBDV,0)) W ?16,$P(IBX,U,2),?24,$P(IBX,U,1),!
  1. ;
  1. W !!,"Currently loaded ",$S(NWFT'=3:"Freestanding",1:"Provider Based")," charges will be inactivated as of ",$$FMTE^XLFDT($$FMADD^XLFDT(NWDT,-1),2)
  1. W !,"New ",$S(NWFT=3:"Freestanding",1:"Provider Based")," charges will be loaded with an effective date of ",$$FMTE^XLFDT(NWDT,2),!
  1. ;
  1. S DIR("?")="No permanent changes have been made, enter Yes to complete the changes."
  1. S DIR("A")="Do you want to complete these changes and update your stored charges"
  1. S DIR(0)="YO" D ^DIR I Y=1 S IBOK=1
  1. ;
  1. Q IBOK
  1. ;
  1. ;
  1. CHECK(VERS,VSDT,NWDT,CMRG,HFRG,NWFT) ; check the inputs to determine if change is ok
  1. N IBX,IBC,IBRG,IBDS,IBOK S IBOK=1 S IBDS="",$P(IBDS,"=",IOM+1)="" W !,IBDS,!
  1. ;
  1. I VERS'=$$VERSION^IBCRHBRV D S IBOK=0 G CHECKQ
  1. . W !,"Error: Version of Host Files loaded is not the current RC version "_VERS_".",!
  1. ;
  1. I $P(CMRG,U,3)'=$P(HFRG,U,2) D S IBOK=0 G CHECKQ
  1. . W !,"Error: Site Number does not match in Host File and Charge Master"
  1. . W !," for selected Region. Data inconsistency unresolved.",!
  1. ;
  1. I $P(CMRG,U,4)'=$P(HFRG,U,4) D S IBOK=0 G CHECKQ
  1. . W !,"Error: Identifier 3-digit zip does not match in Host File and Charge Master"
  1. . W !," for selected Region. Data inconsistency unresolved.",!
  1. ;
  1. I $P(CMRG,U,5)'=$P(HFRG,U,5) D S IBOK=0 G CHECKQ
  1. . W !,"Error: Facility Type does not match in Host File and Charge Master"
  1. . W !," for selected Region. Data inconsistency unresolved.",!
  1. ;
  1. I NWFT=$P(HFRG,U,5) D S IBOK=0 G CHECKQ
  1. . W !,"Error: Host File Facility Type is the same as the selected Facility Type."
  1. . W !," This would result in no change to the charges.",!
  1. ;
  1. I NWFT<3,$P(HFRG,U,5)<3 D S IBOK=0 G CHECKQ
  1. . W !,"Error: Host File Facility Type and Selected Facility Type are both"
  1. . W !," Provider Based. This would result in no change to the charges.",!
  1. ;
  1. I NWDT'>VSDT D S IBOK=0 G CHECKQ
  1. . W !,"Error: Date entered ",$$FMTE^XLFDT(NWDT,2)," is before v",VERS," effective date ",$$FMTE^XLFDT(VSDT,2),"."
  1. . W !," This option may only be used to change the Facility Type of the"
  1. . W !," current version charges after they are effective. Use the regular"
  1. . W !," Upload to change charges on ",$$FMTE^XLFDT(VSDT,2),".",!
  1. ;
  1. S IBC=","_$$VERSITE^IBCRHBRV($P(HFRG,U,2))_",",IBX=","_VERS_","
  1. I IBC'[IBX D S IBOK=0 G CHECKQ
  1. . W !,"Error: Selected Billing Region ",$P(CMRG,U,2)
  1. . W !," does not have the current version ",VERS," of Reasonable Charges installed."
  1. . W !," This option may only be used to change the current version charges."
  1. . W !," Use the regular Upload option to change charges from previous versions.",!
  1. ;
  1. S IBRG=+CMRG,IBC=0,IBX=0 F S IBX=$O(^IBE(363.31,IBRG,11,IBX)) Q:'IBX S IBC=IBC+1
  1. I IBC>1 D S IBOK=0 G CHECKQ
  1. . W !,"Error: Selected Billing Region ",$P(CMRG,U,2)
  1. . W !," has more than one Division assigned. Changing the Facility Type"
  1. . W !," may only be applied to one Division. The extra Divisions need"
  1. . W !," to be removed from the Billing Region and charges loaded specifically"
  1. . W !," for those sites, usually at least two past versions.",!
  1. ;
  1. CHECKQ Q IBOK