BAR50ICN ; IHS/SD/TPF - AR ERA FILE ICN (PAYER CLAIM CONTROL NUMBER) CHECKER ;
;;1.8;IHS ACCOUNTS RECEIVABLE;**5,21**;OCT 26,2005
;
;
;THIS REPORT WILL BE USED TO SEE IF THERE IS A "PATTERN" IN THE USE OF THE
;CLP07 ELEMENT OR 'PAYER CLAIM CONTROL NUMBER' OR ICN BY PAYORS
;
Q
LOOPERA ;EP - LOOP ERA FILE
K ^XTMP("BAREDICN",$J)
N ICN,IMPDA,CLMDA,ERACHECK,ERABILL,ERAFILE,ERAPAT,IMPORTS,CLAIMS,PAYMENT,DUPIMP,TOTALIMP
S (IMPDA,CLAIMS,IMPORTS,DUPIMP,TOTALIMP)=0
F S IMPDA=$O(^BAREDI("I",DUZ(2),IMPDA)) Q:'IMPDA D
.S TOTALIMP=TOTALIMP+1
.S FILENAME=$P($G(^BAREDI("I",DUZ(2),IMPDA,0)),U,5)
.S ARIMPORT=$P($G(^BAREDI("I",DUZ(2),IMPDA,0)),U)
.I $D(^XTMP("BAREDICN",$J,"FILES ALREADY DONE",FILENAME)) D Q ;DON'T PROCESS THE SAME FILE TWICE, IF IMPORTED > ONCE
..W !,"FILE ",FILENAME," IMPORTED MORE THAN ONCE"
..S DUPIMP=DUPIMP+1
.S IMPORTS=IMPORTS+1
.S ^XTMP("BAREDICN",$J,"FILES ALREADY DONE",FILENAME,ARIMPORT)=""
.S CLMDA=0
.F S CLMDA=$O(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA)) Q:'CLMDA D
..S CLAIMS=CLAIMS+1
..D GETDATA(IMPDA,CLMDA)
S ^XTMP("BAREDICN",$J,"CLAIMS")=CLAIMS
S ^XTMP("BAREDICN",$J,"IMPORTS")=IMPORTS
S ^XTMP("BAREDICN",$J,"DUPE IMPORTS")=DUPIMP
D REPORT
Q
;
GETDATA(IMPDA,CLMDA) ;EP - GET DATA FROM ERA FILE
S ERAFILE=$P($G(^BAREDI("I",DUZ(2),IMPDA,0)),U)
S ERABILL=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U)
S FLATFILE=$P($G(^BAREDI("I",DUZ(2),IMPDA,0)),U,5)
S ERAPAT=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,6)
S ERACHECK=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,2)),U)
S PAYMENT=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,4)
S PAYTYPE=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,11)
S ICN=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,3)),U,2)
I ICN[("R") S ICN=$TR(ICN,"R","")
S:ERAFILE="" ERAFILE="UNDEF ERAFILE"
S:ERABILL="" ERABILL="UNDEF ERABILL"
S:ERAPAT="" ERAPAT="UNDEF ERA PATIENT"
S:ERACHECK="" ERACHECK="UNDEF ERACHECK"
S:ICN="" ICN="UNDEF ICN"
S ^XTMP("BAREDICN",$J,ICN,CLAIMS,ERABILL,ERACHECK,ERAFILE,ERAPAT)=PAYMENT_U_PAYTYPE_U_FLATFILE
Q
REPORT ;EP- REPORT ON FINDINGS
N ICN,CLAIMS,CLMCNT,ERABILL,ERACHECK,ERAFILE,ERAPAT,CLMS
W @IOF
W !!,"THERE ARE A TOTAL OF ",TOTALIMP," ENTRIES IN THE A/R EDI IMPORT FILE"
W !,"OF THESE ",^XTMP("BAREDICN",$J,"IMPORTS")," WERE PROCESSED AND CONTAINED ",^XTMP("BAREDICN",$J,"CLAIMS")," CLAIMS."
W !,^XTMP("BAREDICN",$J,"DUPE IMPORTS")_" IMPORT ENTRIES WERE SKIPPED BECAUSE THE FILE WAS DOWNLOADED MORE THAN ONCE."
W !!,"POSSIBLE ICN MATCHES:"
S ICN=""
F S ICN=$O(^XTMP("BAREDICN",$J,ICN)) Q:ICN=""!(ICN="CLAIMS") D
.S CLAIMS=""
.F CLMCNT=1:1 S CLAIMS=$O(^XTMP("BAREDICN",$J,ICN,CLAIMS)) Q:CLAIMS=""
.I CLMCNT>2 D
..W !!,"MULITPLE ICN ENTRIES FOR: ",ICN
..S CLMS=""
..F S CLMS=$O(^XTMP("BAREDICN",$J,ICN,CLMS)) Q:CLMS="" D
...S ERABILL=""
...F S ERABILL=$O(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL)) Q:ERABILL="" D
....S ERACHECK=""
....F S ERACHECK=$O(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK)) Q:ERACHECK="" D
.....S ERAFILE=""
.....F S ERAFILE=$O(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK,ERAFILE)) Q:ERAFILE="" D
......S ERAPAT=""
......F S ERAPAT=$O(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT)) Q:ERAPAT="" D
.......W !!?10,"CLAIM CNT: ",CLMS
.......W !?10,"835 FILE: ",$P(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U,3)
.......W !?10,"ERA BILL: ",ERABILL
.......W !?10,"ERA CHECK: ",ERACHECK
.......W !?10,"A/R IMPORT FILE: ",ERAFILE
.......W !?10,"ERA PATIENT: ",ERAPAT
.......W !?10,"PAYMENT TYPE: ",$P(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U,2)
.......W !?10,"PAYMENT: ",$P(^XTMP("BAREDICN",$J,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U)
Q
BAR50ICN ; IHS/SD/TPF - AR ERA FILE ICN (PAYER CLAIM CONTROL NUMBER) CHECKER ;
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**5,21**;OCT 26,2005
+2 ;
+3 ;
+4 ;THIS REPORT WILL BE USED TO SEE IF THERE IS A "PATTERN" IN THE USE OF THE
+5 ;CLP07 ELEMENT OR 'PAYER CLAIM CONTROL NUMBER' OR ICN BY PAYORS
+6 ;
+7 QUIT
LOOPERA ;EP - LOOP ERA FILE
+1 KILL ^XTMP("BAREDICN",$JOB)
+2 NEW ICN,IMPDA,CLMDA,ERACHECK,ERABILL,ERAFILE,ERAPAT,IMPORTS,CLAIMS,PAYMENT,DUPIMP,TOTALIMP
+3 SET (IMPDA,CLAIMS,IMPORTS,DUPIMP,TOTALIMP)=0
+4 FOR
SET IMPDA=$ORDER(^BAREDI("I",DUZ(2),IMPDA))
IF 'IMPDA
QUIT
Begin DoDot:1
+5 SET TOTALIMP=TOTALIMP+1
+6 SET FILENAME=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,0)),U,5)
+7 SET ARIMPORT=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,0)),U)
+8 ;DON'T PROCESS THE SAME FILE TWICE, IF IMPORTED > ONCE
IF $DATA(^XTMP("BAREDICN",$JOB,"FILES ALREADY DONE",FILENAME))
Begin DoDot:2
+9 WRITE !,"FILE ",FILENAME," IMPORTED MORE THAN ONCE"
+10 SET DUPIMP=DUPIMP+1
End DoDot:2
QUIT
+11 SET IMPORTS=IMPORTS+1
+12 SET ^XTMP("BAREDICN",$JOB,"FILES ALREADY DONE",FILENAME,ARIMPORT)=""
+13 SET CLMDA=0
+14 FOR
SET CLMDA=$ORDER(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA))
IF 'CLMDA
QUIT
Begin DoDot:2
+15 SET CLAIMS=CLAIMS+1
+16 DO GETDATA(IMPDA,CLMDA)
End DoDot:2
End DoDot:1
+17 SET ^XTMP("BAREDICN",$JOB,"CLAIMS")=CLAIMS
+18 SET ^XTMP("BAREDICN",$JOB,"IMPORTS")=IMPORTS
+19 SET ^XTMP("BAREDICN",$JOB,"DUPE IMPORTS")=DUPIMP
+20 DO REPORT
+21 QUIT
+22 ;
GETDATA(IMPDA,CLMDA) ;EP - GET DATA FROM ERA FILE
+1 SET ERAFILE=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,0)),U)
+2 SET ERABILL=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U)
+3 SET FLATFILE=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,0)),U,5)
+4 SET ERAPAT=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,6)
+5 SET ERACHECK=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,2)),U)
+6 SET PAYMENT=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,4)
+7 SET PAYTYPE=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,11)
+8 SET ICN=$PIECE($GET(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,3)),U,2)
+9 IF ICN[("R")
SET ICN=$TRANSLATE(ICN,"R","")
+10 IF ERAFILE=""
SET ERAFILE="UNDEF ERAFILE"
+11 IF ERABILL=""
SET ERABILL="UNDEF ERABILL"
+12 IF ERAPAT=""
SET ERAPAT="UNDEF ERA PATIENT"
+13 IF ERACHECK=""
SET ERACHECK="UNDEF ERACHECK"
+14 IF ICN=""
SET ICN="UNDEF ICN"
+15 SET ^XTMP("BAREDICN",$JOB,ICN,CLAIMS,ERABILL,ERACHECK,ERAFILE,ERAPAT)=PAYMENT_U_PAYTYPE_U_FLATFILE
+16 QUIT
REPORT ;EP- REPORT ON FINDINGS
+1 NEW ICN,CLAIMS,CLMCNT,ERABILL,ERACHECK,ERAFILE,ERAPAT,CLMS
+2 WRITE @IOF
+3 WRITE !!,"THERE ARE A TOTAL OF ",TOTALIMP," ENTRIES IN THE A/R EDI IMPORT FILE"
+4 WRITE !,"OF THESE ",^XTMP("BAREDICN",$JOB,"IMPORTS")," WERE PROCESSED AND CONTAINED ",^XTMP("BAREDICN",$JOB,"CLAIMS")," CLAIMS."
+5 WRITE !,^XTMP("BAREDICN",$JOB,"DUPE IMPORTS")_" IMPORT ENTRIES WERE SKIPPED BECAUSE THE FILE WAS DOWNLOADED MORE THAN ONCE."
+6 WRITE !!,"POSSIBLE ICN MATCHES:"
+7 SET ICN=""
+8 FOR
SET ICN=$ORDER(^XTMP("BAREDICN",$JOB,ICN))
IF ICN=""!(ICN="CLAIMS")
QUIT
Begin DoDot:1
+9 SET CLAIMS=""
+10 FOR CLMCNT=1:1
SET CLAIMS=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLAIMS))
IF CLAIMS=""
QUIT
+11 IF CLMCNT>2
Begin DoDot:2
+12 WRITE !!,"MULITPLE ICN ENTRIES FOR: ",ICN
+13 SET CLMS=""
+14 FOR
SET CLMS=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLMS))
IF CLMS=""
QUIT
Begin DoDot:3
+15 SET ERABILL=""
+16 FOR
SET ERABILL=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL))
IF ERABILL=""
QUIT
Begin DoDot:4
+17 SET ERACHECK=""
+18 FOR
SET ERACHECK=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK))
IF ERACHECK=""
QUIT
Begin DoDot:5
+19 SET ERAFILE=""
+20 FOR
SET ERAFILE=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK,ERAFILE))
IF ERAFILE=""
QUIT
Begin DoDot:6
+21 SET ERAPAT=""
+22 FOR
SET ERAPAT=$ORDER(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT))
IF ERAPAT=""
QUIT
Begin DoDot:7
+23 WRITE !!?10,"CLAIM CNT: ",CLMS
+24 WRITE !?10,"835 FILE: ",$PIECE(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U,3)
+25 WRITE !?10,"ERA BILL: ",ERABILL
+26 WRITE !?10,"ERA CHECK: ",ERACHECK
+27 WRITE !?10,"A/R IMPORT FILE: ",ERAFILE
+28 WRITE !?10,"ERA PATIENT: ",ERAPAT
+29 WRITE !?10,"PAYMENT TYPE: ",$PIECE(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U,2)
+30 WRITE !?10,"PAYMENT: ",$PIECE(^XTMP("BAREDICN",$JOB,ICN,CLMS,ERABILL,ERACHECK,ERAFILE,ERAPAT),U)
End DoDot:7
End DoDot:6
End DoDot:5
End DoDot:4
End DoDot:3
End DoDot:2
End DoDot:1
+31 QUIT