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

BARDMRQC.m

Go to the documentation of this file.
BARDMRQC ;IHS/OIT/FCJ - DEBT MANAGEMENT-PRINTED LETTER REPORT
 ;;1.8;IHS ACCOUNTS RECEIVABLE;**22,23**;OCT 26, 2005;Build 38
 ;New routine AUG 2012 for Debt Letter Management
 ;
 ;This report shows recently printed letters by cycle, Insurer and detail
 ;
 ;code cloned from BARDMRU ;P.OTT
 ;P.OTT MAY 2013 ACTIVATE FILTER FOR INSTYPE; IGNORE BILLS WITH ZERO BALANCE
 ;P.OTT OCT 2013 ADDED FILTER TO DISPLAY 'ORIGINAL' or 'CURRENT' list of printed letters
 Q
CALC I IOST["C-",'$D(IO("S")) W !!,"Running calculations for report of printed letters."
 S BARCTQ=0,BARCT=0,CY=0
 K ^TMP("BARDM",$J,"QN")
 S ^TMP("BARDM",$J,"QN")=0 ;FOR BARSEQ
 D BARSETUP ;P.OTT
 F BARL="CYCLE 1","CYCLE 2","CYCLE 3","CYCLE 4" D
 . S ^TMP("BARDM",$J,"QN",BARL)="0^0^0"  ;bar*1.8*22 SDR
 . Q:BARCTQ
 . S CY=CY+1
 . D A1(BARL)
 S BARCNT=0,BARL="" F  S BARL=$O(^TMP("BARDM",$J,"QN",BARL)) Q:BARL=""  S BARCNT=BARCNT+$G(^TMP("BARDM",$J,"QN",BARL)) ;P.OTT 4/11
 S ^TMP("BARDM",$J,"QN")=BARCNT
 K BARCTQ,BARCNT
 Q
BARSETUP ;P.OTT MAY 2013
 NEW BARL,BARL1,BARL2,BARPIEN
 S BARPIEN=DUZ(2)
 K BARDINS
 S BARL=0
 F  S BARL=$O(^BAR(90052.06,BARPIEN,DUZ(2),19,BARL)) Q:BARL'?1N.N  D
 . S BARL1=$P(^BAR(90052.06,BARPIEN,DUZ(2),19,BARL,0),U)
 . S BARL2=$$GET1^DIQ(90053.03,BARL1,".01","E")
 . I BARL2'="" S BARDINS(BARL2)=""
 Q
 ;
A1(BARL) ; 
 ;^TMP("BARDMQN",$J,BARL,BARDM,BARDMC)=BARDMINS
 NEW BARDM,BARDMC,BARAMTB,BARAMTO,BARBIEN,BARDAC,BARDBDT,BARDI,BARDIT,BARDM,BARDMC
 S BARDM=0 F  S BARDM=$O(^TMP("BARDMQN",$J,BARL,BARDM)) Q:BARDM'?1N.N  D  Q:BARCTQ
 . ;will list all printed dl (even if status changed to P or S)
 . ;;;Q:$P(^BARDM(DUZ(2),BARDM,0),U,2)'="A"  ;bar*1.8*22 SDR
 . S BARDMC=0 F  S BARDMC=$O(^TMP("BARDMQN",$J,BARL,BARDM,BARDMC)) Q:BARDMC'?1N.N  D  Q:BARCTQ
 .. S BARAMTO=$P(^BARDM(DUZ(2),BARDM,100,BARDMC,0),U,6)
 .. S BARBIEN=$P(^BARDM(DUZ(2),BARDM,0),U)
 .. ;----next line will be parameter driven
 .. ;for now will list all printed dl (even if the bill was meanwhile zeroed
 .. ;------
 .. S BARMOD2=$G(BARMOD2)
 .. I DUZ=902 S BAROK=0 D  I 'BAROK Q
 ... I BARMOD2=""!(BARMOD2="O") S BAROK=1 Q  ;SHOW ALWAYS
 ... I BARMOD2="Z" I $P(^BARBL(DUZ(2),BARBIEN,0),U,15)=0 S BAROK=1 Q   ;SHOW ZERO BALANCE
 ... I BARMOD2="C" I $P(^BARBL(DUZ(2),BARBIEN,0),U,15)'>0 S BAROK=1 Q  ;SHOW NON-ZERO BALANCE
 .. S BARDAC=$P(^BARBL(DUZ(2),BARBIEN,0),U,3),BARAMTB=$P(^(0),U,13),BARDBDT=$P(^(0),U,7)
 .. D INSTYP^BARDMU
 .. S BARDI=$$VAL^XBDIQ1(90050.02,BARDAC,.01)
 .. ;will list all printed dl (filtering letters by insurer was before printing! - do not do it here)
 .. ;;;I '$D(BARDINS(BARDI))&'$D(BARDINS(BARDITY)) Q  ;not ins we are looking for
 .. D RPTQ
 .. ;SET TOTALS BY CYCLE
 .. S $P(^TMP("BARDM",$J,"QN",BARL),U)=+$P($G(^TMP("BARDM",$J,"QN",BARL)),U)+1  ;bar*1.8*22 SDR
 .. S $P(^TMP("BARDM",$J,"QN",BARL),U,2)=$P(^TMP("BARDM",$J,"QN",BARL),U,2)+BARAMTB
 .. S $P(^TMP("BARDM",$J,"QN",BARL),U,3)=$P(^TMP("BARDM",$J,"QN",BARL),U,3)+BARAMTO
 .. S:'$G(^TMP("BARDM",$J,"QN",BARL,BARDIT)) ^TMP("BARDM",$J,"QN",BARL,BARDIT)="0^0^0"
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U)+1
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U,2)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U,2)+BARAMTB
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U,3)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT),U,3)+BARAMTO
 .. ;SET TOTALS BY INS
 .. S:'$G(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI)) ^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI)="0^0^0"
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U)+1
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U,2)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U,2)+BARAMTB
 .. S $P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U,3)=$P(^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI),U,3)+BARAMTO
 Q
RPTQ ;SET OTHER ITEMS FOR THE QUEUED LET REPORT
 S ^TMP("BARDM",$J,"QN",BARL,BARDIT,BARDI,$E($P(^BARBL(DUZ(2),BARBIEN,0),U),1,8))=$P(^BARBL(DUZ(2),BARBIEN,1),U)_U_$P(^(1),U,2)_U_BARDBDT_U_BARAMTB_U_BARAMTO
 Q  ;EOR