BARRCHK1 ; IHS/SD/LSL - Report Utility 2 to Check Parms ;12/19/2008
;;1.8;IHS ACCOUNTS RECEIVABLE;**6,7,10,19,20,23**;OCT 26, 2005
; MODIFIED XTMP FILE NAME TO TMP TO MEET SAC REQUIREMENTS;MRS:BAR*1.8*7 IM29892
;CREATED BECAUSE BARRCHK WAS GREATER THAN 15K
; TMM 08/18/10 V1.8*19
; Fix issue - Adjustments not displaying on TSR report
; TMM 08/19/10 V1.8*19
; TSR report should display A/R Account from A/R Transaction, not from A/R Bill
; P.OTTIS MAR 2013 ADDED NEW INS TYPE
; P.OTTIS SEP 2013,OCT 2013 BETA YAK: FIXED BARTR("BI")
Q
;
TRANS ;EP - CALLED FROM BARRCHK
; 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) ;bar*1.8*20 REQ10
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" ;bar*1.8*20 HEAT25436
S:BARTR("ADJ CAT")="" BARTR("ADJ CAT")="NULL"
S:BARTR("ADJ TYPE")="" BARTR("ADJ TYPE")="NULL" ;*TMM*1.8*19
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),".") ;MRS:BAR*1.8*10 IM30590
;
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 ;BAR*1.8*6 DD 4.1.1
..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))=""
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
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 (#)
S BARTMP=BARTR("I")
S BARTR("BI")=$$GETBI(BARTMP) ; Insurer Type / BILLING ENTITY CODE
I $G(BARTR("BI"))="" S BARTR("BI")="No Billing Entity"
I BARTR("BI")'="No Billing Entity" D
. S BARTR("ALL")="O" ; Other Allow Cat P.OTT UPDATED
. I ",R,MH,MD,MC,MMC,"[(","_BARTR("BI")_",") S BARTR("ALL")="R" Q ;MCR
. I ",D,K,FPL,"[(","_BARTR("BI")_",") S BARTR("ALL")="D" Q ;MCD
. I ",F,M,H,P,"[(","_BARTR("BI")_",") S BARTR("ALL")="P" Q ;Private
. I ",V,"[(","_BARTR("BI")_",") S BARTR("ALL")="V" Q ;VETERANS P.OTT
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))="" ;TMM*1.8*19
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 BAR*1.8*6 DD 4.1.1 IM21585
.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")) ;BAR*1.8*6 DD 4.1.1 IM21585
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
GETBI(D0) ;keep D0 intact
I D0="" Q ""
Q $$VALI^BARVPM(8) ; Insurer Type CODE
;
;EOR
BARRCHK1 ; IHS/SD/LSL - Report Utility 2 to Check Parms ;12/19/2008
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**6,7,10,19,20,23**;OCT 26, 2005
+2 ; MODIFIED XTMP FILE NAME TO TMP TO MEET SAC REQUIREMENTS;MRS:BAR*1.8*7 IM29892
+3 ;CREATED BECAUSE BARRCHK WAS GREATER THAN 15K
+4 ; TMM 08/18/10 V1.8*19
+5 ; Fix issue - Adjustments not displaying on TSR report
+6 ; TMM 08/19/10 V1.8*19
+7 ; TSR report should display A/R Account from A/R Transaction, not from A/R Bill
+8 ; P.OTTIS MAR 2013 ADDED NEW INS TYPE
+9 ; P.OTTIS SEP 2013,OCT 2013 BETA YAK: FIXED BARTR("BI")
+10 QUIT
+11 ;
TRANS ;EP - CALLED FROM BARRCHK
+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) ;bar*1.8*20 REQ10
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 ;bar*1.8*20 HEAT25436
IF BARTR("T")=""
SET BARTR("T")="NULL"
+13 IF BARTR("ADJ CAT")=""
SET BARTR("ADJ CAT")="NULL"
+14 ;*TMM*1.8*19
IF BARTR("ADJ TYPE")=""
SET BARTR("ADJ TYPE")="NULL"
+15 IF $DATA(BARY("TRANS TYPE"))
IF '$DATA(BARY("TRANS TYPE",BARTR("T")))
Begin DoDot:1
+16 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
+17 IF $DATA(BARY("TRANS TYPE","ADJ CAT"))
IF '$DATA(BARY("TRANS TYPE","ADJ CAT",BARTR("ADJ CAT")))
Begin DoDot:1
+18 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
+19 ;TMM*1.8*19
IF $DATA(BARY("TRANS TYPE","ADJ TYPE"))
IF '$DATA(BARY("TRANS TYPE","ADJ TYPE",BARTR("ADJ TYPE")))
Begin DoDot:1
+20 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
+21 ; Transaction date/time
SET BARTR("DT")=$PIECE(BARTR(0),U)
+22 ; A/R Collection batch IEN
SET BARTR("B")=$PIECE(BARTR(0),U,14)
+23 KILL BARTR("B DT")
+24 IF BARTR("B")'=""
Begin DoDot:1
+25 ;MRS:BAR*1.8*10 IM30590
SET BARTR("B DT")=$PIECE($PIECE($GET(^BARCOL(DUZ(2),BARTR("B"),0)),U,4),".")
End DoDot:1
+26 ;
+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 KILL BAR("QUIT")
+31 IF $GET(BARY("DT"))="B"
Begin DoDot:1
+32 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
+33 ; Not chosen batch date ;BAR*1.8*6 DD 4.1.1
IF $DATA(BARTR("B DT"))
Begin DoDot:2
+34 IF BARTR("B DT")<BARY("DT",1)
SET BAR("QUIT")=1
+35 IF BARTR("B DT")>BARY("DT",2)
SET BAR("QUIT")=1
+36 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
+37 ; Entry by (AR Clerk)
SET BARTR("AR")=$PIECE(BARTR(0),U,13)
+38 IF BARTR("AR")=""
SET BARTR("AR")=9999999
+39 IF '$DATA(BARY("AR"))
SET BARTR("AR")=0
+40 SET BARTR("CR-DB")=$$GET1^DIQ(90050.03,BARTR,3.5)
+41 ; A/R Bill IEN
SET BAR=$PIECE(BARTR(0),U,4)
+42 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)
+43 IF '+BAR
IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NO BILL FOR TRANSACTION",$PIECE(BARTR(0),U))=""
+44 ; No bill for transaction
IF '+BAR
QUIT
+45 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))=""
+46 ; Trans points to non-existent bill
IF '$DATA(^BARBL(DUZ(2),BAR))
QUIT
+47 ; A/R Bill 0 node
SET BAR(0)=$GET(^BARBL(DUZ(2),BAR,0))
+48 ; A/R Bill 1 node
SET BAR(10)=$GET(^BARBL(DUZ(2),BAR,1))
+49 ;A/R Bill DOS BEGIN
SET BARTR("DOS BEGIN")=$PIECE(BAR(10),U,2)
+50 ;3P APPROVAL DATE
SET BARTR("3P APPROVAL")=$PIECE(BAR(0),U,18)
+51 ;3P PRINT DATE
SET BARTR("3P PRINT")=$PIECE(BAR(0),U,19)
+52 KILL BAR("QUIT")
+53 ; Not chosen visit date
IF $GET(BARY("DT"))="V"
Begin DoDot:1
+54 IF BARTR("DOS BEGIN")<BARY("DT",1)
SET BAR("QUIT")=1
+55 IF $PIECE(BARTR("DOS BEGIN"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+56 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
+57 ; Not chosen approval date
IF $GET(BARY("DT"))="A"
Begin DoDot:1
+58 IF BARTR("3P APPROVAL")<BARY("DT",1)
SET BAR("QUIT")=1
+59 IF $PIECE(BARTR("3P APPROVAL"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+60 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
+61 ; Not chosen export date
IF $GET(BARY("DT"))="X"
Begin DoDot:1
+62 IF BARTR("3P PRINT")<BARY("DT",1)
SET BAR("QUIT")=1
+63 IF $PIECE(BARTR("3P PRINT"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+64 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
+65 ; A/R Account
SET BARTR("I")=$PIECE(BAR(0),U,3)
+66 ; Visit location
SET BARTR("L")=$PIECE(BAR(10),U,8)
+67 ; Provider (New Person)
SET BAR("PV")=$PIECE(BAR(10),U,13)
+68 ; Visit type (3P Visit Type)
SET BAR("V")=$PIECE(BAR(10),U,14)
+69 ; Clinic (Clinic Stop File)
SET BAR("C")=$PIECE(BAR(10),U,12)
+70 ; Discharge Service (#)
SET BAR("DS")=$$GET1^DIQ(90050.01,BAR,23)
+71 SET BARTMP=BARTR("I")
+72 ; Insurer Type / BILLING ENTITY CODE
SET BARTR("BI")=$$GETBI(BARTMP)
+73 IF $GET(BARTR("BI"))=""
SET BARTR("BI")="No Billing Entity"
+74 IF BARTR("BI")'="No Billing Entity"
Begin DoDot:1
+75 ; Other Allow Cat P.OTT UPDATED
SET BARTR("ALL")="O"
+76 ;MCR
IF ",R,MH,MD,MC,MMC,"[(","_BARTR("BI")_",")
SET BARTR("ALL")="R"
QUIT
+77 ;MCD
IF ",D,K,FPL,"[(","_BARTR("BI")_",")
SET BARTR("ALL")="D"
QUIT
+78 ;Private
IF ",F,M,H,P,"[(","_BARTR("BI")_",")
SET BARTR("ALL")="P"
QUIT
+79 ;VETERANS P.OTT
IF ",V,"[(","_BARTR("BI")_",")
SET BARTR("ALL")="V"
QUIT
End DoDot:1
+80 IF $GET(BARTR("ALL"))=""
SET BARTR("ALL")="No Allowance Category"
+81 IF BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="")
Begin DoDot:1
+82 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
+83 IF BARTR("L")=""!(BARTR("I")="")!(BARTR("DT")="")
QUIT
+84 ; Not chosen location
IF $DATA(BARY("LOC"))
IF BARY("LOC")'=BARTR("L")
Begin DoDot:1
+85 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN LOCATION",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+86 ;Not chosn acct
IF $DATA(BARY("ARACCT"))
IF '$DATA(BARY("ARACCT",BARTR("I")))
Begin DoDot:1
+87 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ACCT",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+88 ; Not chosen A/R acct ;TMM*1.8*19
IF $DATA(BARY("ACCT"))
IF BARY("ACCT")'=BARTR("I")
Begin DoDot:1
+89 ;TMM*1.8*19
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
+90 IF $GET(BARY("SORT"))="V"
IF BAR("V")=""
SET BAR("V")=99999
+91 IF $GET(BARY("SORT"))="C"
IF BAR("C")=""
SET BAR("C")=99999
+92 ; Not chosen AR Clerk
IF $DATA(BARY("AR"))
IF BARY("AR")'=BARTR("AR")
Begin DoDot:1
+93 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN AR CLERK",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+94 ; Not chosen provider
IF $DATA(BARY("PRV"))
IF BARY("PRV")'=BAR("PV")
Begin DoDot:1
+95 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN PROV",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+96 ; Not chosen Bill entity BAR*1.8*6 DD 4.1.1 IM21585
IF $DATA(BARY("TYP"))
IF (U_BARY("TYP")_U)'[(U_BARTR("BI")_U)
Begin DoDot:1
+97 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BILL ENTITY",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+98 ; Not chosen Ins Type
IF $DATA(BARY("ITYP"))
IF BARY("ITYP")'=BARTR("BI")
Begin DoDot:1
+99 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN INS TYPE",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+100 ;BAR*1.8*6 DD 4.1.1 IM21585
IF $DATA(BARY("ALL"))
IF (+BARY("ALL")=BARY("ALL"))
SET BARY("ALL")=$$CONVERT^BARRSL2(BARY("ALL"))
+101 ; Not chosen Allow Cat
IF $DATA(BARY("ALL"))
IF BARY("ALL")'=BARTR("ALL")
Begin DoDot:1
+102 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ALLOW CAT",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+103 ; Not chosen batch
IF $DATA(BARY("BATCH"))
IF BARY("BATCH")'=BARTR("B")
Begin DoDot:1
+104 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN BATCH",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+105 ; Not chosen item
IF $DATA(BARY("ITEM"))
IF BARY("ITEM")'=BARTR("IT")
Begin DoDot:1
+106 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN ITEM",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+107 ; Not chosen clinic
IF $DATA(BARY("CLIN"))
IF '$DATA(BARY("CLIN",BAR("C")))
Begin DoDot:1
+108 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN CLINIC",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+109 ; Not chosen visit typ
IF $DATA(BARY("VTYP"))
IF '$DATA(BARY("VTYP",BAR("V")))
Begin DoDot:1
+110 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN VISIT TYP",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+111 IF $DATA(BARY("DSCH"))
IF BAR("DS")=""
SET BAR("DS")=99999
+112 ;Not chosen discharge svc
IF $DATA(BARY("DSCH"))
IF '$DATA(BARY("DSCH",BAR("DS")))
Begin DoDot:1
+113 IF $GET(DEBUG)
SET ^TMP($JOB,"BAR-"_BAR("SUBR"),"REASON REJECTED","NOT CHOSEN DISCHARGE SVC",$PIECE(BARTR(0),U))=""
End DoDot:1
QUIT
+114 KILL BAR("QUIT")
+115 ; Not chosen trans date
IF $GET(BARY("DT"))="T"
Begin DoDot:1
+116 IF BARTR("DT")<BARY("DT",1)
SET BAR("QUIT")=1
+117 IF $PIECE(BARTR("DT"),".")>BARY("DT",2)
SET BAR("QUIT")=1
+118 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
+119 ; Not chosen period date range
IF $DATA(BARY("PER"))
Begin DoDot:1
+120 IF BARTR("DT")<BARBDT
SET BAR("QUIT")=1
+121 IF $PIECE(BARTR("DT"),".")>BAREDT
SET BAR("QUIT")=1
+122 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
+123 IF $DATA(BARY("DATA SRC"))
Begin DoDot:1
+124 IF BARY("DATA SRC")="MANUAL"
IF (BARTR("DATA SRC")="e")
SET BAR("QUIT")=1
+125 IF BARY("DATA SRC")="ELECTRONIC"
IF (BARTR("DATA SRC")="m")
SET BAR("QUIT")=1
End DoDot:1
IF $GET(BAR("QUIT"))
QUIT
+126 SET BARP("HIT")=1
+127 QUIT
GETBI(D0) ;keep D0 intact
+1 IF D0=""
QUIT ""
+2 ; Insurer Type CODE
QUIT $$VALI^BARVPM(8)
+3 ;
+4 ;EOR