BARDYSV7 ; IHS/SD/SDR - DAYS TO COLLECTION comma-delimited summary ; 02/09/2009
;;1.8;IHS ACCOUNTS RECEIVABLE;**28**;OCT 26,2005;Build 92
;IHS/SD/SDR - 1.8*28 - HEAT224215 - New routine to print comma-delimited summary report
;
Q
;
PRTVSCOM ;EP
S ESC=0
S $P(EQUALS,"=",181)=""
D VISHDR
;THESE ARE PAGE SUBTOTALS
S (COLVISIT,COLWITBL,COLNUMBL,COLBILAM,COLCHKIN,COLCREDY,COLREVDY)=0
S (COLTPBA,COLTPBX,COLTOPY,COLEARPY,COLLSTPY,COLTOTPS,PGCNT)=0
S COLTOTPY=0 ;TOT PAY MADE
S MONTHYR=""
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)) Q:MONTHYR="" D Q:+$G(ESC)
.S YR=$P(MONTHYR," ")
.S MTH=$$MONTH^BARDYSPR(+$P(MONTHYR," ",2))
.S COLTOTPY=COLTOTPY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR)) ;TOT PAYMENTS MADE
.W !,MTH," ",YR ;;MONTH of DOS
.W U_$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)) ;# of Visits
.S COLVISIT=COLVISIT+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
.W U_$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR)) ;# Visits with Bills
.S COLWITBL=COLWITBL+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
.W U_$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR)) ;# of Bills
.S COLNUMBL=COLNUMBL+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
.W U_$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)) ;Billed Amount
.S COLBILAM=COLBILAM+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
.W U
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D ;AVG Visits Checked in
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLCHKIN=COLCHKIN+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))
.W U
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D ;AVG Days to PCC CREATED
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLCREDY=COLCREDY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))
.W U
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D ;AVG Days to Reviewed
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLREVDY=COLREVDY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))
.W U
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0 D ;AVG Days to 3P APPROVED
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLTPBA=COLTPBA+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))
.W U
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0 D ;AVG Days to EXPORTED
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLTPBX=COLTPBX+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))
.W U
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0 D ;AVG Days to Payment
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLTOPY=COLTOPY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))
.W U
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0 D ;AVG Days to First Posting
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLEARPY=COLEARPY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))
.W U
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))'=0 D ;AVG Days to Last Posting
..W $J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
..S COLLSTPY=COLLSTPY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))
.W U_$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)) ;Total Posted Amounts
.S COLTOTPS=COLTOTPS+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
;
S TOTNOEXP("GRANDTOT")=0
S MONTHYR=""
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR)) Q:'MONTHYR D
.S TOTNOEXP("GRANDTOT")=TOTNOEXP("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR)
W !,"TOTAL BILLS WITH NO EXPORT: ",TOTNOEXP("GRANDTOT")
I IOST[("P-") D ^%ZISC Q
K DIR S DIR(0)="E" D ^DIR
Q
;
VISHDR ;EP -
S BAR("PG")=BAR("PG")+1
S BAR("HD",0)=""
S BAR("LOC")=""
S BAR("OPT")="BAR RPT DAYS IN AR"
D HD^BARRHD
D WHD^BARRHD
W !,"MonthYear^#ofVisits^#VisitsWithBills^#Bills^BillAmount^AvgVisitsCheckedIn^AvgDaysToPCCCreated^AvgDaysToReviewed^AvgDays3PBillApproved^AvgDaysExported^AvgDaysToPayment^AvgDaysFirstPosting^AvgDaysLastPosting^TotalPostedAmounts"
Q
;EOR - IHS/DIT/CPC 1.8*28
BARDYSV7 ; IHS/SD/SDR - DAYS TO COLLECTION comma-delimited summary ; 02/09/2009
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**28**;OCT 26,2005;Build 92
+2 ;IHS/SD/SDR - 1.8*28 - HEAT224215 - New routine to print comma-delimited summary report
+3 ;
+4 QUIT
+5 ;
PRTVSCOM ;EP
+1 SET ESC=0
+2 SET $PIECE(EQUALS,"=",181)=""
+3 DO VISHDR
+4 ;THESE ARE PAGE SUBTOTALS
+5 SET (COLVISIT,COLWITBL,COLNUMBL,COLBILAM,COLCHKIN,COLCREDY,COLREVDY)=0
+6 SET (COLTPBA,COLTPBX,COLTOPY,COLEARPY,COLLSTPY,COLTOTPS,PGCNT)=0
+7 ;TOT PAY MADE
SET COLTOTPY=0
+8 SET MONTHYR=""
+9 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+10 SET YR=$PIECE(MONTHYR," ")
+11 SET MTH=$$MONTH^BARDYSPR(+$PIECE(MONTHYR," ",2))
+12 ;TOT PAYMENTS MADE
SET COLTOTPY=COLTOTPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))
+13 ;;MONTH of DOS
WRITE !,MTH," ",YR
+14 ;# of Visits
WRITE U_$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
+15 SET COLVISIT=COLVISIT+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
+16 ;# Visits with Bills
WRITE U_$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
+17 SET COLWITBL=COLWITBL+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
+18 ;# of Bills
WRITE U_$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
+19 SET COLNUMBL=COLNUMBL+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
+20 ;Billed Amount
WRITE U_$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
+21 SET COLBILAM=COLBILAM+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
+22 WRITE U
+23 ;AVG Visits Checked in
IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+24 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+25 SET COLCHKIN=COLCHKIN+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))
End DoDot:2
+26 WRITE U
+27 ;AVG Days to PCC CREATED
IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+28 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+29 SET COLCREDY=COLCREDY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))
End DoDot:2
+30 WRITE U
+31 ;AVG Days to Reviewed
IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+32 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+33 SET COLREVDY=COLREVDY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))
End DoDot:2
+34 WRITE U
+35 ;AVG Days to 3P APPROVED
IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+36 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+37 SET COLTPBA=COLTPBA+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))
End DoDot:2
+38 WRITE U
+39 ;AVG Days to EXPORTED
IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+40 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+41 SET COLTPBX=COLTPBX+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))
End DoDot:2
+42 WRITE U
+43 ;AVG Days to Payment
IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+44 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+45 SET COLTOPY=COLTOPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))
End DoDot:2
+46 WRITE U
+47 ;AVG Days to First Posting
IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+48 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+49 SET COLEARPY=COLEARPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))
End DoDot:2
+50 WRITE U
+51 ;AVG Days to Last Posting
IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+52 WRITE $JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+53 SET COLLSTPY=COLLSTPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))
End DoDot:2
+54 ;Total Posted Amounts
WRITE U_$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
+55 SET COLTOTPS=COLTOTPS+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
End DoDot:1
IF +$GET(ESC)
QUIT
+56 ;
+57 SET TOTNOEXP("GRANDTOT")=0
+58 SET MONTHYR=""
+59 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR))
IF 'MONTHYR
QUIT
Begin DoDot:1
+60 SET TOTNOEXP("GRANDTOT")=TOTNOEXP("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR)
End DoDot:1
+61 WRITE !,"TOTAL BILLS WITH NO EXPORT: ",TOTNOEXP("GRANDTOT")
+62 IF IOST[("P-")
DO ^%ZISC
QUIT
+63 KILL DIR
SET DIR(0)="E"
DO ^DIR
+64 QUIT
+65 ;
VISHDR ;EP -
+1 SET BAR("PG")=BAR("PG")+1
+2 SET BAR("HD",0)=""
+3 SET BAR("LOC")=""
+4 SET BAR("OPT")="BAR RPT DAYS IN AR"
+5 DO HD^BARRHD
+6 DO WHD^BARRHD
+7 WRITE !,"MonthYear^#ofVisits^#VisitsWithBills^#Bills^BillAmount^AvgVisitsCheckedIn^AvgDaysToPCCCreated^AvgDaysToReviewed^AvgDays3PBillApproved^AvgDaysExported^AvgDaysToPayment^AvgDaysFirstPosting^AvgDaysLastPosting^TotalPostedAmounts"
+8 QUIT
+9 ;EOR - IHS/DIT/CPC 1.8*28