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

RCSTATU.m

Go to the documentation of this file.
  1. RCSTATU ;EDE/YMG - AR PERFORMACE METRICS UTILITIES;02/03/2021 8:40 AM
  1. ;;4.5;Accounts Receivable;**378**;Mar 20, 1995;Build 54
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. UPDMET(RCFIELD,RCVALUE) ; Update the AR Metrics file.
  1. ;INPUT: RCFIELD = The field # in the AR Metrics File to Update
  1. ; RCVALUE = Amount to add to the data already in the field
  1. ;
  1. N RCSTIEN,RCDATE,RCCURAMT,RCNEWAMT,Y,DLAYGO,DIC,DIK,DR,DA,X
  1. ;
  1. ;Lock the AR Metrics file until daily entry is confirmed to exist or is created.
  1. L +^RCSTAT(340.7):5
  1. S RCDATE=$$DT^XLFDT
  1. S RCSTIEN=$O(^RCSTAT(340.7,"B",RCDATE,""))
  1. S DLAYGO=340.7,DIC="^RCSTAT(340.7,",DIC(0)="L",X=RCDATE
  1. ;
  1. ;Create new entry if necessary
  1. I 'RCSTIEN D
  1. . D FILE^DICN
  1. . S RCSTIEN=+Y
  1. . K DIC,DINUM,DLAYGO
  1. . ;Ensure it is indexed
  1. . S DA=RCSTIEN,DIK="^RCSTAT(340.7,"
  1. . D IX^DIK
  1. . K DR
  1. ;Unlock the file
  1. L -^RCSTAT(340.7):5
  1. ;
  1. ; File the update along with inactivate the ACTION TYPE
  1. S RCCURAMT=$$GET1^DIQ(340.7,RCSTIEN_",",RCFIELD,"I")
  1. S RCNEWAMT=RCCURAMT+RCVALUE
  1. S DR=RCFIELD_"///"_RCNEWAMT ;Update the amount
  1. ;
  1. S DIE="^RCSTAT(340.7,",DA=RCSTIEN
  1. D ^DIE
  1. ;
  1. Q
  1. ;
  1. CSALERT(RCBILLDA,RCIEN) ;Send a bulletin to alert staff if a Debtor has a bill sent to Cross Servicing if they also have an active Repayment Plan.
  1. ;
  1. ;INPUT: RCBILLDA - AR Bill IEN for file 430
  1. ; RCIEN - Repayment Plan IEN for fiel 340.5
  1. ;
  1. N %,RCBILL,XMY,RCRPID
  1. K ^TMP($J,"RCRPPALERT") ; used to store message to send
  1. ;
  1. S LINE=0
  1. S RCBILL=$$GET1^DIQ(430,RCBILLDA_",",.01,"E")
  1. S RCRPID=$$GET1^DIQ(340.5,RCIEN_",",.01,"E")
  1. D SET("Bill "_RCBILL_" was referred to the Treasury Cross Servicing (CS) Referral")
  1. D SET("Program when it should have been added to the Debtor's Active Repayment Plan,")
  1. D SET(RCRPID_".")
  1. D SET("")
  1. D SET("Please investigate and recall from CS if necessary.")
  1. ;
  1. S XMY("G.RC REPAY PLAN EXTERNAL")=""
  1. S %=$$SENDMSG("ALERT: Bill sent to Cross Servicing for Debtor with Repayment Plan",.XMY)
  1. K ^TMP($J,"RCRPPALERT") ; used to store message to send
  1. Q
  1. ;
  1. ;
  1. SET(DATA) ; store report
  1. S LINE=LINE+1,^TMP($J,"RCRPPALERT",LINE)=DATA
  1. Q
  1. ;
  1. ;
  1. SENDMSG(XMSUB,XMY) ; send message with subject and recipients
  1. N %X,D0,D1,D2,DIC,DICR,DIW,X,XCNP,XMDISPI,XMDUN,XMDUZ,XMTEXT,XMZ,ZTPAR
  1. S XMDUZ="AR PACKAGE",XMTEXT="^TMP($J,""RCRPPALERT"","
  1. D ^XMD
  1. Q +$G(XMZ)
  1. ;
  1. CLEANUP ; Remove entries from the AR Metrics File that are older than the METRICS RETENTION DAYS paramenter (#.16, file 342) allows.
  1. ;
  1. N RCSITE,RCNUMDAY,DIK,DA,RCI,RCDT,RCMAXDT,RCNUMDY
  1. ;
  1. ;Get the oldest date to keep.
  1. S RCNUMDY=$$GET1^DIQ(342,"1,",.16,"I") ;METRICS RETENTION DAYS PARAMETER
  1. S RCMAXDT=$$FMADD^XLFDT($$DT^XLFDT,-RCNUMDY)
  1. ;Loop through all of the entry older than RCMAXDT and delete
  1. S RCI=0
  1. F S RCI=$O(^RCSTAT(340.7,RCI)) Q:'RCI D
  1. . S RCDT=$G(^RCSTAT(340.7,RCI,0))
  1. . Q:RCDT'<RCMAXDT
  1. . S DIK="^RCSTAT(340.7,",DA=RCI
  1. . D ^DIK
  1. . K DIK,DA
  1. ;
  1. Q