source: FOIAVistA/tag/r/FEE_BASIS-FB/FBRXUTL.m@ 628

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

initial load of FOIAVistA 6/30/08 version

File size: 3.1 KB
Line 
1FBRXUTL ;WIOFO/SAB-FEE BASIS PHARMACY UTILITY ;4/8/2004
2 ;;3.5;FEE BASIS;**78**;JAN 30, 1995
3 Q
4 ;
5RXSUM(FBDT,FBSN) ; fee prescription costs extrinsic function
6 ; Integration Agreement #4395
7 ; This API returns the count and cost of prescriptions paid
8 ; through the fee software for a specified date.
9 ;
10 ; Usage: S X=$$FEERX(FBDT,FBSN)
11 ; input
12 ; FBDT - date, required, VA FileMan internal format
13 ; Used to select prescriptions based on Date Certified for
14 ; Payment.
15 ; FBSN - station number, required, 3 digit value
16 ; Used to select prescriptions based on the VAMC that approved
17 ; payment when querying the national Fee Replacement system.
18 ; Prescriptions will be included when the approving station
19 ; number Starts With this 3 digit value so satellite
20 ; station 688A1 would be included when FBSN = 688.
21 ; This parameter will not be evaluated until the API is
22 ; modified to obtain data from the Fee Replacement system.
23 ; Return value is a string
24 ; string value = count ^ total amount paid
25 ; where
26 ; count = the number of prescriptions for the date and station
27 ; total amount paid = sum of the Amount Paid for the prescriptions
28 ; in dollars and cents
29 ; OR
30 ; X = -1 ^ exception number ^ exception text
31 ;
32 ; Examples S var=$$FEERX^FBZSAB9(DT,688) could return values like
33 ; 8^10.54
34 ; 0^0.00
35 ; -1^110^Database Unavailable
36 ;
37 ; List of Exceptions
38 ; 101^Valid date not specified.
39 ; 102^Valid station number not specified.
40 ; 110^Database Unavailable.
41 ; The database unavailable exception will not occur until this API
42 ; is modified to obtain data from the fee replacement system.
43 ; However, calling applications should code to handle this exception
44 ; now so appropriate action will be taken once the data is moved from
45 ; the local VistA system to the remote fee replacement system.
46 ;
47 N FBDFN,FBC,FBDA,FBDA1,FBRET,FBTAMT
48 S FBDT=$G(FBDT)
49 S FBSN=$G(FBSN)
50 S FBRET=""
51 ;
52 ; check for required input
53 I FBRET'<0 D
54 . I FBDT'?7N S FBRET="-1^101^Valid date not specified." Q
55 . I $$FMTHL7^XLFDT(FBDT)<0 S FBRET="-1^101^Valid date not specified." Q
56 . I FBSN'?3N S FBRET="-1^102^Valid station number not specified." Q
57 . I $$IEN^XUAF4(FBSN)'>0 S FBRET="-1^102^Valid station number not specified." Q
58 ;
59 ; get count and total amount
60 I FBRET'<0 D
61 . S FBC=0 ; initialize count
62 . S FBTAMT=0 ; initialize total amount paid
63 . ;
64 . ; find prescriptions using File #162.1 "AA" cross-reference
65 . ; loop thru patient within date certified
66 . S FBDFN=""
67 . F S FBDFN=$O(^FBAA(162.1,"AA",FBDT,FBDFN)) Q:FBDFN="" D
68 . . ; loop thru invoice ien
69 . . S FBDA1=0
70 . . F S FBDA1=$O(^FBAA(162.1,"AA",FBDT,FBDFN,FBDA1)) Q:'FBDA1 D
71 . . . ; loop thru prescription ien
72 . . . S FBDA=0
73 . . . F S FBDA=$O(^FBAA(162.1,"AA",FBDT,FBDFN,FBDA1,FBDA)) Q:'FBDA D
74 . . . . ; add prescription to count and total amount paid
75 . . . . S FBC=FBC+1
76 . . . . S FBTAMT=FBTAMT+$P($G(^FBAA(162.1,FBDA1,"RX",FBDA,0)),U,16)
77 . ;
78 . S FBRET=FBC_U_$FN(FBTAMT,"",2)
79 ;
80 Q FBRET
81 ;
82 ;FBRXUTL
Note: See TracBrowser for help on using the repository browser.