Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: BAREDEP1

BAREDEP1.m

Go to the documentation of this file.
BAREDEP1 ; IHS/SD/TPF - AR ERA NONPAYMENT CHECKER ; 01/30/2009
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**5,6,10,22,23,24,28**;OCT 26,2005;Build 92
 ;IHS/SD/POT HEAT82698 NOV 2012 LEADING ZEROES IN CHKECK # (POS)  - BAR*1.8*23
 ;        FEB 13 ADDED INFO ON NONPAY DETAILS; SHOW CLMPYMT
 ;        MAR 13 EXCLUDED COL BATCHES OLDER THAN 365 DAYS
 ;        REFINED 'OVERRIDE' FLAG WITH MESSAGE  - BAR*1.8*23
 ;        10/10/13 FIXED ERR MSG FOR ERROR NIPAC
 ;IHS/SD/POT HEAT147572 ALLOW TRIBAL SITES ERA POSTING OF NEG BAL - BAR*1.8*24
 ;        02/04/14 BLOCK ERROR NIPAC (TDN/IPAC MISSING IN RPMS BATCH AND ITEM) FOR TRIBAL SITES  - BAR*1.8*24
 ;IHS/DIT/CPC - 20180514 CR9572 Recheck reversals - BAR*1.8*28
 Q
NONPAYCH(IMPDA) ;EP - CHECK PAYMENTS NOT MATCHED WITH A REVERSAL
 N CLMDA,ERACHECK,CLSTATUS,POSTAS,CNT,CLIENS
 N BPR02  ;BAR*1.8*6 SCR119
 I $G(BARDBG) W !!!,"LOOKING FOR NON-MATCHED PAYMENTS AGAINST NONPAYMENT BATCHES"
 S CLMDA=0,CLMPYMT=0 F  S CLMDA=$O(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA)) Q:'CLMDA  D
 .S CLMPYMT=CLMPYMT+$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,4)
 S CLMDA=0
 F CNT=1:1 S CLMDA=$O(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA)) Q:'CLMDA  D
 . W:'(CNT#1000) "."
 . Q:$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,0)),U,2)="P"  ;DON'T CHECK POSTED CLAIMS
 . ;Q:$D(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,4,"B",44))  ;DON'T PROCESS USER STATUS OVVERRIDE BAR*1.8*6 SCR120
 . Q:$$OVERIDE^BAREDEP1(CLMDA)                         ;MRS:BAR*1.8*10 D159-1 AND 2
 . S BPR02=+$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,2)),U,5)  ;BPR MONETARY AMOUNT BAR*1.8*6 SCR119 IHS/SD/TPF
 . S CLIENS=CLMDA_","_IMPDA_","
 . S ERACHECK=$$GET1^DIQ(90056.0205,CLIENS,201,"E")  ;CHECK/EFT TRACE
 . S CLSTATUS=$P($$GET1^DIQ(90056.0205,CLIENS,.11,"E")," ")  ;E-CLAIM STATUS CODE (CLP02)
 . I CLSTATUS="" S CLSTATUS=$P($G(^BAREDI("I",DUZ(2),IMPDA,30,CLMDA,2)),U,4)  ;MRS:BAR*1.8*10 H2555
 . Q:(U_"1"_U_"2"_U_"3"_U_"19"_U_"20"_U_"21"_U)'[(U_CLSTATUS_U)  ;PRIMARY,SECONDARY,TERTIARY AS WELL AS THOSE 19,20,21 FORWARDED TO ADDITIONAL PAYER BAR*1.8*6 IM29637
 . S POSTAS=$$GET1^DIQ(90056.0205,CLIENS,501,"I")
 . Q:POSTAS=138!(POSTAS=139)
 . D NONPAY(ERACHECK,IMPDA,CLMDA,BPR02)  ;BAR*1.8*6 SCR119 
 Q
NONPAY(ERACHECK,IMPDA,CLMDA,BPR02) ;EP - SEE IF TDN/IPAC = NONPAYMENT  ;BAR*1.8*6 SCR119 IHS/SD/TPF
 N TDNIPAC,BARCOLDA,ERRORS,BARITMDA,NONPAY,NOITEM,NOHEAD,BARXCHK ;P.OTT
 S BARXCHK=$$BARXCHK^BAREDP09(ERACHECK) ;P.OTT
 S (NOITEM,NOHEAD,NONPAY)=0
 S BARCOLDA=$O(^BARCOL(DUZ(2),"D",BARXCHK,""))
 I 'BARCOLDA,(BPR02=0) Q  ;BAR*1.8*6 SCR119
 I 'BARCOLDA D  Q
 . S ERRORS("NB")=""  ;NO BATCH FOUND FOR ERA CHECK
 . D ADDREAS^BAREDP04(IMPDA,CLMDA,.ERRORS)
 . K ERRORS
 ;CHECK ALL ERACHECK BATCHES/ITEMS FOR A NONPAYMENT
 NEW BARTODAY,%H
 S X=DT D H^%DTC ;GET $H-FORMAT
 S BARTODAY=%H
 S BARCOLDA="" F  S BARCOLDA=$O(^BARCOL(DUZ(2),"D",BARXCHK,BARCOLDA)) Q:BARCOLDA=""  D
 . NEW X,BARCBDT,BARCB
 . S X=$$GET1^DIQ(90051.01,BARCOLDA_",",4,"I")
 . D H^%DTC ;GET $H-FORMAT
 . S BARCBDT=%H
 . IF BARTODAY-BARCBDT>365 D  Q  ;TOO OLD
 . . S BARCB=$$GET1^DIQ(90051.01,BARCOLDA_",",.01,"A")
 . . S BARMSG="IGNORING COLL. BATCH "_BARCB_" EIN# "_BARCOLDA_" TOO OLD: ("_X_")"
 . . D INS^BAR50DET(BARMSG,0)
 . S TDNIPAC=$$GET1^DIQ(90051.01,BARCOLDA_",",28,"E")
 . I TDNIPAC="" S NOHEAD=1
 . Q:TDNIPAC'=""&(TDNIPAC'="NONPAYMENT")
 . I TDNIPAC="NONPAYMENT",(CLMPYMT'=0) D  Q
 . . S ERRORS("P NP")=""
 . . I $G(BARDBG) D DETAILS(0) ;COL LEVEL
 . . Q
 . S BARITMDA=""  S BARITMDA=$O(^BARCOL(DUZ(2),"D",BARXCHK,BARCOLDA,BARITMDA)) Q:BARITMDA=""  D
 . . S TDNIPAC=$$GET1^DIQ(90051.1101,BARITMDA_","_BARCOLDA_",",20,"E")
 . . I TDNIPAC="" S NOITEM=1
 . . I TDNIPAC="NONPAYMENT",(CLMPYMT'=0) D  Q
 . . . S ERRORS("P NP")=""
 . . . I $G(BARDBG) D DETAILS(1) ;DATAIL LEVEL
 . . . Q
 . ;IF THERE ARE NO TDN FOR BOTH TOP LEVEL AND ITEM LEVEL THEN THIS IS ONE WITH MISSING TDN
 . ;ONE OR THE OTHER HAS TO BE POPULATED
 . I NOITEM,NOHEAD D
 . . I '$$IHS^BARUFUT(DUZ(2)) Q  ;2/4/2014 NOT FOR TRIBAL SITES  - BAR*1.8*24
 . . S ERRORS("NIPAC")=""     ;TDN/IPAC MISSING IN RPMS BATCH AND ITEM
 . . ;NEW BARMSG
 . . ;I $G(BARDBG) D
 . . ;. S BARMSG="BATCH "_BARCOLD_" PROBLEM WITH ERA CHECK: "_ERACHECK_" NO TDN FOR BOTH TOP LEVEL AND ITEM LEVEL"
 . . ;. D INS^BAR50DET(BARMSG,0) ;10/10/2013
 . S (NOITEM,NOHEAD)=0
 I $D(ERRORS) D
 . ;I $G(BARDBG) D
 . ;. S BARMSG="PROBLEM WITH ERA CHECK: "_ERACHECK D INS^BAR50DET(BARMSG,0) ;10/10/13
 . ;. D SHOWERR
 . D ADDREAS^BAREDP04(IMPDA,CLMDA,.ERRORS)
 . K ERRORS
 Q
 ;
OVERIDE(X) ;EP; EXTRINSIC FUNCTION TO CHECK FOR OVERRIDES MRS:BAR*1.8*10 D159-2
 ; ENTERS WITH X = CLAIM IEN
 N BAROR,I
 S BAROR=0           ;NOT AN OVERRIDE
 ;NODE 44 = USER STATUS OVVERRIDE
 ;     45 = PLB CHECK
 ;     46 = REVERSAL
 ;     47 = NEGATIVE PAYMENT
 F I=44:1:47 I $D(^BAREDI("I",DUZ(2),IMPDA,30,X,4,"B",I)) D
 . I I=44 S BAROR="1^USER STATUS OVERRIDE" Q
 . I I=45 S BAROR="1^PLB CHECK" Q
 .; I I=46 S BAROR="1^REVERSAL" Q  ;IHS/DIT/CPC - 20180514 CR9572 Recheck reversals - BAR*1.8*28
 .; I I=47 S BAROR="1^NEGATIVE PAYMENT" Q  ;IHS/DIT/CPC - 20180514 CR9572 Recheck neg pymnt - BAR*1.8*28
 Q BAROR
DETAILS(BARLEVEL) ;
 QUIT  ;DROPPED  - BAR*1.8*24 
 S BARMSG="ERA CHK#: "_ERACHECK I ERACHECK'=BARXCHK S BARMSG=BARMSG_" (A/R CHK# "_BARXCHK_")"
 S BARMSG=BARMSG_" COLL DA: "_BARCOLDA
 S BARMSG=BARMSG_" ERA PAYMENT: "_CLMPYMT
 D INS^BAR50DET(BARMSG,0)
 I BARLEVEL=1 S BARMSG="    ITEM#: "_BARITMDA D INS^BAR50DET(BARMSG,0)
 S BARMSG="ERR CODE(S): "
 I $D(ERRORS("P NP")) S BARMSG=BARMSG_"P NP"
 I $D(ERRORS("NEGP")) S BARMSG=BARMSG_"; NEGP"
 D INS^BAR50DET(BARMSG,0)
 Q
SHOWERR ;DROPPED  - BAR*1.8*24
 NEW I,J,BARTMP
 S BARTMP="",I="" F  S I=$O(ERRORS(I)) Q:I=""  S J="" F  S J=$O(^BARERR("B",I,J)) Q:J=""  D
 . S BARMSG=$P($G(^BARERR(J,0)),U,2)
 . D INS^BAR50DET(BARMSG,0)
 Q  ;EOR