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

BARDYSPR.m

Go to the documentation of this file.
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
VISFOOT ;EP -
 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
FOOTNOTE ;EP -
 ;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