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

RCBMILL.m

Go to the documentation of this file.
  1. RCBMILL ;WISC/RFJ-millennium bill report (generator) ; 27 Jun 2001 11:10 AM
  1. ;;4.5;Accounts Receivable;**170,203**;Mar 20, 1995
  1. ;;Per VHA Directive 10-93-142, this routine should not be modified.
  1. N %DT,DEFAULT,RCDATBEG,RCDATEND,RCREPTYP,X,Y
  1. ;
  1. ; ask type of report to generate
  1. W !!,"--- Enter the Type of Report to Generate ---"
  1. S RCREPTYP=$$ASKTYPE
  1. I RCREPTYP<1 Q
  1. ;
  1. ; ask month year
  1. I RCREPTYP=1!(RCREPTYP=2)!(RCREPTYP=3) D
  1. . N RCOFFDT
  1. . W !!,"--- Enter the Month and Year for the Report ---"
  1. . S Y=$E($$PREVMONT^RCRJRBD(DT),1,5)_"00" D DD^%DT S DEFAULT=Y
  1. . S RCOFFDT=3030930 ; The report cannot run for later date
  1. . S %DT(0)=$S(DT>RCOFFDT:-RCOFFDT,1:-DT)
  1. . S %DT("A")="Select MONTH YEAR for Report: ",%DT("B")=DEFAULT,%DT="AEMP"
  1. . D ^%DT I Y<0 Q
  1. . S RCDATBEG=$E(Y,1,5)_"00",RCDATEND=$E(Y,1,5)_"32"
  1. ;
  1. ; ask date range
  1. I RCREPTYP=4 D MONTHSEL I '$G(RCDATEND) Q
  1. ;
  1. I '$G(RCDATEND) Q
  1. ;
  1. ; select device
  1. W ! S %ZIS="Q" D ^%ZIS Q:POP
  1. I $D(IO("Q")) D D ^%ZTLOAD K IO("Q"),ZTSK Q
  1. . S ZTDESC="AR Millennium Bill Report Generator",ZTRTN="DQ^RCBMILL"
  1. . S ZTSAVE("RCREPTYP")="",ZTSAVE("RCDATBEG")="",ZTSAVE("RCDATEND")="",ZTSAVE("ZTREQ")="@"
  1. W !!,"<*> please wait <*>"
  1. ;
  1. DQ ; queued report starts here
  1. ; requires variable rcdatbeg and rcdatend
  1. ;
  1. N %,RCBILLDA,RCCATEG,RCDATE,RCTRANDA,RCTYPE
  1. K ^TMP("RCBMILL",$J),^TMP($J,"RCBMILLDATA")
  1. ;
  1. ; get all payments between the two dates
  1. F RCTYPE=2,34 D
  1. . S RCDATE=$E(RCDATBEG,1,5)_"00"
  1. . F S RCDATE=$O(^PRCA(433,"AT",RCTYPE,RCDATE)) Q:'RCDATE!(RCDATE>RCDATEND) D
  1. . . S RCTRANDA=0
  1. . . F S RCTRANDA=$O(^PRCA(433,"AT",RCTYPE,RCDATE,RCTRANDA)) Q:'RCTRANDA D
  1. . . . S RCBILLDA=+$P($G(^PRCA(433,RCTRANDA,0)),"^",2) I 'RCBILLDA Q
  1. . . . ;
  1. . . . ; bill not rx copay
  1. . . . S RCCATEG=$P($G(^PRCA(430,RCBILLDA,0)),"^",2)
  1. . . . I RCCATEG'=22,RCCATEG'=23 Q
  1. . . . ;
  1. . . . S ^TMP("RCBMILL",$J,RCBILLDA)=""
  1. ;
  1. ; loop bills paid during the month and gather transactions
  1. S RCBILLDA=0 F S RCBILLDA=$O(^TMP("RCBMILL",$J,RCBILLDA)) Q:'RCBILLDA D
  1. . S %=$$BILLFUND^RCBMILLC(RCBILLDA,RCDATEND)
  1. ;
  1. ; set up variables for reports
  1. N %,%H,%I,RCMOYR,RCMOYRTO,RCNOW,RCPAGE,RCRJFLAG,RCRJLINE,RCSCREEN,X,Y
  1. S Y=$E(RCDATBEG,1,5)_"00" D DD^%DT S RCMOYR=Y
  1. S Y=$E(RCDATEND,1,5)_"00" D DD^%DT S RCMOYRTO=Y
  1. D NOW^%DTC S Y=% D DD^%DT S RCNOW=Y
  1. S RCPAGE=1
  1. S RCSCREEN=0 I '$D(ZTQUEUED),IO=IO(0),$E(IOST)="C" S RCSCREEN=1
  1. ;
  1. ; print summary report
  1. I RCREPTYP=1 D SUMMARY^RCBMILL3
  1. ; print payment detail report
  1. I RCREPTYP=2 D PRINT^RCBMILL1
  1. ; print all transaction report
  1. I RCREPTYP=3 D PRINT^RCBMILL2
  1. ; print history for date range
  1. I RCREPTYP=4 D PRINT^RCBMILL4
  1. ;
  1. K ^TMP("RCBMILL",$J),^TMP($J,"RCBMILLDATA")
  1. D ^%ZISC
  1. Q
  1. ;
  1. ;
  1. ASKTYPE() ; ask type of report
  1. N DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. S DIR(0)="SO^1:Summary for Selected Month;2:Payment Detail for Selected Month;3:All Transactions for Selected Month;4:History for Date Range"
  1. S DIR("A")="Select Report to Generate"
  1. S DIR("B")="Summary"
  1. D ^DIR
  1. I $G(DTOUT)!($G(DUOUT)) S Y=-1
  1. ;
  1. I Y=3 D
  1. . W !!,"***** WARNING: THIS WILL USE A LARGE AMOUNT OF PAPER. *****"
  1. . W !,"***** I RECOMMENDED THAT YOU DO ***NOT*** PRINT THIS *****"
  1. . W !,"***** REPORT ON A PRINTER. YOU SHOULD CAPTURE THIS *****"
  1. . W !,"***** TO A FILE ON YOUR PC FOR REVIEW. *****"
  1. ;
  1. Q Y
  1. ;
  1. ;
  1. MONTHSEL ; ask starting and ending month
  1. ; returns rcdatbeg and rcdatend
  1. N %DT,DEFAULT,X,Y
  1. K RCDATBEG,RCDATEND
  1. ;
  1. W !!,"--- Enter the Starting and Ending Month and Year ---"
  1. S Y=$E(DT,1,3)_"0100" D DD^%DT S DEFAULT=Y
  1. S %DT("A")="Select Starting MONTH YEAR: ",%DT("B")=DEFAULT,%DT="AEMP",%DT(0)=-DT D ^%DT I Y<0 Q
  1. S RCDATBEG=$E(Y,1,5)_"00"
  1. ;
  1. S Y=$E(DT,1,5)_"00" D DD^%DT S DEFAULT=Y
  1. S %DT("A")="Select Ending MONTH YEAR: ",%DT("B")=DEFAULT,%DT="AEMP",%DT(0)=-DT D ^%DT I Y<0 Q
  1. I Y<RCDATBEG W !,"ENDING MONTH MUST BE GREATER THAN STARTING MONTH!" G MONTHSEL
  1. S RCDATEND=$E(Y,1,5)_"32"
  1. ;
  1. S Y=RCDATBEG D DD^%DT W !,"--- Selected date range from ",Y," to "
  1. S Y=$E(RCDATEND,1,5)_"00" D DD^%DT W Y," ---"
  1. Q