source: WorldVistAEHR/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCRHBS4.m@ 1375

Last change on this file since 1375 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 7.9 KB
Line 
1IBCRHBS4 ;ALB/ARH - RATES: UPLOAD (RC 2+) SELECT SITES ; 10-OCT-03
2 ;;2.0;INTEGRATED BILLING;**245**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ;
6SELSITE() ; select one site to calculate RC charges for
7 ; return: 0 or 'IFN of site in IBCR RC SITE ^ site number ^ site name ^ 3-digit zip ^ type'
8 ;
9 D SETRGZIP^IBCRHBSZ,CHKRGZIP^IBCRHBSZ
10 ;
11 N IBSNAME,IBSELDIV,IBX,IBXIFN,IBMCDV
12 W !!!,"Select Site to calculate Reasonable Charges v"_$$VERSION^IBCRHBRV_" for load into Charge Master"
13 W !,"--------------------------------------------------------------------------------"
14 ;
15SELECT S (IBSELDIV,IBMCDV)=0
16 S IBSNAME=$$ASKNAM I IBSNAME="" G SSQ
17 ;
18 S IBXIFN=$$LSTSITE(IBSNAME) I +IBXIFN'>0 G SELECT
19 S IBSELDIV=$G(^XTMP("IBCR RC SITE",IBXIFN)) I IBSELDIV="" G SELECT
20 S IBSELDIV=IBXIFN_U_IBSELDIV
21 ;
22 I $$DV999(IBSELDIV) S IBSELDIV=$$ASKDV(IBSELDIV) I IBSELDIV="" G SELECT
23 ;
24 I '$$RECHK(IBSELDIV) G SELECT
25 ;
26 S IBX=$P(IBSELDIV,U,2) D MSGSITE^IBCRHBRV(IBX),MSGVERS^IBCRHBRV(IBX),MSGDIV^IBCRHBSZ(IBX)
27 ;
28 I '$$CONT(IBSELDIV) G SELECT
29 ;
30SSQ Q IBSELDIV
31 ;
32ASKNAM() ; ask the user to enter the name of a site/division, return upper case name entered or null
33 N DIR,DIRUT,DUOUT,X,Y,IBX,IBY S IBX=""
34 S DIR("?",1)="All or some divisions whose care is billed from your site may have charges."
35 S DIR("?",2)="Some charges are unique to a single division, others cover multiple divisions."
36 S DIR("?",3)="This may result in multiple sets in the Charge Master."
37 S DIR("?",4)="Enter '??' for a complete list of divisions."
38 S DIR("?",5)="Enter a division number or name for a matching list.",DIR("?",6)=""
39 S DIR("?")="Select a division that will be billed at your site.",DIR("??")="^D LSTALL^IBCRHBS4"
40 S DIR(0)="FO",DIR("A")="Select Division" W !! D ^DIR K DIR S IBX=Y I $D(DIRUT) S IBX=""
41 I IBX'="" S IBX=$$UP^XLFSTR(IBX)
42 Q IBX
43 ;
44CONT(SITE) ; as user if they want to load this division, return 1 if accept division and calculate charges, else 0
45 N DIR,DIRUT,DUOUT,X,Y,IBX S IBX=0
46 W !,?15,$P(SITE,U,2),?27,$P(SITE,U,3),?60,$P(SITE,U,4),?67,$P(SITE,U,5),!
47 S DIR("?")="Enter 'Y' if the care provided at this division is billed at your site and you need this divisions charges loaded on your system."
48 S DIR("A")="Calculate RC v"_$$VERSION^IBCRHBRV_" charges for this division"
49 S DIR(0)="YO" D ^DIR K DIR I Y=1 S IBX=Y
50 Q IBX
51 ;
52LSTALL ; list all sites, user cannot select, nothing returned
53 N IBX,IBCNT,IBEND,IBXIFN,IBNODE,DIR,DIRUT,DUOUT,DTOUT,X,Y S (IBCNT,IBEND)=0 W !
54 ;
55 S IBX="" F S IBX=$O(^XTMP("IBCR RC SITE","C",IBX)) Q:IBX="" D Q:$D(DIRUT)
56 . S IBXIFN="" F S IBXIFN=$O(^XTMP("IBCR RC SITE","B",IBX,IBXIFN)) Q:'IBXIFN D Q:$D(DIRUT)
57 .. S IBNODE=$G(^XTMP("IBCR RC SITE",IBXIFN))
58 .. W !,?10,$P(IBNODE,U,1),?22,$P(IBNODE,U,2),?60,$P(IBNODE,U,3),?67,$P(IBNODE,U,4)
59 .. S IBCNT=IBCNT+1,IBEND=0 I '(IBCNT#21) W ! S DIR(0)="E" D ^DIR K DIR W ! S IBEND=1
60 I 'IBEND,'$D(DIRUT) W ! S DIR(0)="E" D ^DIR K DIR W !
61 Q
62 ;
63LSTSITE(SNAME) ; search, display, selecy from list of sites
64 ; returns 'site IFN in IBCR RC SITE' if one selected, 0 if none selected, -1 if ^
65 ;
66 N IBX,IBL,IBXIFN,IBNODE,IBCNT,IBEND,IBSEL,SELARR,DIR,DIRUT,DUOUT,X,Y S (IBSEL,IBEND,IBCNT)=0 W !
67 ;
68 S IBX=SNAME,IBL=$L(SNAME) I SNAME'="" S IBX=$E(SNAME,1,$L(SNAME)-1)_$C($A($E(SNAME,$L(SNAME)))-1)_"~"
69 ;
70 F S IBX=$O(^XTMP("IBCR RC SITE","B",IBX)) Q:IBX=""!($E(IBX,1,IBL)'=SNAME) D Q:IBSEL'=0
71 . S IBXIFN="" F S IBXIFN=$O(^XTMP("IBCR RC SITE","B",IBX,IBXIFN)) Q:'IBXIFN D Q:IBSEL'=0
72 .. S IBNODE=$G(^XTMP("IBCR RC SITE",IBXIFN))
73 .. S IBCNT=IBCNT+1,SELARR(IBCNT)=IBXIFN
74 .. W !,?4,IBCNT,")",?10,$P(IBNODE,U,1),?22,$P(IBNODE,U,2),?60,$P(IBNODE,U,3),?67,$P(IBNODE,U,4)
75 .. S IBEND=0 I '(IBCNT#21) S IBSEL=$$ASKSEL(IBCNT) S IBEND=1
76 I SNAME'="",IBCNT'>0 W ?40,"??"
77 ;
78 I IBSEL=0,IBCNT>1,'IBEND S IBSEL=$$ASKSEL(IBCNT)
79 I IBSEL=0,IBCNT=1 S IBSEL=1
80 ;
81 I IBSEL>0,$D(SELARR(+IBSEL)) S IBSEL=SELARR(+IBSEL)
82 ;
83 Q IBSEL
84 ;
85ASKSEL(CNT) ; ask user to select from list of sites, returns number selected, 0 if none selected, -1 if ^
86 ;
87 N DIR,DIRUT,DUOUT,DTOUT,X,Y,IBX S IBX=0 W !
88 S DIR("?")="Enter return to continue, enter '^' to exit, or enter the number preceding the site you want to select. The number may be no greater than "_CNT
89 S DIR(0)="NO^1:"_CNT_":0",DIR("A")=" Press return to continue or select a site" D ^DIR
90 S IBX=$S($D(DUOUT)!$D(DTOUT):-1,+Y>0:+Y,1:0) W !
91 Q IBX
92 ;
93DV999(SITE) ; check if Site is an valid site or a temporary placeholder
94 N IBX S IBX=0 I +$G(SITE) I ($P(SITE,U,2)?1"9".2N.1"X".1N)!($P(SITE,U,5)="") S IBX=1
95 Q IBX
96 ;
97ASKDV(SITE) ; Get new Division number, Name and Type for invalid sites
98 ; return: "" or 'IFN of site in IBCR RC SITE ^ site number ^ site name ^ 3-digit zip ^ type'
99 N IBNDIV,IBNM,IBTYP,IBNEW,IBI,IBX,X,Y,DIR,DIRUT,DUOUT,DTOUT S IBNEW="" I '$G(SITE) G ASKDVQ
100 ;
101 W !!,"--------------------------------------------------------------------------------"
102 W !,"'",$P(SITE,U,2)," - ",$P(SITE,U,3),"' is an invalid site number, you may now enter",!,"the correct information on the site you are loading charges for.",!
103 ;
104 I $P(SITE,U,2)="999" S IBNDIV=$P(SITE,U,2),IBNM=$P(SITE,U,3) G ASKTYP
105 ;
106 S DIR("?")=$P(SITE,U,2)_" is not a valid site number, if you know the correct number for this division you may change it now."
107 S DIR(0)="F^3:7^I X'?3N,X'?3N1.4UN K X",DIR("A")="Site Division Number" D ^DIR K DIR I $D(DIRUT) G ASKDVQ
108 S IBNDIV=Y
109 ;
110 I '$O(^DG(40.8,"C",IBNDIV,0)) W !!,">> ",IBNDIV," is not a valid Medical Center division on your system.",!!
111 ;
112 I $E(IBNDIV)<9 S IBX=$$SITEDV^IBCRHBSZ(IBNDIV) I +IBX S IBNEW=IBX W !!,"**Site exists." G ASKDVQ
113 ;
114 S IBX=$$RGDV^IBCRHBSZ(IBNDIV)
115 I +IBX,+$P(IBX,U,5) S IBNEW=+SITE_U_$P(IBX,U,2,5) W !!,"** Region ",IBNDIV," already exists." G ASKDVQ
116 I +IBX,'$P(IBX,U,5) S IBNDIV=$P(IBX,U,2),IBNM=$P(IBX,U,3) W !!,"** Region ",IBNDIV," already exists." G ASKTYP
117 ;
118 ;
119 S DIR(0)="F^3:25",DIR("A")="Location of Site, City" D ^DIR K DIR G:$D(DIRUT) ASKDVQ S IBNM=Y
120 S DIR(0)="P^5:AEQMZ",DIR("A")="Location of Site, State" D ^DIR K DIR G:$D(DIRUT) ASKDVQ
121 S IBNM=IBNM_", "_$P(Y(0),U,2)
122 ;
123 ;
124 W !!,"*** IT IS VERY IMPORTANT THAT TYPE OF FACILITY BE SET CORRECTLY"
125 W !,"*** IF THERE IS ANY DOUBT OF THE TYPE OF FACILITY THEN CONTACT THE CBO ",!,?4,"OR ENTER A NOIS BEFORE CONTINUING"
126ASKTYP S DIR("?",1)="If unsure of the correct Type of Facility for the site then STOP, "
127 S DIR("?",2)="contact the CBO or enter a NOIS to get the correct Type of Facility.",DIR("?",3)=" "
128 S DIR("?")="The Type of Facility determines the charges loaded for the site."
129 ;
130 S DIR(0)="S^1:Inpatient Facility (Provider Based);2:Outpatient Facility (Provider Based);3:Freestanding (Non-Provider Based)",DIR("A")="Type of Facility" D ^DIR I $D(DIRUT) G ASKDVQ
131 S IBTYP=Y
132 ;
133 I $P(SITE,U,2)="999" S IBNDIV="999A"_IBTYP
134 ;
135 S IBNEW=$P(SITE,U,1)_U_IBNDIV_U_IBNM_U_$P(SITE,U,4)_U_IBTYP
136 ;
137ASKDVQ W !!,"--------------------------------------------------------------------------------",!
138 Q IBNEW
139 ;
140RECHK(SITE) ; re-check site against existing region, Division number and Type are critical
141 N IBX,IBY,IBOK,DA,DIC,DIE,DR S IBOK=1,SITE=$G(SITE),IBX=$P($G(SITE),U,2),IBY=0
142 I IBX'="" S IBY=$$RGDV^IBCRHBSZ(IBX)
143 ;
144 I +IBY,'$P(IBY,U,5),+$P(SITE,U,5) D ; needed for cases where region exists but division not in host file
145 . S DR=".03////"_+$P(SITE,U,5),DIE="^IBE(363.31,",DA=+IBY D ^DIE K DIE,DIC,DA,DR S $P(IBY,U,5)=$P(SITE,U,5)
146 ;
147 I +IBY I ($P(SITE,U,2)'=$P(IBY,U,2))!($P(SITE,U,5)'=$P(IBY,U,5)) D
148 . S IBOK=0 W !,"*** Error: Division selected does not match existing Region"
149 . W !,?10,$P(SITE,U,2),?20,$P(SITE,U,3),?55,$P(SITE,U,4),?65,$P(SITE,U,5)
150 . W !,?10,$P(IBY,U,2),?20,$P(IBY,U,3),?55,$P(IBY,U,4),?65,$P(IBY,U,5)
151 ;
152 I ($P(SITE,U,4)="")!('$P(SITE,U,5)) D
153 . S IBOK=0 W !,"** Error: Required data missing (zip or type):"
154 . W !,?10,$P(SITE,U,2),?20,$P(SITE,U,3),?55,$P(SITE,U,4),?65,$P(SITE,U,5)
155 ;
156 I $P(SITE,U,4)'="",'$O(^XTMP("IBCR RC E","A",$P(SITE,U,4),0)) D
157 . S IBOK=0 W !,"** Error: No Area Factors defined for site/zip:"
158 . W !,?10,$P(SITE,U,2),?20,$P(SITE,U,3),?55,$P(SITE,U,4),?65,$P(SITE,U,5)
159 Q IBOK
Note: See TracBrowser for help on using the repository browser.