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

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

initial load of WorldVistAEHR

File size: 6.8 KB
Line 
1IBCRHBSZ ;ALB/ARH - RATES: UPLOAD (RC 2+) DIVISION FUNCTIONS ; 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 ;
6SITEDV(DIV) ; return the host file site data on the division passed in
7 ; input: site number, output: 0 or 'IFN of site in IBCR RC SITE ^ site number ^ site name ^ 3-digit zip ^ type'
8 ;
9 N IBY,IBX,IBLN S (IBY,IBX)=0
10 I +$G(DIV) S IBY=$O(^XTMP("IBCR RC SITE","C",DIV_" ",0))
11 I +IBY S IBLN=$G(^XTMP("IBCR RC SITE",IBY)) I IBLN'="" S IBX=IBY_U_IBLN
12 Q IBX
13 ;
14RGDV(DV) ; return Billing Region data on division passed in
15 ; Input: site number, output 0 or 'IFN of region in 363.31 ^ site number ^ site city,st ^ 3-digit zip ^ type'
16 N IBRG,IBX,IBY,IBFND S IBFND=0
17 I $G(DV)'="" S IBRG="RC "_DV F S IBRG=$O(^IBE(363.31,"B",IBRG)) Q:$E(IBRG,1,2)'="RC" D Q:IBFND
18 . I IBRG'[(" "_DV_" ") Q
19 . S IBY=$O(^IBE(363.31,"B",IBRG,0)) I 'IBY Q
20 . S IBX=$G(^IBE(363.31,+IBY,0))
21 . S IBFND=IBY_U_DV_U_$P($P(IBX,U,1)," - ",2)_U_$P(IBX,U,2,3)
22 Q IBFND
23 ;
24MSGDIV(SITE) ; check if division selected is defined as a division (40.8) on the system
25 N IBMCDV,IBRG,IBX,IBY,IBFND S (IBMCDV,IBFND)="",SITE=$G(SITE)
26 I SITE'="" S IBMCDV=+$O(^DG(40.8,"C",SITE,0))
27 I +IBMCDV S IBX=$G(^DG(40.8,+IBMCDV,0)) D
28 . W !!,?5,$P(IBX,U,2),?15,$P(IBX,U,1)," is a valid Medical Center division on your system.",!
29 . S IBRG="RC" F S IBRG=$O(^IBE(363.31,"B",IBRG)) Q:$E(IBRG,1,2)'="RC" D Q:IBFND
30 .. I IBRG[(" "_SITE_" ") S IBFND=1 Q
31 .. S IBY=$O(^IBE(363.31,"B",IBRG,0)) I 'IBY Q
32 .. I '$O(^IBE(363.31,IBY,11,"B",+IBMCDV,0)) Q
33 .. W !!,?5,SITE," is already assigned to Billing Region: ",IBRG,! S IBFND=1
34 I 'IBMCDV W !!,?5,"*** ",SITE," is NOT defined as a Medical Center Division on your system ***",!
35 Q
36 ;
37 ;
38 ; ***************************************************************************************
39 ;
40SETRGZIP ; for all existing Billing Regions, set the sites 3-digit zip code into the Identifier field (363.31,.02)
41 ; and set the Facility type into the Type field (363.31,.03)
42 ; the 3-digit zip was not available with RC v1, so Regions created for RC v1 will not have this field set
43 ; the type field was not available until RC v2, so Regions created before RC 2 will not have this field set
44 ;
45 N DIE,DIC,DA,DR,X,Y,IBRGFN,IBLN,IBZIP,IBSITE,IBTYPE I $$VERSION^IBCRHBRV=1 Q
46 ;
47 S IBRGFN=0 F S IBRGFN=$O(^IBE(363.31,IBRGFN)) Q:'IBRGFN D
48 . S IBLN=$G(^IBE(363.31,IBRGFN,0)) Q:$E(IBLN,1,3)'="RC " I $P(IBLN,U,2)'="",$P(IBLN,U,3)'="" Q
49 . ;
50 . S IBSITE=$$SITEDV($P(IBLN," ",2))
51 . S IBZIP=$P(IBSITE,U,4) Q:IBZIP'?3N
52 . S IBTYPE=$P(IBSITE,U,5) Q:IBTYPE=""
53 . ;
54 . S DR=""
55 . I $P(IBLN,U,2)="" S DR=".02////"_IBZIP_";"
56 . I $P(IBLN,U,3)="" S DR=DR_".03////"_IBTYPE
57 . I DR'="" S DIE="^IBE(363.31,",DA=IBRGFN D ^DIE K DIE,DIC,DA,DR
58 Q
59 ;
60CHKRGZIP ; for all existing Billing Regions, check to ensure each division assigned is actually within that Region
61 ; Check the Billing Region zip/type against the Host files zip/type for the site
62 ; Also the 3-digit zip of the Regions Divisions must match the 3-digit zip of the Regions primary division
63 ; if the 3-digit zips do not match, the Division is deleted from the Region
64 ;
65 N IBRGFN,IBLN,IBRGSITE,IBRGZIP,IBRGTYPE,IBDVFN,IBDV,IBDVLN,IBDVSITE,IBDVZIP,IBDVTYPE,ARRAY,ARRAY2,DA,DIK,DIC,DIR,X,Y
66 ;
67 S IBRGFN=0 F S IBRGFN=$O(^IBE(363.31,IBRGFN)) Q:'IBRGFN D
68 . S IBLN=$G(^IBE(363.31,IBRGFN,0)) Q:$E(IBLN,1,3)'="RC "
69 . S IBRGSITE=$$SITEDV($P(IBLN," ",2))
70 . S IBRGZIP=$P(IBRGSITE,U,4)
71 . S IBRGTYPE=$P(IBRGSITE,U,5)
72 . I IBRGZIP'?3N,IBRGTYPE="" Q
73 . ;
74 . ; check region settings against settings for primary division in host files
75 . I $P(IBLN,U,2)'=IBRGZIP S ARRAY2($P(IBLN,U,1))=$P(IBLN,U,2)_U_+$P(IBLN,U,3)_U_IBRGZIP_U_+IBRGTYPE
76 . I +IBRGTYPE,$P(IBLN,U,3)'=IBRGTYPE S ARRAY2($P(IBLN,U,1))=$P(IBLN,U,2)_U_+$P(IBLN,U,3)_U_IBRGZIP_U_+IBRGTYPE
77 .
78 . ; check regions primary division against the assigned divisions
79 . S IBDVFN=0 F S IBDVFN=$O(^IBE(363.31,IBRGFN,11,IBDVFN)) Q:'IBDVFN D
80 .. S IBDV=+$G(^IBE(363.31,IBRGFN,11,IBDVFN,0)) Q:'IBDV
81 .. S IBDVLN=$G(^DG(40.8,+IBDV,0)) Q:IBDVLN=""
82 .. S IBDVSITE=$$SITEDV($P(IBDVLN,U,2))
83 .. S IBDVZIP=$P(IBDVSITE,U,4)
84 .. S IBDVTYPE=$P(IBDVSITE,U,5)
85 .. I IBDVZIP'?3N,IBDVTYPE="" Q
86 .. ;
87 .. I IBRGZIP=IBDVZIP,IBRGTYPE=IBDVTYPE Q
88 .. I IBRGTYPE=1,IBDVTYPE<3 Q
89 .. S ARRAY(IBRGFN)=IBLN,ARRAY(IBRGFN,IBDV)=$P(IBDVLN,U,1,2)_U_IBDVZIP_U_IBDVTYPE
90 .. S DA(1)=IBRGFN,DIK="^IBE(363.31,"_DA(1)_",11,",DA=IBDVFN D ^DIK
91 ;
92 I $O(ARRAY2(""))'="" D
93 . ; check region settings against settings for primary division in host files
94 . W @IOF,!,"********************************************************************************"
95 . W !,"Error Found: Billing Regions found in Charge Master with Incorrect Zip or Type."
96 . W !,"Billing Regions are defined by both the 3-digit zip code and Type of Facility."
97 . W !!,"There are Charge Master Billing Regions whose Zip or Type do not match the "
98 . W !,"settings of that primary division in the new host files.",!
99 . ;
100 . W !!,?3,"Billing Region",?32,"CM Zip-Type",?47,"HF Zip-Type",!,?3,"--------------------------------------------------------------------------"
101 . S IBRGFN="" F S IBRGFN=$O(ARRAY2(IBRGFN)) Q:IBRGFN="" D
102 .. S IBLN=ARRAY2(IBRGFN) W !,?3,IBRGFN,?35,$P(IBLN,U,1),"-",$P(IBLN,U,2),?50,$P(IBLN,U,3),"-",$P(IBLN,U,4)
103 . ;
104 . W !!,"IT IS POSSIBLE THERE ARE PROBLEMS WITH THE CHARGES, PLEASE CONTACT SUPPORT."
105 . W !,"********************************************************************************",!
106 . S DIR(0)="E" D ^DIR K DIR W @IOF
107 ;
108 I $O(ARRAY(0)) D
109 . ; check regions primary division against the assigned divisions
110 . W @IOF,!,"********************************************************************************"
111 . W !,"Error Found: Incorrect Billing Regions found in the Charge Master."
112 . W !!,"Billing Regions are defined by the 3-digit zip code identifier and "
113 . W !,"Type of Facility of the primary division. Only Divisions with the "
114 . W !,"same 3-digit zip code and type should be assigned to a Billing Region."
115 . W !!,"There were Divisions incorrectly associated with Billing Regions in the"
116 . W !,"Charge Master. For the following Billing Regions, the corresponding "
117 . W !,"Division has been deleted."
118 . W !!,?3,"Billing Region",?43,"Division(s) Deleted",!,?3,"--------------------------------------------------------------------------"
119 . ;
120 . S IBRGFN=0 F S IBRGFN=$O(ARRAY(IBRGFN)) Q:'IBRGFN D
121 .. S IBLN=ARRAY(IBRGFN) W !,?3,$E($P(IBLN,U,1),1,23),?26,"(",$P(IBLN,U,2),"-",$P(IBLN,U,3),")"
122 .. ;
123 .. S IBDV=0 F S IBDV=$O(ARRAY(IBRGFN,IBDV)) Q:'IBDV D
124 ... S IBLN=ARRAY(IBRGFN,IBDV) W ?43,$P(IBLN,U,2),?50,$E($P(IBLN,U,1),1,20),?72,"(",$P(IBLN,U,3),"-",$P(IBLN,U,4),")",!
125 . ;
126 . W !,"IT IS LIKELY THE ABOVE DIVISIONS NO LONGER HAVE ANY REASONABLE CHARGES ASSIGNED."
127 . W !,"********************************************************************************",!
128 . S DIR(0)="E" D ^DIR K DIR W @IOF
129 Q
Note: See TracBrowser for help on using the repository browser.