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

RCTCSWL1.m

Go to the documentation of this file.
  1. RCTCSWL1 ;ALB/PAW-Cross Servicing Worklist ;30-SEP-2015
  1. ;;4.5;ACCOUNTS RECEIVABLE;**315,339**;Mar 20, 1995;Build 2
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. ;
  1. GETRPT(RCRPT) ; Create patient report based upon report selection
  1. ; required input RCRPT (see comments below for number/report correlation)
  1. ; output ^TMP("RCTCSWL",$J), containing auths for group queue
  1. N RCBILLEX,RCDATE,RCDEBTOR,RCDFN,RCBILL,RCDBTRN,RCDFN,RCFND1,RCTRAN,RCRTCD,RCRTCDX,RCUNC,RCPIF,RCSPA,RCDIV,RCDIVX
  1. ; Loop through ACCOUNTS RECEIVABLE File (#430) Cross-Servicing Index
  1. S RCDATE="" F S RCDATE=$O(^PRCA(430,"AN",RCDATE)) Q:RCDATE="" D
  1. .S RCBILL="" F S RCBILL=$O(^PRCA(430,"AN",RCDATE,RCBILL)) Q:RCBILL="" D
  1. ..I +$P($G(^PRCA(430,RCBILL,30)),U,9) Q ;Bill has been removed from CS Reconciliation Worklist
  1. ..S RCDEBTOR=$P($G(^PRCA(430,RCBILL,0)),U,9) ;Debtor in File 340
  1. ..I $P($G(^RCD(340,RCDEBTOR,0)),U,1)["DPT" S RCDFN=+$P($G(^RCD(340,RCDEBTOR,0)),U,1)
  1. ..S RCRTCD=$P($G(^PRCA(430,RCBILL,30)),U,2)
  1. ..I RCRTCD="" Q
  1. ..S RCRTCDX=$P(^PRCA(430.5,RCRTCD,0),U)
  1. ..S RCBILLEX=$P(^PRCA(430,RCBILL,0),U)
  1. ..; Check if running for specific Division - MEDICAL CENTER DIVISION File #40.8
  1. ..S RCDIV=$P(RCBILLEX,"-")
  1. ..S RCDIVX="" I VAUTD=0 I '$D(VAUTD(RCDIV)) Q
  1. ..; Check if running for specific Patient
  1. ..I $P(FILTERS(0),U,3)=1 I '$D(RCDFN) Q
  1. ..I $P(FILTERS(0),U,3)=1 I '$D(FILTERS(2,RCDFN)) Q
  1. ..; Specific checks for each type of report
  1. ..I RCRPT=1 I RCRTCDX'="B" Q ;Bankruptcy Return Reason code B
  1. ..I RCRPT=2 I RCRTCDX'="D" Q ;Death Return Reason Code D
  1. ..I RCRPT=3 I RCRTCDX'="Z" Q ;Uncollectable Return Reason Code Z
  1. ..I RCRPT=4 I RCRTCDX'="F" Q ;Payment in Full - Return Reason Code = F
  1. ..I RCRPT=5 I RCRTCDX'="P" Q ;Satisfied PA - Return Reason Code = P, but nothing in Compromise Field
  1. ..I RCRPT=6 I RCRTCDX'="S" Q ;Compromise Field set to Y
  1. ..I RCRPT=7 I RCRTCDX="" Q ;Any Return Reason Code
  1. ..D BLDTMP
  1. Q
  1. ;
  1. BLDTMP ; Build ^TMP("RCTCSWL",$J) for the main list screen
  1. N A1,A2,PRCA3,DFN,RCBAL,RCBILLEX,RCNAME,RCPTID,RCRTRSN,RCLINE,VA,VADM,VAERR,TRTYP,RCBIND
  1. I $D(RCDFN) D
  1. . S DFN=RCDFN
  1. . D DEM^VADPT
  1. . I VAERR K VADM
  1. . S RCNAME=VADM(1)
  1. . S RCPTID=$E(RCNAME,1)_VA("BID")
  1. S A1=$P(^RCD(340,RCDEBTOR,0),";",1),A2=$P($P(^(0),U,1),";",2),PRCA3=U_A2_A1_",0)",RCNAME=$S($D(@PRCA3):$P(^(0),U,1),1:"")
  1. S RCBAL=$$GET1^DIQ(430,RCBILL_",",11)
  1. S RCBILLEX=$P($G(^PRCA(430,RCBILL,0)),U,1) ;External Bill Number
  1. ; Set historical indicator "y" when returned from Treasury
  1. I $D(^PRCA(430,"AN",RCDATE,RCBILL)) S RCBIND="y"
  1. S RCLINE=$G(RCNAME)_U_$G(RCPTID)_U_$G(RCBAL)_U_$G(DFN)_U_$G(RCBIND)_$G(RCBILLEX)_U_RCDEBTOR_U_RCBILL_U_RCDATE_U_RCRTCDX
  1. ; Sort by Patient Name
  1. I SORTBY=1 S ^TMP("RCTCSWL",$J,RCNAME,RCBILLEX)=RCLINE
  1. ; Sort by Bill Number
  1. I SORTBY=2 S ^TMP("RCTCSWL",$J,RCBILLEX,RCNAME)=RCLINE
  1. ; Sort by Return Reason Code
  1. I SORTBY=3 S ^TMP("RCTCSWL",$J,RCRTCDX,RCBILLEX)=RCLINE
  1. ;
  1. BLDWL ; Format main list screen data lines
  1. ; build display lines
  1. K ^TMP("RCTCSWLX",$J)
  1. N RCBILL,RCBILLEX,RCDATE,RCDEBTOR,RCDFN,RCNAME,RCPATNAM,RCPTID,RCRRSN,RCXX,RCY,RCYY,FIRST,LINE,VCNT
  1. S (VALMCNT,FIRST,VCNT)=0
  1. S RCY="" F S RCY=$O(^TMP("RCTCSWL",$J,RCY)) Q:RCY="" D
  1. .S RCYY="" F S RCYY=$O(^TMP("RCTCSWL",$J,RCY,RCYY)) Q:RCYY="" D
  1. ..S VCNT=VCNT+1
  1. ..S LINE=$$LJ^XLFSTR(VCNT,6) ;line #
  1. ..S RCXX=^TMP("RCTCSWL",$J,RCY,RCYY)
  1. ..S RCPATNAM=$P(RCXX,U)
  1. ..S RCPTID=$P(RCXX,U,2)
  1. ..S RCDFN=$P(RCXX,U,4)
  1. ..S RCBILLEX=$P(RCXX,U,5)
  1. ..S RCDEBTOR=$P(RCXX,U,6)
  1. ..S RCBILL=$P(RCXX,U,7)
  1. ..S RCDATE=$P(RCXX,U,8)
  1. ..S RCRRSN=$P(RCXX,U,9)
  1. ..I SORTBY=1 D
  1. ...;Patient^Patient ID^Bill No.^Balance^Ret Rsn
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U),"",4,27)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,2),"",32,5)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,5),"",40,12)
  1. ...S LINE=$$SETL(LINE,$J($P(RCXX,U,3),10,2),"",55,12)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,9),"",67,3)
  1. ..I SORTBY=2 D
  1. ...;Bill No.^Patient ID^Patient^Balance^Ret Rsn
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,5),"",4,12)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,2),"",17,5)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U),"",24,27)
  1. ...S LINE=$$SETL(LINE,$J($P(RCXX,U,3),10,2),"",55,12)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,9),"",67,3)
  1. ..I SORTBY=3 D
  1. ...;Ret Rsn^Bill No.^Pt ID^Patient^Balance
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,9),"",4,7)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,5),"",12,12)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U,2),"",25,5)
  1. ...S LINE=$$SETL(LINE,$P(RCXX,U),"",32,27)
  1. ...S LINE=$$SETL(LINE,$J($P(RCXX,U,2),10,2),"",64,12)
  1. ..S VALMCNT=VALMCNT+1
  1. ..D SET^VALM10(VALMCNT,LINE,VCNT)
  1. ..S ^TMP("RCTCSWLX",$J,VCNT)=RCDFN_U_RCPATNAM_U_RCPTID_U_RCDEBTOR_U_RCBILL_U_RCBILLEX_U_RCDATE_U_RCRRSN ;This is set for ACTIONS
  1. Q
  1. ;
  1. SETL(LINE,DATA,LABEL,COL,LNG) ; Creates a line of data to be set into the body
  1. ; of the worklist
  1. ; Input: LINE - Current line being created
  1. ; DATA - Information to be added to the end of the current line
  1. ; LABEL - Label to describe the information being added
  1. ; COL - Column position in line to add information add
  1. ; LNG - Maximum length of data information to include on the line
  1. ; Returns: Line updated with added information
  1. S LINE=LINE_$J("",(COL-$L(LABEL)-$L(LINE)))_LABEL_$E(DATA,1,LNG)
  1. Q LINE
  1. ;
  1. EXCEL ;Format and Print EXCEL file
  1. W @IOF
  1. N RCX,RCXX,RCY,RCYY,RCZ,RCAMT
  1. S RCX=$P(FILTERS(0),U,1)
  1. S RCXX=$S(RCX=1:"Bankruptcy",RCX=2:"Deaths",RCX=3:"Uncollectible",RCX=4:"Payment in Full",1:"")
  1. I $G(RCXX)="" S RCXX=$S(RCX=5:"Satisfied PA",RCX=6:"Compromise",RCX=7:"All Returns",1:"")
  1. W !,RCXX_" Report"
  1. I SORTBY=1 W !,"Patient Name^Patient ID^Bill Number^Current Amount^Rt Rsn Code"
  1. I SORTBY=2 W !,"Bill Number^Patient ID^Patient Name^Current Amount^Rt Rsn Code"
  1. I SORTBY=3 W !,"Rt Rsn Code^Bill Number^Patient ID^Patient Name^Current Amount"
  1. S RCY="" F S RCY=$O(^TMP("RCTCSWL",$J,RCY)) Q:RCY="" D
  1. .S RCYY="" F S RCYY=$O(^TMP("RCTCSWL",$J,RCY,RCYY)) Q:RCYY="" D
  1. ..S RCZ=^TMP("RCTCSWL",$J,RCY,RCYY)
  1. ..;Reformat Excel line, based upon sort
  1. ..;Input from RCZ: PtName_U_PtID_U_CurBal_U_DFN_U_Bill No_U_Debtor_U_InternalBill_U_Date_U_ReturnReasonCode
  1. ..S RCAMT=$P(RCZ,U,3)
  1. ..I RCAMT="" S RCAMT=0
  1. ..S RCAMT=$J(RCAMT,10,2)
  1. ..I SORTBY=1 W !,$P(RCZ,U)_"^",$P(RCZ,U,2)_"^"_$P(RCZ,U,5)_"^"_RCAMT_"^"_$P(RCZ,U,9)
  1. ..I SORTBY=2 W !,$P(RCZ,U,5)_"^",$P(RCZ,U,2)_"^"_$P(RCZ,U)_"^"_RCAMT_"^"_$P(RCZ,U,9)
  1. ..I SORTBY=3 W !,$P(RCZ,U,9)_"^",$P(RCZ,U,5)_"^"_$P(RCZ,U,2)_"^"_$P(RCZ,U)_"^"_RCAMT
  1. I $E(IOST,1,2)="C-",'EXCEL R !!,"END OF REPORT...PRESS RETURN TO CONTINUE",X:DTIME W @IOF
  1. D ^%ZISC
  1. S:$D(ZTQUEUED) ZTREQ="@"
  1. K IOP,%ZIS,ZTQUEUED
  1. Q
  1. ;
  1. ;RCDIV() N DIC,DIR,DIRUT,DTOUT,DUOUT,X,Y
  1. ;
  1. ;Reset RCDIV array
  1. K RCDIV
  1. ;
  1. ;First see if they want to enter individual divisions or ALL
  1. S DIR(0)="S^D:DIVISION;A:ALL"
  1. S DIR("A")="Select Certain (D)ivisions or (A)LL"
  1. S DIR("L",1)="Select one of the following:"
  1. S DIR("L",2)=""
  1. S DIR("L",3)=" D DIVISION"
  1. S DIR("L",4)=" A ALL"
  1. D ^DIR K DIR
  1. ;
  1. ;Check for "^" or timeout, otherwise define BPPHARM
  1. I ($G(DUOUT)=1)!($G(DTOUT)=1) S Y="^"
  1. E S RCDIV=$S(Y="A":0,1:1)
  1. ;
  1. ;If division selected, ask prompt
  1. I $G(RCDIV)=1 F D Q:Y="^"!(Y="")
  1. .;
  1. .;Prompt for entry
  1. .K X S DIC(0)="QEAM",DIC=40.8,DIC("A")="Select Division(s): "
  1. .W ! D ^DIC
  1. .;
  1. .;Check for "^" or timeout
  1. .I ($G(DUOUT)=1)!($G(DTOUT)=1) K RCDIV S Y="^" Q
  1. .;
  1. .;Check for blank entry, quit if no previous selections
  1. .I $G(X)="" S Y=$S($D(RCDIV)>9:"",1:"^") K:Y="^" RCDIV Q
  1. .;
  1. .;Handle Deletes
  1. .I $D(RCDIV(+Y)) D Q:Y="^" I 1
  1. ..N P
  1. ..S P=Y ;Save Original Value
  1. ..S DIR(0)="S^Y:YES;N:NO",DIR("A")="Delete "_$P(P,U,2)_" from your list?"
  1. ..S DIR("B")="NO" D ^DIR
  1. ..I ($G(DUOUT)=1)!($G(DTOUT)=1) K RCDIV S Y="^" Q
  1. ..I Y="Y" K RCDIV(+P),RCDIV("B",$P(P,U,2),+P)
  1. ..S Y=P ;Restore Original Value
  1. ..K P
  1. .E D
  1. ..;Define new entries in RCDIV array
  1. ..S VAUTD(+Y)=Y
  1. ..S RCDIV("B",$P(Y,U,2),+Y)=""
  1. .;
  1. .;Display a list of selected divisions
  1. .I $D(RCDIV)>9 D
  1. ..N X
  1. ..W !,?2,"Selected:"
  1. ..S X="" F S X=$O(RCDIV("B",X)) Q:X="" W !,?10,X
  1. ..K X
  1. .Q
  1. ;
  1. K RCDIV("B")
  1. Q Y
  1. ;
  1. CSTOP(BILL) ;
  1. ; Input:
  1. ; BILL - Bill number from #430 - External Value (.01), not IEN
  1. ; Output:
  1. ; CSTOP - Cross-serviced status (blank = not found, 0 = not stopped, 1 = stopped)
  1. ;
  1. N CSTOP,IEN
  1. I BILL="" Q "" ;no bill #
  1. I '$D(^PRCA(430,"TCSP",BILL)) Q ""
  1. S CSTOP=$$GET1^DIQ(430,BILL,"157,","IE")
  1. Q CSTOP