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