ABSPES02 ; IHS/FCS/DRS - JWS 03:28 PM 6 Mar 1996 ; [ 09/12/2002 10:03 AM ]
;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
;----------------------------------------------------------------------
;----------------------------------------------------------------------
;Claim Response List by Response Code
;
;Parameters:
; SDATE - Start DATE (Internal FM Fmat)
; EDATE - End DATE (Internal FM Fmat)
; RSPCODE - Claim Response rejection type (R,P,C,D)
; MAX - MAXimum number of items returned in list
; GROOT - Global root of resulting list (eg: "^LIST2($J")
;
;Returns:
;
;----------------------------------------------------------------------
Q
EN1(SDATE,EDATE,RSPCODE,MAX,GROOT) ;EP - from ABSPECZ3
I $E(GROOT,$L(GROOT))="," S GROOT=$E(GROOT,1,$L(GROOT)-1) ; 03/12/2001
;Manage local variables
N DA,DA2,COUNT,DATA,CLAIMID,SENTON,VCPTIEN,VMEDIEN,DRUGIEN,QTY
N DRUGNAME,RS,TDATE,DATE1,DATE2,NDATE,RDA
;
;Make sure input variables are defined
Q:$G(SDATE)=""
Q:$G(EDATE)=""
Q:$G(RSPCODE)=""
Q:$G(MAX)=""
Q:$G(GROOT)=""
;
S DATE1=$$CDTFM^ABSPOSU1(SDATE,-1)_".245959"
S DATE2=EDATE_".245959"
K @(GROOT_")")
S COUNT=0,NDATE=DATE1
F D Q:NDATE=""!(NDATE>DATE2)!(COUNT=MAX)
.S NDATE=$O(^ABSPC("AE",NDATE))
.Q:NDATE=""
.Q:NDATE>DATE2
.S DA=0
.F D Q:'+DA!(COUNT=MAX)
..S DA=$O(^ABSPC("AE",NDATE,DA))
..Q:'+DA
..S RDA=0
..F S RDA=$O(^ABSPR("B",DA,RDA)) Q:'RDA D
...Q:'$D(^ABSPR("AC",RSPCODE,RDA))
...S DATA=$G(^ABSPC(DA,0))
...S CLAIMID=$$LJBF^ABSPOSU9($P(DATA,U,1),16)
...S SENTON=$$FM2EXT^ABSPOSU1($P($P(DATA,U,5),".",1))
...S SENTON=$$LJBF^ABSPOSU9($S(SENTON="":"<Not Sent>",1:SENTON),11)
...S DA2=0
...F D Q:'+DA2
....S DA2=$O(^ABSPR("AC",RSPCODE,RDA,DA2))
....Q:'+DA2
....S RS=$S(RDA="":"",1:$P($G(^ABSPR(RDA,1000,DA2,500)),U,1))
....S RS=$$RJBF^ABSPOSU9(RS,2)
....S VCPTIEN=$P($G(^ABSPC(DA,400,DA2,0)),U,2)
....S VMEDIEN=$S(VCPTIEN="":"",1:$P($G(^ABSVCPT(9002301,VCPTIEN,"SPEC")),U,2))
....S DRUGIEN=$S(VMEDIEN="":"",1:$P($G(^AUPNVMED(VMEDIEN,0)),U,1))
....S QTY=$S(VMEDIEN="":"",1:$P($G(^AUPNVMED(VMEDIEN,0)),U,6))
....S QTY=$$RJBF^ABSPOSU9(QTY,4)
....S DRUGNAME=$S(DRUGIEN="":"Undefined",1:$P($G(^PSDRUG(DRUGIEN,0)),U,1))
....S DRUGNAME=$$LJBF^ABSPOSU9(DRUGNAME,29)
....S COUNT=COUNT+1
....S @(GROOT_",COUNT,""I"")")=DA_U_DA2_U_RDA
....S @(GROOT_",COUNT,""E"")")=CLAIMID_" "_SENTON_" "_RS_" "_DRUGNAME_" "_QTY
S @(GROOT_",""Column Headers"")")="2|Claim ID:16,DATE Sent:11,RS:2,MEDication NAME:29,QTY:4"
S @(GROOT_",0)")=COUNT
Q
ABSPES02 ; IHS/FCS/DRS - JWS 03:28 PM 6 Mar 1996 ; [ 09/12/2002 10:03 AM ]
+1 ;;1.0;PHARMACY POINT OF SALE;**3**;JUN 21, 2001;Build 38
+2 ;----------------------------------------------------------------------
+3 ;----------------------------------------------------------------------
+4 ;Claim Response List by Response Code
+5 ;
+6 ;Parameters:
+7 ; SDATE - Start DATE (Internal FM Fmat)
+8 ; EDATE - End DATE (Internal FM Fmat)
+9 ; RSPCODE - Claim Response rejection type (R,P,C,D)
+10 ; MAX - MAXimum number of items returned in list
+11 ; GROOT - Global root of resulting list (eg: "^LIST2($J")
+12 ;
+13 ;Returns:
+14 ;
+15 ;----------------------------------------------------------------------
+16 QUIT
EN1(SDATE,EDATE,RSPCODE,MAX,GROOT) ;EP - from ABSPECZ3
+1 ; 03/12/2001
IF $EXTRACT(GROOT,$LENGTH(GROOT))=","
SET GROOT=$EXTRACT(GROOT,1,$LENGTH(GROOT)-1)
+2 ;Manage local variables
+3 NEW DA,DA2,COUNT,DATA,CLAIMID,SENTON,VCPTIEN,VMEDIEN,DRUGIEN,QTY
+4 NEW DRUGNAME,RS,TDATE,DATE1,DATE2,NDATE,RDA
+5 ;
+6 ;Make sure input variables are defined
+7 IF $GET(SDATE)=""
QUIT
+8 IF $GET(EDATE)=""
QUIT
+9 IF $GET(RSPCODE)=""
QUIT
+10 IF $GET(MAX)=""
QUIT
+11 IF $GET(GROOT)=""
QUIT
+12 ;
+13 SET DATE1=$$CDTFM^ABSPOSU1(SDATE,-1)_".245959"
+14 SET DATE2=EDATE_".245959"
+15 KILL @(GROOT_")")
+16 SET COUNT=0
SET NDATE=DATE1
+17 FOR
Begin DoDot:1
+18 SET NDATE=$ORDER(^ABSPC("AE",NDATE))
+19 IF NDATE=""
QUIT
+20 IF NDATE>DATE2
QUIT
+21 SET DA=0
+22 FOR
Begin DoDot:2
+23 SET DA=$ORDER(^ABSPC("AE",NDATE,DA))
+24 IF '+DA
QUIT
+25 SET RDA=0
+26 FOR
SET RDA=$ORDER(^ABSPR("B",DA,RDA))
IF 'RDA
QUIT
Begin DoDot:3
+27 IF '$DATA(^ABSPR("AC",RSPCODE,RDA))
QUIT
+28 SET DATA=$GET(^ABSPC(DA,0))
+29 SET CLAIMID=$$LJBF^ABSPOSU9($PIECE(DATA,U,1),16)
+30 SET SENTON=$$FM2EXT^ABSPOSU1($PIECE($PIECE(DATA,U,5),".",1))
+31 SET SENTON=$$LJBF^ABSPOSU9($SELECT(SENTON="":"<Not Sent>",1:SENTON),11)
+32 SET DA2=0
+33 FOR
Begin DoDot:4
+34 SET DA2=$ORDER(^ABSPR("AC",RSPCODE,RDA,DA2))
+35 IF '+DA2
QUIT
+36 SET RS=$SELECT(RDA="":"",1:$PIECE($GET(^ABSPR(RDA,1000,DA2,500)),U,1))
+37 SET RS=$$RJBF^ABSPOSU9(RS,2)
+38 SET VCPTIEN=$PIECE($GET(^ABSPC(DA,400,DA2,0)),U,2)
+39 SET VMEDIEN=$SELECT(VCPTIEN="":"",1:$PIECE($GET(^ABSVCPT(9002301,VCPTIEN,"SPEC")),U,2))
+40 SET DRUGIEN=$SELECT(VMEDIEN="":"",1:$PIECE($GET(^AUPNVMED(VMEDIEN,0)),U,1))
+41 SET QTY=$SELECT(VMEDIEN="":"",1:$PIECE($GET(^AUPNVMED(VMEDIEN,0)),U,6))
+42 SET QTY=$$RJBF^ABSPOSU9(QTY,4)
+43 SET DRUGNAME=$SELECT(DRUGIEN="":"Undefined",1:$PIECE($GET(^PSDRUG(DRUGIEN,0)),U,1))
+44 SET DRUGNAME=$$LJBF^ABSPOSU9(DRUGNAME,29)
+45 SET COUNT=COUNT+1
+46 SET @(GROOT_",COUNT,""I"")")=DA_U_DA2_U_RDA
+47 SET @(GROOT_",COUNT,""E"")")=CLAIMID_" "_SENTON_" "_RS_" "_DRUGNAME_" "_QTY
End DoDot:4
IF '+DA2
QUIT
End DoDot:3
End DoDot:2
IF '+DA!(COUNT=MAX)
QUIT
End DoDot:1
IF NDATE=""!(NDATE>DATE2)!(COUNT=MAX)
QUIT
+48 SET @(GROOT_",""Column Headers"")")="2|Claim ID:16,DATE Sent:11,RS:2,MEDication NAME:29,QTY:4"
+49 SET @(GROOT_",0)")=COUNT
+50 QUIT