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

ABSPOSFB.m

Go to the documentation of this file.
  1. ABSPOSFB ; IHS/FCS/DRS - VMEDS(*) prep for ABSP(*) ; [ 09/12/2002 10:08 AM ]
  1. ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
  1. ;----------------------------------------------------------------------
  1. ;
  1. ; Copied from routine ABSPOSCB on 03/20/2001.
  1. ; This version is for printing NCPDP forms.
  1. ; Goal: merge the two versions back into the same one someday.
  1. ; Complication with that, however: this operates off 9002313.57
  1. ; but the other one works with 9002313.59
  1. ;----------------------------------------------------------------------
  1. ;
  1. Q
  1. ABSP() ;EP - from ABSPOSFA - with TRANSACT(ien57)=""
  1. ; Returns 0 if success, nonzero if error
  1. ;
  1. ; We know that all of the transactions in the list
  1. ; have the same insurer, patient, visit.
  1. N PATIEN,VMEDS,NMEDS,INSURER,INSPINS,VSTIEN,INDEX,DIALOUT
  1. D ; set up some vars and make very sure some basic data exists
  1. . N R0,R1,IEN57 S IEN57=$O(TRANSACT(""))
  1. . S R0=^ABSPTL(IEN57,0),R1=^(1)
  1. . S PATIEN=$P(R0,U,6)
  1. . S VSTIEN=$P(R0,U,7)
  1. . S INSURER=$P(R1,U,6)
  1. . S INSPINS=$P(R1,U,8),INSPINS=$P($G(^ABSPTL(IEN57,6)),U,INSPINS)
  1. . I 'PATIEN D CRASH
  1. . I '$D(^DPT(PATIEN,0)) D CRASH
  1. . I 'VSTIEN D CRASH
  1. . I '$D(^AUPNVSIT(VSTIEN,0)) D CRASH
  1. ;
  1. E ;Set up VMEDS(*)=^RXI^RXR^^IEN57
  1. D GETVMED(.VMEDS)
  1. I '$D(VMEDS) Q 651
  1. I 'VMEDS(0) Q 652
  1. ;
  1. ;Get general info and set up ABSP array for Patient, Insurer, Site and
  1. ;NCPDP record format data
  1. ;
  1. S DIALOUT=0
  1. D GETINFO^ABSPOSFC(DIALOUT,PATIEN,VSTIEN,INSPINS,INSURER)
  1. ;
  1. ;Determine number of mediations returned from GetInfo procedure
  1. S NMEDS=+$G(VMEDS(0))
  1. S ABSP("RX",0)=NMEDS
  1. Q:NMEDS=0 653
  1. L ;Get medication and prescription data for each medication
  1. F INDEX=1:1:NMEDS D MEDINFO^ABSPOSFD(VMEDS(INDEX),INDEX,INSPINS)
  1. Q 0
  1. ;----------------------------------------------------------------------
  1. ;Setup VMEDS() array, which contains medication and prescription data
  1. ;for each medication in the billing items record:
  1. ;
  1. ; .VMEDS - Array of V Medication IEN #s (9000010.14)
  1. ; VMEDS(0) = <Total Number>
  1. ; VMEDS(N) = $P=1 --> null
  1. ; $P=2 --> <RXIEN>
  1. ; $P=3 --> <RXRFIEN>
  1. ; $P=4 --> null
  1. ; $P=5 --> pointer to 9002313.57
  1. ;----------------------------------------------------------------------
  1. GETVMED(VMEDS) ;
  1. ;Manage local variables
  1. N NEXT,COUNT,RXIEN,RXRFIEN,IEN57
  1. ;
  1. ;Loop: TRANSACT(ien57)->VMED(*)
  1. ;
  1. S (NEXT,COUNT)=0
  1. F D Q:'NEXT
  1. .S NEXT=$O(TRANSACT(NEXT)) Q:'NEXT
  1. .S IEN57=NEXT
  1. .N R0,R1 S R0=^ABSPTL(IEN57,0),R1=^(1)
  1. .S VMEDIEN="" ; don't know, don't care
  1. .S RXIEN=$P(R1,U,11) I 'RXIEN D CRASH
  1. .S RXRFIEN=$P(R1,U,1) I RXRFIEN="" D CRASH
  1. .S COUNT=COUNT+1
  1. .S VMEDS(COUNT)=U_RXIEN_U_RXRFIEN_U_U_IEN57
  1. S VMEDS(0)=COUNT
  1. Q
  1. CRASH N % Q %