BARDYSPR ; IHS/SD/TPF - DAYS IN A/R REPORT PRINT DRIVER;
;;1.8;IHS ACCOUNTS RECEIVABLE;**16,28**;OCT 26, 2005;Build 92
;IHS/SD/SDR 1.8*28 - HEAT224215 - Added code to write comma-delmtd or detl report
;IHS/DIT/CPC - 1.8*28 - CR8345 - Changed delimited file format, added spreadsheet XML option
Q
;
PRINTAPP ;EP -
N MONTHYR
S BAR("PG")=0
D APPHDR
S (TOTBILLD,TOTCOL,TOTBILLS,TOTVISIT)=0
S MONTHYR=""
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR)) Q:MONTHYR="" D
.W !,$$MONTH^BARDYSPR(+$P(MONTHYR," ",2))_" ",$P(MONTHYR," ")
.W ?20,$J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR)),7,0)
.W ?30,$J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","BILLNUM",MONTHYR)),7,0)
.W ?43,$J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","AMTBILLD",MONTHYR)),10,2)
.W ?60,$J($G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","COLLAMT",MONTHYR)),10,2)
.S TOTBILLD=TOTBILLD+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","AMTBILLD",MONTHYR))
.S TOTCOL=TOTCOL+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","COLLAMT",MONTHYR))
.S TOTBILLS=TOTBILLS+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","BILLNUM",MONTHYR))
.S TOTVISIT=TOTVISIT+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR))
W !?20,"=======",?30,"======="
W ?45,"========",?60,"=========="
;PRINT GRAND TOTALS
W !,"GRAND TOTALS",?20,$J(TOTVISIT,7,0),?30,$J(TOTBILLS,7,0),?43,$J(TOTBILLD,10,2),?60,$J(TOTCOL,10,2)
I IOST[("P-") D ^%ZISC Q
K DIR S DIR(0)="E" D ^DIR
Q
APPHDR ;EP -
S BAR("PG")=BAR("PG")+1
D HD^BARRHD
D WHD^BARRHD
W !!!,"MONTH",?20,"NUMBER",?30,"#",?45,""
W !,"OF",?20,"OF",?30,"OF",?45,"Billed",?60,"Collection"
W !,"VISIT",?20,"VISITS",?30,"Bills",?45,"Amount",?60,"Amount"
Q
PRINTVIS ;EP -
N MTH,YR,MONTHYR,ESC
S ESC=0
S $P(EQUALS,"=",181)=""
S BAR(180)=""
S DOLLARW=14 ;DOLLAR COL WIDTH
S GENERALW=5 ;UNIT COL WIDTH
S DECIMALS=2 ;HOW MANY DECIMALS FOR AVERAGES
S BAR("PG")=0
I BARY("SUMORDET")="D" D PRNTDET^BARDYSV6 Q ;bar*1.8*27 IHS/SD/SDR HEAT224215
I BARY("COMMADELIM")=1 D PRTVSCOM^BARDYSV7 Q ;bar*1.8*27 IHS/SD/SDR HEAT224215
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(+$P(MONTHYR," ",2))
.I (IOST[("C-")),($Y>(IOSL-6)) D VISFOOT K DIR S DIR(0)="E" D ^DIR S ESC=X=U D:'ESC VISHDR
.I (IOST[("P-")),($Y>(IOSL-16)) D VISFOOT,VISHDR
.S PGCNT=PGCNT+1
.;TOT PAYMENTS MADE
.S COLTOTPY=COLTOTPY+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))
.;MONTH of DOS
.W !,MTH," ",YR
.;;# of Visits
.W ?17,$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
.S COLVISIT=COLVISIT+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
.;# Visits with Bills
.W ?26,$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
.S COLWITBL=COLWITBL+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
.;# of Bills
.W ?33,$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
.S COLNUMBL=COLNUMBL+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
.;Billed Amount
.W ?37,$J($FN($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)),"",2),DOLLARW)
.S COLBILAM=COLBILAM+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
.;AVG Visits Checked in
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D
..W ?56,$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))
.;AVG Days to PCC CREATED
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D
..W ?65,$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))
.;AVG Days to Reviewed
.I +^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0 D
..W ?77,$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))
.;AVG Days to 3P APPROVED
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0 D
..W ?90,$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))
.;AVG Days to EXPORTED
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0 D
..W ?101,$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))
.;AVG Days to Payment
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0 D
..W ?113,$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))
.;AVG Days to First Posting
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0 D
..W ?125,$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))
.;AVG Days to Last Posting
.I +$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))'=0 D
..W ?137,$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))
.;Total Posted Amounts
.W ?155,$J($FN($G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)),"",2),DOLLARW)
.S COLTOTPS=COLTOTPS+$G(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
W !,EQUALS
;DO THE GRAND TOTALS
S MONTHYR=""
S NUMVISIT("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S NUMVISIT("GRANDTOT")=NUMVISIT("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)
W !,"GRAND TOTAL:",?17,NUMVISIT("GRANDTOT")
S MONTHYR=""
S WITBILLS("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S WITBILLS("GRANDTOT")=WITBILLS("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR)
W ?26,WITBILLS("GRANDTOT")
S BILLNUM("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S BILLNUM("GRANDTOT")=BILLNUM("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR)
W ?33,BILLNUM("GRANDTOT")
S AMTBILLD("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S AMTBILLD("GRANDTOT")=AMTBILLD("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)
W ?37,$J($FN(AMTBILLD("GRANDTOT"),"",2),DOLLARW)
S AVGCHKIN("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S AVGCHKIN("GRANDTOT")=AVGCHKIN("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR)
W:$G(NUMVISIT("GRANDTOT")) ?56,$J(AVGCHKIN("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
S CREDAYS("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S CREDAYS("GRANDTOT")=CREDAYS("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR)
W:$G(NUMVISIT("GRANDTOT")) ?65,$J(CREDAYS("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
S REVDAYS("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S REVDAYS("GRANDTOT")=REVDAYS("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR)
W:$G(NUMVISIT("GRANDTOT")) ?77,$J(REVDAYS("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
S DAYSAPP("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S DAYSAPP("GRANDTOT")=DAYSAPP("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR)
W:$G(BILLNUM("GRANDTOT")) ?90,$J(DAYSAPP("GRANDTOT")/BILLNUM("GRANDTOT"),GENERALW,DECIMALS)
S DAYSEXP("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S DAYSEXP("GRANDTOT")=DAYSEXP("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR)
W:$G(BILLNUM("GRANDTOT")) ?101,$J(DAYSEXP("GRANDTOT")/BILLNUM("GRANDTOT"),GENERALW,DECIMALS)
S NUMPAYMT("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S NUMPAYMT("GRANDTOT")=NUMPAYMT("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR)
S NUMFIRST("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S NUMFIRST("GRANDTOT")=NUMFIRST("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR)
S NUMLAST("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S NUMLAST("GRANDTOT")=NUMLAST("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR)
S DYSTOPAY("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S DYSTOPAY("GRANDTOT")=DYSTOPAY("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR)
W:$G(NUMPAYMT("GRANDTOT")) ?113,$J(DYSTOPAY("GRANDTOT")/NUMPAYMT("GRANDTOT"),GENERALW,DECIMALS)
S EARLYPAY("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S EARLYPAY("GRANDTOT")=EARLYPAY("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR)
W:$G(NUMFIRST("GRANDTOT")) ?125,$J(EARLYPAY("GRANDTOT")/NUMFIRST("GRANDTOT"),GENERALW,DECIMALS)
S LASTPAY("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S LASTPAY("GRANDTOT")=LASTPAY("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR)
W:$G(NUMLAST("GRANDTOT")) ?137,$J(LASTPAY("GRANDTOT")/NUMLAST("GRANDTOT"),GENERALW,DECIMALS)
S TOTPOST("GRANDTOT")=0
F S MONTHYR=$O(^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)) Q:MONTHYR="" D
.S TOTPOST("GRANDTOT")=TOTPOST("GRANDTOT")+^XTMP("BARDYSVS",$J,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)
W ?155,$J($FN(TOTPOST("GRANDTOT"),"",2),DOLLARW)
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
MONTH(X) ;EP -
Q $S(X=1:"JAN",X=2:"FEB",X=3:"MAR",X=4:"APR",X=5:"MAY",X=6:"JUN",X=7:"JUL",X=8:"AUG",X=9:"SEP",X=10:"OCT",X=11:"NOV",X=12:"DEC",1:"UNK")
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 !,"",?16,"",?25,"#",?33,"",?43,"",?56,"AVG",?65,"AVG",?77,"AVG",?90,"AVG"
W ?101,"AVG",?113,"AVG",?125,"AVG",?137,"AVG"
W !,"Month",?16,"#",?25,"Visits",?33,"#",?43,"",?56,"Visits",?65,"Days",?77,"Days",?90,"Days"
W ?101,"Date",?113,"Days",?125,"Days",?137,"Days",?163,"Total"
W !,"of",?16,"of",?25,"with",?33,"of",?43,"Billed",?56,"Checked",?65,"to PCC",?77,"to",?90,"3p Bill"
W ?101,"Export",?113,"to",?125,"First",?137,"Last",?163,"Posted"
W !,"DOS",?16,"Visits",?25,"Bills",?33,"Bills",?43,"Amount",?56,"in",?65,"CREATED",?77,"Reviewed",?90,"APPROVED"
W ?101,"EXPORTED",?113,"Payment",?125,"Posting",?137,"Posting",?163,"Amounts"
Q
Q:'$G(PGCNT)
W !,EQUALS
W !,"PAGE SUBTOTAL"
W ?17,COLVISIT
W ?26,COLWITBL
W ?33,COLNUMBL
W ?37,$J($FN(COLBILAM,"",2),DOLLARW)
W ?56,$J(COLCHKIN/COLVISIT,GENERALW,DECIMALS)
W ?65,$J(COLCREDY/COLVISIT,GENERALW,DECIMALS)
W ?77,$J(COLREVDY/COLVISIT,GENERALW,DECIMALS)
W ?90,$J(COLTPBA/COLVISIT,GENERALW,DECIMALS)
W ?101,$J(COLTPBX/COLVISIT,GENERALW,DECIMALS)
W:COLTOPY'=0 ?113,$J(COLTOPY/COLTOTPY,GENERALW,DECIMALS)
W:COLTOPY'=0 ?125,$J(COLEARPY/COLTOTPY,GENERALW,DECIMALS)
W:COLTOPY'=0 ?137,$J(COLLSTPY/COLTOTPY,GENERALW,DECIMALS)
W ?155,$J($FN(COLTOTPS,"",2),DOLLARW)
S (COLVISIT,COLWITBL,COLNUMBL,COLBILAM,COLCHKIN,COLCREDY,COLREVDY)=0
S (COLTPBA,COLTPBX,COLTOPY,COLLSTPY,COLTOTPS,PGCNT,COLTOTPY)=0
D FOOTNOTE
Q
;W !,"NOTE: THE '# OF BILLS' COLUMN MAY NOT EQUAL THE '# OF VISITS WITH BILLS' BECAUSE"
;W !?7,"NOT ALL BILLS ARE UTILIZED IN THE CALCULATIONS. I.E. PROVIDER OR BILLING ENITITY NOT CHOSEN TO INCLUDE. BILLS SCREENED=",$G(BILLREJT)
Q
;PULL TOTAL COLLECTIONS FOR DATE RANGE OF INTEREST
COLLECT(START,END,COLLAMT) ;EP -
N ENTRY,DEBIT,CREDIT
S ENTRY=START-.01
S END=END_".24"
F S ENTRY=$O(^BARTR(DUZ(2),"B",ENTRY)) Q:ENTRY=""!(ENTRY>END) D
.S MONTHYR=$E(ENTRY,4,5)_$E(ENTRY,2,3)
.S THISYR=$E(DT,1,3)
.S REC=""
.F S REC=$O(^BARTR(DUZ(2),"B",ENTRY,REC)) Q:'REC D
..S POSTAMT=$$GET1^DIQ(90050.03,REC_",",2)
..S:POSTAMT="" POSTAMT=$$GET1^DIQ(90050.03,REC_",",3)
..S COLLAMT=COLLAMT+POSTAMT
..S COLLAMT(MONTHYR)=$G(COLLAMT(MONTHYR))+POSTAMT
Q
BARDYSPR ; IHS/SD/TPF - DAYS IN A/R REPORT PRINT DRIVER;
+1 ;;1.8;IHS ACCOUNTS RECEIVABLE;**16,28**;OCT 26, 2005;Build 92
+2 ;IHS/SD/SDR 1.8*28 - HEAT224215 - Added code to write comma-delmtd or detl report
+3 ;IHS/DIT/CPC - 1.8*28 - CR8345 - Changed delimited file format, added spreadsheet XML option
+4 QUIT
+5 ;
PRINTAPP ;EP -
+1 NEW MONTHYR
+2 SET BAR("PG")=0
+3 DO APPHDR
+4 SET (TOTBILLD,TOTCOL,TOTBILLS,TOTVISIT)=0
+5 SET MONTHYR=""
+6 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+7 WRITE !,$$MONTH^BARDYSPR(+$PIECE(MONTHYR," ",2))_" ",$PIECE(MONTHYR," ")
+8 WRITE ?20,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR)),7,0)
+9 WRITE ?30,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","BILLNUM",MONTHYR)),7,0)
+10 WRITE ?43,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","AMTBILLD",MONTHYR)),10,2)
+11 WRITE ?60,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","COLLAMT",MONTHYR)),10,2)
+12 SET TOTBILLD=TOTBILLD+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","AMTBILLD",MONTHYR))
+13 SET TOTCOL=TOTCOL+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","COLLAMT",MONTHYR))
+14 SET TOTBILLS=TOTBILLS+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","BILLNUM",MONTHYR))
+15 SET TOTVISIT=TOTVISIT+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL APPROVAL","NUMVISIT",MONTHYR))
End DoDot:1
+16 WRITE !?20,"=======",?30,"======="
+17 WRITE ?45,"========",?60,"=========="
+18 ;PRINT GRAND TOTALS
+19 WRITE !,"GRAND TOTALS",?20,$JUSTIFY(TOTVISIT,7,0),?30,$JUSTIFY(TOTBILLS,7,0),?43,$JUSTIFY(TOTBILLD,10,2),?60,$JUSTIFY(TOTCOL,10,2)
+20 IF IOST[("P-")
DO ^%ZISC
QUIT
+21 KILL DIR
SET DIR(0)="E"
DO ^DIR
+22 QUIT
APPHDR ;EP -
+1 SET BAR("PG")=BAR("PG")+1
+2 DO HD^BARRHD
+3 DO WHD^BARRHD
+4 WRITE !!!,"MONTH",?20,"NUMBER",?30,"#",?45,""
+5 WRITE !,"OF",?20,"OF",?30,"OF",?45,"Billed",?60,"Collection"
+6 WRITE !,"VISIT",?20,"VISITS",?30,"Bills",?45,"Amount",?60,"Amount"
+7 QUIT
PRINTVIS ;EP -
+1 NEW MTH,YR,MONTHYR,ESC
+2 SET ESC=0
+3 SET $PIECE(EQUALS,"=",181)=""
+4 SET BAR(180)=""
+5 ;DOLLAR COL WIDTH
SET DOLLARW=14
+6 ;UNIT COL WIDTH
SET GENERALW=5
+7 ;HOW MANY DECIMALS FOR AVERAGES
SET DECIMALS=2
+8 SET BAR("PG")=0
+9 ;bar*1.8*27 IHS/SD/SDR HEAT224215
IF BARY("SUMORDET")="D"
DO PRNTDET^BARDYSV6
QUIT
+10 ;bar*1.8*27 IHS/SD/SDR HEAT224215
IF BARY("COMMADELIM")=1
DO PRTVSCOM^BARDYSV7
QUIT
+11 DO VISHDR
+12 ;THESE ARE PAGE SUBTOTALS
+13 SET (COLVISIT,COLWITBL,COLNUMBL,COLBILAM,COLCHKIN,COLCREDY,COLREVDY)=0
+14 SET (COLTPBA,COLTPBX,COLTOPY,COLEARPY,COLLSTPY,COLTOTPS,PGCNT)=0
+15 ;TOT PAY MADE
SET COLTOTPY=0
+16 SET MONTHYR=""
+17 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+18 SET YR=$PIECE(MONTHYR," ")
+19 SET MTH=$$MONTH(+$PIECE(MONTHYR," ",2))
+20 IF (IOST[("C-"))
IF ($Y>(IOSL-6))
DO VISFOOT
KILL DIR
SET DIR(0)="E"
DO ^DIR
SET ESC=X=U
IF 'ESC
DO VISHDR
+21 IF (IOST[("P-"))
IF ($Y>(IOSL-16))
DO VISFOOT
DO VISHDR
+22 SET PGCNT=PGCNT+1
+23 ;TOT PAYMENTS MADE
+24 SET COLTOTPY=COLTOTPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))
+25 ;MONTH of DOS
+26 WRITE !,MTH," ",YR
+27 ;;# of Visits
+28 WRITE ?17,$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
+29 SET COLVISIT=COLVISIT+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
+30 ;# Visits with Bills
+31 WRITE ?26,$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
+32 SET COLWITBL=COLWITBL+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
+33 ;# of Bills
+34 WRITE ?33,$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
+35 SET COLNUMBL=COLNUMBL+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
+36 ;Billed Amount
+37 WRITE ?37,$JUSTIFY($FNUMBER($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)),"",2),DOLLARW)
+38 SET COLBILAM=COLBILAM+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
+39 ;AVG Visits Checked in
+40 IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+41 WRITE ?56,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+42 SET COLCHKIN=COLCHKIN+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))
End DoDot:2
+43 ;AVG Days to PCC CREATED
+44 IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+45 WRITE ?65,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+46 SET COLCREDY=COLCREDY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))
End DoDot:2
+47 ;AVG Days to Reviewed
+48 IF +^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)'=0
Begin DoDot:2
+49 WRITE ?77,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+50 SET COLREVDY=COLREVDY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))
End DoDot:2
+51 ;AVG Days to 3P APPROVED
+52 IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+53 WRITE ?90,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+54 SET COLTPBA=COLTPBA+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))
End DoDot:2
+55 ;AVG Days to EXPORTED
+56 IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+57 WRITE ?101,$JUSTIFY($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))/^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR),GENERALW,DECIMALS)
+58 SET COLTPBX=COLTPBX+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))
End DoDot:2
+59 ;AVG Days to Payment
+60 IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+61 WRITE ?113,$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)
+62 SET COLTOPY=COLTOPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))
End DoDot:2
+63 ;AVG Days to First Posting
+64 IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+65 WRITE ?125,$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)
+66 SET COLEARPY=COLEARPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))
End DoDot:2
+67 ;AVG Days to Last Posting
+68 IF +$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))'=0
Begin DoDot:2
+69 WRITE ?137,$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)
+70 SET COLLSTPY=COLLSTPY+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))
End DoDot:2
+71 ;Total Posted Amounts
+72 WRITE ?155,$JUSTIFY($FNUMBER($GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)),"",2),DOLLARW)
+73 SET COLTOTPS=COLTOTPS+$GET(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
End DoDot:1
IF +$GET(ESC)
QUIT
+74 WRITE !,EQUALS
+75 ;DO THE GRAND TOTALS
+76 SET MONTHYR=""
+77 SET NUMVISIT("GRANDTOT")=0
+78 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+79 SET NUMVISIT("GRANDTOT")=NUMVISIT("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","NUMVISIT","MONTHYR",MONTHYR)
End DoDot:1
+80 WRITE !,"GRAND TOTAL:",?17,NUMVISIT("GRANDTOT")
+81 SET MONTHYR=""
+82 SET WITBILLS("GRANDTOT")=0
+83 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+84 SET WITBILLS("GRANDTOT")=WITBILLS("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","WITBILLS","MONTHYR",MONTHYR)
End DoDot:1
+85 WRITE ?26,WITBILLS("GRANDTOT")
+86 SET BILLNUM("GRANDTOT")=0
+87 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+88 SET BILLNUM("GRANDTOT")=BILLNUM("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BILLNUM","MONTHYR",MONTHYR)
End DoDot:1
+89 WRITE ?33,BILLNUM("GRANDTOT")
+90 SET AMTBILLD("GRANDTOT")=0
+91 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+92 SET AMTBILLD("GRANDTOT")=AMTBILLD("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AMTBILLD","MONTHYR",MONTHYR)
End DoDot:1
+93 WRITE ?37,$JUSTIFY($FNUMBER(AMTBILLD("GRANDTOT"),"",2),DOLLARW)
+94 SET AVGCHKIN("GRANDTOT")=0
+95 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+96 SET AVGCHKIN("GRANDTOT")=AVGCHKIN("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","AVGCHKIN","MONTHYR",MONTHYR)
End DoDot:1
+97 IF $GET(NUMVISIT("GRANDTOT"))
WRITE ?56,$JUSTIFY(AVGCHKIN("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
+98 SET CREDAYS("GRANDTOT")=0
+99 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+100 SET CREDAYS("GRANDTOT")=CREDAYS("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","CREDAYS","MONTHYR",MONTHYR)
End DoDot:1
+101 IF $GET(NUMVISIT("GRANDTOT"))
WRITE ?65,$JUSTIFY(CREDAYS("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
+102 SET REVDAYS("GRANDTOT")=0
+103 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+104 SET REVDAYS("GRANDTOT")=REVDAYS("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","REVDAYS","MONTHYR",MONTHYR)
End DoDot:1
+105 IF $GET(NUMVISIT("GRANDTOT"))
WRITE ?77,$JUSTIFY(REVDAYS("GRANDTOT")/NUMVISIT("GRANDTOT"),GENERALW,DECIMALS)
+106 SET DAYSAPP("GRANDTOT")=0
+107 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+108 SET DAYSAPP("GRANDTOT")=DAYSAPP("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSAPP","MONTHYR",MONTHYR)
End DoDot:1
+109 IF $GET(BILLNUM("GRANDTOT"))
WRITE ?90,$JUSTIFY(DAYSAPP("GRANDTOT")/BILLNUM("GRANDTOT"),GENERALW,DECIMALS)
+110 SET DAYSEXP("GRANDTOT")=0
+111 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+112 SET DAYSEXP("GRANDTOT")=DAYSEXP("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DAYSEXP","MONTHYR",MONTHYR)
End DoDot:1
+113 IF $GET(BILLNUM("GRANDTOT"))
WRITE ?101,$JUSTIFY(DAYSEXP("GRANDTOT")/BILLNUM("GRANDTOT"),GENERALW,DECIMALS)
+114 SET NUMPAYMT("GRANDTOT")=0
+115 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+116 SET NUMPAYMT("GRANDTOT")=NUMPAYMT("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT PAY MADE","MONTHYR",MONTHYR)
End DoDot:1
+117 SET NUMFIRST("GRANDTOT")=0
+118 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+119 SET NUMFIRST("GRANDTOT")=NUMFIRST("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT FIRST PAYMENT MADE","MONTHYR",MONTHYR)
End DoDot:1
+120 SET NUMLAST("GRANDTOT")=0
+121 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+122 SET NUMLAST("GRANDTOT")=NUMLAST("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOT LAST PAYMENT MADE","MONTHYR",MONTHYR)
End DoDot:1
+123 SET DYSTOPAY("GRANDTOT")=0
+124 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+125 SET DYSTOPAY("GRANDTOT")=DYSTOPAY("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","DYSTOPAY","MONTHYR",MONTHYR)
End DoDot:1
+126 IF $GET(NUMPAYMT("GRANDTOT"))
WRITE ?113,$JUSTIFY(DYSTOPAY("GRANDTOT")/NUMPAYMT("GRANDTOT"),GENERALW,DECIMALS)
+127 SET EARLYPAY("GRANDTOT")=0
+128 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+129 SET EARLYPAY("GRANDTOT")=EARLYPAY("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","EARLYPAY","MONTHYR",MONTHYR)
End DoDot:1
+130 IF $GET(NUMFIRST("GRANDTOT"))
WRITE ?125,$JUSTIFY(EARLYPAY("GRANDTOT")/NUMFIRST("GRANDTOT"),GENERALW,DECIMALS)
+131 SET LASTPAY("GRANDTOT")=0
+132 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+133 SET LASTPAY("GRANDTOT")=LASTPAY("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","LASTPAY","MONTHYR",MONTHYR)
End DoDot:1
+134 IF $GET(NUMLAST("GRANDTOT"))
WRITE ?137,$JUSTIFY(LASTPAY("GRANDTOT")/NUMLAST("GRANDTOT"),GENERALW,DECIMALS)
+135 SET TOTPOST("GRANDTOT")=0
+136 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR))
IF MONTHYR=""
QUIT
Begin DoDot:1
+137 SET TOTPOST("GRANDTOT")=TOTPOST("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","TOTPOST","MONTHYR",MONTHYR)
End DoDot:1
+138 WRITE ?155,$JUSTIFY($FNUMBER(TOTPOST("GRANDTOT"),"",2),DOLLARW)
+139 SET TOTNOEXP("GRANDTOT")=0
+140 SET MONTHYR=""
+141 FOR
SET MONTHYR=$ORDER(^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR))
IF 'MONTHYR
QUIT
Begin DoDot:1
+142 SET TOTNOEXP("GRANDTOT")=TOTNOEXP("GRANDTOT")+^XTMP("BARDYSVS",$JOB,"DAYS TO COL VISIT","BLLNOEXP","MONTHYR",MONTHYR)
End DoDot:1
+143 WRITE !,"TOTAL BILLS WITH NO EXPORT: ",TOTNOEXP("GRANDTOT")
+144 IF IOST[("P-")
DO ^%ZISC
QUIT
+145 KILL DIR
SET DIR(0)="E"
DO ^DIR
+146 QUIT
MONTH(X) ;EP -
+1 QUIT $SELECT(X=1:"JAN",X=2:"FEB",X=3:"MAR",X=4:"APR",X=5:"MAY",X=6:"JUN",X=7:"JUL",X=8:"AUG",X=9:"SEP",X=10:"OCT",X=11:"NOV",X=12:"DEC",1:"UNK")
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 !,"",?16,"",?25,"#",?33,"",?43,"",?56,"AVG",?65,"AVG",?77,"AVG",?90,"AVG"
+8 WRITE ?101,"AVG",?113,"AVG",?125,"AVG",?137,"AVG"
+9 WRITE !,"Month",?16,"#",?25,"Visits",?33,"#",?43,"",?56,"Visits",?65,"Days",?77,"Days",?90,"Days"
+10 WRITE ?101,"Date",?113,"Days",?125,"Days",?137,"Days",?163,"Total"
+11 WRITE !,"of",?16,"of",?25,"with",?33,"of",?43,"Billed",?56,"Checked",?65,"to PCC",?77,"to",?90,"3p Bill"
+12 WRITE ?101,"Export",?113,"to",?125,"First",?137,"Last",?163,"Posted"
+13 WRITE !,"DOS",?16,"Visits",?25,"Bills",?33,"Bills",?43,"Amount",?56,"in",?65,"CREATED",?77,"Reviewed",?90,"APPROVED"
+14 WRITE ?101,"EXPORTED",?113,"Payment",?125,"Posting",?137,"Posting",?163,"Amounts"
+15 QUIT
+1 IF '$GET(PGCNT)
QUIT
+2 WRITE !,EQUALS
+3 WRITE !,"PAGE SUBTOTAL"
+4 WRITE ?17,COLVISIT
+5 WRITE ?26,COLWITBL
+6 WRITE ?33,COLNUMBL
+7 WRITE ?37,$JUSTIFY($FNUMBER(COLBILAM,"",2),DOLLARW)
+8 WRITE ?56,$JUSTIFY(COLCHKIN/COLVISIT,GENERALW,DECIMALS)
+9 WRITE ?65,$JUSTIFY(COLCREDY/COLVISIT,GENERALW,DECIMALS)
+10 WRITE ?77,$JUSTIFY(COLREVDY/COLVISIT,GENERALW,DECIMALS)
+11 WRITE ?90,$JUSTIFY(COLTPBA/COLVISIT,GENERALW,DECIMALS)
+12 WRITE ?101,$JUSTIFY(COLTPBX/COLVISIT,GENERALW,DECIMALS)
+13 IF COLTOPY'=0
WRITE ?113,$JUSTIFY(COLTOPY/COLTOTPY,GENERALW,DECIMALS)
+14 IF COLTOPY'=0
WRITE ?125,$JUSTIFY(COLEARPY/COLTOTPY,GENERALW,DECIMALS)
+15 IF COLTOPY'=0
WRITE ?137,$JUSTIFY(COLLSTPY/COLTOTPY,GENERALW,DECIMALS)
+16 WRITE ?155,$JUSTIFY($FNUMBER(COLTOTPS,"",2),DOLLARW)
+17 SET (COLVISIT,COLWITBL,COLNUMBL,COLBILAM,COLCHKIN,COLCREDY,COLREVDY)=0
+18 SET (COLTPBA,COLTPBX,COLTOPY,COLLSTPY,COLTOTPS,PGCNT,COLTOTPY)=0
+19 DO FOOTNOTE
+20 QUIT
+1 ;W !,"NOTE: THE '# OF BILLS' COLUMN MAY NOT EQUAL THE '# OF VISITS WITH BILLS' BECAUSE"
+2 ;W !?7,"NOT ALL BILLS ARE UTILIZED IN THE CALCULATIONS. I.E. PROVIDER OR BILLING ENITITY NOT CHOSEN TO INCLUDE. BILLS SCREENED=",$G(BILLREJT)
+3 QUIT
+4 ;PULL TOTAL COLLECTIONS FOR DATE RANGE OF INTEREST
COLLECT(START,END,COLLAMT) ;EP -
+1 NEW ENTRY,DEBIT,CREDIT
+2 SET ENTRY=START-.01
+3 SET END=END_".24"
+4 FOR
SET ENTRY=$ORDER(^BARTR(DUZ(2),"B",ENTRY))
IF ENTRY=""!(ENTRY>END)
QUIT
Begin DoDot:1
+5 SET MONTHYR=$EXTRACT(ENTRY,4,5)_$EXTRACT(ENTRY,2,3)
+6 SET THISYR=$EXTRACT(DT,1,3)
+7 SET REC=""
+8 FOR
SET REC=$ORDER(^BARTR(DUZ(2),"B",ENTRY,REC))
IF 'REC
QUIT
Begin DoDot:2
+9 SET POSTAMT=$$GET1^DIQ(90050.03,REC_",",2)
+10 IF POSTAMT=""
SET POSTAMT=$$GET1^DIQ(90050.03,REC_",",3)
+11 SET COLLAMT=COLLAMT+POSTAMT
+12 SET COLLAMT(MONTHYR)=$GET(COLLAMT(MONTHYR))+POSTAMT
End DoDot:2
End DoDot:1
+13 QUIT