Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: FBRXUTL

FBRXUTL.m

Go to the documentation of this file.
  1. FBRXUTL ;WIOFO/SAB-FEE BASIS PHARMACY UTILITY ;4/8/2004
  1. ;;3.5;FEE BASIS;**78**;JAN 30, 1995
  1. Q
  1. ;
  1. RXSUM(FBDT,FBSN) ; fee prescription costs extrinsic function
  1. ; Integration Agreement #4395
  1. ; This API returns the count and cost of prescriptions paid
  1. ; through the fee software for a specified date.
  1. ;
  1. ; Usage: S X=$$FEERX(FBDT,FBSN)
  1. ; input
  1. ; FBDT - date, required, VA FileMan internal format
  1. ; Used to select prescriptions based on Date Certified for
  1. ; Payment.
  1. ; FBSN - station number, required, 3 digit value
  1. ; Used to select prescriptions based on the VAMC that approved
  1. ; payment when querying the national Fee Replacement system.
  1. ; Prescriptions will be included when the approving station
  1. ; number Starts With this 3 digit value so satellite
  1. ; station 688A1 would be included when FBSN = 688.
  1. ; This parameter will not be evaluated until the API is
  1. ; modified to obtain data from the Fee Replacement system.
  1. ; Return value is a string
  1. ; string value = count ^ total amount paid
  1. ; where
  1. ; count = the number of prescriptions for the date and station
  1. ; total amount paid = sum of the Amount Paid for the prescriptions
  1. ; in dollars and cents
  1. ; OR
  1. ; X = -1 ^ exception number ^ exception text
  1. ;
  1. ; Examples S var=$$FEERX^FBZSAB9(DT,688) could return values like
  1. ; 8^10.54
  1. ; 0^0.00
  1. ; -1^110^Database Unavailable
  1. ;
  1. ; List of Exceptions
  1. ; 101^Valid date not specified.
  1. ; 102^Valid station number not specified.
  1. ; 110^Database Unavailable.
  1. ; The database unavailable exception will not occur until this API
  1. ; is modified to obtain data from the fee replacement system.
  1. ; However, calling applications should code to handle this exception
  1. ; now so appropriate action will be taken once the data is moved from
  1. ; the local VistA system to the remote fee replacement system.
  1. ;
  1. N FBDFN,FBC,FBDA,FBDA1,FBRET,FBTAMT
  1. S FBDT=$G(FBDT)
  1. S FBSN=$G(FBSN)
  1. S FBRET=""
  1. ;
  1. ; check for required input
  1. I FBRET'<0 D
  1. . I FBDT'?7N S FBRET="-1^101^Valid date not specified." Q
  1. . I $$FMTHL7^XLFDT(FBDT)<0 S FBRET="-1^101^Valid date not specified." Q
  1. . I FBSN'?3N S FBRET="-1^102^Valid station number not specified." Q
  1. . I $$IEN^XUAF4(FBSN)'>0 S FBRET="-1^102^Valid station number not specified." Q
  1. ;
  1. ; get count and total amount
  1. I FBRET'<0 D
  1. . S FBC=0 ; initialize count
  1. . S FBTAMT=0 ; initialize total amount paid
  1. . ;
  1. . ; find prescriptions using File #162.1 "AA" cross-reference
  1. . ; loop thru patient within date certified
  1. . S FBDFN=""
  1. . F S FBDFN=$O(^FBAA(162.1,"AA",FBDT,FBDFN)) Q:FBDFN="" D
  1. . . ; loop thru invoice ien
  1. . . S FBDA1=0
  1. . . F S FBDA1=$O(^FBAA(162.1,"AA",FBDT,FBDFN,FBDA1)) Q:'FBDA1 D
  1. . . . ; loop thru prescription ien
  1. . . . S FBDA=0
  1. . . . F S FBDA=$O(^FBAA(162.1,"AA",FBDT,FBDFN,FBDA1,FBDA)) Q:'FBDA D
  1. . . . . ; add prescription to count and total amount paid
  1. . . . . S FBC=FBC+1
  1. . . . . S FBTAMT=FBTAMT+$P($G(^FBAA(162.1,FBDA1,"RX",FBDA,0)),U,16)
  1. . ;
  1. . S FBRET=FBC_U_$FN(FBTAMT,"",2)
  1. ;
  1. Q FBRET
  1. ;
  1. ;FBRXUTL