RCDMBWLR ;WISC/RFJ-diagnostic measures workload report (build it) ;1 Jan 01
;;4.5;Accounts Receivable;**167**;Mar 20, 1995
;;Per VHA Directive 10-93-142, this routine should not be modified.
Q
;
;
DQ ; called by nightly background job
;
N RCASSIGN,RCBALANC,RCBILLDA,RCCLERK,RCDATA0,RCDATA1,RCDATA2,RCDATA7,RCDATA6
N RCDEBT,RCDEBTDA,RCDPDATA,RCFDEATH,RCIFDESC,RCIFSTAT,RCNAME,RCSSN,RCRC
K ^TMP("RCDMBWLR",$J)
;
; loop all workload assignments and generate logic to screen bills
S RCWLFLG=0
S RCCLERK=0 F S RCCLERK=$O(^IBE(351.73,RCCLERK)) Q:'RCCLERK D
. S RCASSIGN=0 F S RCASSIGN=$O(^IBE(351.73,RCCLERK,1,RCASSIGN)) Q:'RCASSIGN D I RCIFSTAT'="" D BUILDIF^RCDMBWLA S RCWLFLG=1
. . ;
. . S RCIFSTAT=""
. . S RCIFDESC=""
. . ;
. . ;
. . ; screen on all bills by category or minimum balance
. . S RCDATA0=$G(^IBE(351.73,RCCLERK,1,RCASSIGN,0))
. . I $P(RCDATA0,"^",2)!($P(RCDATA0,"^",3)) D
. . . ; screen on category
. . . I $P(RCDATA0,"^",2) D
. . . . S RCIFSTAT="I $P(RCDATA0,U,2)="_$P(RCDATA0,"^",2)_" "
. . . . S RCIFDESC="[CATEGORY equals "_$P($G(^PRCA(430.2,+$P(RCDATA0,"^",2),0)),"^")_"]"
. . . ; screen on minimum bill balance
. . . I $P(RCDATA0,"^",3) D
. . . . S RCIFSTAT=RCIFSTAT_"I RCBALANC>"_($P(RCDATA0,"^",3)-.01)_" "
. . . . I RCIFDESC'="" S RCIFDESC=RCIFDESC_" AND "
. . . . S RCIFDESC=RCIFDESC_"[MINIMUM BILL BALANCE greater than "_$J($P(RCDATA0,"^",3)-.01,0,2)_"]"
. . . I $P(RCDATA0,"^",5) D
. . . . S RCIFSTAT=RCIFSTAT_"I 'RCRC "
. . . . S RCIFDESC=RCIFDESC_"[EXCLUDE REGIONAL COUNSEL RECEIVABLES]"
. . ;
. . ;
. . ; screen on bill by first party
. . S RCDATA1=$G(^IBE(351.73,RCCLERK,1,RCASSIGN,1))
. . I $TR(RCDATA1,"^")'="" D Q
. . . ;
. . . ; screen on first party
. . . S RCIFSTAT=RCIFSTAT_"I RCDEBT[""DPT("" "
. . . ;
. . . ; screen on days since last payment
. . . I $P(RCDATA1,"^") D
. . . . S RCIFSTAT=RCIFSTAT_"I $$PAYDAYS^RCDMBWLA(RCBILLDA)>"_$P(RCDATA1,"^")_" "
. . . . S RCIFDESC=RCIFDESC_"[DAYS SINCE LAST PAYMENT greater than "_$P(RCDATA1,"^")_"]"
. . . ;
. . . ; screen on first patient name last patient name
. . . I $P(RCDATA1,"^",2)'=""!($P(RCDATA1,"^",3)'="") D Q
. . . . ; if first patient name is null, set to @ char (before A)
. . . . I $P(RCDATA1,"^",2)="" S $P(RCDATA1,"^",2)=$C(64)
. . . . ; if last patient name is null, set to / char (after Z)
. . . . I $P(RCDATA1,"^",3)="" S $P(RCDATA1,"^",3)=$C(92)
. . . . ;
. . . . S RCIFSTAT=RCIFSTAT_"I RCNAME]"_$C(34)_$P(RCDATA1,"^",2)_$C(34)_",RCNAME']"_$C(34)_$P(RCDATA1,"^",3)_$C(34)_" "
. . . . ;
. . . . ; if first patient name is null, set variable for description
. . . . I $P(RCDATA1,"^",2)=$C(64) S $P(RCDATA1,"^",2)="<first>"
. . . . ; if last patient name is null, set variable for desctription
. . . . I $P(RCDATA1,"^",3)=$C(92) S $P(RCDATA1,"^",3)="<last>"
. . . . S RCIFDESC=RCIFDESC_"[PATIENT NAME is after "_$P(RCDATA1,"^",2)_" and before "_$P(RCDATA1,"^",3)_"]"
. . . ;
. . . ; screen on social security number
. . . I $P(RCDATA1,"^",4)'=""!($P(RCDATA1,"^",5)'="") D Q
. . . . ; if first ssn is null, set starting point
. . . . I $P(RCDATA1,"^",4)="" S $P(RCDATA1,"^",4)="0000"
. . . . ; if last ssn is null, set ending point
. . . . I $P(RCDATA1,"^",5)="" S $P(RCDATA1,"^",5)="9999"
. . . . ;
. . . . S RCIFSTAT=RCIFSTAT_"I RCSSN]"_$C(34)_$P(RCDATA1,"^",4)_$C(34)_",RCSSN']"_$C(34)_$P(RCDATA1,"^",5)_$C(34)
. . . . ;
. . . . ; if first ssn is null, set variable for description
. . . . I $P(RCDATA1,"^",4)="0000" S $P(RCDATA1,"^",4)="<first>"
. . . . ; if last ssn is null, set variable for desctription
. . . . I $P(RCDATA1,"^",5)="9999" S $P(RCDATA1,"^",5)="<last>"
. . . . S RCIFDESC=RCIFDESC_"[PATIENT SSN is after "_$P(RCDATA1,"^",4)_" and before "_$P(RCDATA1,"^",5)_"]"
. . ;
. . ;
. . ; screen on bills by third party
. . S RCDATA2=$G(^IBE(351.73,RCCLERK,1,RCASSIGN,2))
. . I $TR(RCDATA2,"^")'="" D Q
. . . ; screen on third party
. . . S RCIFSTAT=RCIFSTAT_"I RCDEBT[""DIC(36"" "
. . . ; screen on days since transaction days
. . . I $P(RCDATA2,"^") D
. . . . S RCIFSTAT=RCIFSTAT_"I $$TRANDAYS^RCDMBWLA(RCBILLDA)>"_$P(RCDATA2,"^")_" "
. . . . S RCIFDESC=RCIFDESC_"[DAYS SINCE LAST TRANSACTION greater than "_$P(RCDATA2,"^")_"]"
. . . ; screen on receivable type
. . . D RECTYP^RCDMBWLA
. . . ; screen on first insurance name and last insurance name
. . . I $P(RCDATA2,"^",2)'=""!($P(RCDATA2,"^",3)'="") D
. . . . ; if first insurance name is null, set to @ char (before A)
. . . . I $P(RCDATA2,"^",2)="" S $P(RCDATA2,"^",2)=$C(64)
. . . . ; if last insurance name is null, set to \ char (after Z)
. . . . I $P(RCDATA2,"^",3)="" S $P(RCDATA2,"^",3)=$C(92)
. . . . ;
. . . . S RCIFSTAT=RCIFSTAT_"I RCNAME]"_$C(34)_$P(RCDATA2,"^",2)_$C(34)_",RCNAME']"_$C(34)_$P(RCDATA2,"^",3)_$C(34)_" "
. . . . ;
. . . . ; if first insurance company name is null, set variable for description
. . . . I $P(RCDATA2,"^",2)=$C(64) S $P(RCDATA2,"^",2)="<first>"
. . . . ; if last insurance company name is null, set variable for desctription
. . . . I $P(RCDATA2,"^",3)=$C(92) S $P(RCDATA2,"^",3)="<last>"
. . . . S RCIFDESC=RCIFDESC_"[INSURANCE COMPANY NAME is after "_$P(RCDATA2,"^",2)_" and before "_$P(RCDATA2,"^",3)_"]"
. . . ;
. . . ; screen on first patient name last patient name
. . . I $P(RCDATA2,"^",4)'=""!($P(RCDATA2,"^",5)'="") D Q
. . . . ; if first patient name is null, set to @ char (before A)
. . . . I $P(RCDATA2,"^",4)="" S $P(RCDATA2,"^",4)=$C(64)
. . . . ; if last patient name is null, set to / char (after Z)
. . . . I $P(RCDATA2,"^",5)="" S $P(RCDATA2,"^",5)=$C(92)
. . . . ;
. . . . S RCIFSTAT=RCIFSTAT_"I RCPTNAM]"_$C(34)_$P(RCDATA2,"^",4)_$C(34)_",RCPTNAM']"_$C(34)_$P(RCDATA2,"^",5)_$C(34)_" "
. . . . ;
. . . . ; if first patient name is null, set variable for description
. . . . I $P(RCDATA2,"^",4)=$C(64) S $P(RCDATA2,"^",4)="<first>"
. . . . ; if last patient name is null, set variable for description
. . . . I $P(RCDATA2,"^",5)=$C(92) S $P(RCDATA2,"^",5)="<last>"
. . . . S RCIFDESC=RCIFDESC_"[PATIENT NAME is after "_$P(RCDATA2,"^",4)_" and before "_$P(RCDATA2,"^",5)_"]"
. . . ;
. . . ; screen on social security number
. . . I $P(RCDATA2,"^",6)'=""!($P(RCDATA2,"^",7)'="") D Q
. . . . ; if first ssn is null, set starting point
. . . . I $P(RCDATA2,"^",6)="" S $P(RCDATA2,"^",6)="0000"
. . . . ; if last ssn is null, set ending point
. . . . I $P(RCDATA2,"^",7)="" S $P(RCDATA2,"^",7)="9999"
. . . . ;
. . . . S RCIFSTAT=RCIFSTAT_"I RCSSN]"_$C(34)_$P(RCDATA2,"^",6)_$C(34)_",RCSSN']"_$C(34)_$P(RCDATA2,"^",7)_$C(34)
. . . . ;
. . . . ; if first ssn is null, set variable for description
. . . . I $P(RCDATA2,"^",6)="0000" S $P(RCDATA2,"^",6)="<first>"
. . . . ; if last ssn is null, set variable for desctription
. . . . I $P(RCDATA2,"^",7)="9999" S $P(RCDATA2,"^",7)="<last>"
. . . . S RCIFDESC=RCIFDESC_"[PATIENT SSN is after "_$P(RCDATA2,"^",6)_" and before "_$P(RCDATA2,"^",7)_"]"
. . . ;
. . ;
. . ; clerk has no assignment, quit
. . Q
;
;
I RCWLFLG D LOOP^RCDMBWLA
;
I RCWLFLG D REPORT^RCDMBWL1
;
K ^TMP("RCDMBWLR",$J),RCWLFLG
Q
;
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HRCDMBWLR 8155 printed Dec 13, 2024@01:43:24 Page 2
RCDMBWLR ;WISC/RFJ-diagnostic measures workload report (build it) ;1 Jan 01
+1 ;;4.5;Accounts Receivable;**167**;Mar 20, 1995
+2 ;;Per VHA Directive 10-93-142, this routine should not be modified.
+3 QUIT
+4 ;
+5 ;
DQ ; called by nightly background job
+1 ;
+2 NEW RCASSIGN,RCBALANC,RCBILLDA,RCCLERK,RCDATA0,RCDATA1,RCDATA2,RCDATA7,RCDATA6
+3 NEW RCDEBT,RCDEBTDA,RCDPDATA,RCFDEATH,RCIFDESC,RCIFSTAT,RCNAME,RCSSN,RCRC
+4 KILL ^TMP("RCDMBWLR",$JOB)
+5 ;
+6 ; loop all workload assignments and generate logic to screen bills
+7 SET RCWLFLG=0
+8 SET RCCLERK=0
FOR
SET RCCLERK=$ORDER(^IBE(351.73,RCCLERK))
if 'RCCLERK
QUIT
Begin DoDot:1
+9 SET RCASSIGN=0
FOR
SET RCASSIGN=$ORDER(^IBE(351.73,RCCLERK,1,RCASSIGN))
if 'RCASSIGN
QUIT
Begin DoDot:2
+10 ;
+11 SET RCIFSTAT=""
+12 SET RCIFDESC=""
+13 ;
+14 ;
+15 ; screen on all bills by category or minimum balance
+16 SET RCDATA0=$GET(^IBE(351.73,RCCLERK,1,RCASSIGN,0))
+17 IF $PIECE(RCDATA0,"^",2)!($PIECE(RCDATA0,"^",3))
Begin DoDot:3
+18 ; screen on category
+19 IF $PIECE(RCDATA0,"^",2)
Begin DoDot:4
+20 SET RCIFSTAT="I $P(RCDATA0,U,2)="_$PIECE(RCDATA0,"^",2)_" "
+21 SET RCIFDESC="[CATEGORY equals "_$PIECE($GET(^PRCA(430.2,+$PIECE(RCDATA0,"^",2),0)),"^")_"]"
End DoDot:4
+22 ; screen on minimum bill balance
+23 IF $PIECE(RCDATA0,"^",3)
Begin DoDot:4
+24 SET RCIFSTAT=RCIFSTAT_"I RCBALANC>"_($PIECE(RCDATA0,"^",3)-.01)_" "
+25 IF RCIFDESC'=""
SET RCIFDESC=RCIFDESC_" AND "
+26 SET RCIFDESC=RCIFDESC_"[MINIMUM BILL BALANCE greater than "_$JUSTIFY($PIECE(RCDATA0,"^",3)-.01,0,2)_"]"
End DoDot:4
+27 IF $PIECE(RCDATA0,"^",5)
Begin DoDot:4
+28 SET RCIFSTAT=RCIFSTAT_"I 'RCRC "
+29 SET RCIFDESC=RCIFDESC_"[EXCLUDE REGIONAL COUNSEL RECEIVABLES]"
End DoDot:4
End DoDot:3
+30 ;
+31 ;
+32 ; screen on bill by first party
+33 SET RCDATA1=$GET(^IBE(351.73,RCCLERK,1,RCASSIGN,1))
+34 IF $TRANSLATE(RCDATA1,"^")'=""
Begin DoDot:3
+35 ;
+36 ; screen on first party
+37 SET RCIFSTAT=RCIFSTAT_"I RCDEBT[""DPT("" "
+38 ;
+39 ; screen on days since last payment
+40 IF $PIECE(RCDATA1,"^")
Begin DoDot:4
+41 SET RCIFSTAT=RCIFSTAT_"I $$PAYDAYS^RCDMBWLA(RCBILLDA)>"_$PIECE(RCDATA1,"^")_" "
+42 SET RCIFDESC=RCIFDESC_"[DAYS SINCE LAST PAYMENT greater than "_$PIECE(RCDATA1,"^")_"]"
End DoDot:4
+43 ;
+44 ; screen on first patient name last patient name
+45 IF $PIECE(RCDATA1,"^",2)'=""!($PIECE(RCDATA1,"^",3)'="")
Begin DoDot:4
+46 ; if first patient name is null, set to @ char (before A)
+47 IF $PIECE(RCDATA1,"^",2)=""
SET $PIECE(RCDATA1,"^",2)=$CHAR(64)
+48 ; if last patient name is null, set to / char (after Z)
+49 IF $PIECE(RCDATA1,"^",3)=""
SET $PIECE(RCDATA1,"^",3)=$CHAR(92)
+50 ;
+51 SET RCIFSTAT=RCIFSTAT_"I RCNAME]"_$CHAR(34)_$PIECE(RCDATA1,"^",2)_$CHAR(34)_",RCNAME']"_$CHAR(34)_$PIECE(RCDATA1,"^",3)_$CHAR(34)_" "
+52 ;
+53 ; if first patient name is null, set variable for description
+54 IF $PIECE(RCDATA1,"^",2)=$CHAR(64)
SET $PIECE(RCDATA1,"^",2)="<first>"
+55 ; if last patient name is null, set variable for desctription
+56 IF $PIECE(RCDATA1,"^",3)=$CHAR(92)
SET $PIECE(RCDATA1,"^",3)="<last>"
+57 SET RCIFDESC=RCIFDESC_"[PATIENT NAME is after "_$PIECE(RCDATA1,"^",2)_" and before "_$PIECE(RCDATA1,"^",3)_"]"
End DoDot:4
QUIT
+58 ;
+59 ; screen on social security number
+60 IF $PIECE(RCDATA1,"^",4)'=""!($PIECE(RCDATA1,"^",5)'="")
Begin DoDot:4
+61 ; if first ssn is null, set starting point
+62 IF $PIECE(RCDATA1,"^",4)=""
SET $PIECE(RCDATA1,"^",4)="0000"
+63 ; if last ssn is null, set ending point
+64 IF $PIECE(RCDATA1,"^",5)=""
SET $PIECE(RCDATA1,"^",5)="9999"
+65 ;
+66 SET RCIFSTAT=RCIFSTAT_"I RCSSN]"_$CHAR(34)_$PIECE(RCDATA1,"^",4)_$CHAR(34)_",RCSSN']"_$CHAR(34)_$PIECE(RCDATA1,"^",5)_$CHAR(34)
+67 ;
+68 ; if first ssn is null, set variable for description
+69 IF $PIECE(RCDATA1,"^",4)="0000"
SET $PIECE(RCDATA1,"^",4)="<first>"
+70 ; if last ssn is null, set variable for desctription
+71 IF $PIECE(RCDATA1,"^",5)="9999"
SET $PIECE(RCDATA1,"^",5)="<last>"
+72 SET RCIFDESC=RCIFDESC_"[PATIENT SSN is after "_$PIECE(RCDATA1,"^",4)_" and before "_$PIECE(RCDATA1,"^",5)_"]"
End DoDot:4
QUIT
End DoDot:3
QUIT
+73 ;
+74 ;
+75 ; screen on bills by third party
+76 SET RCDATA2=$GET(^IBE(351.73,RCCLERK,1,RCASSIGN,2))
+77 IF $TRANSLATE(RCDATA2,"^")'=""
Begin DoDot:3
+78 ; screen on third party
+79 SET RCIFSTAT=RCIFSTAT_"I RCDEBT[""DIC(36"" "
+80 ; screen on days since transaction days
+81 IF $PIECE(RCDATA2,"^")
Begin DoDot:4
+82 SET RCIFSTAT=RCIFSTAT_"I $$TRANDAYS^RCDMBWLA(RCBILLDA)>"_$PIECE(RCDATA2,"^")_" "
+83 SET RCIFDESC=RCIFDESC_"[DAYS SINCE LAST TRANSACTION greater than "_$PIECE(RCDATA2,"^")_"]"
End DoDot:4
+84 ; screen on receivable type
+85 DO RECTYP^RCDMBWLA
+86 ; screen on first insurance name and last insurance name
+87 IF $PIECE(RCDATA2,"^",2)'=""!($PIECE(RCDATA2,"^",3)'="")
Begin DoDot:4
+88 ; if first insurance name is null, set to @ char (before A)
+89 IF $PIECE(RCDATA2,"^",2)=""
SET $PIECE(RCDATA2,"^",2)=$CHAR(64)
+90 ; if last insurance name is null, set to \ char (after Z)
+91 IF $PIECE(RCDATA2,"^",3)=""
SET $PIECE(RCDATA2,"^",3)=$CHAR(92)
+92 ;
+93 SET RCIFSTAT=RCIFSTAT_"I RCNAME]"_$CHAR(34)_$PIECE(RCDATA2,"^",2)_$CHAR(34)_",RCNAME']"_$CHAR(34)_$PIECE(RCDATA2,"^",3)_$CHAR(34)_" "
+94 ;
+95 ; if first insurance company name is null, set variable for description
+96 IF $PIECE(RCDATA2,"^",2)=$CHAR(64)
SET $PIECE(RCDATA2,"^",2)="<first>"
+97 ; if last insurance company name is null, set variable for desctription
+98 IF $PIECE(RCDATA2,"^",3)=$CHAR(92)
SET $PIECE(RCDATA2,"^",3)="<last>"
+99 SET RCIFDESC=RCIFDESC_"[INSURANCE COMPANY NAME is after "_$PIECE(RCDATA2,"^",2)_" and before "_$PIECE(RCDATA2,"^",3)_"]"
End DoDot:4
+100 ;
+101 ; screen on first patient name last patient name
+102 IF $PIECE(RCDATA2,"^",4)'=""!($PIECE(RCDATA2,"^",5)'="")
Begin DoDot:4
+103 ; if first patient name is null, set to @ char (before A)
+104 IF $PIECE(RCDATA2,"^",4)=""
SET $PIECE(RCDATA2,"^",4)=$CHAR(64)
+105 ; if last patient name is null, set to / char (after Z)
+106 IF $PIECE(RCDATA2,"^",5)=""
SET $PIECE(RCDATA2,"^",5)=$CHAR(92)
+107 ;
+108 SET RCIFSTAT=RCIFSTAT_"I RCPTNAM]"_$CHAR(34)_$PIECE(RCDATA2,"^",4)_$CHAR(34)_",RCPTNAM']"_$CHAR(34)_$PIECE(RCDATA2,"^",5)_$CHAR(34)_" "
+109 ;
+110 ; if first patient name is null, set variable for description
+111 IF $PIECE(RCDATA2,"^",4)=$CHAR(64)
SET $PIECE(RCDATA2,"^",4)="<first>"
+112 ; if last patient name is null, set variable for description
+113 IF $PIECE(RCDATA2,"^",5)=$CHAR(92)
SET $PIECE(RCDATA2,"^",5)="<last>"
+114 SET RCIFDESC=RCIFDESC_"[PATIENT NAME is after "_$PIECE(RCDATA2,"^",4)_" and before "_$PIECE(RCDATA2,"^",5)_"]"
End DoDot:4
QUIT
+115 ;
+116 ; screen on social security number
+117 IF $PIECE(RCDATA2,"^",6)'=""!($PIECE(RCDATA2,"^",7)'="")
Begin DoDot:4
+118 ; if first ssn is null, set starting point
+119 IF $PIECE(RCDATA2,"^",6)=""
SET $PIECE(RCDATA2,"^",6)="0000"
+120 ; if last ssn is null, set ending point
+121 IF $PIECE(RCDATA2,"^",7)=""
SET $PIECE(RCDATA2,"^",7)="9999"
+122 ;
+123 SET RCIFSTAT=RCIFSTAT_"I RCSSN]"_$CHAR(34)_$PIECE(RCDATA2,"^",6)_$CHAR(34)_",RCSSN']"_$CHAR(34)_$PIECE(RCDATA2,"^",7)_$CHAR(34)
+124 ;
+125 ; if first ssn is null, set variable for description
+126 IF $PIECE(RCDATA2,"^",6)="0000"
SET $PIECE(RCDATA2,"^",6)="<first>"
+127 ; if last ssn is null, set variable for desctription
+128 IF $PIECE(RCDATA2,"^",7)="9999"
SET $PIECE(RCDATA2,"^",7)="<last>"
+129 SET RCIFDESC=RCIFDESC_"[PATIENT SSN is after "_$PIECE(RCDATA2,"^",6)_" and before "_$PIECE(RCDATA2,"^",7)_"]"
End DoDot:4
QUIT
+130 ;
End DoDot:3
QUIT
+131 ;
+132 ; clerk has no assignment, quit
+133 QUIT
End DoDot:2
IF RCIFSTAT'=""
DO BUILDIF^RCDMBWLA
SET RCWLFLG=1
End DoDot:1
+134 ;
+135 ;
+136 IF RCWLFLG
DO LOOP^RCDMBWLA
+137 ;
+138 IF RCWLFLG
DO REPORT^RCDMBWL1
+139 ;
+140 KILL ^TMP("RCDMBWLR",$JOB),RCWLFLG
+141 QUIT
+142 ;