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

RCDPEDAR.m

Go to the documentation of this file.
  1. RCDPEDAR ;ALB/TMK - ACTIVITY REPORT ;Jun 06, 2014@19:11:19
  1. ;;4.5;Accounts Receivable;**173,276,284,283,298,304,318,321,326,432**;Mar 20, 1995;Build 16
  1. ;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. RPT ; Daily Activity Rpt On Demand
  1. N POP,RCDET,RCDIV,RCDONLY,RCDT1,RCDT2,RCHDR,RCINC,RCLSTMGR,RCNJ
  1. N RCPAR,RCPAY,RCPYRSEL,RCRANGE,RCSTOP,RCTMPND,RCTYPE,VAUTD,X,XX,Y,%ZIS
  1. S RCNJ=0 ; Not the nightly job, user interactions
  1. D DIVISION^VAUTOMA ; IA 664 Select Division/Station - sets VAUTD
  1. I 'VAUTD,($D(VAUTD)'=11) Q
  1. S RCDET=$$RTYPE() ; Select Report Type (Summary/Detail)
  1. Q:RCDET=-1
  1. S XX=$$DTRANGE(.RCDT1,.RCDT2) ; Select Date Range to be used
  1. Q:'XX
  1. ;
  1. ; PRCA*4.5*326 - Ask to show Medical/Pharmacy Tricare CHAMPVA or All
  1. S RCTYPE=$$RTYPE^RCDPEU1("")
  1. I RCTYPE<0 Q
  1. ;
  1. S RCPAY=$$PAYRNG^RCDPEU1() ; PRCA*4.5*326 - Selected or Range of Payers
  1. Q:RCPAY=-1 ; PRCA*4.5*326 '^' or timeout
  1. ;
  1. I RCPAY'="A" D Q:XX=-1 ; PRCA*4.5*326 - Since we don't want all payers
  1. . S RCPAR("SELC")=RCPAY ; prompt for payers we do want
  1. . S RCPAR("TYPE")=RCTYPE
  1. . S RCPAR("FILE")=344.4
  1. . S RCPAR("DICA")="Select Insurance Company NAME: "
  1. . S XX=$$SELPAY^RCDPEU1(.RCPAR)
  1. ;
  1. S RCDONLY=$$DBTONLY() ; Debit only filter ;PRCA*4.5*321
  1. Q:RCDONLY=-1 ; '^' or timeout
  1. S RCLSTMGR=$$ASKLM^RCDPEARL ; Ask to Display in Listman Template
  1. Q:RCLSTMGR<0 ; '^' or timeout
  1. ;
  1. I RCLSTMGR=1 D Q ; ListMan Template format, put in array
  1. . S RCTMPND="RCDPE_DAR"
  1. . K ^TMP($J,RCTMPND)
  1. . D EN(RCDET,RCDT1,RCDT2,RCLSTMGR,RCDONLY)
  1. . D LMHDR^RCDPEDA4(.RCSTOP,RCDET,1,RCDT1,RCDT2,.RCHDR,RCDONLY)
  1. . D LMRPT^RCDPEARL(.RCHDR,$NA(^TMP($J,RCTMPND))) ; Generate ListMan display
  1. . K ^TMP($J,RCTMPND)
  1. ;
  1. ; Ask device
  1. S %ZIS="QM"
  1. D ^%ZIS
  1. Q:POP
  1. ;
  1. I $D(IO("Q")) D Q ; Queued Report
  1. . N ZTDESC,ZTRTN,ZTSAVE,ZTSK
  1. . S ZTRTN="EN^RCDPEDAR("_RCDET_","_RCDT1_","_RCDT2_",0,"_RCDONLY_")" ;PRCA*4.5*321 added RCDONLY
  1. . S ZTDESC="AR - EDI LOCKBOX EFT DAILY ACTIVITY REPORT"
  1. . S ZTSAVE("RC*")="",ZTSAVE("VAUTD")=""
  1. . S ZTSAVE("^TMP(""RCDPEU1"",$J,")="" ; PRCA*4.5*326
  1. . ;
  1. . D ^%ZTLOAD
  1. . W !!,$S($D(ZTSK):"Task number "_ZTSK_" was queued.",1:"Unable to queue this task.")
  1. . K ZTSK,IO("Q")
  1. . D HOME^%ZIS
  1. ;
  1. U IO
  1. D EN(RCDET,RCDT1,RCDT2,RCLSTMGR,RCDONLY)
  1. Q
  1. ;
  1. DBTONLY() ; Allows the user to select filter to only show EFTs with debits
  1. ; PRCA*4.5*321 Added subroutine
  1. ; Input: None
  1. ; Returns: 0 - All EFTs to display
  1. ; 1 - Only EFTs with debits to be displayed
  1. ; -1 - User up-arrowed or timed out
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. S DIR("A")="Show EFTs with debits only? "
  1. S DIR(0)="SA^Y:YES;N:NO"
  1. S DIR("B")="NO"
  1. S DIR("?",1)="Enter 'YES' to only show EFTs with a debit flag of 'D'."
  1. S DIR("?")="Enter 'NO' to show all EFTs."
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT)!(Y="") Q -1
  1. Q $E(Y,1)="Y"
  1. ;
  1. RTYPE() ; Allows the user to select the report type (Summary/Detail)
  1. ; Input: None
  1. ; Returns: 0 - Summary Display
  1. ; 1 - Detail Display
  1. ; -1 - User up-arrowed or timed out
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. S DIR("A")="(S)UMMARY OR (D)ETAIL?: "
  1. S DIR(0)="SA^S:SUMMARY TOTALS ONLY;D:DETAIL AND TOTALS"
  1. S DIR("B")="D"
  1. D ^DIR
  1. I $D(DTOUT)!$D(DUOUT)!(Y="") Q -1
  1. Q Y="D"
  1. ;
  1. DTRANGE(STDATE,ENDDATE) ; Allows the user to select the date range to by used
  1. ; Input: None
  1. ; Output: STDATE = Internal Fileman Date to start at
  1. ; ENDDATE - Internal Fileman Date to end at
  1. ; Returns: 0 - User up-arrowed or timed out, 1 otherwise
  1. N DIR,DIROUT,DIRUT,DTOUT,DUOUT
  1. S DIR("?")="Enter the earliest date of receipt of deposit to include on the report."
  1. S DIR(0)="DAO^:"_DT_":APE"
  1. S DIR("A")="START DATE: "
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT)!(Y="") 0
  1. S STDATE=Y
  1. K DIR
  1. S DIR("?")="Enter the latest date of receipt of deposit to include on the report."
  1. S DIR("B")=Y(0)
  1. S DIR(0)="DAO^"_RCDT1_":"_DT_":APE",DIR("A")="END DATE: "
  1. D ^DIR
  1. Q:$D(DTOUT)!$D(DUOUT)!(Y="") 0
  1. S ENDDATE=Y
  1. Q 1
  1. ;
  1. EN(RCDET,RCDT1,RCDT2,RCLSTMGR,DONLY) ; Entry point for report, might be queued
  1. ; Input: RCDET - 1 - Detail Report, 0 - Summary
  1. ; RCDT1 - Internal Fileman Start date
  1. ; RCDT2 - Internal Fileman End date
  1. ; RCLSTMGR - 1 display in list manager, 0 otherwise
  1. ; Optional, defaults to 0
  1. ; DONLY - 1 only display EFTs with a debit flag of 'D'
  1. ; 0 display all EFTs
  1. ; RCPAY - A - All Payers selected
  1. ; - R - Range of Payers
  1. ; - S - Specific payers
  1. ; RCPYRSEL - Array of selected payers (Only present if A1=3 above
  1. ; VAUTD - 1 - All selected divisions OR an array of selected divisions
  1. N DFLG,DTADD,IEN3443,IEN34431,INPUT,RCFLG,RCJOB,RCT,XX,Z ; PRCA*4.5*321 Added DFLG
  1. N:$G(ZTSK) ZTSTOP ; Job was tasked, ZTSTOP = flag to stop
  1. S:'$D(RCLSTMGR) RCLSTMGR=0
  1. S RCPAY=$G(RCPAY,"A") ; PRCA*4.5*326
  1. ;
  1. S XX=$S(RCLSTMGR:1,1:0)
  1. S INPUT=XX_"^"_RCLSTMGR_"^"_+RCDET
  1. S RCJOB=$J
  1. K ^TMP("RCDAILYACT",$J)
  1. K ^TMP($J,"TOTALS") ; Initialize Totals temp workspace
  1. ;
  1. ; Loop through all of the EDI LOCKBOX DEPOSIT records in the selected date
  1. ; range and add any that pass the payer and division filters into ^TMP
  1. ; by the internal date added
  1. S DTADD=RCDT1-.0001,RCT=0
  1. S $P(INPUT,"^",4)=0 ; Current Page Number
  1. S $P(INPUT,"^",5)=0 ; Stop Flag
  1. S $P(INPUT,"^",10)=DONLY
  1. F D Q:'DTADD Q:DTADD>(RCDT2_".9999") Q:$P(INPUT,"^",5)=1
  1. . S DTADD=$O(^RCY(344.3,"ARECDT",DTADD))
  1. . Q:'DTADD
  1. . Q:DTADD>(RCDT2_".9999")
  1. . S IEN3443=0
  1. . F D Q:'IEN3443 Q:$P(INPUT,"^",5)=1
  1. . . S IEN3443=$O(^RCY(344.3,"ARECDT",DTADD,IEN3443))
  1. . . Q:'IEN3443
  1. . . S IEN34431="",RCFLG=0
  1. . . F D Q:IEN34431=""
  1. . . . S IEN34431=$O(^RCY(344.31,"B",IEN3443,IEN34431))
  1. . . . Q:IEN34431=""
  1. . . . ;
  1. . . . I RCPAY'="A" D Q:'XX
  1. . . . . S XX=$$ISSEL^RCDPEU1(344.31,IEN34431) ; PRCA*4.5*326 Check if payer was selected
  1. . . . I RCTYPE'="A" D Q:'XX ; If all of a given type of payer selected
  1. . . . . S XX=$$ISTYPE^RCDPEU1(344.31,IEN34431,RCTYPE) ; check that payer matches type
  1. . . . ;
  1. . . . Q:'$$CHKDIV(IEN34431,0,.VAUTD) ; Not a selected station/division
  1. . . . ;
  1. . . . ; PRCA*4.5*321 Added filter for Debit EFTs Only below
  1. . . . I DONLY D Q:DFLG'="D" ; Not an EFT with a debit flag of 'D'
  1. . . . . S DFLG=$$GET1^DIQ(344.31,IEN34431,3,"E")
  1. . . . S RCFLG=1
  1. . . . S ^TMP("RCDAILYACT",$J,DTADD\1,IEN3443,"EFT",IEN34431)=""
  1. . . ;
  1. . . S:RCFLG ^TMP("RCDAILYACT",$J,DTADD\1,IEN3443)=""
  1. . . S RCT=RCT+1 ; Current Record Count
  1. . . ;
  1. . . ; Check for user stopped every 100 records
  1. . . I '(RCT#100),$D(ZTQUEUED),$$S^%ZTLOAD D Q
  1. . . . S ZTSTOP=1
  1. . . . S $P(INPUT,"^",5)=1 ; Stop now
  1. . . . K ZTREQ
  1. ;
  1. I '$P(INPUT,"^",5) D
  1. . S $P(INPUT,"^",6)=RCDT1 ; Start of Date Range
  1. . S $P(INPUT,"^",7)=RCDT2 ; End of Date Range
  1. . D RPT1(.INPUT)
  1. D ENQ(INPUT)
  1. Q
  1. ;
  1. ENQ(INPUT) ; Clean up
  1. ; Input: INPUT - A1^A2^A3^...^A8 Where:
  1. ; A1 - 1 if Detail report, 0 if summary report
  1. ; A2 - 1 if displaying to Listman, 0 otherwise
  1. ; A3 - 0 if NOT called from Nightly Process, 1 otherwise
  1. ; A4 - Current Page Number
  1. ; A5 - Stop Flag
  1. ; A6 - Start of Date Range
  1. ; A7 - End of Date Range
  1. ; ZTQUEUED - Defined if Joh was queued
  1. ; Output: ZTREQ - "@" Only returned if ZTQUEUED is defined
  1. N XX,YY,ZZ
  1. K ^TMP($J,"DEPERRS"),^TMP($J,"ONEDEP") ; PRCA*4.5*321
  1. K ^TMP("RCDAILYACT",$J),^TMP("RCSELPAY",$J)
  1. K ^TMP($J,"TOTALS")
  1. K ^TMP("RCDPEU1",$J) ; PRCA*4.5*326
  1. I '$D(ZTQUEUED) D
  1. . D ^%ZISC
  1. . S XX=$P(INPUT,"^",1) ; Nightly Process Flag
  1. . S YY=$P(INPUT,"^",5) ; Stop Flag
  1. . S ZZ=$P(INPUT,"^",4) ; Current Page Number
  1. . I 'XX,'YY,ZZ D
  1. . . S XX=""
  1. . . D ASK^RCDPEARL(.XX)
  1. I $D(ZTQUEUED) S ZTREQ="@"
  1. Q
  1. ;
  1. RPT1(INPUT) ;EP from RCDPEM1 (Nightly Process)
  1. ; Output the report
  1. ; Input: INPUT - A1^A2^A3^...^An Where:
  1. ; A1 - 1 if called from Nightly Process, 0 otherwise
  1. ; A2 - 1 if displaying to Listman, 0 otherwise
  1. ; A4 - Current Page Number
  1. ; A5 - Stop Flag
  1. ; A6 - Start of Date Range
  1. ; A7 - End of Date Range
  1. ; ^TMP(B1,$J,B2,B3) = "" - Array of record IENs in 344.3 in date range
  1. ; and for selected payer(s) and division(s)
  1. ; ^TMP(B1,$J,B2,B3,"EFT",B4) = "" - Array of record IENS in 344.31 for above Where:
  1. ; B1 - "RCDAILYACT"
  1. ; B2 - Internal Date from DATE/TIME ADDED (344.3, .13)
  1. ; B3 - Internal IEN for 344.3
  1. ; B4 - Internal IEN for file 344.31
  1. ; Output: INPUT - A1^A2^A3^...^An - The following pieces may be updated
  1. ; A4 - Current Page Number
  1. ; A5 - Stop Flag
  1. ;
  1. N CURPG,DETL,DTADD,DTEND,DTST,HDR1,LSTMAN,NJ
  1. S DETL=$P(INPUT,"^",3) ; Detail Report flag
  1. S LSTMAN=$P(INPUT,"^",2) ; Listman flag
  1. S NJ=$P(INPUT,"^",1) ; Nightly Process flag
  1. S CURPG=$P(INPUT,"^",4) ; Current Page Number
  1. S DTST=$P(INPUT,"^",6) ; Date Range Start
  1. S DTEND=$P(INPUT,"^",7) ; Date Range End
  1. S $P(INPUT,"^",8)=0 ; Current line counter
  1. S DTADD=""
  1. F D Q:DTADD="" Q:$P(INPUT,"^",5)=1
  1. . S DTADD=$O(^TMP("RCDAILYACT",$J,DTADD))
  1. . Q:DTADD=""
  1. . ;
  1. . I 'LSTMAN,DETL D Q:$P(INPUT,"^",5)=1 ; PRCA*4.5*321
  1. . . D HDR^RCDPEDA3(.INPUT)
  1. . ;
  1. . I DETL D ; Detail Report
  1. . . S HDR1="DATE EFT DEPOSIT RECEIVED: "_$$FMTE^XLFDT(DTADD,"2Z") ; PRCA*4.5*321 moved location
  1. . . S HDR1=$J("",80-$L(HDR1)\2)_HDR1 ; Center it
  1. . . D SL^RCDPEDA3(.INPUT,HDR1)
  1. . . D SL^RCDPEDA3(.INPUT," ")
  1. . S $P(INPUT,"^",9)=DTADD
  1. . D RPT2^RCDPEDA2(.INPUT) ; Process all 344.3 records found
  1. . Q:$P(INPUT,"^",5)=1 ; User quit
  1. . D TOTSDAY^RCDPEDA3(.INPUT) ; Display Totals for Date
  1. ;
  1. Q:$P(INPUT,"^",5)=1 ; User quit
  1. D TOTSF^RCDPEDA3(.INPUT) ; Display Final Totals
  1. D SL^RCDPEDA3(.INPUT,$$ENDORPRT^RCDPEARL) ; Display End of Report
  1. Q
  1. ;
  1. CHKDIV(IEN,FLG,VAUTD) ;
  1. ; IEN - ien in file 344.31 or 344.4
  1. ; FLG - 0 if IEN contains ien in file 344.31, 1 if IEN contains ien in file 344.4
  1. ; VAUTD - array of selected divisions from DIVISION^VAUTOMA API call
  1. ; returns 1 if division associated with an entry in 344.31 is on the list in VAUTD
  1. ; returns 0 otherwise
  1. N ERA,I,NAME,RCSTA,RES
  1. S RES=0
  1. I VAUTD=1 S RES=1 G CHKDIVX
  1. I 'IEN G CHKDIVX
  1. S ERA=$S(FLG:IEN,1:$P($G(^RCY(344.31,IEN,0)),U,10))
  1. S RCSTA=$$ERASTA^RCDPEM3(ERA),NAME=$P(RCSTA,U)
  1. I NAME="UNKNOWN" G CHKDIVX
  1. S I=0 I 'VAUTD F S I=$O(VAUTD(I)) Q:'I!RES I NAME=VAUTD(I) S RES=1
  1. CHKDIVX ;
  1. Q RES