source: FOIAVistA/trunk/r/INTEGRATED_BILLING-IB-PRQ--IBD--IBQ--PRQS/IBCROI1.m@ 1540

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

initial load of FOIAVistA 6/30/08 version

File size: 3.9 KB
Line 
1IBCROI1 ;ALB/ARH - RATES: REPORTS CHARGE ITEM (SRCH) ; 11/22/96
2 ;;2.0;INTEGRATED BILLING;**52,106,245,287**;21-MAR-94
3 ;;Per VHA Directive 10-93-142, this routine should not be modified.
4 ;
5 ; ^TMP($J,SUB1) = report header ^ SORT1 ^ SORT2 ^ count & desc (optional)
6 ; ^TMP($J,SUB1, SUB2) = IFN of SUB2
7 ; ^TMP($J,SUB1, SUB2, SUB3, SUB4, CI IFN) = itm ^ cs ^ ef dt ^ in dt ^ chg ^ rv cd ^ mod ^ base charge
8 ;
9 ; SORT1=1: (SRCH1) SUB2 = BILLING RATE name SORT2=1: SUB3 = Item Name SUB4 = Effective Date
10 ; SORT1=2: (SRCH2) SUB2 = CHARGE SET name SORT2=2: SUB3 = Effective Date SUB4 = Item Name
11 ;
12 ; SUB1 - first subscript to identify the search/print, set to "IBCROI" for the Charge Item report
13 ; other reports may use this array and print routine, both TMPLN and TMPHDR must be called to setup array
14 ; if called direct to SRCHITM with SORT3=3: sort by Item, Effective Date, SUB2 (as passed in)
15 ;
16SRCH1(BRL,SORT2,BDT,EDT,IBSELITM) ; search/gather items for the report, all charge sets for a particular Rate
17 ; Input: BRL = List of Billing Rates to include, SORT2 = secondary sort: 1/charge item, 2/effective date
18 N IBRATE,IBRATEN,IBHDR,IBSUB2,IBCS,IBCS0,IBI K ^TMP($J,"IBCROI") I '$G(SORT2)!($G(BDT)'?7N)!($G(EDT)'?7N) Q
19 ;
20 I +$G(BRL) S IBRATE=0 F IBI=1:1 S IBRATE=$P(BRL,U,IBI) Q:'IBRATE D
21 . S IBRATEN=$P($G(^IBE(363.3,+IBRATE,0)),U,1) Q:IBRATEN=""
22 . S IBHDR="Charges for "_$S(+$P(BRL,U,2):"Selected",1:IBRATEN)_" Rates ",IBSUB2="BILLING RATE"
23 . ;
24 . S IBCS=0 F S IBCS=$O(^IBE(363.1,IBCS)) Q:'IBCS D
25 .. S IBCS0=$G(^IBE(363.1,IBCS,0)) I $P(IBCS0,U,2)'=IBRATE Q
26 .. D SRCHITM(IBCS,IBSUB2,SORT2,BDT,EDT,$G(IBSELITM)) I '$D(ZTQUEUED) W "."
27 .. D TMPHDR("IBCROI",IBSUB2,0,IBHDR,"1^"_SORT2,BDT,EDT)
28 Q
29 ;
30SRCH2(CSL,SORT2,BDT,EDT,IBSELITM) ; search/gather items for the report for a group of Charge Sets
31 ; Input: CSL = list of Charge Sets to sort, SORT2 = secondary sort: 1/charge item, 2/effective date
32 N IBCS,IBCSN,IBI,IBHDR K ^TMP($J,"IBCROI") I '$G(SORT2)!($G(BDT)'?7N)!($G(EDT)'?7N) Q
33 ;
34 I +$G(CSL) S IBCS=0 F IBI=1:1 S IBCS=$P(CSL,U,IBI) Q:'IBCS D
35 . S IBCSN=$P($G(^IBE(363.1,+IBCS,0)),U,1) Q:IBCSN="" S IBHDR="Charges by Set for "
36 . D SRCHITM(IBCS,IBCSN,SORT2,BDT,EDT,$G(IBSELITM)) I '$D(ZTQUEUED) W "."
37 . D TMPHDR("IBCROI",IBCSN,IBCS,IBHDR,"2^"_SORT2,BDT,EDT)
38 Q
39 ;
40SRCHITM(CS,SUB2,SORT2,BDT,EDT,IBSELITM) ; search/gather all items within the date range for one Charge Set
41 ; Input: CS = CS IFN, SUB2 = first data subscript, SORT2 = secondary sort: 1/charge item, 2/effective date
42 N IBXRF,IBITM,IBEFDT,IBCI,IBINDT,IBITEM,IBITEMN I '$G(CS)!'$G(SORT2)!($G(SUB2)="")!($G(BDT)'?7N)!($G(EDT)'?7N) Q
43 S IBXRF="AIVDTS"_+CS
44 ;
45 S IBITM=+$G(IBSELITM) I +IBITM S IBITM=IBITM-.0001
46 F S IBITM=$O(^IBA(363.2,IBXRF,IBITM)) Q:'IBITM!(+$G(IBSELITM)&(IBITM'=$G(IBSELITM))) D
47 . S IBEFDT=-(EDT+.01) F S IBEFDT=$O(^IBA(363.2,IBXRF,IBITM,IBEFDT)) Q:'IBEFDT D
48 .. S IBCI=0 F S IBCI=$O(^IBA(363.2,IBXRF,IBITM,IBEFDT,IBCI)) Q:'IBCI D
49 ... ;
50 ... S IBINDT=$$INACTCI^IBCRU4(IBCI) I +IBINDT,IBINDT<BDT Q
51 ... D TMPLN(IBCI,"IBCROI",SUB2,SORT2)
52 Q
53 ;
54TMPLN(CI,SUB1,SUB2,SORT2) ; add charge item to TMP array
55 N IBINDT,IBITEM,IBITEMN I '$G(CI)!'$G(SORT2)!($G(SUB1)="")!($G(SUB2)="") Q
56 S IBINDT=$$INACTCI^IBCRU4(CI)
57 S IBITEM=$G(^IBA(363.2,+CI,0)) Q:IBITEM="" ;S $P(IBITEM,U,8)=IBINDT
58 S IBITEMN=$$EXPAND^IBCRU1(363.2,.01,$P(IBITEM,U,1))_" "
59 I +$P(IBITEM,U,7) S IBITEMN=IBITEMN_"- "_$P($$MOD^ICPTMOD(+$P(IBITEM,U,7),"I",DT),U,2)
60 ;
61 I SORT2=1 S ^TMP($J,SUB1,SUB2,IBITEMN,+$P(IBITEM,U,3),+CI)=IBITEM
62 I SORT2=2 S ^TMP($J,SUB1,SUB2,+$P(IBITEM,U,3),IBITEMN,+CI)=IBITEM
63 ;
64 I SORT2=3 S ^TMP($J,SUB1,IBITEMN,+$P(IBITEM,U,3),SUB2,+CI)=IBITEM
65 Q
66 ;
67TMPHDR(SUB1,SUB2,SUB2IFN,HDR,SORT,BDT,EDT) ; set up top level of the TMP array
68 I '$G(SORT)!($G(SUB2)="")!($G(SUB1)="") Q
69 I +$G(BDT) S HDR=$G(HDR)_" "_$$DATE^IBCRU1(BDT) I +$G(EDT) S HDR=HDR_" - "_$$DATE^IBCRU1(EDT)
70 S ^TMP($J,SUB1)=HDR_U_SORT
71 S ^TMP($J,SUB1,SUB2)=SUB2IFN
72 Q
Note: See TracBrowser for help on using the repository browser.