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