RCTAS10I ;HAF/PJH; MCCF Date Index Logic;4/20/20 2:50pm
 ;;4.5;Accounts Receivable;**371**;Mar 20, 1995;Build 29
 ;Per VA Directive 6402, this routine should not be modified.
 Q
RECEIPT(RCPTIEN) ; File #344 Action AMCCF to update ERA or EFT DETAIL indexes
 ; INPUT - RCPTIEN - Receipt #344 IEN
 ; OUTPUT - Update MCCF index on ##344.4 or #344.31
 ;
 ; No action if this is not EDI receipt
 Q:$$GET1^DIQ(344,RCPTIEN_",",.04,"E")'="EDI LOCKBOX"
 ;
 N RCDOC,RCEFT
 ; Get document
 S RCDOC=$$GET1^DIQ(344,RCPTIEN_",",200,"E")
 ; Check if EFT exists
 S RCEFT=$O(^RCY(344.31,"MCCFR",RCPTIEN,""))
 ; If this is CR receipt for an EFT
 I $E(RCDOC,1,2)="CR",RCEFT D  Q
 .; Update #344.31 MCCF index
 .N DA,FDA,MSG,DIERR
 .S DA=RCEFT
 .S FDA(344.31,DA_",",9)="NOW"
 .D FILE^DIE("E","FDA","MSG")
 ;
 ; If ERA type receipt TR for EFT or CR for ERA matched to paper
 N RCERA
 ;Get ERA ien
 S RCERA=$$GET1^DIQ(344,RCPTIEN_",",.18,"I")
 I RCERA D  Q
 .; Update #344.4 MCCF index
 .N DA,FDA,MSG,DIERR
 .S DA=RCERA
 .S FDA(344.4,DA_",",9)="NOW"
 .D FILE^DIE("E","FDA","MSG")
 Q
 ;
ACCOUNT(RCACCNT) ; File #430 Action AMCCF to update ERA indexes
 ;
 ; INPUT - RCACCNT - AR Acccount #430 IEN
 ; OUTPUT - Update MCCF index on #344.4
 ;
 N RCCLAIM,RCERA
 ; External format claim number
 S RCCLAIM=$$GET1^DIQ(430,RCACCNT_",",.01,"E") Q:'RCCLAIM
 S:RCCLAIM["-" RCCLAIM=$P(RCCLAIM,"-",2)
 S RCERA=""
 ; Search scratchpad index for ERA containing this claim
 F  S RCERA=$O(^RCY(344.49,"D",RCCLAIM,RCERA)) Q:'RCERA  D
 .; Update #344.4 MCCF index (DINUM)
 .N DA,FDA,MSG,DIERR
 .S DA=RCERA
 .S FDA(344.4,DA_",",9)="NOW"
 .D FILE^DIE("E","FDA","MSG")
 Q
 ;
EOB(RCEOB) ; File #361.1 Action AMCCF to update ERA indexes
 ;
 ; INPUT - RCEOB - EOB #361.1 IEN
 ; OUTPUT - Update MCCF index on #344.4
 ;
 N RCERA
 S RCERA=""
 ; Search scratchpad index for ERA containing this claim
 F  S RCERA=$O(^RCY(344.4,"ADET",RCEOB,RCERA)) Q:'RCERA  D
 .; Update #344.4 MCCF index (DINUM)
 .N DA,FDA,MSG,DIERR
 .S DA=RCERA
 .S FDA(344.4,DA_",",9)="NOW"
 .D FILE^DIE("E","FDA","MSG")
 Q
 ;
FMSSTAT(IEN347) ; Get receipt for FMS Document and mark EFT or ERA as updated
 ; INPUT - IEN347 = AR FMS DOCUMENT file #347 IEN
 ; OUTPUT - Update MCCF index on #344.4 or #344.31
 N RCPTIEN,FMSDOC
 ; Get document number
 S FMSDOC=$$GET1^DIQ(347,IEN347_",",.09)
 ; Skip if not found
 Q:FMSDOC=""
 ; Find Receipt
 S RCPTIEN=$O(^RCY(344,"ADOC",FMSDOC,"")) Q:'RCPTIEN
 ; Mark EFT DETAIL or ERA as updated
 D RECEIPT(RCPTIEN)
 Q
 ;
 
--- Routine Detail   --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCTAS10I   2554     printed  Sep 23, 2025@19:24:45                                                                                                                                                                                                    Page 2
RCTAS10I  ;HAF/PJH; MCCF Date Index Logic;4/20/20 2:50pm
 +1       ;;4.5;Accounts Receivable;**371**;Mar 20, 1995;Build 29
 +2       ;Per VA Directive 6402, this routine should not be modified.
 +3        QUIT 
RECEIPT(RCPTIEN) ; File #344 Action AMCCF to update ERA or EFT DETAIL indexes
 +1       ; INPUT - RCPTIEN - Receipt #344 IEN
 +2       ; OUTPUT - Update MCCF index on ##344.4 or #344.31
 +3       ;
 +4       ; No action if this is not EDI receipt
 +5        if $$GET1^DIQ(344,RCPTIEN_",",.04,"E")'="EDI LOCKBOX"
               QUIT 
 +6       ;
 +7        NEW RCDOC,RCEFT
 +8       ; Get document
 +9        SET RCDOC=$$GET1^DIQ(344,RCPTIEN_",",200,"E")
 +10      ; Check if EFT exists
 +11       SET RCEFT=$ORDER(^RCY(344.31,"MCCFR",RCPTIEN,""))
 +12      ; If this is CR receipt for an EFT
 +13       IF $EXTRACT(RCDOC,1,2)="CR"
               IF RCEFT
                   Begin DoDot:1
 +14      ; Update #344.31 MCCF index
 +15                   NEW DA,FDA,MSG,DIERR
 +16                   SET DA=RCEFT
 +17                   SET FDA(344.31,DA_",",9)="NOW"
 +18                   DO FILE^DIE("E","FDA","MSG")
                   End DoDot:1
                   QUIT 
 +19      ;
 +20      ; If ERA type receipt TR for EFT or CR for ERA matched to paper
 +21       NEW RCERA
 +22      ;Get ERA ien
 +23       SET RCERA=$$GET1^DIQ(344,RCPTIEN_",",.18,"I")
 +24       IF RCERA
               Begin DoDot:1
 +25      ; Update #344.4 MCCF index
 +26               NEW DA,FDA,MSG,DIERR
 +27               SET DA=RCERA
 +28               SET FDA(344.4,DA_",",9)="NOW"
 +29               DO FILE^DIE("E","FDA","MSG")
               End DoDot:1
               QUIT 
 +30       QUIT 
 +31      ;
ACCOUNT(RCACCNT) ; File #430 Action AMCCF to update ERA indexes
 +1       ;
 +2       ; INPUT - RCACCNT - AR Acccount #430 IEN
 +3       ; OUTPUT - Update MCCF index on #344.4
 +4       ;
 +5        NEW RCCLAIM,RCERA
 +6       ; External format claim number
 +7        SET RCCLAIM=$$GET1^DIQ(430,RCACCNT_",",.01,"E")
           if 'RCCLAIM
               QUIT 
 +8        if RCCLAIM["-"
               SET RCCLAIM=$PIECE(RCCLAIM,"-",2)
 +9        SET RCERA=""
 +10      ; Search scratchpad index for ERA containing this claim
 +11       FOR 
               SET RCERA=$ORDER(^RCY(344.49,"D",RCCLAIM,RCERA))
               if 'RCERA
                   QUIT 
               Begin DoDot:1
 +12      ; Update #344.4 MCCF index (DINUM)
 +13               NEW DA,FDA,MSG,DIERR
 +14               SET DA=RCERA
 +15               SET FDA(344.4,DA_",",9)="NOW"
 +16               DO FILE^DIE("E","FDA","MSG")
               End DoDot:1
 +17       QUIT 
 +18      ;
EOB(RCEOB) ; File #361.1 Action AMCCF to update ERA indexes
 +1       ;
 +2       ; INPUT - RCEOB - EOB #361.1 IEN
 +3       ; OUTPUT - Update MCCF index on #344.4
 +4       ;
 +5        NEW RCERA
 +6        SET RCERA=""
 +7       ; Search scratchpad index for ERA containing this claim
 +8        FOR 
               SET RCERA=$ORDER(^RCY(344.4,"ADET",RCEOB,RCERA))
               if 'RCERA
                   QUIT 
               Begin DoDot:1
 +9       ; Update #344.4 MCCF index (DINUM)
 +10               NEW DA,FDA,MSG,DIERR
 +11               SET DA=RCERA
 +12               SET FDA(344.4,DA_",",9)="NOW"
 +13               DO FILE^DIE("E","FDA","MSG")
               End DoDot:1
 +14       QUIT 
 +15      ;
FMSSTAT(IEN347) ; Get receipt for FMS Document and mark EFT or ERA as updated
 +1       ; INPUT - IEN347 = AR FMS DOCUMENT file #347 IEN
 +2       ; OUTPUT - Update MCCF index on #344.4 or #344.31
 +3        NEW RCPTIEN,FMSDOC
 +4       ; Get document number
 +5        SET FMSDOC=$$GET1^DIQ(347,IEN347_",",.09)
 +6       ; Skip if not found
 +7        if FMSDOC=""
               QUIT 
 +8       ; Find Receipt
 +9        SET RCPTIEN=$ORDER(^RCY(344,"ADOC",FMSDOC,""))
           if 'RCPTIEN
               QUIT 
 +10      ; Mark EFT DETAIL or ERA as updated
 +11       DO RECEIPT(RCPTIEN)
 +12       QUIT 
 +13      ;