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

RCDPARC1.m

Go to the documentation of this file.
  1. RCDPARC1 ;AITC/CJE - CARC REPORT ON PAYER OR CARC CODE ;9/15/14 3:00pm
  1. ;;4.5;Accounts Receivable;**326**;Mar 20, 1995;Build 26
  1. ;;Per VA Directive 6402, this routine should not be modified.
  1. Q
  1. ;
  1. SORT(ARRAY,SORT) ; Sort and summarize data based on SORT variable
  1. N CARC,IEN,D1,D2,PIEN,PAYER,Z,TIN,DESC,R1,BILL S IEN=""
  1. ; IEN= IEN from file 361.1; PIEN= 835 Payer IEN from file 344.6
  1. F S IEN=$O(@ARRAY@("BILLS",IEN)) Q:IEN="" D
  1. . S D1=@ARRAY@("BILLS",IEN,0),TIN=$P(D1,U,5),BILL=$P(D1,U,2)
  1. . S PAYER=$$GPAYR^RCDPRU2(TIN) Q:$G(PAYER)="" ; couldn't find a payer to match TIN, quit
  1. . S CARC="",Z="",R1=""
  1. . F S Z=$O(@ARRAY@("BILLS",IEN,"C",Z)) Q:Z="" S D2=@ARRAY@("BILLS",IEN,"C",Z),CARC=$P(D2,U,1),DESC=$P(D2,U,4) D
  1. .. ; If RARC exists append to CARC Information
  1. .. S:$G(@ARRAY@("BILLS",IEN,"R",Z))'="" R1=@ARRAY@("BILLS",IEN,"R",Z)
  1. .. ;W "RARC: |",$G(@ARRAY@("BILLS",IEN,"R",Z)),"|",!
  1. .. D:SORT="C" ; Sort by CARC, group by Payer
  1. ... S @ARRAY@("REPORT",CARC,PAYER_"/"_TIN,IEN,0)=D1
  1. ... ; First time through set the "BILLS" D2 into report, otherwise add adjustment amt to the existing for this CARC
  1. ... I $G(@ARRAY@("REPORT",CARC,PAYER_"/"_TIN,IEN,1))="" S @ARRAY@("REPORT",CARC,PAYER_"/"_TIN,IEN,1)=D2_U_R1
  1. ... E S $P(@ARRAY@("REPORT",CARC,PAYER_"/"_TIN,IEN,1),U,2)=$P(@ARRAY@("REPORT",CARC,PAYER_"/"_TIN,IEN,1),U,2)+$P(D2,U,2) ;W "CARC: ",CARC," Bill: ",BILL," D2: ",D2,!
  1. .. D:SORT="P" ; Sort by Payer, group by CARC
  1. ... S @ARRAY@("REPORT",PAYER_"/"_TIN,CARC,IEN,0)=D1
  1. ... ; First time through set the "BILLS" D2 into report, otherwise add adjustment amt to the existing for this CARC
  1. ... I $G(@ARRAY@("REPORT",PAYER_"/"_TIN,CARC,IEN,1))="" S @ARRAY@("REPORT",PAYER_"/"_TIN,CARC,IEN,1)=D2_U_R1
  1. ... E S $P(@ARRAY@("REPORT",PAYER_"/"_TIN,CARC,IEN,1),U,2)=$P(@ARRAY@("REPORT",PAYER_"/"_TIN,CARC,IEN,1),U,2)+$P(D2,U,2)
  1. .. ;I CARC=1 W ARRAY," BILL:",BILL," CARC:",CARC," ",PAYER_"/"_TIN," ",$P(D1,U,6)," ",$P(D1,U,7)," ",DESC," ",$P(D2,U,2)," ",SORT,!
  1. .. D SUM^RCDPRU2(ARRAY,IEN,BILL,CARC,PAYER_"/"_TIN,$P(D1,U,6),$P(D1,U,7),DESC,$P(D2,U,2),SORT)
  1. Q