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

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

initial load of WorldVistAEHR

File size: 5.3 KB
Line 
1IBCRHL ;ALB/ARH - RATES: UPLOAD CHECK & ADD TO CM SEARCH ; 22-MAY-1996
2 ;;2.0;INTEGRATED BILLING;**52,106,138,245**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; check data in XTMP files to see if it can be loaded into the Charge Master
6 ; file checks: Charge Set and Billable Items defined and match
7 ; line checks: these must be true for the item to be added to CM (Errors)
8 ; - item in source file and is active
9 ; - NDCs not checked since these are added to the source file (363.21) if not defined
10 ; - if CPT and Modifier defined then modifier must be valid for the CPT
11 ; - dates are in correct format
12 ; - inactive date and modifier are not required
13 ;
14 ; duplicates: the new charge for an Item is compared to any existing charges for the Item in the CM,
15 ; duplicates are not added
16 ; - possible duplicates: CS, item, eff dt, and modifier all match
17 ; - these are NOT counted as Duplicates, but as Errors so they can be displayed
18 ; individually on the reports
19 ; - exact duplicates: CS, item, eff dt, modifier, and Charge all match
20 ; - these will be counted as exact Duplicates and are not added to CM
21 ; - removed IB*2*138: no change in charge: the same charge already exists for the item
22 ; - this is basically an exact duplicate except the effective date may be different
23 ; - these will be counted as exact Duplicates and are not added to CM
24 ;
25 ; zero charge: Items uploaded with a with zero charge are not added to CM
26 ; - on check report all items found with a zero charge are added to the Zero Count
27 ; - if an active charge currently exists in CM for the item of the zero charge then
28 ; - the existing charge is inactivated by having an inactive date added
29 ; - the inactive date added is 1 day before the zero charges effective date
30 ; - the effective dates do not have to match, the charge just has to be active
31 ; on the zero charge effective date
32 ; - on the Add report these added to the Inactive Count
33 ;
34 ; Inactive Date: Tries to inactivate an existing entry if the Item uploaded is inactive
35 ; - if a charge has an inactive date but is an exact duplicate of an existing charge
36 ; - the existing charge must match effective date and not already have an inactive date
37 ; - the inactive date will be added as the Inactive Date of the existing charge
38 ; - these will be counted as Duplicates during the Check but as Inactives during the Add
39 ;
40 ; NDC Numbers not already defined in 363.31 are automatically added
41 ;
42SRCH(FILE,ADD) ; search and check a particular Host file
43 ; results: ^TMP($J,FILE,SUBFILE) = ^ comment 1 ^ comment 2 ^ comment 3
44 ; ^TMP($J,FILE,SUBFILE,X) = error # ^ comment/error
45 ;
46 N IBSUB,IBTSCNT,IBCS,IBCI,IBBI,IBADD,IBDUP,IBCNT,IBZERO,IBERR,IBINAC,IBLN,IBX,IBY,IBZ,IBITM,IBARR Q:$G(FILE)=""
47 K ^TMP($J,FILE) I $G(^XTMP(FILE,0))="" Q
48 I '$D(ZTQUEUED) W !!,$S(+$G(ADD):"Loading data into Charge Master:",1:"Data validity check on temporary files:")
49 ;
50 S IBSUB=0 F S IBSUB=$O(^XTMP(FILE,IBSUB)) Q:IBSUB="" D CHECKS
51 ;
52 Q
53 ;
54 ;
55CHECKS ;
56 S IBTSCNT=+$G(^XTMP(FILE,IBSUB))
57 S IBCS=+$P($G(^XTMP(FILE,IBSUB)),U,3) I '+IBCS Q
58 S IBBI=$$CSBI^IBCRU3(+IBCS)
59 I '$D(ZTQUEUED) W !!,FILE,?35,IBSUB,?50
60 ;
61 S IBY=$$CHKFL^IBCRHU1(IBCS,FILE,IBSUB) I +IBY D SETF(IBY) Q
62 ;
63 S (IBDUP,IBERR,IBADD,IBINAC,IBZERO,IBCNT,IBX)=0
64 ;
65 F S IBX=$O(^XTMP(FILE,IBSUB,IBX)) Q:'IBX D Q:+IBY=3
66 . I '$D(ZTQUEUED),'(IBCNT#100) W "."
67 . S IBY=0,IBCNT=IBCNT+1,IBLN=$G(^XTMP(FILE,IBSUB,IBX)) Q:IBLN=""
68 . S IBITM=$$ITPTR^IBCRU2(IBBI,$P(IBLN,U,1))
69 . ;
70 . I +$G(ADD),'IBITM,+IBBI=3 S IBITM=$$ADDBI^IBCREF("NDC",$P(IBLN,U,1)) Q:'IBITM
71 . ;
72 . I '$P(IBLN,U,4) D S:'IBCI IBZERO=IBZERO+1 Q
73 .. S IBCI=0 K IBARR I '$G(ADD)!+IBY Q
74 .. D ITMCHG^IBCRCC(IBCS,IBITM,$P(IBLN,U,2),$P(IBLN,U,5),.IBARR) S IBCI=+$G(IBARR(1))
75 .. I +IBCI S IBZ=$$FMADD^XLFDT($P(IBLN,U,2),-1) D EDITCI^IBCREF(+IBCI,"","","",IBZ) S IBINAC=IBINAC+1
76 . ;
77 . I +$G(ADD),+$P(IBLN,U,3) D I +IBCI Q
78 .. S IBCI=$$FINDCI^IBCRU4(IBCS,IBITM,$P(IBLN,U,2),$P(IBLN,U,5),"",$P(IBLN,U,4),"",,$P(IBLN,U,6))
79 .. I +IBCI D EDITCI^IBCREF(IBCI,"","","",$P(IBLN,U,3)) S IBINAC=IBINAC+1
80 . ;
81 . S IBY=$$CHKLN^IBCRHU1(IBBI,IBLN) I +IBY D SETL(IBY) S IBERR=IBERR+1 Q
82 . ;
83 . S IBY=$$CHKDUP^IBCRHU1(IBCS,IBLN,+$G(ADD)) I +IBY S:+IBY=2 IBDUP=IBDUP+1 D:+IBY'=2 SETL(IBY) S:+IBY<2 IBERR=IBERR+1 Q
84 . ;
85 . I +$G(ADD),'IBY D
86 .. I $$ADDCI^IBCREF(IBCS,IBITM,$P(IBLN,U,2),+$P(IBLN,U,4),"",$P(IBLN,U,5),$P(IBLN,U,3),$P(IBLN,U,6)) S IBADD=IBADD+1
87 ;
88 I +IBCNT,$G(^TMP($J,FILE,IBSUB))="" D D SETF(IBY)
89 . S IBZ=((IBERR/IBCNT)*100)
90 . S IBY="0^"_IBCNT_" of "_IBTSCNT_" records checked, "_IBDUP_" duplicates, "_IBZERO_" with $=0^"_IBERR_" line/data errors or warnings found for a "_+$FN(IBZ,"",2)_"% error rate.^"
91 . ;
92 . I +$G(ADD),+IBINAC S IBY=IBY_IBINAC_" charges items inactivated, "
93 . I +$G(ADD) S IBY=IBY_IBADD_" entries added to the Charge Set "_$P($G(^IBE(363.1,+IBCS,0)),U,1)_"."
94 Q
95 ;
96SETF(ERROR) ;
97 S ^TMP($J,FILE,IBSUB)=ERROR
98 Q
99SETL(ERROR) ;
100 S ^TMP($J,FILE,IBSUB,IBX)=ERROR
101 Q
Note: See TracBrowser for help on using the repository browser.