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

RCTCSP4.m

Go to the documentation of this file.
  1. RCTCSP4 ;HAF/ASF - CS Debt Referral Stop Reactivate Report ;6/1/2017
  1. ;;4.5;Accounts Receivable;**315,339,350,433**;Mar 25, 2019;Build 7
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. Q
  1. ;
  1. EN ; main report entry point
  1. ;
  1. N BILLDATA,CRT,DEBRANGE,DEBTDATA,DEBTOR,DIC,DIV1,DLEVEL,DV,G,IENS,N1,NN,PTID,RCDT,RCTC,RCTCDATE
  1. N RCTCDB,RCTCDEBT1,RCTCDEBT2,RCTCDIV,RCTCDIVN,RCTCEXCEL,RCTCFLG,RCTCSP4,RCTCSTOP,RTCN,REASON,RCTN,SEPLINE,SR,SRDT,SSN,TRANDATA,USER,XDATE
  1. ;
  1. D FLAGGED(.RCTCFLG) Q:RCTCFLG=""
  1. D DEBBILL Q:RCTCDB=""
  1. I RCTCDB="D" D DLEVEL^RCTCSP4E Q
  1. D DEBTORS Q:$D(DIRUT)
  1. D DATES Q:'$D(RCTCDATE)!$D(DIRUT)
  1. S RCTCDIV="" I RCTCDB="B" D DIVSEL Q:RCTCDIV=""
  1. D FORMAT Q:RCTCEXCEL=""
  1. D DEVICE
  1. ;D COMP ;PRCA*4.5*433 COMMENTED OUT LINE
  1. K ^TMP("RCTCSP4",$J) ; kill scratch global at end
  1. D ^%ZISC ; close the device
  1. Q
  1. ;
  1. EX ; main report exit point
  1. Q
  1. ;
  1. STOP() ; Determine if user wants to exit out of the option entirely
  1. ; 1=yes, get out entirely
  1. ; 0=no, just go back to the previous question
  1. ;
  1. N DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. ;
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to exit out of this option entirely"
  1. S DIR("B")="YES"
  1. S DIR("?",1)=" Enter YES to immediately exit out of this option."
  1. S DIR("?")=" Enter NO to return to the previous question."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S Y=1
  1. Q Y
  1. ;
  1. FLAGGED(RCTCFLG) ; capture if the user wants bills with a current flag, reactivated, or both
  1. ; RCTCFLG=C meaning data is currently present in the STOP TCSP REFERRAL FLAG field (430,157)
  1. ; RCTCFLG=R meaning data is currently blank in the STOP TCSP REFERRAL FLAG field (430,157)
  1. ; RCTCFLG=B meaning either is wanted
  1. ; pass parameter by reference
  1. ;
  1. N RET,DIR,X,Y
  1. S RCTCFLG="",RET=1
  1. S DIR(0)="S"
  1. S $P(DIR(0),U,2)="C:Currently Flagged;R:Reactivated;B:Both"
  1. S DIR("A")="Run the Report for"
  1. S DIR("B")="B"
  1. S DIR("?",1)="Select 'Currently Flagged' to see bills which currently have the Cross-"
  1. S DIR("?",2)="Servicing activity stop flag set."
  1. S DIR("?",3)="Select 'Reactivated' to see bills in which the stop flag is not currently"
  1. S DIR("?",4)="set, but was once set in the past."
  1. S DIR("?")="Select 'Both' to see bills of both types."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S RET=0 W $C(7) G FLX
  1. S RCTCFLG=Y
  1. FLX ;
  1. Q RET
  1. ;
  1. DEBBILL ;
  1. ; RCTCDB=C meaning data is currently present in the STOP TCSP REFERRAL FLAG field (430,157)
  1. ; RCTCDB=R meaning data is currently blank in the STOP TCSP REFERRAL FLAG field (430,157)
  1. ;
  1. N RET,DIR,X,Y
  1. S RCTCDB="",RET=1
  1. S DIR(0)="S"
  1. S $P(DIR(0),U,2)="B:Bill Level;D:Debtor Level;"
  1. S DIR("A")="Run the Report for"
  1. S DIR("B")="Debtor"
  1. S DIR("?")="Select 'Bills' to see selected bills"
  1. S DIR("?",1)="Select 'Debtors' to see selected debtors"
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S RET=0 W $C(7) Q
  1. S RCTCDB=Y
  1. Q
  1. DIVSEL ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT,DIC
  1. S RCTCDIV="",RET=1
  1. K RCTC("DIVS")
  1. S DIR(0)="S"
  1. S $P(DIR(0),U,2)="A:All;D:Division"
  1. S DIR("A")="Run the Report for"
  1. S DIR("B")="All"
  1. S DIR("?")="Select 'All' to see all bills, Select Division to see only bills from a single division."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S RET=0 W $C(7) G FLX
  1. S RCTCDIV=Y
  1. Q:RCTCDIV="A"
  1. S DIC=40.8,DIC(0)="AEQZ" F D ^DIC Q:Y'>0 S RCTC("DIVS",$P(Y(0),U,7))="",RCTC("DIVN",$P(Y(0),U))=$P(Y(0),U,2) ;ASF 5/6/19
  1. Q
  1. ;
  1. DEBTORS ; select debtor range
  1. DEBTFR ; start with debtor
  1. N RET,DIR,X,Y
  1. S RCTCDEBT1="",RET=1
  1. S DIR(0)="F^1:50"
  1. S DIR("A")="Start with Debtor"
  1. S DIR("B")="FIRST"
  1. S DIR("?",1)="If you want to specify a range of AR debtor names, enter the beginning"
  1. S DIR("?",2)="debtor name here. If you want to include all debtors, accept the default"
  1. S DIR("?")="value of FIRST here."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S RET=0 W $C(7) Q
  1. S RCTCDEBT1=Y
  1. ;
  1. DEBTTO ; go to debtor
  1. N RET,DIR,X,Y
  1. DBT1 S RCTCDEBT2="",RET=1
  1. S DIR(0)="F^1:50"
  1. S DIR("A")=" Go to Debtor"
  1. S DIR("B")="LAST"
  1. S DIR("?",1)="If you want to specify a range of AR debtor names, enter the ending debtor"
  1. S DIR("?",2)="name here. If you want to include all debtors, accept the default value of"
  1. S DIR("?")="LAST here."
  1. D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S RET=0 W $C(7) Q
  1. S RCTCDEBT2=Y
  1. I RCTCDEBT1'="FIRST",RCTCDEBT2'="LAST",RCTCDEBT1]RCTCDEBT2 W $C(7),!!,"You must enter something after '",RCTCDEBT1,"'!",! G DBT1
  1. Q
  1. ;
  1. DATES ; all dates or a date range - also capture from and thru dates
  1. ; RCTCDATE="A" or "R" if user wants All Dates or to select a Date Range
  1. ; RCTCDATE("BEGIN")=starting FM date
  1. ; RCTCDATE("END")=ending FM date
  1. ;
  1. N RET,DIR,X,Y
  1. K RCTCDATE
  1. S RET=1
  1. S DIR(0)="S^A:All Dates;R:Date Range"
  1. S DIR("A")="Include All Dates or Select by Date Range"
  1. S DIR("B")="Date Range"
  1. S DIR("?",1)="If you want to include all transaction entered dates, please select 'A' -"
  1. S DIR("?",2)="All Dates here. But if you want to specify a date range for the"
  1. S DIR("?",3)="transaction entered dates, then enter 'R' here and then choose the from and"
  1. S DIR("?")="through dates."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!(Y="") S ZZRET=0 W $C(7) Q
  1. S RCTCDATE=Y
  1. I RCTCDATE="A" S RCTCDATE("END")=DT_.9,RCTCDATE("BEGIN")=2840101 Q
  1. ;
  1. S DIR(0)="DA^:DT:EX"
  1. S DIR("A")="Date Entered From: "
  1. S DIR("?",1)="The From and To dates for this report refer to the date that the AR"
  1. S DIR("?")="transaction was entered."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT)!'Y S RET=0 W $C(7) K RCTCDATE Q
  1. S RCTCDATE("BEGIN")=Y
  1. ;
  1. S DIR(0)="DA^"_RCTCDATE("BEGIN")_":DT:EX"
  1. S DIR("A")=" Date Entered To: "
  1. S DIR("B")="T"
  1. S DIR("?",1)="The From and To dates for this report refer to the date that the AR"
  1. S DIR("?")="transaction was entered."
  1. D ^DIR K DIR
  1. I $D(DIRUT)!'Y S RET=0 W $C(7) K RCTCDATE Q
  1. S RCTCDATE("END")=Y
  1. Q
  1. ;
  1. FORMAT ; output format is Excel format or normal report output
  1. ; RCTCEXCEL=0 for normal report output
  1. ; RCTCEXCEL=1 for Excel output
  1. ; pass parameter by reference
  1. ;
  1. N RET,DIR,X,Y,DTOUT,DUOUT,DIRUT,DIROUT
  1. S RCTCEXCEL="",RET=1
  1. S DIR(0)="Y"
  1. S DIR("A")="Do you want to capture the output in Excel format"
  1. S DIR("B")="NO"
  1. S DIR("?",1)="If you want to capture the output from this report in a format which can"
  1. S DIR("?",2)="easily be imported into Excel, then answer YES here."
  1. S DIR("?",3)=" "
  1. S DIR("?")="If you just want a normal report output, then answer NO here."
  1. W ! D ^DIR K DIR
  1. I $D(DIRUT) S RET=0 W $C(7) Q
  1. S RCTCEXCEL=Y
  1. Q
  1. ;
  1. DEVICE() ; Device Selection
  1. N ZTRTN,ZTDESC,ZTSAVE,POP,RET,ZTSK,DIR,X,Y
  1. S RET=1
  1. I 'RCTCEXCEL W !!,"It is recommended that you Queue this report to a device ",!,"that is 140 or greater characters wide",!
  1. I RCTCEXCEL D
  1. . W !!,"To capture as an Excel format, it is recommended that you queue this report to"
  1. . W !,"a spool device with margins of 256 and page length of 99999,"
  1. . W !,"(e.g. spoolname;256;99999).This should help avoid wrapping problems.",!
  1. . W !,"Another method would be to set up your terminal to capture the detail report"
  1. . W !,"data. On some terminals, this can be done by clicking on the 'Tools' menu above,"
  1. . W !,"then click on 'Capture Incoming Data' to save to Desktop."
  1. . W !,"To avoid undesired wrapping of the data saved to the file,"
  1. . W !,"please enter '0;256;99999' at the 'DEVICE:' prompt."
  1. ;
  1. S ZTRTN="COMPILE^RCTCSP4"
  1. S ZTDESC="RCTC AR Cross-Servicing Stop Reactivate Report"
  1. S ZTSAVE("RCTC(")=""
  1. S ZTSAVE("RCTCDB")=""
  1. S ZTSAVE("RCTCDIV")=""
  1. S ZTSAVE("RCARCAT")="" ;PRCA*4.5*433
  1. S ZTSAVE("RCTCFLG")=""
  1. S ZTSAVE("RCTCDEBT1")=""
  1. S ZTSAVE("RCTCDEBT2")=""
  1. S ZTSAVE("RCTCDATE")=""
  1. S ZTSAVE("RCTCDATE(")=""
  1. S ZTSAVE("RCTCEXCEL")=""
  1. S ZTSAVE("DEBRANGE")=""
  1. S ZTSAVE("DLEVEL")=""
  1. D EN^XUTMDEVQ(ZTRTN,ZTDESC,.ZTSAVE,"QM",1)
  1. I POP S RET=0
  1. I $G(ZTSK) W !!,"Report compilation has started with task# ",ZTSK,".",! S DIR(0)="E" D ^DIR K DIR
  1. Q RET
  1. ;
  1. ;
  1. COMPILE ; entry point for the report compile to build the scratch global
  1. ; may be a background task if job queued
  1. ;
  1. I '$D(ZTQUEUED) W !!,"Compiling Cross-Servicing Stop Reactivate Report. Please wait ... "
  1. ;
  1. D COMP ; build scratch global
  1. D PRINT ; print the report
  1. D ^%ZISC ; close the device
  1. I $D(ZTQUEUED) S ZTREQ="@" ; purge the task
  1. COMIPLX ;
  1. Q
  1. ;
  1. COMP ; compile data into scratch global
  1. N ARTTIEN,RCTCTT,RCTCDTENT,RC433,P0,RCIBN,USER,RCTTNAME,RC340,DEBTNAME,FLAG,RCDEBTOR,RCBILLNUM,RCARCAT ;PRCA*4.5*433
  1. ;
  1. ; first identify the AR Transaction types eligible for this report (CS STOP PLACED or CS STOP DELETED)
  1. ; load into the RCTCTT local array
  1. S ARTTIEN=0 F S ARTTIEN=$O(^PRCA(430.3,ARTTIEN)) Q:'ARTTIEN I $P($G(^PRCA(430.3,ARTTIEN,0)),U,1)["CS STOP" S RCTCTT(ARTTIEN)=""
  1. ;
  1. ; if no end date specified then assume all dates are OK
  1. I '$G(RCTCDATE("END")) S RCTCDATE("END")=9999999
  1. ;
  1. ; start loop
  1. S ARTTIEN=0 F S ARTTIEN=$O(RCTCTT(ARTTIEN)) Q:'ARTTIEN D
  1. . ;
  1. . ; determine date to start looping based on if the user specified a start date or not
  1. . S RCTCDTENT=0
  1. . I $G(RCTCDATE("BEGIN")) S RCTCDTENT=$O(^PRCA(433,"AT",ARTTIEN,RCTCDATE("BEGIN")),-1) ; get one day earlier to start
  1. . ;
  1. . F S RCTCDTENT=$O(^PRCA(433,"AT",ARTTIEN,RCTCDTENT)) Q:'RCTCDTENT!(RCTCDTENT>RCTCDATE("END")) D
  1. .. S RC433=0 F S RC433=$O(^PRCA(433,"AT",ARTTIEN,RCTCDTENT,RC433)) Q:'RC433 D
  1. ... S P0=$G(^PRCA(433,RC433,0))
  1. ... S RCIBN=+$P(P0,U,2) Q:'RCIBN ; bill# ien
  1. ... S RCARCAT=$E($$GET1^DIQ(430,RCIBN,2,"E"),1,10) ;AR Category PRCA*4.5*433
  1. ... S USER=$P($G(^VA(200,+$P(P0,U,9),0)),U,1) ; processed by user
  1. ... S RCTTNAME=$$GET1^DIQ(433,RC433,12) ; trans type name
  1. ... ; now get some bill data from 430
  1. ... S RC340=+$P($G(^PRCA(430,RCIBN,0)),U,9) ; ar debtor ien
  1. ... Q:'RC340
  1. ... Q:^RCD(340,RC340,0)'?.N1";DPT".E ; only patients
  1. ... S DEBTNAME=$$GET1^DIQ(340,RC340,.01) ; external ar debtor name
  1. ... Q:DEBTNAME=""
  1. ... ;
  1. ... ; check report filter on debtor name ASF
  1. ... ;I RCTCDB'="B",'$D(RCTCSP4("DEBTOR",DEBTNAME)) Q
  1. ... I RCTCDEBT1'="FIRST",RCTCDEBT1'=DEBTNAME,RCTCDEBT1]DEBTNAME Q ; before name range
  1. ... I RCTCDEBT2'="LAST",RCTCDEBT2'=DEBTNAME,DEBTNAME]RCTCDEBT2 Q ; after name range
  1. ... ;
  1. ... ; Division filter
  1. ... S RCTCDIVN=$$GET1^DIQ(430,RCIBN_",",12,"I")
  1. ... I RCTCDIV="D",RCTCDIVN="" Q
  1. ... I RCTCDIV="D",'$D(RCTC("DIVS",RCTCDIVN)) Q
  1. ... ;
  1. ... ; get the current flag value and check report filter
  1. ... S FLAG=+$P($G(^PRCA(430,RCIBN,15)),U,7) ; stop tcsp referral flag field (430,157) 1:flag set
  1. ... I RCTCFLG="R",FLAG Q ; user wants only Reactivated bills and this one is still flagged
  1. ... I RCTCFLG="C",'FLAG Q ; user wants only currently flagged bills and this flag is clear
  1. ... ;
  1. ... S RCDEBTOR=DEBTNAME_U_RC340 ; debtor name^debtor ien (used in subscript)
  1. ... S RCBILLNUM=$$GET1^DIQ(430,RCIBN,.01) ; bill#
  1. ... Q:RCBILLNUM=""
  1. ... ;
  1. ... ; store data at the debtor level if not already there
  1. ... I '$D(^TMP("RCTCSP4",$J,RCDEBTOR)) D
  1. .... N RCDV,SSN,PTID
  1. .... S (SSN,PTID)=""
  1. .... S SSN=$$SSN^RCFN01(RC340)
  1. .... S PTID=$E(DEBTNAME,1)_$S(SSN'="":$E(SSN,6,9),1:"0000") ; patient id
  1. .... S ^TMP("RCTCSP4",$J,RCDEBTOR)=PTID_U_DEBTNAME_U_$S(SSN?.E9N.E:SSN,1:"") ; save into scratch
  1. .... Q
  1. ... ;
  1. ... ; store data at the bill# level if not already there
  1. ... I '$D(^TMP("RCTCSP4",$J,RCDEBTOR,RCBILLNUM)) D
  1. .... N RCX,CAT
  1. .... S RCX=RCBILLNUM ; bill#
  1. .... S $P(RCX,U,2)=$$GET1^DIQ(430,RCIBN,11) ; current balance
  1. .... S $P(RCX,U,3)=$$GET1^DIQ(430,RCIBN,8) ; current ar status name
  1. .... S $P(RCX,U,4)=$E($$GET1^DIQ(430,RCIBN,2),1,10) ; AR category name first 10 char ;PRCA*4.5*433
  1. .... S $P(RCX,U,5)=$$GET1^DIQ(430,RCIBN,61,"I") ; letter1 date FM format
  1. .... S $P(RCX,U,6)=$$GET1^DIQ(430,RCIBN,158,"I") ; stop tcsp referral eff. date FM format
  1. .... S $P(RCX,U,7)=$$GET1^DIQ(430,RCIBN,159) ; stop tcsp referral reason desc
  1. .... S CAT=+$P($G(^PRCA(430,RCIBN,0)),U,2) ; ar category ien
  1. .... S $P(RCX,U,8)=$$GET1^DIQ(430.2,CAT,1) ; ar category abbreviation
  1. .... S $P(RCX,U,9)=$$GET1^DIQ(430,RCIBN,12,"I") ;site
  1. .... S ^TMP("RCTCSP4",$J,RCDEBTOR,RCBILLNUM)=RCX
  1. ... ;
  1. ... ; now we can store the AR transaction data
  1. ... S ^TMP("RCTCSP4",$J,RCDEBTOR,RCBILLNUM,RC433)=RCTTNAME_U_RCTCDTENT_U_USER
  1. . Q
  1. Q
  1. ;
  1. ;
  1. PRINT ; entry point for printing the report
  1. N CRT,PAGE,RCTCSTOP,SEPLINE,DIR,DIROUT,DIRUT,DTOUT,DUOUT,X,Y,RCD,DEBTDATA,BILL,BILLDATA,RC433,TRANDATA
  1. S CRT=$S(IOST["C-":1,1:0)
  1. I RCTCEXCEL S IOSL=999999 ; long screen length for Excel output
  1. S PAGE=0,RCTCSTOP=0,$P(SEPLINE,"-",133)=""
  1. ;
  1. I '$D(^TMP("RCTCSP4",$J)) D HDR^RCTCSP4E W !!?5,"No data found for this report." Q
  1. I $G(ZTSTOP) D HDR^RCTCSP4E W !!?5,"This report was halted during compilation by TaskManager Request." D PX
  1. D HDR^RCTCSP4E I RCTCSTOP D PX ; display headers first for both types of output
  1. ;
  1. ; loop thru scratch, check for RCTCSTOP as we go
  1. ;
  1. S RCD="" F S RCD=$O(^TMP("RCTCSP4",$J,RCD)) Q:RCD=""!RCTCSTOP D
  1. . S DEBTDATA=$G(^TMP("RCTCSP4",$J,RCD))
  1. . S BILL="" F S BILL=$O(^TMP("RCTCSP4",$J,RCD,BILL)) Q:BILL=""!RCTCSTOP D
  1. .. S BILLDATA=$G(^TMP("RCTCSP4",$J,RCD,BILL))
  1. .. S RC433=0 F S RC433=$O(^TMP("RCTCSP4",$J,RCD,BILL,RC433)) Q:'RC433!RCTCSTOP D
  1. ... S TRANDATA=$G(^TMP("RCTCSP4",$J,RCD,BILL,RC433))
  1. ... D RPTLN
  1. ... Q
  1. .. Q
  1. . Q
  1. I RCTCSTOP Q ; get out right away if stop flag is set
  1. ;
  1. I $Y+3>IOSL D HDR^RCTCSP4E I RCTCSTOP Q
  1. W !!?5,"*** End of Report ***"
  1. ;
  1. PX ;
  1. I CRT,'$D(ZTQUEUED) S DIR(0)="E" D ^DIR
  1. PRINTX ;
  1. Q
  1. ;
  1. I $Y+3>IOSL D HDR^RCTCSP4E I RCTCSTOP D PRINTX
  1. W !!?5,"*** End of Report ***"
  1. Q
  1. ;
  1. RPTLN ; display one line on the report - either normal or Excel
  1. N TT
  1. ;
  1. ; for Excel output, print a line and get out
  1. I RCTCEXCEL D EXCELN^RCTCSP4E Q
  1. ;
  1. ; page break check
  1. I $Y+3>IOSL D HDR^RCTCSP4E I RCTCSTOP G RPTLNX
  1. ;
  1. ; write a line of report data
  1. W !,$E($P(DEBTDATA,U,2),1,27) ; debtor name
  1. W ?28,$P(BILLDATA,U,9)," " ;division
  1. W ?34,$P(DEBTDATA,U,1) ; Pt ID
  1. ;W ?38,$P(DEBTDATA,U,3) ;SSN
  1. W ?41,$P(BILLDATA,U,1) ; bill#
  1. W ?55,$P(BILLDATA,U,4) ;AR Category PRCA*4.5*433
  1. ;W ?34,$$RJ^XLFSTR($FN($P(BILLDATA,U,2),"",2),10) ; current balance
  1. W ?66,$E($P(BILLDATA,U,3),1,11) ; current status PRCA*4.5*433/PRCA*4.5*433
  1. ;W ?64,$P(BILLDATA,U,8) ; category abbr
  1. W ?78,$$FMTE^XLFDT($P(BILLDATA,U,5),"2Z") ; letter 1 date PRCA*4.5*433
  1. W ?88,$$FMTE^XLFDT($P(BILLDATA,U,6),"2Z") ; stop date PRCA*4.5*433
  1. W ?100,$E($P(BILLDATA,U,7),1,9) ; stop reason PRCA*4.5*433/PRCA*4.5*433
  1. S TT=$P(TRANDATA,U,1)
  1. W ?110,$S(TT["DELETED":"DEL",TT["PLACED":"ADD",1:"UNK") ; transaction type PRCA*4.5*433
  1. ;W ?105,$$FMTE^XLFDT($P(TRANDATA,U,2),"2Z") ; date entered
  1. W ?120,$E($P(TRANDATA,U,3),1,17) ; user PRCA*4.5*433
  1. Q
  1. RPTLNDIV ;Lines for division
  1. N TT
  1. ;
  1. ; for Excel output, print a line and get out
  1. I RCTCEXCEL D EXCELN^RCTCSP4E Q
  1. ;
  1. ; page break check
  1. I $Y+3>IOSL D HDR^RCTCSP4E I RCTCSTOP G RPTLNX
  1. ;
  1. ; write a line of report data
  1. W !,$P(DEBTDATA,U,2) ; debtor name
  1. W ?32,$P(BILLDATA,U,9)," " ;division
  1. W ?37,$P(DEBTDATA,U,1) ; Pt ID
  1. W ?46,$P($P(BILLDATA,U,1),"-",2) ; bill#
  1. W ?55,$P(BILLDATA,U,8) ; category abbr
  1. W ?59,$$FMTE^XLFDT($P(BILLDATA,U,5),"2Z") ; letter 1 date
  1. W ?69,$$FMTE^XLFDT($P(BILLDATA,U,6),"2Z") ; stop date
  1. W ?79,$E($P(BILLDATA,U,7),1,10) ; stop reason
  1. S TT=$P(TRANDATA,U,1)
  1. W ?91,$S(TT["DELETED":"DEL",TT["PLACED":"ADD",1:"UNK") ; transaction type
  1. W ?99,$$FMTE^XLFDT($P(TRANDATA,U,2),"2Z") ; date entered
  1. W ?109,$E($P(TRANDATA,U,3),1,17) ; user
  1. ;
  1. RPTLNX ;X
  1. Q