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

RCDPAPST.m

Go to the documentation of this file.
  1. RCDPAPST ;WISC/RFJ-account profile bill status select ;1 Jun 99
  1. ;;4.5;Accounts Receivable;**114,168**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. Q
  1. ;
  1. ;
  1. SELSTAT ; select a status called from listmanager
  1. D FULL^VALM1
  1. S VALMBCK="R"
  1. ;
  1. W !!,"This option will allow you to specify which bill statuses to display."
  1. D GETSTAT(RCDEBTDA)
  1. ;
  1. D INIT^RCDPAPLM
  1. Q
  1. ;
  1. ;
  1. GETSTAT(RCDEBTDA) ; select the list of statuses of bills to display for an account
  1. ; if rcdebtda passed, it will show selectable statuses for this account
  1. N %,DIR,DIRUT,RCRJFLAG,RCSTAT,RCSTATSL,STATDA,STATLIST,X,Y
  1. ;
  1. ; get the status list for the user
  1. D STATDEF
  1. ;
  1. ; build list of possible statuses for AR package (show statuses used)
  1. S STATLIST=""
  1. S STATDA=0 F S STATDA=$O(^PRCA(430,"ASDT",STATDA)) Q:'STATDA D
  1. . S RCSTAT(STATDA)=$P($G(^PRCA(430.3,STATDA,0)),"^")
  1. . S STATLIST=STATLIST_STATDA_":"_$E(RCSTAT(STATDA),1,20)_";"
  1. S STATLIST=STATLIST_"*:ALL statuses;-:NO statuses;"
  1. ;
  1. F D Q:$G(RCRJFLAG)
  1. . D SHOWSTAT(RCDEBTDA)
  1. . S DIR(0)="SOA^"_STATLIST,DIR("A")="Select STATUS of bills to display: "
  1. . D ^DIR
  1. . I $D(DIRUT) S RCRJFLAG=1 Q
  1. . I Y="*" S %=0 F S %=$O(RCSTAT(%)) Q:'% S RCSTATSL(%)=1
  1. . I Y="-" K RCSTATSL Q
  1. . S Y=+Y
  1. . I $D(RCSTAT(Y)) D
  1. . . I $D(RCSTATSL(Y)) K RCSTATSL(Y) W " un-selected" Q
  1. . . S RCSTATSL(Y)=1 W " selected"
  1. ;
  1. ; save as default for user
  1. S STATLIST=""
  1. S STATDA=0 F S STATDA=$O(RCSTATSL(STATDA)) Q:'STATDA S STATLIST=STATLIST_STATDA_"^"
  1. S ^DISV(DUZ,"RCDPAPLM","STATUS")=STATLIST
  1. Q
  1. ;
  1. ;
  1. STATDEF ; get list of statuses for the user
  1. ; returns RCSTATSL(statda)
  1. N %,STATDA
  1. ; build default selected statuses
  1. K RCSTATSL
  1. F %=1:1 S STATDA=$P($G(^DISV(DUZ,"RCDPAPLM","STATUS")),"^",%) Q:'STATDA S RCSTATSL(STATDA)=1
  1. Q
  1. ;
  1. ;
  1. DEFAULT ; set the default statuses
  1. W !
  1. W !,"When using this option, you have the option to select bills to display by"
  1. W !,"status. You can select a list of statuses of the bills to display. After"
  1. W !,"you select the list of statuses, the option will retain the list of selected"
  1. W !,"statuses for the next time you enter this option. Since you currently do"
  1. W !,"not have any statuses selected for your list, the default statuses of"
  1. W !,"active, open, pending calm, and refund review will be automatically"
  1. W !,"selected for your list now."
  1. ; active(16), open(42), pending calm(21), refund review(44)
  1. S ^DISV(DUZ,"RCDPAPLM","STATUS")="16^42^21^44"
  1. Q
  1. ;
  1. ;
  1. SHOWSTAT(RCDEBTDA) ; show list of statuses
  1. N OFFSET,STARS,STATDA
  1. W !!?3,"The following is a list of available statuses for bills:"
  1. W !?3,"--------------------------------------------------------"
  1. S OFFSET=0
  1. S STATDA=0 F S STATDA=$O(RCSTAT(STATDA)) Q:'STATDA D
  1. . I OFFSET=0 W !
  1. . W ?(OFFSET)
  1. . ; does account have bills under status, if yes show stars
  1. . S STARS=" "
  1. . I $G(RCDEBTDA),$D(^PRCA(430,"AS",RCDEBTDA,STATDA)) S STARS="**"
  1. . W STARS," ",$E(STATDA_" ",1,2)," ",$E(RCSTAT(STATDA)_" ",1,16)
  1. . ; user has status selected
  1. . I $G(RCSTATSL(STATDA)) W " selected"
  1. . S OFFSET=OFFSET+44
  1. . I OFFSET>44 S OFFSET=0
  1. W !,"** indicates account has bills under status **",!
  1. Q
  1. ;
  1. ;
  1. GETBILLS(RCDEBTDA) ; bills for account
  1. ; returns a list of bills in ^tmp("rcdpapst",$j,actdate,status,bill)
  1. N BILLDA,DATE,STATDA
  1. K ^TMP("RCDPAPST",$J)
  1. ;
  1. S STATDA=0 F S STATDA=$O(^PRCA(430,"AS",RCDEBTDA,STATDA)) Q:'STATDA D
  1. . S BILLDA=0 F S BILLDA=$O(^PRCA(430,"AS",RCDEBTDA,STATDA,BILLDA)) Q:'BILLDA D
  1. . . S DATE=$P($G(^PRCA(430,BILLDA,6)),"^",21) I 'DATE Q
  1. . . S ^TMP("RCDPAPST",$J,$P(DATE,"."),STATDA,BILLDA)=$$BILLBAL(BILLDA,0)
  1. Q
  1. ;
  1. ;
  1. BILLBAL(BILLDA,EXTERNAL) ; return a bills current balance principal ^ interest ^ admin
  1. ; set the external flag if data is being reported to an external system
  1. ; like fms, ndb, ig, etc.
  1. N ADMIN,CATEG,DATA7,INTEREST,PRINCPAL,STATDA
  1. S DATA7=$G(^PRCA(430,BILLDA,7))
  1. S PRINCPAL=$P(DATA7,"^")
  1. S INTEREST=$P(DATA7,"^",2)
  1. S ADMIN=$P(DATA7,"^",3)+$P(DATA7,"^",4)+$P(DATA7,"^",5)
  1. ;
  1. S CATEG=$P(^PRCA(430,BILLDA,0),"^",2),STATDA=$P(^(0),"^",8)
  1. ;
  1. ; special case for prepayments (26)
  1. I CATEG=26 D
  1. . S PRINCPAL=-PRINCPAL,(INTEREST,ADMIN)=0
  1. . ; bill status not open, active, or in refund review
  1. . I STATDA'=42,STATDA'=16,STATDA'=44 S PRINCPAL=0
  1. ;
  1. ; if the bill's status is write-off, balance and int = 0
  1. I STATDA=23 S (PRINCPAL,INTEREST,ADMIN)=0
  1. ; if the bill's status is suspended, balance and int = 0
  1. ; this would be for collecting payments only, external systems
  1. ; still would get the bills balance
  1. I STATDA=40,'$G(EXTERNAL) S (PRINCPAL,INTEREST,ADMIN)=0
  1. ;
  1. Q PRINCPAL_"^"_INTEREST_"^"_ADMIN