BARRNBRE ; IHS/SD/POT - Non Ben Payment Report PART 4
;;1.8;IHS ACCOUNTS RECEIVABLE;**24**;OCT 26, 2005;Build 69
; IHS/SD/POT 07/15/13 HEAT114352 NEW REPORT BAR*1.8*24
Q
;
CHKTRANS(BARTR) ;EP - CALLED FROM BARRNBRA
; for checking Transaction File data parameters
S BARP("HIT")=0
S:$G(BAR("SUBR"))="" BAR("SUBR")=$S($G(BAR("RTN"))'="":BAR("RTN"),1:"UNKNOWN CALL")
I '$D(^BARTR(DUZ(2),BARTR,0)) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO ZERO NODE",BARTR)="" Q
S BARTR(0)=$G(^BARTR(DUZ(2),BARTR,0)) ; A/R Transaction 0 node
I '$D(^BARTR(DUZ(2),BARTR,1)) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO 1 NODE",BARTR)="" Q
S BARTR(1)=$G(^BARTR(DUZ(2),BARTR,1)) ; A/R Transaction 1 node
S BARTR("DATA SRC")=$S($P(BARTR(1),U,6)'="":$P(BARTR(1),U,6),1:"m") ;A/R Transaction DATA SOURCE (e=ERA posted)
S BARTR("T")=$P(BARTR(1),U) ; Transaction type
S BARTR("ADJ CAT")=$P(BARTR(1),U,2) ;Adjustment Category
S BARTR("ADJ TYPE")=$P(BARTR(1),U,3) ;Adjustment Type
S:BARTR("T")="" BARTR("T")="NULL"
S:BARTR("ADJ CAT")="" BARTR("ADJ CAT")="NULL"
S:BARTR("ADJ TYPE")="" BARTR("ADJ TYPE")="NULL"
;ADD TRANS TYPE/ADJ CAT/ADJ TYPE INCLUSION
I $D(BARY("TRANS TYPE")),'$D(BARY("TRANS TYPE",BARTR("T"))) D Q
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN TRANSACTION TYPE",$P(BARTR(0),U))=BARTR("T")
I $D(BARY("TRANS TYPE","ADJ CAT")),'$D(BARY("TRANS TYPE","ADJ CAT",BARTR("ADJ CAT"))) D Q
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ADJUSTMENT CATEGORY",$P(BARTR(0),U))=BARTR("ADJ CAT")
I $D(BARY("TRANS TYPE","ADJ TYPE")),'$D(BARY("TRANS TYPE","ADJ TYPE",BARTR("ADJ TYPE"))) D Q ;TMM*1.8*19
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ADJ TYPE",$P(BARTR(0),U))=BARTR("ADJ TYPE")
S BARTR("DT")=$P(BARTR(0),U) ; Transaction date/time
S BARTR("B")=$P(BARTR(0),U,14) ; A/R Collection batch IEN
K BARTR("B DT")
I BARTR("B")'="" D
.S BARTR("B DT")=$P($P($G(^BARCOL(DUZ(2),BARTR("B"),0)),U,4),".") ;
S:BARTR("B")="" BARTR("B")="No Collection Batch"
S BARTR("IT")=$P(BARTR(0),U,15) ; A/R Collection batch item
S:BARTR("IT")="" BARTR("IT")="No Collection Batch Item"
;
K BAR("QUIT")
I $G(BARY("DT"))="B" D Q:$G(BAR("QUIT"))
.I '$G(BARTR("B DT")) S BAR("QUIT")=1 S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO BATCH DATE",$P(BARTR(0),U))="" Q
.I $D(BARTR("B DT")) D Q:$G(BAR("QUIT")) ; Not chosen batch date
..S:BARTR("B DT")<BARY("DT",1) BAR("QUIT")=1
..S:BARTR("B DT")>BARY("DT",2) BAR("QUIT")=1
..I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BATCH DATE",$P(BARTR(0),U))=""
;END
S BARTR("AR")=$P(BARTR(0),U,13) ; Entry by (AR Clerk)
S:BARTR("AR")="" BARTR("AR")=9999999
S:'$D(BARY("AR")) BARTR("AR")=0
S BARTR("CR-DB")=$$GET1^DIQ(90050.03,BARTR,3.5)
S BAR=$P(BARTR(0),U,4) ; A/R Bill IEN
I $D(BARY("BATCH")),BARTR("T")=100 S BAR("UN-ALLOCATED",BARTR("IT"))=$G(BAR("UN-ALLOCATED",BARTR("IT")))+BARTR("CR-DB")_U_DUZ(2)
I '+BAR S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO BILL FOR TRANSACTION",$P(BARTR(0),U))=""
Q:'+BAR ; No bill for transaction
I '$D(^BARBL(DUZ(2),BAR)) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","TRANS PTS TO NON EXIST BILL",$P(BARTR(0),U))=""
Q:'$D(^BARBL(DUZ(2),BAR)) ; Trans points to non-existent bill
S BAR(0)=$G(^BARBL(DUZ(2),BAR,0)) ; A/R Bill 0 node
S BAR(10)=$G(^BARBL(DUZ(2),BAR,1)) ; A/R Bill 1 node
;
S BARTR("DOS BEGIN")=$P(BAR(10),U,2) ;A/R Bill DOS BEGIN
S BARTR("3P APPROVAL")=$P(BAR(0),U,18) ;3P APPROVAL DATE
S BARTR("3P PRINT")=$P(BAR(0),U,19) ;3P PRINT DATE
K BAR("QUIT")
I $G(BARY("DT"))="V" D Q:$G(BAR("QUIT")) ; Not chosen visit date
. S:BARTR("DOS BEGIN")<BARY("DT",1) BAR("QUIT")=1
. S:$P(BARTR("DOS BEGIN"),".")>BARY("DT",2) BAR("QUIT")=1
. I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN VISIT DATE",$P(BARTR(0),U))=""
I $G(BARY("DT"))="A" D Q:$G(BAR("QUIT")) ; Not chosen approval date
. S:BARTR("3P APPROVAL")<BARY("DT",1) BAR("QUIT")=1
. S:$P(BARTR("3P APPROVAL"),".")>BARY("DT",2) BAR("QUIT")=1
. I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN APPROVAL DATE",$P(BARTR(0),U))=""
I $G(BARY("DT"))="X" D Q:$G(BAR("QUIT")) ; Not chosen export date
. S:BARTR("3P PRINT")<BARY("DT",1) BAR("QUIT")=1
. S:$P(BARTR("3P PRINT"),".")>BARY("DT",2) BAR("QUIT")=1
. I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN EXPORT DATE",$P(BARTR(0),U))=""
;S BARTR("I")=$P(BAR(0),U,3) ; A/R Account ;12/15/2013 P.OTT
S BARTR("I")=$P(BARTR(0),U,6) ; A/R Account ;12/15/2013 P.OTT
S BARTR("L")=$P(BAR(10),U,8) ; Visit location
S BAR("PV")=$P(BAR(10),U,13) ; Provider (New Person)
S BAR("V")=$P(BAR(10),U,14) ; Visit type (3P Visit Type)
S BAR("C")=$P(BAR(10),U,12) ; Clinic (Clinic Stop File)
S BAR("DS")=$$GET1^DIQ(90050.01,BAR,23) ; Discharge Service (#)
I BARTR("I")]"" D
. S D0=BARTR("I")
. S BARTR("BI")=$$VALI^BARVPM(8) ; Insurer Type
I $G(BARTR("BI"))="" S BARTR("BI")="No Billing Entity"
I BARTR("BI")'="No Billing Entity" D
. S BARTR("ALL")="O" ; Other Allow Cat
. I BARTR("BI")="G" S BARTR("ALL")="O" Q ;
. I BARTR("BI")="R"!(BARTR("BI")="MD")!(BARTR("BI")="MH") S BARTR("ALL")="R" Q ; Medicare Allow Cat
. I BARTR("BI")="D" S BARTR("ALL")="D" Q ; Medicaid Allow Cat
. I BARTR("BI")="K" S BARTR("ALL")="D" Q ; CHIPS is lumped with Medicaid ;
. I ",F,M,H,P,"[(","_BARTR("BI")_",") S BARTR("ALL")="P" Q ; Private ;
I $G(BARTR("ALL"))="" S BARTR("ALL")="No Allowance Category"
I BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="") D
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NULL LOCATION^INS TYPE^TRANS DATE/TIME",$P(BARTR(0),U))=BARTR("L")_U_BARTR("I")_U_BARTR("DT")
Q:BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="")
I $D(BARY("LOC")),BARY("LOC")'=BARTR("L") D Q ; Not chosen location
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN LOCATION",$P(BARTR(0),U))=""
I $D(BARY("ARACCT")),'$D(BARY("ARACCT",BARTR("I"))) D Q ;Not chosn acct
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ACCT",$P(BARTR(0),U))=""
I $D(BARY("ACCT")),BARY("ACCT")'=BARTR("I") D Q ; Not chosen A/R acct ;TMM*1.8*19
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN A/R ACCT-"_BARTR("I"),$P(BARTR(0),U))=""
I $G(BARY("SORT"))="V",BAR("V")="" S BAR("V")=99999
I $G(BARY("SORT"))="C",BAR("C")="" S BAR("C")=99999
I $D(BARY("AR")),BARY("AR")'=BARTR("AR") D Q ; Not chosen AR Clerk
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN AR CLERK",$P(BARTR(0),U))=""
I $D(BARY("PRV")),BARY("PRV")'=BAR("PV") D Q ; Not chosen provider
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN PROV",$P(BARTR(0),U))=""
;I $D(BARY("TYP")),(U_BARY("TYP")_U)'[(U_BARTR("BI")_U) D Q ; Not chosen Bill entity
;. ;W !,"NOT BILL ENT; ",BARTR(0)_": "_BARTR("BI")_": "_BARTR("I") R AWD 12/15/2013
;.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BILL ENTITY",$P(BARTR(0),U))=""
I $D(BARY("ITYP")),BARY("ITYP")'=BARTR("BI") D Q ; Not chosen Ins Type
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN INS TYPE",$P(BARTR(0),U))=""
I $D(BARY("ALL")),(+BARY("ALL")=BARY("ALL")) S BARY("ALL")=$$CONVERT^BARRSL2(BARY("ALL"))
I $D(BARY("ALL")),BARY("ALL")'=BARTR("ALL") D Q ; Not chosen Allow Cat
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ALLOW CAT",$P(BARTR(0),U))=""
I $D(BARY("BATCH")),BARY("BATCH")'=BARTR("B") D Q ; Not chosen batch
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BATCH",$P(BARTR(0),U))=""
I $D(BARY("ITEM")),BARY("ITEM")'=BARTR("IT") D Q ; Not chosen item
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ITEM",$P(BARTR(0),U))=""
I $D(BARY("CLIN")),'$D(BARY("CLIN",BAR("C"))) D Q ; Not chosen clinic
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN CLINIC",$P(BARTR(0),U))=""
I $D(BARY("VTYP")),'$D(BARY("VTYP",BAR("V"))) D Q ; Not chosen visit typ
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN VISIT TYP",$P(BARTR(0),U))=""
I $D(BARY("DSCH")),BAR("DS")="" S BAR("DS")=99999
I $D(BARY("DSCH")),'$D(BARY("DSCH",BAR("DS"))) D Q ;Not chosen discharge svc
.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN DISCHARGE SVC",$P(BARTR(0),U))=""
K BAR("QUIT")
I $G(BARY("DT"))="T" D Q:$G(BAR("QUIT")) ; Not chosen trans date
. S:BARTR("DT")<BARY("DT",1) BAR("QUIT")=1
. S:$P(BARTR("DT"),".")>BARY("DT",2) BAR("QUIT")=1
. I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN TRANS DATE",$P(BARTR(0),U))=""
I $D(BARY("PER")) D Q:$G(BAR("QUIT")) ; Not chosen period date range
. S:BARTR("DT")<BARBDT BAR("QUIT")=1
. S:$P(BARTR("DT"),".")>BAREDT BAR("QUIT")=1
. I $G(BAR("QUIT")) S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN PERIOD DATE",$P(BARTR(0),U))=""
I $D(BARY("DATA SRC")) D Q:$G(BAR("QUIT"))
.I BARY("DATA SRC")="MANUAL",(BARTR("DATA SRC")="e") S BAR("QUIT")=1
.I BARY("DATA SRC")="ELECTRONIC",(BARTR("DATA SRC")="m") S BAR("QUIT")=1
S BARP("HIT")=1
Q
BARRNBRE ; IHS/SD/POT - Non Ben Payment Report PART 4
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**24**;OCT 26, 2005;Build 69
+2 ; IHS/SD/POT 07/15/13 HEAT114352 NEW REPORT BAR*1.8*24
+3 QUIT
+4 ;
CHKTRANS(BARTR) ;EP - CALLED FROM BARRNBRA
+1 ; for checking Transaction File data parameters
+2 SET BARP("HIT")=0
+3 IF $GET(BAR("SUBR"))=""
SET BAR("SUBR")=$SELECT($GET(BAR("RTN"))'="":BAR("RTN"),1:"UNKNOWN CALL")
+4 IF '$DATA(^BARTR(DUZ(2),BARTR,0))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO ZERO NODE",BARTR)=""
QUIT
+5 ; A/R Transaction 0 node
SET BARTR(0)=$GET(^BARTR(DUZ(2),BARTR,0))
+6 IF '$DATA(^BARTR(DUZ(2),BARTR,1))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO 1 NODE",BARTR)=""
QUIT
+7 ; A/R Transaction 1 node
SET BARTR(1)=$GET(^BARTR(DUZ(2),BARTR,1))
+8 ;A/R Transaction DATA SOURCE (e=ERA posted)
SET BARTR("DATA SRC")=$SELECT($PIECE(BARTR(1),U,6)'="":$PIECE(BARTR(1),U,6),1:"m")
+9 ; Transaction type
SET BARTR("T")=$PIECE(BARTR(1),U)
+10 ;Adjustment Category
SET BARTR("ADJ CAT")=$PIECE(BARTR(1),U,2)
+11 ;Adjustment Type
SET BARTR("ADJ TYPE")=$PIECE(BARTR(1),U,3)
+12 IF BARTR("T")=""
SET BARTR("T")="NULL"
+13 IF BARTR("ADJ CAT")=""
SET BARTR("ADJ CAT")="NULL"
+14 IF BARTR("ADJ TYPE")=""
SET BARTR("ADJ TYPE")="NULL"
+15 ;ADD TRANS TYPE/ADJ CAT/ADJ TYPE INCLUSION
+16 IF $DATA(BARY("TRANS TYPE"))
IF '$DATA(BARY("TRANS TYPE",BARTR("T")))
Begin DoDot:1
+17 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN TRANSACTION TYPE",$PIECE(BARTR(0),U))=BARTR("T")
End DoDot:1
QUIT
+18 IF $DATA(BARY("TRANS TYPE","ADJ CAT"))
IF '$DATA(BARY("TRANS TYPE","ADJ CAT",BARTR("ADJ CAT")))
Begin DoDot:1
+19 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ADJUSTMENT CATEGORY",$PIECE(BARTR(0),U))=BARTR("ADJ CAT")
End DoDot:1
QUIT
+20 ;TMM*1.8*19
IF $DATA(BARY("TRANS TYPE","ADJ TYPE"))
IF '$DATA(BARY("TRANS TYPE","ADJ TYPE",BARTR("ADJ TYPE")))
Begin DoDot:1
+21 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ADJ TYPE",$PIECE(BARTR(0),U))=BARTR("ADJ TYPE")
End DoDot:1
QUIT
+22 ; Transaction date/time
SET BARTR("DT")=$PIECE(BARTR(0),U)
+23 ; A/R Collection batch IEN
SET BARTR("B")=$PIECE(BARTR(0),U,14)
+24 KILL BARTR("B DT")
+25 IF BARTR("B")'=""
Begin DoDot:1
+26 ;
SET BARTR("B DT")=$PIECE($PIECE($GET(^BARCOL(DUZ(2),BARTR("B"),0)),U,4),".")
End DoDot:1
+27 IF BARTR("B")=""
SET BARTR("B")="No Collection Batch"
+28 ; A/R Collection batch item
SET BARTR("IT")=$PIECE(BARTR(0),U,15)
+29 IF BARTR("IT")=""
SET BARTR("IT")="No Collection Batch Item"
+30 ;
+31 KILL BAR("QUIT")
+32 IF $GET(BARY("DT"))="B"
Begin DoDot:1
+33 IF '$GET(BARTR("B DT"))
SET BAR("QUIT")=1
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO BATCH DATE",$PIECE(BARTR(0),U))=""
QUIT
+34 ; Not chosen batch date
IF $DATA(BARTR("B DT"))
Begin DoDot:2
+35 IF BARTR("B DT")<BARY("DT",1)
SET BAR("QUIT")=1
+36 IF BARTR("B DT")>BARY("DT",2)
SET BAR("QUIT")=1
+37 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BATCH DATE",$PIECE(BARTR(0),U))=""
End DoDot:2
IF $GET(BAR("QUIT"))
QUIT
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+38 ;END
+39 ; Entry by (AR Clerk)
SET BARTR("AR")=$PIECE(BARTR(0),U,13)
+40 IF BARTR("AR")=""
SET BARTR("AR")=9999999
+41 IF '$DATA(BARY("AR"))
SET BARTR("AR")=0
+42 SET BARTR("CR-DB")=$$GET1^DIQ(90050.03,BARTR,3.5)
+43 ; A/R Bill IEN
SET BAR=$PIECE(BARTR(0),U,4)
+44 IF $DATA(BARY("BATCH"))
IF BARTR("T")=100
SET BAR("UN-ALLOCATED",BARTR("IT"))=$GET(BAR("UN-ALLOCATED",BARTR("IT")))+BARTR("CR-DB")_U_DUZ(2)
+45 IF '+BAR
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO BILL FOR TRANSACTION",$PIECE(BARTR(0),U))=""
+46 ; No bill for transaction
IF '+BAR
QUIT
+47 IF '$DATA(^BARBL(DUZ(2),BAR))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","TRANS PTS TO NON EXIST BILL",$PIECE(BARTR(0),U))=""
+48 ; Trans points to non-existent bill
IF '$DATA(^BARBL(DUZ(2),BAR))
QUIT
+49 ; A/R Bill 0 node
SET BAR(0)=$GET(^BARBL(DUZ(2),BAR,0))
+50 ; A/R Bill 1 node
SET BAR(10)=$GET(^BARBL(DUZ(2),BAR,1))
+51 ;
+52 ;A/R Bill DOS BEGIN
SET BARTR("DOS BEGIN")=$PIECE(BAR(10),U,2)
+53 ;3P APPROVAL DATE
SET BARTR("3P APPROVAL")=$PIECE(BAR(0),U,18)
+54 ;3P PRINT DATE
SET BARTR("3P PRINT")=$PIECE(BAR(0),U,19)
+55 KILL BAR("QUIT")
+56 ; Not chosen visit date
IF $GET(BARY("DT"))="V"
Begin DoDot:1
+57 IF BARTR("DOS BEGIN")<BARY("DT",1)
SET BAR("QUIT")=1
+58 IF $PIECE(BARTR("DOS BEGIN"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+59 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN VISIT DATE",$PIECE(BARTR(0),U))=""
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+60 ; Not chosen approval date
IF $GET(BARY("DT"))="A"
Begin DoDot:1
+61 IF BARTR("3P APPROVAL")<BARY("DT",1)
SET BAR("QUIT")=1
+62 IF $PIECE(BARTR("3P APPROVAL"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+63 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN APPROVAL DATE",$PIECE(BARTR(0),U))=""
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+64 ; Not chosen export date
IF $GET(BARY("DT"))="X"
Begin DoDot:1
+65 IF BARTR("3P PRINT")<BARY("DT",1)
SET BAR("QUIT")=1
+66 IF $PIECE(BARTR("3P PRINT"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+67 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN EXPORT DATE",$PIECE(BARTR(0),U))=""
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+68 ;S BARTR("I")=$P(BAR(0),U,3) ; A/R Account ;12/15/2013 P.OTT
+69 ; A/R Account ;12/15/2013 P.OTT
SET BARTR("I")=$PIECE(BARTR(0),U,6)
+70 ; Visit location
SET BARTR("L")=$PIECE(BAR(10),U,8)
+71 ; Provider (New Person)
SET BAR("PV")=$PIECE(BAR(10),U,13)
+72 ; Visit type (3P Visit Type)
SET BAR("V")=$PIECE(BAR(10),U,14)
+73 ; Clinic (Clinic Stop File)
SET BAR("C")=$PIECE(BAR(10),U,12)
+74 ; Discharge Service (#)
SET BAR("DS")=$$GET1^DIQ(90050.01,BAR,23)
+75 IF BARTR("I")]""
Begin DoDot:1
+76 SET D0=BARTR("I")
+77 ; Insurer Type
SET BARTR("BI")=$$VALI^BARVPM(8)
End DoDot:1
+78 IF $GET(BARTR("BI"))=""
SET BARTR("BI")="No Billing Entity"
+79 IF BARTR("BI")'="No Billing Entity"
Begin DoDot:1
+80 ; Other Allow Cat
SET BARTR("ALL")="O"
+81 ;
IF BARTR("BI")="G"
SET BARTR("ALL")="O"
QUIT
+82 ; Medicare Allow Cat
IF BARTR("BI")="R"!(BARTR("BI")="MD")!(BARTR("BI")="MH")
SET BARTR("ALL")="R"
QUIT
+83 ; Medicaid Allow Cat
IF BARTR("BI")="D"
SET BARTR("ALL")="D"
QUIT
+84 ; CHIPS is lumped with Medicaid ;
IF BARTR("BI")="K"
SET BARTR("ALL")="D"
QUIT
+85 ; Private ;
IF ",F,M,H,P,"[(","_BARTR("BI")_",")
SET BARTR("ALL")="P"
QUIT
End DoDot:1
+86 IF $GET(BARTR("ALL"))=""
SET BARTR("ALL")="No Allowance Category"
+87 IF BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="")
Begin DoDot:1
+88 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NULL LOCATION^INS TYPE^TRANS DATE/TIME",$PIECE(BARTR(0),U))=BARTR("L")_U_BARTR("I")_U_BARTR("DT")
End DoDot:1
+89 IF BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="")
QUIT
+90 ; Not chosen location
IF $DATA(BARY("LOC"))
IF BARY("LOC")'=BARTR("L")
Begin DoDot:1
+91 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN LOCATION",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+92 ;Not chosn acct
IF $DATA(BARY("ARACCT"))
IF '$DATA(BARY("ARACCT",BARTR("I")))
Begin DoDot:1
+93 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ACCT",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+94 ; Not chosen A/R acct ;TMM*1.8*19
IF $DATA(BARY("ACCT"))
IF BARY("ACCT")'=BARTR("I")
Begin DoDot:1
+95 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN A/R ACCT-"_BARTR("I"),$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+96 IF $GET(BARY("SORT"))="V"
IF BAR("V")=""
SET BAR("V")=99999
+97 IF $GET(BARY("SORT"))="C"
IF BAR("C")=""
SET BAR("C")=99999
+98 ; Not chosen AR Clerk
IF $DATA(BARY("AR"))
IF BARY("AR")'=BARTR("AR")
Begin DoDot:1
+99 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN AR CLERK",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+100 ; Not chosen provider
IF $DATA(BARY("PRV"))
IF BARY("PRV")'=BAR("PV")
Begin DoDot:1
+101 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN PROV",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+102 ;I $D(BARY("TYP")),(U_BARY("TYP")_U)'[(U_BARTR("BI")_U) D Q ; Not chosen Bill entity
+103 ;. ;W !,"NOT BILL ENT; ",BARTR(0)_": "_BARTR("BI")_": "_BARTR("I") R AWD 12/15/2013
+104 ;.S:$G(DEBUG) ^TMP($J,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BILL ENTITY",$P(BARTR(0),U))=""
+105 ; Not chosen Ins Type
IF $DATA(BARY("ITYP"))
IF BARY("ITYP")'=BARTR("BI")
Begin DoDot:1
+106 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN INS TYPE",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+107 IF $DATA(BARY("ALL"))
IF (+BARY("ALL")=BARY("ALL"))
SET BARY("ALL")=$$CONVERT^BARRSL2(BARY("ALL"))
+108 ; Not chosen Allow Cat
IF $DATA(BARY("ALL"))
IF BARY("ALL")'=BARTR("ALL")
Begin DoDot:1
+109 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ALLOW CAT",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+110 ; Not chosen batch
IF $DATA(BARY("BATCH"))
IF BARY("BATCH")'=BARTR("B")
Begin DoDot:1
+111 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BATCH",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+112 ; Not chosen item
IF $DATA(BARY("ITEM"))
IF BARY("ITEM")'=BARTR("IT")
Begin DoDot:1
+113 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ITEM",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+114 ; Not chosen clinic
IF $DATA(BARY("CLIN"))
IF '$DATA(BARY("CLIN",BAR("C")))
Begin DoDot:1
+115 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN CLINIC",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+116 ; Not chosen visit typ
IF $DATA(BARY("VTYP"))
IF '$DATA(BARY("VTYP",BAR("V")))
Begin DoDot:1
+117 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN VISIT TYP",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+118 IF $DATA(BARY("DSCH"))
IF BAR("DS")=""
SET BAR("DS")=99999
+119 ;Not chosen discharge svc
IF $DATA(BARY("DSCH"))
IF '$DATA(BARY("DSCH",BAR("DS")))
Begin DoDot:1
+120 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN DISCHARGE SVC",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+121 KILL BAR("QUIT")
+122 ; Not chosen trans date
IF $GET(BARY("DT"))="T"
Begin DoDot:1
+123 IF BARTR("DT")<BARY("DT",1)
SET BAR("QUIT")=1
+124 IF $PIECE(BARTR("DT"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+125 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN TRANS DATE",$PIECE(BARTR(0),U))=""
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+126 ; Not chosen period date range
IF $DATA(BARY("PER"))
Begin DoDot:1
+127 IF BARTR("DT")<BARBDT
SET BAR("QUIT")=1
+128 IF $PIECE(BARTR("DT"),".")>BAREDT
SET BAR("QUIT")=1
+129 IF $GET(BAR("QUIT"))
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN PERIOD DATE",$PIECE(BARTR(0),U))=""
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+130 IF $DATA(BARY("DATA SRC"))
Begin DoDot:1
+131 IF BARY("DATA SRC")="MANUAL"
IF (BARTR("DATA SRC")="e")
SET BAR("QUIT")=1
+132 IF BARY("DATA SRC")="ELECTRONIC"
IF (BARTR("DATA SRC")="m")
SET BAR("QUIT")=1
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+133 SET BARP("HIT")=1
+134 QUIT