Exemplo n.º 1
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            carrier = PIn.String(textBoxCarrier.Text);
            ReportComplex report       = new ReportComplex(true, false);
            DataTable     table        = RpInsCo.GetInsCoTable(carrier);
            Font          font         = new Font("Tahoma", 8);
            Font          fontTitle    = new Font("Tahoma", 15, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Insurance Plan List");
            report.AddTitle("Title", Lan.g(this, "Insurance Plan List"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Carrier Name", 230, font);
            query.AddColumn("Subscriber Name", 175, font);
            query.AddColumn("Carrier Phone#", 175, font);
            query.AddColumn("Group Name", 165, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            report.AddFooterText("Total", "Total: " + report.TotalRows.ToString(), font, 10, ContentAlignment.MiddleRight);
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 2
0
        private void butOK_Click(object sender, EventArgs e)
        {
            ReportComplex report       = new ReportComplex(true, false);
            DataTable     table        = RpDiscountPlan.GetTable(textDescription.Text);
            Font          font         = new Font("Tahoma", 8);
            Font          fontTitle    = new Font("Tahoma", 15, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Discount Plan List");
            report.AddTitle("Title", Lan.g(this, "Discount Plan List"), fontTitle);
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Description", 230, font);
            query.AddColumn("FeeSched", 175, font);
            query.AddColumn("AdjType", 175, font);
            query.AddColumn("Patient", 165, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            report.AddFooterText("Total", "Total: " + report.TotalRows.ToString(), font, 10, ContentAlignment.MiddleRight);
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 3
0
        private void butReport_Click(object sender, System.EventArgs e)
        {
            if (!validDateFrom.IsValid || !validDateTo.IsValid)
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }

            DateTime dateFrom = PIn.Date(validDateFrom.Text);
            DateTime dateTo   = PIn.Date(validDateTo.Text);

            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            if (dateFrom.AddYears(1) <= dateTo)
            {
                MsgBox.Show(this, "Date range must not exceed 1 year.");
                return;
            }
            ReportComplex report       = new ReportComplex(true, false);
            Font          font         = new Font("Tahoma", 9);
            Font          fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Birthdays");
            report.AddTitle("Title", Lan.g(this, "Birthdays"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(), fontSubTitle);
            QueryObject query = report.AddQuery(RpBirthday.GetBirthdayTable(dateFrom, dateTo), "", "", SplitByKind.None, 1, true);

            query.AddColumn("LName", 90, FieldValueType.String, font);
            query.AddColumn("FName", 90, FieldValueType.String, font);
            query.AddColumn("Preferred", 90, FieldValueType.String, font);
            query.AddColumn("Address", 90, FieldValueType.String, font);
            query.AddColumn("Address2", 90, FieldValueType.String, font);
            query.AddColumn("City", 75, FieldValueType.String, font);
            query.AddColumn("State", 60, FieldValueType.String, font);
            query.AddColumn("Zip", 75, FieldValueType.String, font);
            query.AddColumn("Birthdate", 75, FieldValueType.Date, font);
            query.GetColumnDetail("Birthdate").StringFormat = "d";
            query.AddColumn("Age", 45, FieldValueType.Integer, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 4
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            ReportComplex report    = new ReportComplex(true, true);
            FeeSched      feeSched  = _listFeeScheds[listBoxFeeSched.SelectedIndex];
            long          clinicNum = 0;

            if (listBoxClinics.SelectedIndex > 0)
            {
                clinicNum = _listClinics[listBoxClinics.SelectedIndex - 1].ClinicNum;
            }
            long provNum = 0;

            if (listBoxProviders.SelectedIndex > 0)
            {
                provNum = _listProviders[listBoxProviders.SelectedIndex - 1].ProvNum;
            }
            DataTable dataTable = RpProcCodes.GetData(feeSched.FeeSchedNum, clinicNum, provNum, radioCategories.Checked, checkShowBlankFees.Checked);

            report.ReportName = "Procedure Codes - Fee Schedules";
            report.AddTitle("Title", Lan.g(this, "Procedure Codes - Fee Schedules"));
            report.AddSubTitle("Fee Schedule", feeSched.Description);
            report.AddSubTitle("Clinic", listBoxClinics.Items[listBoxClinics.SelectedIndex].ToString());
            report.AddSubTitle("Provider", listBoxProviders.Items[listBoxProviders.SelectedIndex].ToString());
            report.AddSubTitle("Date", DateTime.Now.ToShortDateString());
            QueryObject queryObject = new QueryObject();

            queryObject = report.AddQuery(dataTable, "", "", SplitByKind.None, 1, true);
            if (radioCategories.Checked)
            {
                queryObject.AddColumn("Category", 100, FieldValueType.String);
                queryObject.GetColumnDetail("Category").SuppressIfDuplicate = true;
            }
            queryObject.AddColumn("Code", 100, FieldValueType.String);
            queryObject.AddColumn("Desc", 600, FieldValueType.String);
            queryObject.AddColumn("Abbr", 100, FieldValueType.String);
            queryObject.AddColumn("Fee", 100, FieldValueType.String);
            queryObject.GetColumnDetail("Fee").ContentAlignment = ContentAlignment.MiddleRight;
            queryObject.GetColumnDetail("Fee").StringFormat     = "C";       //This isn't working...
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
        //Only called in FillGrid().
        private void RefreshReport()
        {
            bool hasValidationPassed = ValidateFields();
            //Above line also sets "All" clinics option if no items are selected.
            DataTable tableNotBilled = new DataTable();

            if (hasValidationPassed)
            {
                //not truly all clinics; just the ones user has permission for
                tableNotBilled = RpProcNotBilledIns.GetProcsNotBilled(comboClinics.ListSelectedClinicNums, checkMedical.Checked, _myReportDateFrom, _myReportDateTo,
                                                                      checkShowProcsNoIns.Checked, checkShowProcsInProcess.Checked);
            }
            string subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                subtitleClinics = Lan.g(this, "Clinics: ") + comboClinics.GetStringSelectedClinics();
            }
            //This report will never show progress for printing.  This is because the report is being rebuilt whenever the grid is refreshed.
            _myReport            = new ReportComplex(true, false, false);
            _myReport.ReportName = Lan.g(this, "Procedures Not Billed to Insurance");
            _myReport.AddTitle("Title", Lan.g(this, "Procedures Not Billed to Insurance"));
            _myReport.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle));
            if (_myReportDateFrom == _myReportDateTo)
            {
                _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString());
            }
            else
            {
                _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString() + " - " + _myReportDateTo.ToShortDateString());
            }
            if (PrefC.HasClinicsEnabled)
            {
                _myReport.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = _myReport.AddQuery(tableNotBilled, DateTimeOD.Today.ToShortDateString());

            query.AddColumn("Patient Name", _colWidthPatName, FieldValueType.String);
            query.AddColumn("Stat", _colWidthStat, FieldValueType.String);
            query.AddColumn("Procedure Date", _colWidthProcDate, FieldValueType.Date);
            query.GetColumnDetail("Procedure Date").StringFormat = "d";
            query.AddColumn("Procedure Description", 300, FieldValueType.String);
            query.AddColumn("Amount", _colWidthAmount, FieldValueType.Number);
            _myReport.AddPageNum();
            if (!_myReport.SubmitQueries(false))             //If we are loading and there are no results for _myReport do not show msgbox found in SubmitQueryies(...).
            {
                return;
            }
        }
Exemplo n.º 6
0
        private void ExecuteGroup()
        {
            Font          font         = new Font("Tahoma", 9);
            Font          fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);
            ReportComplex report       = new ReportComplex(true, false);

            report.AddTitle("Title", Lan.g(this, "PPO Writeoffs"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToShortDateString() + " - " + date2.SelectionStart.ToShortDateString(), fontSubTitle);
            report.AddSubTitle("Claims", Lan.g(this, "Individual Claims"), fontSubTitle);
            if (textCarrier.Text != "")
            {
                report.AddSubTitle("Carrier", Lan.g(this, "Carrier like: ") + textCarrier.Text, fontSubTitle);
            }
            if (textCarrier.Text != "")
            {
                report.AddSubTitle("Carrier", Lan.g(this, "Carrier like: ") + textCarrier.Text, fontSubTitle);
            }
            DataTable   table = RpPPOwriteoff.GetWriteoffTable(date1.SelectionStart, date2.SelectionStart, radioIndividual.Checked, textCarrier.Text, GetWriteoffType());
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"), "", SplitByKind.None, 1, true);

            query.AddColumn("Carrier", 180, FieldValueType.String, font);
            query.AddColumn("Stand Fee", 80, FieldValueType.Number, font);
            query.AddColumn("PPO Fee", 80, FieldValueType.Number, font);
            query.AddColumn("Writeoff", 80, FieldValueType.Number, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                DialogResult = DialogResult.Cancel;
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 7
0
        ///<summary>Uses the report complex pattern to print the same report generated by FillGrid()</summary>
        private void butRunReport_Click(object sender, EventArgs e)
        {
            if (!ValidateFilters())
            {
                return;
            }
            ReportComplex report          = new ReportComplex(true, false);
            List <long>   listClinicNums  = comboClinicMulti.ListSelectedClinicNums;
            DataTable     table           = RpClaimNotSent.GetClaimsNotSent(_startDate, _endDate, listClinicNums, true, (ClaimNotSentStatuses)comboBoxInsFilter.SelectedItem);
            string        subtitleClinics = "";

            subtitleClinics   = comboClinicMulti.GetStringSelectedClinics();
            report.ReportName = Lan.g(this, "Claims Not Sent");
            report.AddTitle("Title", Lan.g(this, "Claims Not Sent"));
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = report.AddQuery(table, "Date: " + DateTimeOD.Today.ToShortDateString());

            if (PrefC.HasClinicsEnabled)
            {
                query.AddColumn("Clinic", 60, FieldValueType.String);
            }
            query.AddColumn("Date", 85, FieldValueType.Date);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Type", 90, FieldValueType.String);
            query.AddColumn("Claim Status", 100, FieldValueType.String);
            query.AddColumn("Patient Name", 150, FieldValueType.String);
            query.AddColumn("Insurance Carrier", 150, FieldValueType.String);
            query.AddColumn("Amount", 90, FieldValueType.Number);
            query.AddColumn("Proc Codes", 90);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 8
0
        private void CreateGrouped()
        {
            ReportComplex report          = new ReportComplex(true, false);
            DataTable     table           = RpProcSheet.GetGroupedTable(date1.SelectionStart, date2.SelectionStart, _listProvNums, _listClinicNums, textCode.Text, checkAllProv.Checked);
            string        subtitleProvs   = ConstructProviderSubtitle();
            string        subtitleClinics = ConstructClinicSubtitle();
            Font          font            = new Font("Tahoma", 9);
            Font          fontBold        = new Font("Tahoma", 9, FontStyle.Bold);
            Font          fontTitle       = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle    = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Procedures By Procedure Code");
            report.AddTitle("Title", Lan.g(this, "Procedures By Procedure Code"), fontTitle);
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Dates of Report", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle);
            report.AddSubTitle("Providers", subtitleProvs, fontSubTitle);
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle);
            }
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn(Lan.g(this, "Category"), 150, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Code"), 130, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Description"), 140, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Quantity"), 60, FieldValueType.Integer, font);
            query.GetColumnDetail(Lan.g(this, "Quantity")).ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn(Lan.g(this, "Average Fee"), 110, FieldValueType.String, font);
            query.GetColumnDetail(Lan.g(this, "Average Fee")).ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn(Lan.g(this, "Total Fees"), 110, FieldValueType.Number, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 9
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            ReportComplex report       = new ReportComplex(true, false);
            DataTable     table        = RpPrescriptions.GetPrescriptionTable(radioPatient.Checked, textBoxInput.Text);
            Font          font         = new Font("Tahoma", 9);
            Font          fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font          fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Prescriptions");
            report.AddTitle("Title", Lan.g(this, "Prescriptions"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            if (radioPatient.Checked)
            {
                report.AddSubTitle("By Patient", "By Patient");
            }
            else
            {
                report.AddSubTitle("By Drug", "By Drug");
            }
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Patient Name", 120, FieldValueType.String);
            query.AddColumn("Date", 95, FieldValueType.Date);
            query.AddColumn("Drug Name", 100, FieldValueType.String);
            query.AddColumn("Directions", 300);
            query.AddColumn("Dispense", 100);
            query.AddColumn("Prov Name", 100, FieldValueType.String);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 10
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            if (listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (listProv.SelectedIndices[0] == 0 && listProv.SelectedIndices.Count > 1)
            {
                MsgBox.Show(this, "You cannot select 'all' providers as well as specific providers.");
                return;
            }
            DateTime dateFrom = PIn.Date(textDateFrom.Text);
            DateTime dateTo   = PIn.Date(textDateTo.Text);

            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            ReportComplex report;

            if (checkAddress.Checked)
            {
                report = new ReportComplex(true, true);
            }
            else
            {
                report = new ReportComplex(true, false);
            }
            List <long>     listProvNums  = new List <long>();
            List <Provider> listProvs     = Providers.GetListReports();
            string          subtitleProvs = "";

            if (listProv.SelectedIndices[0] == 0)           //'All' is selected
            {
                for (int i = 0; i < listProvs.Count; i++)
                {
                    listProvNums.Add(listProvs[i].ProvNum);
                    subtitleProvs = Lan.g(this, "All Providers");
                }
            }
            else
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(listProvs[listProv.SelectedIndices[i] - 1].ProvNum);                  //Minus 1 from the selected index to account for 'All' option
                    if (i > 0)
                    {
                        subtitleProvs += ", ";
                    }
                    subtitleProvs += listProvs[listProv.SelectedIndices[i] - 1].Abbr;                //Minus 1 from the selected index to account for 'All' option
                }
            }
            DataTable table        = RpNewPatients.GetNewPatients(dateFrom, dateTo, listProvNums, checkAddress.Checked, checkProd.Checked, listProv.SelectedIndices[0] == 0);
            Font      font         = new Font("Tahoma", 9);
            Font      fontBold     = new Font("Tahoma", 9, FontStyle.Bold);
            Font      fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font      fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "New Patients");
            report.AddTitle("Title", Lan.g(this, "New Patients"), fontTitle);
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Providers", subtitleProvs, fontSubTitle);
            report.AddSubTitle("Dates of Report", dateFrom.ToString("d") + " - " + dateTo.ToString("d"), fontSubTitle);
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn(Lan.g(this, "#"), 40, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Date"), 90, FieldValueType.Date, font);
            query.AddColumn(Lan.g(this, "Last Name"), 120, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "First Name"), 120, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Referral"), 140, FieldValueType.String, font);
            query.AddColumn(Lan.g(this, "Production Fee"), 90, FieldValueType.Number, font);
            if (checkAddress.Checked)
            {
                query.AddColumn(Lan.g(this, "Pref'd"), 90, FieldValueType.String, font);
                query.AddColumn(Lan.g(this, "Address"), 100, FieldValueType.String, font);
                query.AddColumn(Lan.g(this, "Add2"), 80, FieldValueType.String, font);
                query.AddColumn(Lan.g(this, "City"), 100, FieldValueType.String, font);
                query.AddColumn(Lan.g(this, "ST"), 30, FieldValueType.String, font);
                query.AddColumn(Lan.g(this, "Zip"), 55, FieldValueType.String, font);
            }
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 11
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (date2.SelectionStart < date1.SelectionStart)
            {
                MsgBox.Show(this, "End date cannot be before start date.");
                return;
            }
            if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (_hasClinicsEnabled)
            {
                if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            List <long> listClinicNums = new List <long>();

            for (int i = 0; i < listClin.SelectedIndices.Count; i++)
            {
                if (Security.CurUser.ClinicIsRestricted)
                {
                    listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                    //we know that the list is a 1:1 to _listClinics
                }
                else
                {
                    if (listClin.SelectedIndices[i] == 0)
                    {
                        listClinicNums.Add(0);
                    }
                    else
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                      //Minus 1 from the selected index
                    }
                }
            }
            List <string> listProvNames = new List <string>();
            List <long>   listProvNums  = new List <long>();

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                    listProvNames.Add(_listProviders[i].Abbr);
                }
            }
            else
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum);
                    listProvNames.Add(_listProviders[listProv.SelectedIndices[i]].Abbr);
                }
            }
            ReportComplex report = new ReportComplex(true, false);
            DataTable     table  = RpWriteoffSheet.GetWriteoffTable(date1.SelectionStart, date2.SelectionStart, listProvNums, listClinicNums
                                                                    , checkAllClin.Checked, _hasClinicsEnabled, GetWriteoffType());
            Font font         = new Font("Tahoma", 9);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Daily Writeoffs");
            report.AddTitle("Title", Lan.g(this, "Daily Writeoffs"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle);
            if (checkAllProv.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                report.AddSubTitle("Providers", string.Join(", ", listProvNames));
            }
            if (_hasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Date", 100, FieldValueType.Date);
            query.AddColumn("Patient Name", 150);
            query.AddColumn("Carrier", 225);
            query.AddColumn("Provider", 60);
            if (_hasClinicsEnabled)
            {
                query.AddColumn("Clinic", 80);
            }
            query.AddColumn("Amount", 75, FieldValueType.Number);
            query.GetColumnDetail("Amount").ContentAlignment = ContentAlignment.MiddleRight;
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 12
0
        private void butNetUnearnedOK_Click(object sender, EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkNetUnearnedAllClins.Checked && listNetUnearnedClins.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            if (!checkNetUnearnedAllProvs.Checked && listNetUnearnedProvs.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (!checkNetUnearnedAllTypes.Checked && listNetUnearnedTypes.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one unearned type must be selected.");
                return;
            }
            List <long>   listClinicNums       = listNetUnearnedClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum).ToList();
            List <long>   listProvNums         = listNetUnearnedProvs.SelectedItems.OfType <ODBoxItem <Provider> >().Select(x => x.Tag.ProvNum).ToList();
            List <long>   listUnearnedTypeNums = listNetUnearnedTypes.SelectedItems.OfType <ODBoxItem <Def> >().Select(x => x.Tag.DefNum).ToList();
            ReportComplex report = new ReportComplex(true, false);
            DataTable     table  = RpUnearnedIncome.GetNetUnearnedData(listClinicNums, listProvNums, listUnearnedTypeNums, checkNetUnearnedExcludeZero.Checked);

            report.ReportName = "Net Unearned Income Report";
            QueryObject query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);

            query.AddColumn("Patient", 170, FieldValueType.String);
            query.AddColumn("Guarantor", 170, FieldValueType.String);
            query.AddColumn("Unearned Amt", 100, FieldValueType.Number);
            query.AddColumn("Fam Bal", 100, FieldValueType.String);
            report.AddTitle("Title", "Net Unearned Income");
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle));
            if (checkNetUnearnedAllTypes.Checked)
            {
                report.AddSubTitle("UnearnedTypes", "All Unearned Types");
            }
            else
            {
                string unearnedTypes = string.Join(", ", listNetUnearnedTypes.SelectedItems.OfType <ODBoxItem <Def> >().Select(x => x.Tag.ItemName));
                report.AddSubTitle("UnearnedTypes", unearnedTypes);
            }
            if (checkNetUnearnedAllProvs.Checked)
            {
                report.AddSubTitle("Provs", Lan.g(this, "All Providers"));
            }
            else
            {
                string provNames = string.Join(", ", listNetUnearnedProvs.SelectedItems.OfType <ODBoxItem <Provider> >().Select(x => x.Tag.Abbr));
                report.AddSubTitle("ProvNames", provNames);
            }
            if (PrefC.HasClinicsEnabled)             //show sub titles if clinics are enabled.
            {
                if (checkNetUnearnedAllClins.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = string.Join(", ", listNetUnearnedClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.Abbr));
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            //Display report
            FormReportComplex FormRC = new FormReportComplex(report);

            FormRC.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 13
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!checkBillTypesAll.Checked && listBillType.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one billing type must be selected.");
                return;
            }
            if (!checkProvAll.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            if (textDate.errorProvider1.GetError(textDate) != "")
            {
                MsgBox.Show(this, "Invalid date.");
                return;
            }
            DateTime    asOfDate               = PIn.Date(textDate.Text);
            List <long> listProvNums           = new List <long>();
            List <long> listClinicNums         = new List <long>();
            List <long> listBillingTypeDefNums = new List <long>();

            if (!checkProvAll.Checked)
            {
                listProvNums = listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].ProvNum).ToList();
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    listClinicNums = listClin.Items.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum).ToList();
                }
                else
                {
                    listClinicNums = listClin.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum).ToList();
                }
            }
            if (!checkBillTypesAll.Checked)
            {
                for (int i = 0; i < listBillType.SelectedIndices.Count; i++)
                {
                    listBillingTypeDefNums.Add(_listBillingTypeDefs[listBillType.SelectedIndices[i]].DefNum);
                }
            }
            AgeOfAccount accountAge = AgeOfAccount.Any;

            if (radioAny.Checked)
            {
                accountAge = AgeOfAccount.Any;
            }
            else if (radio30.Checked)
            {
                accountAge = AgeOfAccount.Over30;
            }
            else if (radio60.Checked)
            {
                accountAge = AgeOfAccount.Over60;
            }
            else if (radio90.Checked)
            {
                accountAge = AgeOfAccount.Over90;
            }
            ReportComplex report     = new ReportComplex(true, true);
            DataTable     tableAging = new DataTable();

            tableAging = RpInsAging.GetInsAgingTable
                             (asOfDate, radioGroupByFam.Checked, accountAge, checkBillTypesAll.Checked, checkProvAll.Checked, listProvNums, listClinicNums, listBillingTypeDefNums);
            report.ReportName = Lan.g(this, "Insurance Aging Report");
            report.AddTitle("InsAging", Lan.g(this, "Insurance Aging Report"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of ") + textDate.Text);
            if (radioAny.Checked)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            else if (radio30.Checked)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            else if (radio60.Checked)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            else if (radio90.Checked)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (checkBillTypesAll.Checked)
            {
                report.AddSubTitle("AllBillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                string subt = _listBillingTypeDefs[listBillType.SelectedIndices[0]].ItemName;
                for (int i = 1; i < listBillType.SelectedIndices.Count; i++)           //there must be at least one selected
                {
                    subt += ", " + _listBillingTypeDefs[listBillType.SelectedIndices[i]].ItemName;
                }
                report.AddSubTitle("", subt);
            }
            string subtitleProvs = "";

            if (checkProvAll.Checked)
            {
                subtitleProvs = Lan.g(this, "All Providers");
            }
            else
            {
                subtitleProvs += string.Join(", ", listProv.SelectedIndices.OfType <int>().ToList().Select(x => _listProviders[x].Abbr));
            }
            report.AddSubTitle("Providers", subtitleProvs);
            if (checkAllClin.Checked)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                string subt = "";
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (i != 0)
                    {
                        subt += ", ";
                    }
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        subt += _listClinics[listClin.SelectedIndices[i]].Abbr;
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            subt += "Unassigned";
                            continue;
                        }
                        subt += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;
                    }
                }
                report.AddSubTitle("Clinics", subt);
            }
            //Patient Account Aging Query-----------------------------------------------
            QueryObject query = report.AddQuery(tableAging, "Date " + DateTime.Today.ToShortDateString());

            query.AddColumn((radioGroupByFam.Checked?"GUARANTOR":"PATIENT"), 160, FieldValueType.String);
            query.AddColumn("INS PAY EST 0-30", 75, FieldValueType.Number);
            query.AddColumn("INS PAY EST 31-60", 75, FieldValueType.Number);
            query.AddColumn("INS PAY EST 61-90", 75, FieldValueType.Number);
            query.AddColumn("INS PAY EST >90", 75, FieldValueType.Number);
            query.AddColumn("INS EST TOTAL", 80, FieldValueType.Number);
            query.AddColumn("PAT EST  BAL 0-30", 75, FieldValueType.Number);
            query.AddColumn("PAT EST BAL 31-60", 75, FieldValueType.Number);
            query.AddColumn("PAT EST BAL 61-90", 75, FieldValueType.Number);
            query.AddColumn("PAT EST BAL >90", 75, FieldValueType.Number);
            query.AddColumn("PAT TOTAL", 80, FieldValueType.Number);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 14
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!checkBillTypesAll.Checked && listBillType.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one billing type must be selected.");
                return;
            }
            if (!checkProvAll.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            if (textDate.errorProvider1.GetError(textDate) != "")
            {
                MsgBox.Show(this, "Invalid date.");
                return;
            }
            RpAgingParamObject rpo        = GetParamsFromForm();
            ReportComplex      report     = new ReportComplex(true, true);
            DataTable          tableAging = new DataTable();

            tableAging        = RpInsAging.GetInsAgingTable(rpo);
            report.ReportName = Lan.g(this, "Insurance Aging Report");
            report.AddTitle("InsAging", Lan.g(this, "Insurance Aging Report"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of") + " " + rpo.AsOfDate.ToShortDateString());
            if (radioAny.Checked)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            else if (radio30.Checked)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            else if (radio60.Checked)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            else if (radio90.Checked)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (checkBillTypesAll.Checked)
            {
                report.AddSubTitle("AllBillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                report.AddSubTitle("", string.Join(", ", listBillType.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x].ItemName)));             //there must be at least one selected
            }
            if (checkProvAll.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                report.AddSubTitle("Providers", string.Join(", ", listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].Abbr)));
            }
            if (checkAllClin.Checked)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                report.AddSubTitle("Clinics", string.Join(", ", listClin.GetListSelected <Clinic>().Select(x => x.Abbr)));
            }
            //Patient Account Aging Query-----------------------------------------------
            QueryObject query = report.AddQuery(tableAging, "Date " + DateTime.Today.ToShortDateString());

            query.AddColumn((radioGroupByFam.Checked ? "Guarantor" : "Patient"), 150, FieldValueType.String);
            if (rpo.IsDetailedBreakdown)
            {
                query.AddColumn("Carrier", 220, FieldValueType.String);
                query.AddColumn("Group Name", 160, FieldValueType.String);
            }
            query.AddColumn("Ins Pay\r\nEst 0-30", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst 31-60", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst 61-90", 70, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst >90", 75, FieldValueType.Number);
            query.AddColumn("Ins Pay\r\nEst Total", 80, FieldValueType.Number);
            if (!rpo.IsDetailedBreakdown)
            {
                query.AddColumn("Pat Est\r\nBal 0-30", 75, FieldValueType.Number);
                query.AddColumn("Pat Est\r\nBal 31-60", 75, FieldValueType.Number);
                query.AddColumn("Pat Est\r\nBal 61-90", 70, FieldValueType.Number);
                query.AddColumn("Pat Est\r\nBal >90", 75, FieldValueType.Number);
                query.AddColumn("Pat Est\r\nBal Total", 80, FieldValueType.Number);
                query.AddColumn("-W/O\r\nChange", 70, FieldValueType.Number);
                query.AddColumn("=Pat Est\r\nAmt Due", 80, FieldValueType.Number);
            }
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 15
0
        ///<summary>Uses the report complex pattern to print the same report generated by FillGrid()</summary>
        private void butRunReport_Click(object sender, EventArgs e)
        {
            if (!ValidateFilters())
            {
                return;
            }
            ReportComplex report          = new ReportComplex(true, false);
            List <long>   listClinicNums  = GetSelectedClinicNums();
            DataTable     table           = RpClaimNotSent.GetClaimsNotSent(_startDate, _endDate, listClinicNums, true, (ClaimNotSentStatuses)comboBoxInsFilter.SelectedItem);
            string        subtitleClinics = "";

            //the following logic could probably be simplified
            if (PrefC.HasClinicsEnabled)
            {
                if (comboBoxClinics.SelectedIndices.Contains(0))
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < comboBoxClinics.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[(int)comboBoxClinics.SelectedIndices[i] - 1].Abbr;
                        }
                        else
                        {
                            if ((int)comboBoxClinics.SelectedIndices[i] == 1)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");                             //start here
                            }
                            else
                            {
                                subtitleClinics += _listClinics[(int)comboBoxClinics.SelectedIndices[i] - 2].Abbr;                            //Minus 2 from the selected index
                            }
                        }
                    }
                }
            }
            report.ReportName = Lan.g(this, "Claims Not Sent");
            report.AddTitle("Title", Lan.g(this, "Claims Not Sent"));
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = report.AddQuery(table, "Date: " + DateTimeOD.Today.ToShortDateString());

            if (PrefC.HasClinicsEnabled)
            {
                query.AddColumn("Clinic", 60, FieldValueType.String);
            }
            query.AddColumn("Date", 85, FieldValueType.Date);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Type", 90, FieldValueType.String);
            query.AddColumn("Claim Status", 100, FieldValueType.String);
            query.AddColumn("Patient Name", 150, FieldValueType.String);
            query.AddColumn("Insurance Carrier", 150, FieldValueType.String);
            query.AddColumn("Amount", 90, FieldValueType.Number);
            query.AddColumn("Proc Codes", 90);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 16
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            DateTime dateFrom = PIn.Date(textDateFrom.Text);
            DateTime dateTo   = PIn.Date(textDateTo.Text);

            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            ReportComplex report       = new ReportComplex(true, false);
            List <long>   listProvNums = new List <long>();

            if (!checkAllProv.Checked)
            {
                listProvNums.AddRange(listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].ProvNum).ToList());
            }
            List <long> listBillingDefNums = new List <long>();

            if (!checkAllBilling.Checked)
            {
                listBillingDefNums.AddRange(listBillingType.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x].DefNum).ToList());
            }
            DataTable table        = RpFinanceCharge.GetFinanceChargeTable(dateFrom, dateTo, PrefC.GetLong(PrefName.FinanceChargeAdjustmentType), listProvNums, listBillingDefNums);
            Font      font         = new Font("Tahoma", 9);
            Font      fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font      fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Finance Charge Report");
            report.AddTitle("Title", Lan.g(this, "Finance Charge Report"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date SubTitle", dateFrom.ToString("d") + " - " + dateTo.ToString("d"), fontSubTitle);
            string subtitleProvs = "";

            if (listProvNums.Count > 0)
            {
                subtitleProvs += string.Join(", ", listProv.SelectedIndices.OfType <int>().ToList().Select(x => _listProviders[x].Abbr));
            }
            else
            {
                subtitleProvs = Lan.g(this, "All Providers");
            }
            report.AddSubTitle("Provider Subtitle", subtitleProvs);
            string subtBillingTypes = "";

            if (listBillingDefNums.Count > 0)
            {
                subtBillingTypes += string.Join(", ", listBillingType.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x].ItemName));
            }
            else
            {
                subtBillingTypes = Lan.g(this, "All Billing Types");
            }
            report.AddSubTitle("Billing Subtitle", subtBillingTypes);
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("PatNum", 75);
            query.AddColumn("Patient Name", 180);
            query.AddColumn("Preferred Name", 130);
            query.AddColumn("Amount", 100, FieldValueType.Number);
            query.GetColumnDetail("Amount").ContentAlignment = ContentAlignment.MiddleRight;
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 17
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            int     payPlanVersion = PrefC.GetInt(PrefName.PayPlansVersion);
            string  bDate;
            string  eDate;
            decimal rcvStart          = 0;
            decimal rcvCharge         = 0;
            decimal rcvPayPlanCredit  = 0;
            decimal rcvProd           = 0;
            decimal rcvPayPlanCharges = 0;
            decimal rcvAdj            = 0;
            decimal rcvWriteoff       = 0;
            decimal rcvPayment        = 0;
            decimal rcvInsPayment     = 0;
            decimal runningRcv        = 0;
            decimal rcvDaily          = 0;

            decimal[] colTotals = new decimal[11];
            string    wMonth;
            string    wYear;
            string    wDay = "01";
            string    wDate;

            // Get the year / month and instert the 1st of the month for stop point for calculated running balance
            wYear  = date1.SelectionStart.Year.ToString();
            wMonth = date1.SelectionStart.Month.ToString();
            if (wMonth.Length < 2)
            {
                wMonth = "0" + wMonth;
            }
            wDate = wYear + "-" + wMonth + "-" + wDay;
            List <long> listProvNums = new List <long>();
            bool        hasAllProvs  = (listProv.SelectedIndices[0] == 0);

            if (!hasAllProvs)
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    //Minus 1 due to the 'Practice' option.
                    listProvNums.Add(_listProvs[listProv.SelectedIndices[i] - 1].ProvNum);
                }
            }
            bool isPayPlan2;

            if (payPlanVersion == 2)
            {
                isPayPlan2 = true;
            }
            else
            {
                isPayPlan2 = false;
            }
            ReportComplex report             = new ReportComplex(true, isPayPlan2); //Landscape if using PayPlan Version 2
            DataTable     TableProduction    = new DataTable();                     //Production
            DataTable     TablePayPlanCredit = new DataTable();                     //PayPlanCredits
            DataTable     TableCharge        = new DataTable();                     //charges(Production-PayPlanCredits)
            DataTable     TablePayPlanCharge = new DataTable();                     //PayPlanCharges
            DataTable     TableCapWriteoff   = new DataTable();                     //capComplete writeoffs
            DataTable     TableInsWriteoff   = new DataTable();                     //ins writeoffs
            DataTable     TablePay           = new DataTable();                     //payments - Patient
            DataTable     TableIns           = new DataTable();                     //payments - Ins, added SPK
            DataTable     TableAdj           = new DataTable();                     //adjustments

            //
            // Main Loop:  This will loop twice 1st loop gets running balance to start of month selected
            //             2nd will break the numbers down by day and calculate the running balances
            //
            for (int j = 0; j <= 1; j++)
            {
                if (j == 0)
                {
                    bDate = "0001-01-01";
                    eDate = wDate;
                }
                else
                {
                    bDate = wDate;
                    eDate = POut.Date(date1.SelectionStart.AddDays(1)).Substring(1, 10);                   // Needed because all Queries are < end date to get correct Starting AR
                }
                TableProduction = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableProduction");
                if (isPayPlan2)
                {
                    TablePayPlanCredit = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TablePayPlanCredit");
                    TableCharge        = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableCharge");
                    TablePayPlanCharge = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TablePayPlanCharge");
                }
                TableCapWriteoff = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableCapWriteoff");
                TableInsWriteoff = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableInsWriteoff");
                TablePay         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TablePay");
                TableIns         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableIns");
                TableAdj         = RpReceivablesBreakdown.GetRecvBreakdownTable(date1.SelectionStart, listProvNums, radioWriteoffPay.Checked, isPayPlan2, wDate, eDate, bDate, "TableAdj");
                //Sum up all the transactions grouped by date.
                Dictionary <DateTime, decimal> dictPayPlanCharges = TablePayPlanCharge.Select().GroupBy(x => PIn.Date(x["ChargeDate"].ToString()))
                                                                    .ToDictionary(y => y.Key, y => y.ToList().Sum(z => PIn.Decimal(z["Amt"].ToString())));
                //1st Loop Calculate running Accounts Receivable upto the 1st of the Month Selected
                //2nd Loop Calculate the Daily Accounts Receivable upto the Date Selected
                //Finaly Generate Report showing the breakdown upto the date specified with totals for what is on the report
                if (j == 0)
                {
                    for (int k = 0; k < TableCharge.Rows.Count; k++)
                    {
                        rcvCharge += PIn.Decimal(TableCharge.Rows[k][1].ToString());                        //Production-PayPlanCredits
                    }
                    rcvPayPlanCharges += dictPayPlanCharges.Sum(x => x.Value);
                    for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                    {
                        rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TablePay.Rows.Count; k++)
                    {
                        rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableIns.Rows.Count; k++)
                    {
                        rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableAdj.Rows.Count; k++)
                    {
                        rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TableProduction.Rows.Count; k++)
                    {
                        rcvProd += PIn.Decimal(TableProduction.Rows[k][1].ToString());
                    }
                    for (int k = 0; k < TablePayPlanCredit.Rows.Count; k++)
                    {
                        rcvPayPlanCredit += PIn.Decimal(TablePayPlanCredit.Rows[k][1].ToString());
                    }
                    TableProduction.Clear();
                    TablePayPlanCredit.Clear();
                    TableCharge.Clear();
                    TablePayPlanCharge.Clear();
                    TableCapWriteoff.Clear();
                    TableInsWriteoff.Clear();
                    TablePay.Clear();
                    TableIns.Clear();
                    TableAdj.Clear();
                    rcvStart = (rcvProd - rcvPayPlanCredit + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                }
                else
                {
                    rcvCharge         = 0;
                    rcvPayPlanCredit  = 0;
                    rcvAdj            = 0;
                    rcvInsPayment     = 0;
                    rcvPayment        = 0;
                    rcvProd           = 0;
                    rcvPayPlanCharges = 0;
                    rcvWriteoff       = 0;
                    rcvDaily          = 0;
                    runningRcv        = rcvStart;
                    DataTable TableQ = new DataTable();
                    TableQ.Columns.Add("Date");
                    TableQ.Columns.Add("Production");
                    TableQ.Columns.Add("PayPlanCredits");
                    TableQ.Columns.Add("Charges");
                    TableQ.Columns.Add("PayPlanCharges");
                    TableQ.Columns.Add("Adjustments");
                    TableQ.Columns.Add("Writeoffs");
                    TableQ.Columns.Add("Payment");
                    TableQ.Columns.Add("InsPayment");
                    TableQ.Columns.Add("Daily");
                    TableQ.Columns.Add("Running");
                    eDate = POut.Date(date1.SelectionStart).Substring(1, 10); // Reset EndDate to Selected Date
                    DateTime[] dates = new DateTime[(PIn.Date(eDate) - PIn.Date(bDate)).Days + 1];
                    for (int i = 0; i < dates.Length; i++)                    //usually 31 days in loop
                    {
                        dates[i] = PIn.Date(bDate).AddDays(i);
                        //create new row called 'row' based on structure of TableQ
                        DataRow row = TableQ.NewRow();
                        row[0] = dates[i].ToShortDateString();
                        for (int k = 0; k < TableProduction.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableProduction.Rows[k][0].ToString())))
                            {
                                rcvProd += PIn.Decimal(TableProduction.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TablePayPlanCredit.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TablePayPlanCredit.Rows[k][0].ToString())))
                            {
                                rcvPayPlanCredit += PIn.Decimal(TablePayPlanCredit.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableCharge.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCharge.Rows[k][0].ToString())))
                            {
                                rcvCharge += PIn.Decimal(TableCharge.Rows[k][1].ToString());
                            }
                        }
                        decimal rcvPayPlanChargesForDay = 0;
                        if (dictPayPlanCharges.TryGetValue(dates[i], out rcvPayPlanChargesForDay))
                        {
                            rcvPayPlanCharges += rcvPayPlanChargesForDay;
                        }
                        for (int k = 0; k < TableCapWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableCapWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableCapWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableAdj.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableAdj.Rows[k][0].ToString())))
                            {
                                rcvAdj += PIn.Decimal(TableAdj.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableInsWriteoff.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableInsWriteoff.Rows[k][0].ToString())))
                            {
                                rcvWriteoff += PIn.Decimal(TableInsWriteoff.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TablePay.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TablePay.Rows[k][0].ToString())))
                            {
                                rcvPayment += PIn.Decimal(TablePay.Rows[k][1].ToString());
                            }
                        }
                        for (int k = 0; k < TableIns.Rows.Count; k++)
                        {
                            if (dates[i] == (PIn.Date(TableIns.Rows[k][0].ToString())))
                            {
                                rcvInsPayment += PIn.Decimal(TableIns.Rows[k][1].ToString());
                            }
                        }
                        //rcvPayPlanCharges and rcvPayPlanCredit will be 0 if not on version 2.
                        rcvDaily              = (rcvProd - rcvPayPlanCredit + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        runningRcv           += (rcvProd - rcvPayPlanCredit + rcvPayPlanCharges + rcvAdj - rcvWriteoff) - (rcvPayment + rcvInsPayment);
                        row["Production"]     = rcvProd.ToString("n");
                        row["PayPlanCredits"] = rcvPayPlanCredit.ToString("n");
                        row["Charges"]        = rcvCharge.ToString("n");
                        row["PayPlanCharges"] = rcvPayPlanCharges.ToString("n");
                        row["Adjustments"]    = rcvAdj.ToString("n");
                        row["Writeoffs"]      = rcvWriteoff.ToString("n");
                        row["Payment"]        = rcvPayment.ToString("n");
                        row["InsPayment"]     = rcvInsPayment.ToString("n");
                        row["Daily"]          = rcvDaily.ToString("n");
                        row["Running"]        = runningRcv.ToString("n");
                        colTotals[1]         += rcvProd;
                        colTotals[2]         += rcvPayPlanCredit;
                        colTotals[3]         += rcvCharge;
                        colTotals[4]         += rcvPayPlanCharges;
                        colTotals[5]         += rcvAdj;
                        colTotals[6]         += rcvWriteoff;
                        colTotals[7]         += rcvPayment;
                        colTotals[8]         += rcvInsPayment;
                        colTotals[9]         += rcvDaily;
                        colTotals[10]         = runningRcv;
                        TableQ.Rows.Add(row);                          //adds row to table Q
                        rcvAdj            = 0;
                        rcvInsPayment     = 0;
                        rcvPayment        = 0;
                        rcvProd           = 0;
                        rcvPayPlanCharges = 0;
                        rcvWriteoff       = 0;
                        rcvCharge         = 0;
                        rcvPayPlanCredit  = 0;
                    }
                    //Drop the PayPlan columns if not version 2
                    if (!isPayPlan2)
                    {
                        TableQ.Columns.RemoveAt(2);                        //PayPlanCredits
                        TableQ.Columns.RemoveAt(2);                        //Production - PayPlanCredits
                        TableQ.Columns.RemoveAt(2);                        //PayPlanCharges
                    }
                    ////columnCount will get incremented on the second ColTotal call so we can use it in this way
                    //if(payPlanVersion==2) {
                    //	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
                    //	report.ColTotal[2]=PIn.Decimal(colTotals[2].ToString("n")); //payplancharges
                    //	report.ColTotal[3]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
                    //	report.ColTotal[4]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
                    //	report.ColTotal[5]=PIn.Decimal(colTotals[5].ToString("n")); //payment
                    //	report.ColTotal[6]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
                    //	report.ColTotal[7]=PIn.Decimal(colTotals[7].ToString("n")); //daily
                    //	report.ColTotal[8]=PIn.Decimal(colTotals[8].ToString("n")); //running
                    //}
                    //else {
                    //	report.ColTotal[1]=PIn.Decimal(colTotals[1].ToString("n")); //prod
                    //	report.ColTotal[2]=PIn.Decimal(colTotals[3].ToString("n")); //adjustment
                    //	report.ColTotal[3]=PIn.Decimal(colTotals[4].ToString("n")); //writeoffs
                    //	report.ColTotal[4]=PIn.Decimal(colTotals[5].ToString("n")); //payment
                    //	report.ColTotal[5]=PIn.Decimal(colTotals[6].ToString("n")); //inspayment
                    //	report.ColTotal[6]=PIn.Decimal(colTotals[7].ToString("n")); //daily
                    //	report.ColTotal[7]=PIn.Decimal(colTotals[8].ToString("n")); //running
                    //}
                    Font font         = new Font("Tahoma", 9);
                    Font boldFont     = new Font("Tahoma", 9, FontStyle.Bold);
                    Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
                    Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);
                    report.ReportName = Lan.g(this, "Receivables Breakdown");
                    report.AddTitle("Title", Lan.g(this, "Receivables Breakdown"), fontTitle);
                    report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
                    report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d"), fontSubTitle);
                    string provNames = "";
                    for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                    {
                        if (hasAllProvs)
                        {
                            provNames = "All Providers";
                            break;
                        }
                        if (i > 0)
                        {
                            provNames += ", ";
                        }
                        provNames += _listProvs[listProv.SelectedIndices[i] - 1].Abbr;
                    }
                    report.AddSubTitle("Provider SubTitle", provNames);
                    int[]       summaryGroups1 = { 1 };
                    QueryObject query          = report.AddQuery(TableQ, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));
                    query.AddColumn("Date", 72, FieldValueType.Date);
                    query.AddColumn("Production", 80, FieldValueType.Number);
                    query.GetColumnDetail("Production").ContentAlignment = ContentAlignment.MiddleRight;
                    if (isPayPlan2)
                    {
                        query.AddColumn("PayPlanCredits", 90, FieldValueType.Number);
                        query.GetColumnDetail("PayPlanCredits").ContentAlignment = ContentAlignment.MiddleRight;
                        query.AddColumn("Prod - PPCred", 85, FieldValueType.Number);
                        query.GetColumnDetail("Prod - PPCred").ContentAlignment = ContentAlignment.MiddleRight;
                        query.AddColumn("PayPlanCharges", 100, FieldValueType.Number);
                        query.GetColumnDetail("PayPlanCharges").ContentAlignment = ContentAlignment.MiddleRight;
                    }
                    query.AddColumn("Adjustment", 80, FieldValueType.Number);
                    query.GetColumnDetail("Adjustment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Writeoff", 80, FieldValueType.Number);
                    query.GetColumnDetail("Writeoff").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Payment", 80, FieldValueType.Number);
                    query.GetColumnDetail("Payment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("InsPayment", 80, FieldValueType.Number);
                    query.GetColumnDetail("InsPayment").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Daily A/R", 100, FieldValueType.Number);
                    query.GetColumnDetail("Daily A/R").ContentAlignment = ContentAlignment.MiddleRight;
                    query.AddColumn("Ending A/R", 100);
                    query.GetColumnDetail("Ending A/R").ContentAlignment = ContentAlignment.MiddleRight;
                    query.GetColumnDetail("Ending A/R").Font             = boldFont;
                    if (isPayPlan2)
                    {
                        report.AddFooterText("Desc", "Receivables Calculation: (Production - PayPlanCredits + PayPlanCharges + Adjustments - Writeoffs) "
                                             + "- (Payments + Insurance Payments)", font, 0, ContentAlignment.MiddleCenter);
                    }
                    else
                    {
                        report.AddFooterText("Desc", "Receivables Calculation: (Production + Adjustments - Writeoffs) - (Payments + Insurance Payments)", font, 0, ContentAlignment.MiddleCenter);
                    }
                    //report.AddText("EndingAR","Final Ending A/R: "+runningRcv.ToString(),boldFont,0,ContentAlignment.MiddleLeft);
                    report.AddPageNum(font);
                    if (!report.SubmitQueries())
                    {
                        return;
                    }
                    FormReportComplex FormR = new FormReportComplex(report);
                    FormR.ShowDialog();
                    DialogResult = DialogResult.OK;
                } //END If
            }     // END For Loop
        }         //END OK button Clicked
Exemplo n.º 18
0
        private void RunDaily()
        {
            ReportComplex report = new ReportComplex(true, true);

            _dateFrom = PIn.Date(textDateFrom.Text);
            _dateTo   = PIn.Date(textDateTo.Text);
            List <DataSet> listProdData      = new List <DataSet>();   //A list of all data sets for each connection.
            List <string>  listServerNames   = new List <string>();
            string         stringFailedConns = "";

            for (int i = 0; i < ConnList.Count; i++)
            {
                ODThread odThread = new ODThread(ConnectAndRunDailyReport, ConnList[i]);
                odThread.GroupName = "ConnectAndReportDaily";
                odThread.Start(false);
            }
            ODThread.JoinThreadsByGroupName(Timeout.Infinite, "ConnectAndReportDaily");
            List <ODThread> listThreads = ODThread.GetThreadsByGroupName("ConnectAndReportDaily");

            for (int i = 0; i < listThreads.Count; i++)
            {
                object[] obj        = (object[])listThreads[i].Tag;
                DataSet  data       = (DataSet)obj[0];
                string   connString = CentralConnections.GetConnectionString((CentralConnection)obj[1]);
                if (data == null)
                {
                    stringFailedConns += connString + "\r\n";
                }
                else
                {
                    listServerNames.Add(connString);
                    listProdData.Add(data);
                }
                listThreads[i].QuitSync(Timeout.Infinite);
            }
            report.ReportName = "DailyP&I";
            report.AddTitle("Title", Lan.g(this, "Daily Production and Income"));
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle));
            string dateRangeStr = _dateFrom.ToShortDateString() + " - " + _dateTo.ToShortDateString();

            if (_dateFrom.Date == _dateTo.Date)
            {
                dateRangeStr = _dateFrom.ToShortDateString();              //Do not show a date range for the same day...
            }
            report.AddSubTitle("Date", dateRangeStr);
            report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            QueryObject query = null;
            //Per connection, add each table and split on clinic.  We also need to make a totals table that will be total per clinic per connection.
            DataTable connectionTotals = new DataTable("Totals");

            connectionTotals.Columns.Add(new DataColumn("Connection"));
            connectionTotals.Columns.Add(new DataColumn("Clinic"));
            connectionTotals.Columns.Add(new DataColumn("Production"));
            connectionTotals.Columns.Add(new DataColumn("Adjust"));
            connectionTotals.Columns.Add(new DataColumn("Writeoff"));
            connectionTotals.Columns.Add(new DataColumn("Pt Income"));
            connectionTotals.Columns.Add(new DataColumn("Ins Income"));
            for (int i = 0; i < listProdData.Count; i++)                               //Per connection
            {
                DataTable tableDailyProdForConn = listProdData[i].Tables["DailyProd"]; //Includes multiple clinics.
                for (int j = 0; j < tableDailyProdForConn.Rows.Count; j++)             //Go through the rows
                {
                    DataRow connRow = tableDailyProdForConn.Rows[j];
                    bool    isFound = false;
                    for (int k = 0; k < connectionTotals.Rows.Count; k++)               //Attempt to find an existing totals row that matches.
                    {
                        DataRow connTotalsRow = connectionTotals.Rows[k];
                        if (connRow["Clinic"] == connTotalsRow["Clinic"] && listServerNames[i] == connTotalsRow["Connection"].ToString()) //Totals row already exists. Add to it.
                        {
                            DataRow totalRow = connectionTotals.NewRow();                                                                 //Need to make a new row, can't just modify old table values.  Sadly.
                            double  prod     = PIn.Double(connTotalsRow["Production"].ToString());
                            double  adjust   = PIn.Double(connTotalsRow["Adjust"].ToString());
                            double  writeoff = PIn.Double(connTotalsRow["Writeoff"].ToString());
                            double  ptInc    = PIn.Double(connTotalsRow["Pt Income"].ToString());
                            double  insInc   = PIn.Double(connTotalsRow["Ins Income"].ToString());
                            totalRow[0] = connTotalsRow["Connection"];
                            totalRow[1] = connTotalsRow["Clinic"];
                            totalRow[2] = (prod + PIn.Double(connRow["Production"].ToString()));
                            totalRow[3] = (adjust + PIn.Double(connRow["Adjust"].ToString()));
                            totalRow[4] = (writeoff + PIn.Double(connRow["Writeoff"].ToString()));
                            totalRow[5] = (ptInc + PIn.Double(connRow["Pt Income"].ToString()));
                            totalRow[6] = (insInc + PIn.Double(connRow["Ins Income"].ToString()));
                            connectionTotals.Rows.RemoveAt(k);
                            connectionTotals.Rows.Add(totalRow);
                            isFound = true;
                            break;
                        }
                    }
                    if (!isFound)                    //Totals row for this connection and clinic combination doesn't exist yet.
                    {
                        DataRow totalRow = connectionTotals.NewRow();
                        totalRow[0] = listServerNames[i];
                        totalRow[1] = connRow["Clinic"];
                        totalRow[2] = connRow["Production"];
                        totalRow[3] = connRow["Adjust"];
                        totalRow[4] = connRow["Writeoff"];
                        totalRow[5] = connRow["Pt Income"];
                        totalRow[6] = connRow["Ins Income"];
                        connectionTotals.Rows.Add(totalRow);
                    }
                }
                query = report.AddQuery(tableDailyProdForConn, listServerNames[i], "Clinic", SplitByKind.Value, 1, true);
                // add columns to report
                query.AddColumn("Date", 75, FieldValueType.String, new Font("Tahoma", 8));
                query.AddColumn("Patient Name", 130, FieldValueType.String, new Font("Tahoma", 8));
                query.AddColumn("Description", 220, FieldValueType.String, new Font("Tahoma", 8));
                query.AddColumn("Prov", 65, FieldValueType.String, new Font("Tahoma", 8));
                query.AddColumn("Clinic", 130, FieldValueType.String, new Font("Tahoma", 8));
                query.AddColumn("Production", 75, FieldValueType.Number, new Font("Tahoma", 8));
                query.AddColumn("Adjust", 75, FieldValueType.Number, new Font("Tahoma", 8));
                query.AddColumn("Writeoff", 75, FieldValueType.Number, new Font("Tahoma", 8));
                query.AddColumn("Pt Income", 75, FieldValueType.Number, new Font("Tahoma", 8));
                query.AddColumn("Ins Income", 75, FieldValueType.Number, new Font("Tahoma", 8));
            }
            if (connectionTotals.Rows.Count == 0)
            {
                //MsgBox.Show(this,"This report returned no values.");//We don't want to do this, it hides behind the progress bar!
                return;
            }
            connectionTotals = connectionTotals.AsEnumerable().OrderBy(r => r.Field <string>("Connection"))
                               .ThenBy(r => r.Field <string>("Clinic")).CopyToDataTable();
            query = report.AddQuery(connectionTotals, "Totals", "", SplitByKind.None, 2, true);
            query.AddColumn("Connection", 250, FieldValueType.String, new Font("Tahoma", 8));
            query.AddColumn("Clinic", 250, FieldValueType.String, new Font("Tahoma", 8));
            query.AddColumn("Production", 75, FieldValueType.Number, new Font("Tahoma", 8));
            query.AddColumn("Adjust", 75, FieldValueType.Number, new Font("Tahoma", 8));
            query.AddColumn("Writeoff", 75, FieldValueType.Number, new Font("Tahoma", 8));
            query.AddColumn("Pt Income", 75, FieldValueType.Number, new Font("Tahoma", 8));
            query.AddColumn("Ins Income", 75, FieldValueType.Number, new Font("Tahoma", 8));
            //Calculate the total production and total income and add them to the bottom of the report:
            double totalProduction = 0;
            double totalIncome     = 0;

            for (int i = 0; i < connectionTotals.Rows.Count; i++)
            {
                //Total production is (Production + Adjustments - Writeoffs)
                totalProduction += PIn.Double(connectionTotals.Rows[i]["Production"].ToString());
                totalProduction += PIn.Double(connectionTotals.Rows[i]["Adjust"].ToString());
                totalProduction += PIn.Double(connectionTotals.Rows[i]["Writeoff"].ToString());              //Writeoffs stored as negative number
                //Total income is (Pt Income + Ins Income)
                totalIncome += PIn.Double(connectionTotals.Rows[i]["Pt Income"].ToString());
                totalIncome += PIn.Double(connectionTotals.Rows[i]["Ins Income"].ToString());
            }
            //Add the Total Production and Total Income to the bottom of the report if there were any rows present.
            if (connectionTotals.Rows.Count > 0)
            {
                //Use a custom table and add it like it is a "query" to the report because using a group summary would be more complicated due
                //to the need to add and subtract from multiple columns at the same time.
                DataTable tableTotals = new DataTable("TotalProdAndInc");
                tableTotals.Columns.Add("Summary");
                tableTotals.Rows.Add(Lan.g(this, "Total Production (Production + Adjustments - Writeoffs):") + " " + totalProduction.ToString("c"));
                tableTotals.Rows.Add(Lan.g(this, "Total Income (Pt Income + Ins Income):") + " " + totalIncome.ToString("c"));
                //Add tableTotals to the report.
                //No column name and no header because we want to display this table to NOT look like a table.
                query = report.AddQuery(tableTotals, "", "", SplitByKind.None, 2, false);
                query.AddColumn("", 785, FieldValueType.String, new Font("Tahoma", 8, FontStyle.Bold));
            }
            report.AddPageNum();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 19
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            ReportComplex report = new ReportComplex(true, false);

            Cursor = Cursors.WaitCursor;
            List <long> listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DataTable tableOverpaid = RpInsOverpaid.GetInsuranceOverpaid(dateStart.SelectionStart, dateEnd.SelectionStart, listClinicNums,
                                                                         radioGroupByProc.Checked);

            Cursor = Cursors.Default;
            string subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            report.ReportName = Lan.g(this, "Insurance Overpaid");
            report.AddTitle("Title", Lan.g(this, "Insurance Overpaid"));
            report.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle));
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = report.AddQuery(tableOverpaid, DateTimeOD.Today.ToShortDateString());

            query.AddColumn("Pat Name", 200, FieldValueType.String);
            query.AddColumn("Date", 90, FieldValueType.Date);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Fee", 100, FieldValueType.Number);
            query.AddColumn("InsPaid+W/O", 120, FieldValueType.Number);
            report.AddPageNum();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 20
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            if (gridMain.ListGridRows.Count == 0)
            {
                MsgBox.Show(this, "The report has no results to show. Please click 'Refresh' to populate the grid first.");
                return;
            }
            DataTable tableReportCur = new DataTable();

            tableReportCur.Columns.Add("Patient");
            tableReportCur.Columns.Add("0_30");
            tableReportCur.Columns.Add("31_60");
            tableReportCur.Columns.Add("61_90");
            tableReportCur.Columns.Add("Over90");
            tableReportCur.Columns.Add("BatTotal");
            //Uses the grid's rows so that the user's row sorting selection is retained.
            foreach (AgingPat agingPatCur in gridMain.ListGridRows.Select(x => (AgingPat)x.Tag))
            {
                DataRow row = tableReportCur.NewRow();
                row["Patient"]  = agingPatCur.Pat.GetNameLF();
                row["0_30"]     = agingPatCur.BalZeroThirty.ToString("f");
                row["31_60"]    = agingPatCur.BalThirtySixty.ToString("f");
                row["61_90"]    = agingPatCur.BalSixtyNinety.ToString("f");
                row["Over90"]   = agingPatCur.BalOverNinety.ToString("f");
                row["BatTotal"] = agingPatCur.BalTotal.ToString("f");
                tableReportCur.Rows.Add(row);
            }
            ReportComplex report = new ReportComplex(true, false);

            report.ReportName = Lan.g(this, "Custom Aging of Accounts Receivable");
            report.AddTitle("Custom Aging Report", Lan.g(this, "Custom Aging of Accounts Receivable"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of ") + _agingOptions.DateAsOf.ToShortDateString());
            List <string> listAgingInc = new List <string>();

            //Go through every aging option and for every one that is selected, add the descriptions as a subtitle
            foreach (AgingOptions.AgingInclude agingInc in Enum.GetValues(typeof(AgingOptions.AgingInclude)))
            {
                if (agingInc == AgingOptions.AgingInclude.None)
                {
                    continue;
                }
                if (_agingOptions.AgingInc.HasFlag(agingInc))
                {
                    listAgingInc.Add(Lan.g(this, agingInc.GetDescription()));
                }
            }
            //Add a newline to the list if it's too long.
            if (listAgingInc.Count > 5)
            {
                listAgingInc[(listAgingInc.Count + 1) / 2] = "\r\n" + listAgingInc[(listAgingInc.Count + 1) / 2];
            }
            report.AddSubTitle("AgeInc", Lan.g(this, "For") + ": " + string.Join(", ", listAgingInc));
            if (_agingOptions.AgeAccount == AgeOfAccount.Any)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            else if (_agingOptions.AgeAccount == AgeOfAccount.Over30)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            else if (_agingOptions.AgeAccount == AgeOfAccount.Over60)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            else if (_agingOptions.AgeAccount == AgeOfAccount.Over90)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (_agingOptions.ListBillTypes == null)
            {
                report.AddSubTitle("BillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                report.AddSubTitle("BillingTypes", string.Join(", ", _agingOptions.ListBillTypes.Select(x => x.ItemName)));
            }
            if (_agingOptions.ListProvs == null)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                report.AddSubTitle("Providers", string.Join(", ", _agingOptions.ListProvs.Select(x => x.Abbr)));
            }
            if (_agingOptions.ListClins == null)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                report.AddSubTitle("Clinics", string.Join(", ", _agingOptions.ListClins.Select(x => x.Abbr)));
            }
            QueryObject query = report.AddQuery(tableReportCur, "Date " + DateTimeOD.Today.ToShortDateString());

            query.AddColumn((_agingOptions.FamGroup == AgingOptions.FamilyGrouping.Family ? "GUARANTOR" : "PATIENT"), 160, FieldValueType.String);
            query.AddColumn("0-30 DAYS", 75, FieldValueType.Number);
            query.AddColumn("31-60 DAYS", 75, FieldValueType.Number);
            query.AddColumn("61-90 DAYS", 75, FieldValueType.Number);
            query.AddColumn("> 90 DAYS", 75, FieldValueType.Number);
            query.AddColumn("TOTAL", 80, FieldValueType.Number);
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
        }
Exemplo n.º 21
0
        private void butUnearnedAllocationOK_Click(object sender, EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkUnearnedAllocationAllClins.Checked && listUnearnedAllocationClins.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            if (!checkUnearnedAllocationAllProvs.Checked && listUnearnedAllocationProvs.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (!checkUnearnedAllocationAllTypes.Checked && listUnearnedAllocationTypes.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one unearned type must be selected.");
                return;
            }
            List <long>   listClinicNums       = listUnearnedAllocationClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum).ToList();
            List <long>   listProvNums         = listUnearnedAllocationProvs.SelectedItems.OfType <ODBoxItem <Provider> >().Select(x => x.Tag.ProvNum).ToList();
            List <long>   listUnearnedTypeNums = listUnearnedAllocationTypes.SelectedItems.OfType <ODBoxItem <Def> >().Select(x => x.Tag.DefNum).ToList();
            ReportComplex report = new ReportComplex(true, true);
            DataTable     table  = RpUnearnedIncome.GetUnearnedAllocationData(listClinicNums, listProvNums, listUnearnedTypeNums,
                                                                              checkUnearnedAllocationExcludeZero.Checked, checkUnearnedAllocationShowProv.Checked);

            report.ReportName = "Unearned Allocation Report";
            QueryObject query = report.AddQuery(table, "Unearned Allocation Report");

            query.AddColumn("Guar", 150, FieldValueType.String);
            query.GetColumnDetail("Guar").Font = new Font(query.GetColumnDetail("Guar").Font, FontStyle.Bold);
            query.AddColumn("FamBal", 100, FieldValueType.String);
            query.GetColumnDetail("FamBal").Font = new Font(query.GetColumnDetail("FamBal").Font, FontStyle.Bold);
            query.AddColumn("FamUnearned", 100, FieldValueType.String);
            query.GetColumnDetail("FamUnearned").Font = new Font(query.GetColumnDetail("FamUnearned").Font, FontStyle.Bold);
            query.AddColumn("FamRemAmt", 100, FieldValueType.String);
            query.GetColumnDetail("FamRemAmt").Font = new Font(query.GetColumnDetail("FamRemAmt").Font, FontStyle.Bold);
            if (checkUnearnedAllocationShowProv.Checked)
            {
                query.AddColumn("Prov", 50, FieldValueType.String);
                query.GetColumnDetail("Prov").Font = new Font(query.GetColumnDetail("Prov").Font, FontStyle.Bold);
            }
            query.AddColumn("Pat", 150, FieldValueType.String);
            query.AddColumn("Code", 50, FieldValueType.String);
            query.AddColumn("Date", 80, FieldValueType.String);
            query.AddColumn("Fee", 100, FieldValueType.String);
            query.AddColumn("RemAmt", 100, FieldValueType.String);
            report.AddTitle("Title", "Unearned Allocation Report");
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle));
            if (checkUnearnedAllocationAllTypes.Checked)
            {
                report.AddSubTitle("UnearnedTypes", "All Unearned Types");
            }
            else
            {
                string unearnedTypes = string.Join(", ", listUnearnedAllocationTypes.SelectedItems.OfType <ODBoxItem <Def> >().Select(x => x.Tag.ItemName));
                report.AddSubTitle("UnearnedTypes", unearnedTypes);
            }
            if (checkUnearnedAllocationAllProvs.Checked)
            {
                report.AddSubTitle("Provs", Lan.g(this, "All Providers"));
            }
            else
            {
                string provNames = string.Join(", ", listUnearnedAllocationProvs.SelectedItems.OfType <ODBoxItem <Provider> >().Select(x => x.Tag.Abbr));
                report.AddSubTitle("ProvNames", provNames);
            }
            if (PrefC.HasClinicsEnabled)             //show sub titles if clinics are enabled.
            {
                if (checkUnearnedAllocationAllClins.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = string.Join(", ", listUnearnedAllocationClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.Abbr));
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            //Display report
            FormReportComplex FormRC = new FormReportComplex(report);

            FormRC.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 22
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (date2.SelectionStart < date1.SelectionStart)
            {
                MsgBox.Show(this, "End date cannot be before start date.");
                return;
            }
            if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (_hasClinicsEnabled)
            {
                if (!checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            if (!checkAllAdjs.Checked && listType.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one type must be selected.");
                return;
            }
            List <long> listClinicNums = new List <long>();

            for (int i = 0; i < listClin.SelectedIndices.Count; i++)
            {
                if (Security.CurUser.ClinicIsRestricted)
                {
                    listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                            //we know that the list is a 1:1 to _listClinics
                }
                else
                {
                    if (listClin.SelectedIndices[i] == 0)
                    {
                        listClinicNums.Add(0);
                    }
                    else
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                      //Minus 1 from the selected index
                    }
                }
            }
            List <long> listProvNums = new List <long>();

            if (checkAllProv.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                }
            }
            else
            {
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(_listProviders[listProv.SelectedIndices[i]].ProvNum);
                }
            }
            List <string> listAdjType = new List <string>();

            if (checkAllAdjs.Checked)
            {
                //add all adjustment types, including hidden
                listAdjType = Defs.GetDefsForCategory(DefCat.AdjTypes).Select(x => POut.Long(x.DefNum)).ToList();
            }
            else
            {
                for (int i = 0; i < listType.SelectedIndices.Count; i++)           //1:1
                {
                    listAdjType.Add(POut.Long(_listAdjTypeDefs[listType.SelectedIndices[i]].DefNum));
                }
            }
            ReportComplex report = new ReportComplex(true, false);
            DataTable     table  = RpAdjSheet.GetAdjTable(date1.SelectionStart, date2.SelectionStart, listProvNums,
                                                          listClinicNums, listAdjType, checkAllClin.Checked, _hasClinicsEnabled);
            Font font         = new Font("Tahoma", 9);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Daily Adjustments");
            report.AddTitle("Title", Lan.g(this, "Daily Adjustments"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date SubTitle", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle);
            if (checkAllProv.Checked)
            {
                report.AddSubTitle("Provider SubTitle", Lan.g(this, "All Providers"));
            }
            else
            {
                string provNames = "";
                for (int i = 0; i < listProv.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        provNames += ", ";
                    }
                    provNames += _listProviders[listProv.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Provider SubTitle", provNames);
            }
            if (_hasClinicsEnabled)
            {
                if (checkAllClin.Checked)
                {
                    report.AddSubTitle("Clinic SubTitle", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = "";
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            clinNames += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            clinNames += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                clinNames += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                clinNames += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                    report.AddSubTitle("Clinic SubTitle", clinNames);
                }
            }
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Date", 90, FieldValueType.Date);
            query.AddColumn("Patient Name", 130, FieldValueType.String);
            query.AddColumn("Prov", 60, FieldValueType.String);
            if (_hasClinicsEnabled)
            {
                query.AddColumn("Clinic", 70, FieldValueType.String);
            }
            query.AddColumn("AdjustmentType", 150, FieldValueType.String);
            query.AddColumn("Note", 180, FieldValueType.String);
            query.AddColumn("Amount", 75, FieldValueType.Number);
            query.GetColumnDetail("Amount").ContentAlignment = ContentAlignment.MiddleRight;
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 23
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDateFrom.errorProvider1.GetError(textDateFrom) != "" ||
                textDateTo.errorProvider1.GetError(textDateTo) != ""
                )
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
                return;
            }
            if (listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (listProv.SelectedIndices[0] == 0 && listProv.SelectedIndices.Count > 1)
            {
                MsgBox.Show(this, "You cannot select 'All' providers as well as specific providers.");
                return;
            }
            DateTime dateFrom = PIn.Date(textDateFrom.Text);
            DateTime dateTo   = PIn.Date(textDateTo.Text);

            if (dateTo < dateFrom)
            {
                MsgBox.Show(this, "To date cannot be before From date.");
                return;
            }
            bool          hasAllProvs   = (listProv.SelectedIndices[0] == 0);
            List <long>   listProvNums  = new List <long>();
            List <string> listProvNames = new List <string>();

            if (hasAllProvs)
            {
                listProv.ClearSelected();
                for (int i = 1; i < listProv.Items.Count; i++)           //Start i at 1 due to the 'All' option.
                {
                    listProv.SetSelected(i, true);
                }
            }
            for (int i = 0; i < listProv.SelectedIndices.Count; i++)
            {
                //Minus 1 due to the 'All' option.
                listProvNums.Add(_listProviders[listProv.SelectedIndices[i] - 1].ProvNum);
                listProvNames.Add(_listProviders[listProv.SelectedIndices[i] - 1].Abbr);
            }
            ReportComplex report;

            if (checkLandscape.Checked)
            {
                report = new ReportComplex(true, true);
            }
            else
            {
                report = new ReportComplex(true, false);
            }
            DataTable table        = RpReferralAnalysis.GetReferralTable(dateFrom, dateTo, listProvNums, checkAddress.Checked, checkNewPat.Checked);
            Font      font         = new Font("Tahoma", 9);
            Font      fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font      fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Referral Analysis");
            report.AddTitle("Title", Lan.g(this, "Referral Analysis"), fontTitle);
            report.AddSubTitle("PracticeTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date SubTitle", dateFrom.ToString("d") + " - " + dateTo.ToString("d"), fontSubTitle);
            if (hasAllProvs)
            {
                report.AddSubTitle("Provider Subtitle", Lan.g(this, "All Providers"));
            }
            else if (listProv.SelectedIndices.Count == 1)
            {
                report.AddSubTitle("Provider SubTitle", Lan.g(this, "Prov:") + " " + _listProviders[listProv.SelectedIndices[0] - 1].GetLongDesc());
            }
            else
            {
                report.AddSubTitle("Provider SubTitle", string.Join(", ", listProvNames));
            }
            QueryObject query = report.AddQuery(table, Lan.g(this, "Date") + ": " + DateTimeOD.Today.ToString("d"));

            query.AddColumn("Last Name", 100, FieldValueType.String);
            query.AddColumn("First Name", 100, FieldValueType.String);
            query.AddColumn("Count", 40, FieldValueType.Integer);
            query.AddColumn("Production", 75, FieldValueType.Number);
            query.GetColumnDetail("Production").ContentAlignment = ContentAlignment.MiddleRight;
            if (checkAddress.Checked)
            {
                query.AddColumn("Title", 40);
                if (checkLandscape.Checked)
                {
                    query.AddColumn("Address", 160, FieldValueType.String);
                    query.AddColumn("Add2", 140, FieldValueType.String);
                    query.AddColumn("City", 90, FieldValueType.String);
                }
                else
                {
                    query.AddColumn("Address", 140, FieldValueType.String);
                    query.AddColumn("Add2", 80, FieldValueType.String);
                    query.AddColumn("City", 70, FieldValueType.String);
                }
                query.AddColumn("State", 40, FieldValueType.String);
                query.AddColumn("Zip", 70, FieldValueType.String);
                if (checkLandscape.Checked)
                {
                    query.AddColumn("Specialty", 90, FieldValueType.String);
                }
                else
                {
                    query.AddColumn("Specialty", 60, FieldValueType.String);
                }
            }
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 24
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!Validation())
            {
                return;
            }
            DateTime     asOfDate               = PIn.Date(textDate.Text);
            List <long>  listProvNums           = new List <long>();
            List <long>  listClinicNums         = new List <long>();
            List <long>  listBillingTypeDefNums = new List <long>();
            AgeOfAccount accountAge             = GenerateLists(listProvNums, listClinicNums, listBillingTypeDefNums);
            DataTable    tableAging             = new DataTable();
            bool         isForInsAging          = false;

            tableAging = RpAging.GetAgingTable(asOfDate, checkAgeWriteoffs.Checked, checkHasDateLastPay.Checked, radioGroupByFam.Checked, checkOnlyNeg.Checked,
                                               accountAge, checkIncludeNeg.Checked, checkExcludeInactive.Checked, checkBadAddress.Checked, listProvNums, listClinicNums, listBillingTypeDefNums,
                                               checkExcludeArchive.Checked, checkIncludeInsNoBal.Checked, checkOnlyInsNoBal.Checked, checkAgeNegAdjs.Checked, isForInsAging,
                                               checkAgePatPayPlanPayments.Checked);
            ReportComplex report = new ReportComplex(true, false);

            report.IsLandscape = checkHasDateLastPay.Checked;
            report.ReportName  = Lan.g(this, "AGING OF ACCOUNTS RECEIVABLE REPORT");
            report.AddTitle("Aging Report", Lan.g(this, "AGING OF ACCOUNTS RECEIVABLE"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of ") + textDate.Text);
            if (radioAny.Checked)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            if (radio30.Checked)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            if (radio60.Checked)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            if (radio90.Checked)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (checkBillTypesAll.Checked)
            {
                report.AddSubTitle("AllBillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                string subt = _listBillingTypeDefs[listBillType.SelectedIndices[0]].ItemName;
                for (int i = 1; i < listBillType.SelectedIndices.Count; i++)
                {
                    subt += ", " + _listBillingTypeDefs[listBillType.SelectedIndices[i]].ItemName;
                }
                report.AddSubTitle("", subt);
            }
            string subtitleProvs = "";

            if (checkProvAll.Checked)
            {
                subtitleProvs = Lan.g(this, "All Providers");
            }
            else
            {
                subtitleProvs += string.Join(", ", listProv.SelectedIndices.OfType <int>().ToList().Select(x => _listProviders[x].Abbr));
            }
            report.AddSubTitle("Providers", subtitleProvs);
            if (checkAllClin.Checked)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                string subt = string.Join(", ", listClin.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.Abbr));
                report.AddSubTitle("Clinics", subt);
            }
            //Patient Account Aging Query-----------------------------------------------
            bool isWoEstIncluded = true;

            if (checkAgeWriteoffs.Checked && tableAging.Select().All(x => Math.Abs(PIn.Double(x["InsWoEst"].ToString())) <= 0.005))
            {
                tableAging.Columns.Remove("InsWoEst");
                isWoEstIncluded = false;
            }
            QueryObject query = report.AddQuery(tableAging, "Date " + DateTime.Today.ToShortDateString());

            query.AddColumn((radioGroupByFam.Checked?"GUARANTOR":"PATIENT"), 160, FieldValueType.String);
            query.AddColumn("0-30 DAYS", 75, FieldValueType.Number);
            query.AddColumn("31-60 DAYS", 75, FieldValueType.Number);
            query.AddColumn("61-90 DAYS", 75, FieldValueType.Number);
            query.AddColumn("> 90 DAYS", 75, FieldValueType.Number);
            query.AddColumn("TOTAL", 80, FieldValueType.Number);
            if (isWoEstIncluded)
            {
                query.AddColumn("-W/O EST", 75, FieldValueType.Number);
            }
            query.AddColumn("-INS EST", 75, FieldValueType.Number);
            query.AddColumn("=PATIENT", 80, FieldValueType.Number);
            if (checkHasDateLastPay.Checked)
            {
                query.AddColumn("", 10);               //add some space between the right alligned amounts and the left alligned date
                query.AddColumn("LAST PAY DATE", 100, FieldValueType.Date);
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 25
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            ReportComplex report         = new ReportComplex(true, false);
            List <long>   listClinicNums = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            DataTable table           = RpPatPortionUncollected.GetPatUncollected(date1.SelectionStart, date2.SelectionStart, listClinicNums);
            string    subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                if (checkAllClin.Checked && !Security.CurUser.ClinicIsRestricted)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            Font font         = new Font("Tahoma", 9);
            Font fontBold     = new Font("Tahoma", 9, FontStyle.Bold);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Patient Portion Uncollected");
            report.AddTitle("Title", Lan.g(this, "Patient Portion Uncollected"), fontTitle);
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Dates of Report", date1.SelectionStart.ToString("d") + " - " + date2.SelectionStart.ToString("d"), fontSubTitle);
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle);
            }

            QueryObject query = report.AddQuery(table, "Patient Portion Uncollected");

            query.AddColumn("Date", 90, FieldValueType.Date, font);
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Patient Name", 150, FieldValueType.String, font);
            query.AddColumn("Procedure", 80, FieldValueType.String, font);
            query.AddColumn("Fee", 60, FieldValueType.Number, font);
            query.AddColumn("Patient", 65, FieldValueType.Number, font);
            query.AddColumn("Adjustment", 75, FieldValueType.Number, font);
            query.AddColumn("Patient Paid", 90, FieldValueType.Number, font);
            query.AddColumn("Uncollected", 80, FieldValueType.Number, font);
            report.AddPageNum(font);
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 26
0
        //Only called in FillGrid().
        private void RefreshReport()
        {
            bool        hasValidationPassed = ValidateFields();
            List <long> listClinicNums      = new List <long>();

            if (PrefC.HasClinicsEnabled)
            {
                if (comboBoxMultiClinics.ListSelectedIndices.Contains(0))                 //All option selected
                {
                    for (int j = 0; j < _listClinics.Count; j++)
                    {
                        listClinicNums.Add(_listClinics[j].ClinicNum);                        //Add all clinics this person has access to.
                    }
                    if (!Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(0);                        //Unassigned
                    }
                }
                else                  //All option not selected
                {
                    for (int i = 0; i < comboBoxMultiClinics.ListSelectedIndices.Count; i++)
                    {
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 1].ClinicNum); //Minus 1 to skip over the All.
                        }
                        else if (comboBoxMultiClinics.ListSelectedIndices[i] == 1)                                       //Not restricted and user selected Unassigned.
                        {
                            listClinicNums.Add(0);                                                                       //Unassigned
                        }
                        else                                                                                             //Not restricted and Unassigned option is not selected.
                        {
                            listClinicNums.Add(_listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 2].ClinicNum); //Minus 2 to skip over All and Unassigned.
                        }
                    }
                }
            }
            DataTable tableNotBilled = new DataTable();

            if (hasValidationPassed)
            {
                tableNotBilled = RpProcNotBilledIns.GetProcsNotBilled(listClinicNums, checkMedical.Checked, _myReportDateFrom, _myReportDateTo, checkShowProcsNoIns.Checked);
            }
            string subtitleClinics = "";

            if (PrefC.HasClinicsEnabled)
            {
                if (comboBoxMultiClinics.ListSelectedIndices.Contains(0))                 //All option selected
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < comboBoxMultiClinics.ListSelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 1].Abbr; //Minus 1 for All.
                        }
                        else                                                                                       //Not restricted
                        {
                            if (comboBoxMultiClinics.ListSelectedIndices[i] == 1)                                  //Unassigned option selected.
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[comboBoxMultiClinics.ListSelectedIndices[i] - 2].Abbr;                            //Minus 2 for All and Unassigned.
                            }
                        }
                    }
                }
            }
            //This report will never show progress for printing.  This is because the report is being rebuilt whenever the grid is refreshed.
            _myReport            = new ReportComplex(true, false, false);
            _myReport.ReportName = Lan.g(this, "Procedures Not Billed to Insurance");
            _myReport.AddTitle("Title", Lan.g(this, "Procedures Not Billed to Insurance"));
            _myReport.AddSubTitle("Practice Name", PrefC.GetString(PrefName.PracticeTitle));
            if (_myReportDateFrom == _myReportDateTo)
            {
                _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString());
            }
            else
            {
                _myReport.AddSubTitle("Report Dates", _myReportDateFrom.ToShortDateString() + " - " + _myReportDateTo.ToShortDateString());
            }
            if (PrefC.HasClinicsEnabled)
            {
                _myReport.AddSubTitle("Clinics", subtitleClinics);
            }
            QueryObject query = _myReport.AddQuery(tableNotBilled, DateTimeOD.Today.ToShortDateString());

            query.AddColumn("Patient Name", _colWidthPatName, FieldValueType.String);
            query.AddColumn("Procedure Date", _colWidthProcDate, FieldValueType.Date);
            query.GetColumnDetail("Procedure Date").StringFormat = "d";
            query.AddColumn("Procedure Description", 300, FieldValueType.String);
            query.AddColumn("Amount", _colWidthAmount, FieldValueType.Number);
            _myReport.AddPageNum();
            if (!_myReport.SubmitQueries(false))             //If we are loading and there are no results for _myReport do not show msgbox found in SubmitQueryies(...).
            {
                return;
            }
        }
Exemplo n.º 27
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!Validation())
            {
                return;
            }
            ReportComplex report     = new ReportComplex(true, false);
            DataTable     tableAging = RpAging.GetAgingTable(GetParamsFromForm());

            report.IsLandscape = checkHasDateLastPay.Checked;
            report.ReportName  = Lan.g(this, "AGING OF ACCOUNTS RECEIVABLE REPORT");
            report.AddTitle("Aging Report", Lan.g(this, "AGING OF ACCOUNTS RECEIVABLE"));
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle));
            report.AddSubTitle("AsOf", Lan.g(this, "As of ") + textDate.Text);
            if (radioAny.Checked)
            {
                report.AddSubTitle("Balance", Lan.g(this, "Any Balance"));
            }
            if (radio30.Checked)
            {
                report.AddSubTitle("Over30", Lan.g(this, "Over 30 Days"));
            }
            if (radio60.Checked)
            {
                report.AddSubTitle("Over60", Lan.g(this, "Over 60 Days"));
            }
            if (radio90.Checked)
            {
                report.AddSubTitle("Over90", Lan.g(this, "Over 90 Days"));
            }
            if (checkBillTypesAll.Checked)
            {
                report.AddSubTitle("AllBillingTypes", Lan.g(this, "All Billing Types"));
            }
            else
            {
                report.AddSubTitle("", string.Join(", ", listBillType.SelectedIndices.OfType <int>().Select(x => _listBillingTypeDefs[x].ItemName)));
            }
            if (checkProvAll.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                report.AddSubTitle("Providers", string.Join(", ", listProv.SelectedIndices.OfType <int>().Select(x => _listProviders[x].Abbr)));
            }
            if (checkAllClin.Checked)
            {
                report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
            }
            else
            {
                report.AddSubTitle("Clinics", string.Join(", ", listClin.GetListSelected <Clinic>().Select(x => x.Abbr)));
            }
            //Patient Account Aging Query-----------------------------------------------
            bool isWoEstIncluded = true;

            if (checkAgeWriteoffs.Checked && tableAging.Select().All(x => Math.Abs(PIn.Double(x["InsWoEst"].ToString())) <= 0.005))
            {
                tableAging.Columns.Remove("InsWoEst");
                isWoEstIncluded = false;
            }
            QueryObject query = report.AddQuery(tableAging, "Date " + DateTime.Today.ToShortDateString());

            query.AddColumn((radioGroupByFam.Checked?"Guarantor":"Patient"), (checkAgeWriteoffs.Checked?135:140), FieldValueType.String);
            query.AddColumn("0-30 Days", 80, FieldValueType.Number);
            query.AddColumn("31-60 Days", 80, FieldValueType.Number);
            query.AddColumn("61-90 Days", 80, FieldValueType.Number);
            query.AddColumn("> 90 Days", 80, FieldValueType.Number);
            query.AddColumn("Total", 80, FieldValueType.Number);
            if (isWoEstIncluded)
            {
                query.AddColumn("-W/O " + (checkAgeWriteoffs.Checked?"Change":"Est"), (checkAgeWriteoffs.Checked?85:80), FieldValueType.Number);
            }
            query.AddColumn("-Ins Est", 80, FieldValueType.Number);
            query.AddColumn("=Patient", 80, FieldValueType.Number);
            if (checkHasDateLastPay.Checked)
            {
                query.AddColumn("", 10);               //add some space between the right alligned amounts and the left alligned date
                query.AddColumn("Last Pay Date", 90, FieldValueType.Date);
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 28
0
        private void ButOK_Click(object sender, EventArgs e)
        {
            if (!IsValid())
            {
                return;
            }
            ReportComplex report                  = new ReportComplex(true, false);
            List <long>   listProvNums            = new List <long>();
            List <long>   listClinicNums          = new List <long>();
            List <long>   listUnearnedTypeDefNums = new List <long>();
            string        subtitleProvs           = "";
            string        subtitleClinics         = "";
            string        subtitleUnearned        = "";

            if (checkAllProv.Checked)
            {
                subtitleProvs = "All Providers";
                listProvNums  = _listProviders.Select(x => x.ProvNum).ToList();
            }
            else
            {
                subtitleProvs = string.Join(", ", listBoxProv.GetListSelected <Provider>().Select(x => x.Abbr));
                listProvNums  = listBoxProv.GetListSelected <Provider>().Select(x => x.ProvNum).ToList();
            }
            if (checkAllUnearnedTypes.Checked)
            {
                subtitleUnearned        = "All Hidden Unearned";
                listUnearnedTypeDefNums = _listUnearnedTypes.Select(x => x.DefNum).ToList();
            }
            else
            {
                subtitleUnearned        = string.Join(", ", listBoxUnearnedTypes.GetListSelected <Def>().Select(x => x.ItemName));
                listUnearnedTypeDefNums = listBoxUnearnedTypes.GetListSelected <Def>().Select(x => x.DefNum).ToList();
            }
            if (PrefC.HasClinicsEnabled && checkAllClinics.Checked)
            {
                subtitleClinics = "All Clinics";
                listClinicNums  = listBoxClinic.AllTags <Clinic>().Select(x => x.ClinicNum).ToList();
            }
            else if (PrefC.HasClinicsEnabled && !checkAllClinics.Checked)
            {
                subtitleClinics = string.Join(", ", listBoxClinic.GetListSelected <Clinic>().Select(x => x.Abbr).ToList());
                listClinicNums  = listBoxClinic.GetListSelected <Clinic>().Select(x => x.ClinicNum).ToList();
            }
            DataTable table = new DataTable();

            table = RpHiddenPaySplits.GetReportData(listProvNums, listUnearnedTypeDefNums, listClinicNums, PrefC.HasClinicsEnabled
                                                    , odDateRangePicker.GetDateTimeFrom(), odDateRangePicker.GetDateTimeTo());
            Font font         = new Font("Tahoma", 9);
            Font fontBold     = new Font("Tahoma", 9, FontStyle.Bold);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Hidden Payment Splits");
            report.AddTitle("Title", Lan.g(this, "Hidden Payment Splits"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Providers", subtitleProvs, fontSubTitle);
            report.AddSubTitle("UnearnedTypes", subtitleUnearned, fontSubTitle);
            if (PrefC.HasClinicsEnabled)
            {
                report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle);
            }
            QueryObject query = report.AddQuery(table, "Hidden PaySplits");

            query.AddColumn("Date", 90, FieldValueType.Date, font);
            query.AddColumn("Patient", 140, FieldValueType.String, font);
            query.AddColumn("Provider", 90, FieldValueType.String, font);
            if (PrefC.HasClinicsEnabled)
            {
                query.AddColumn("Clinic", 50, FieldValueType.String, font);
            }
            query.AddColumn("Code", 65, FieldValueType.String, font);
            query.AddColumn("Description", 220, FieldValueType.String, font);
            query.AddColumn("Amount", 80, FieldValueType.Number, font);
            report.AddPageNum(font);
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex formComplex = new FormReportComplex(report);

            formComplex.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 29
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!checkAllProv.Checked && listProv.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one provider must be selected.");
                return;
            }
            if (PrefC.HasClinicsEnabled && !checkAllClin.Checked && listClin.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one clinic must be selected.");
                return;
            }
            if (!checkPatientTypes.Checked && listPatientTypes.SelectedIndices.Count == 0 &&
                !checkInsuranceTypes.Checked && listInsuranceTypes.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one type must be selected.");
                return;
            }
            if (!checkAllClaimPayGroups.Checked && listClaimPayGroups.SelectedIndices.Count == 0)
            {
                MsgBox.Show(this, "At least one claim payment group must be selected.");
                return;
            }
            ReportComplex report         = new ReportComplex(true, false);
            List <long>   listProvNums   = new List <long>();
            List <long>   listClinicNums = new List <long>();
            List <long>   listInsTypes   = new List <long>();
            List <long>   listPatTypes   = new List <long>();
            List <long>   listSelectedClaimPayGroupNums = new List <long>();

            if (checkAllProv.Checked)
            {
                listProvNums = _listProviders.Select(x => x.ProvNum).ToList();
            }
            else
            {
                listProvNums = listProv.SelectedIndices.OfType <int>().ToList().Select(x => _listProviders[x].ProvNum).ToList();
            }
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                {
                    if (Security.CurUser.ClinicIsRestricted)
                    {
                        listClinicNums.Add(_listClinics[listClin.SelectedIndices[i]].ClinicNum);                        //we know that the list is a 1:1 to _listClinics
                    }
                    else
                    {
                        if (listClin.SelectedIndices[i] == 0)
                        {
                            listClinicNums.Add(0);
                        }
                        else
                        {
                            listClinicNums.Add(_listClinics[listClin.SelectedIndices[i] - 1].ClinicNum);                          //Minus 1 from the selected index
                        }
                    }
                }
            }
            if (checkInsuranceTypes.Checked)
            {
                listInsTypes = _listInsDefs.Select(x => x.DefNum).ToList();
            }
            else
            {
                listInsTypes = listInsuranceTypes.SelectedIndices.OfType <int>().Select(x => _listInsDefs[x].DefNum).ToList();
            }
            if (checkPatientTypes.Checked)
            {
                listPatTypes = _listPayDefs.Select(x => x.DefNum).ToList();
            }
            else
            {
                listPatTypes = listPatientTypes.SelectedIndices.OfType <int>().Select(x => _listPayDefs[x].DefNum).ToList();
            }
            if (checkAllClaimPayGroups.Checked)
            {
                listSelectedClaimPayGroupNums = _listClaimPayGroupDefs.Select(x => x.DefNum).ToList();
            }
            else
            {
                listSelectedClaimPayGroupNums = listClaimPayGroups.SelectedIndices.OfType <int>().Select(x => _listClaimPayGroupDefs[x].DefNum).ToList();
            }
            DataTable tableIns = new DataTable();

            if (listProvNums.Count != 0)
            {
                tableIns = RpPaySheet.GetInsTable(date1.SelectionStart, date2.SelectionStart, listProvNums, listClinicNums, listInsTypes,
                                                  listSelectedClaimPayGroupNums, checkAllProv.Checked, checkAllClin.Checked, checkInsuranceTypes.Checked, radioPatient.Checked,
                                                  checkAllClaimPayGroups.Checked, checkShowProvSeparate.Checked);
            }
            DataTable tablePat = RpPaySheet.GetPatTable(date1.SelectionStart, date2.SelectionStart, listProvNums, listClinicNums, listPatTypes,
                                                        checkAllProv.Checked, checkAllClin.Checked, checkPatientTypes.Checked, radioPatient.Checked, checkUnearned.Checked, checkShowProvSeparate.Checked);
            string subtitleProvs   = "";
            string subtitleClinics = "";

            if (checkAllProv.Checked)
            {
                subtitleProvs = Lan.g(this, "All Providers");
            }
            else
            {
                subtitleProvs += string.Join(", ", listProv.SelectedIndices.OfType <int>().ToList().Select(x => _listProviders[x].Abbr));
            }
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                if (checkAllClin.Checked && !Security.CurUser.ClinicIsRestricted)
                {
                    subtitleClinics = Lan.g(this, "All Clinics");
                }
                else
                {
                    for (int i = 0; i < listClin.SelectedIndices.Count; i++)
                    {
                        if (i > 0)
                        {
                            subtitleClinics += ", ";
                        }
                        if (Security.CurUser.ClinicIsRestricted)
                        {
                            subtitleClinics += _listClinics[listClin.SelectedIndices[i]].Abbr;
                        }
                        else
                        {
                            if (listClin.SelectedIndices[i] == 0)
                            {
                                subtitleClinics += Lan.g(this, "Unassigned");
                            }
                            else
                            {
                                subtitleClinics += _listClinics[listClin.SelectedIndices[i] - 1].Abbr;                            //Minus 1 from the selected index
                            }
                        }
                    }
                }
            }
            Font font         = new Font("Tahoma", 9);
            Font fontBold     = new Font("Tahoma", 9, FontStyle.Bold);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.ReportName = Lan.g(this, "Daily Payments");
            report.AddTitle("Title", Lan.g(this, "Daily Payments"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Providers", subtitleProvs, fontSubTitle);
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                report.AddSubTitle("Clinics", subtitleClinics, fontSubTitle);
            }
            Dictionary <long, string> dictInsDefNames = new Dictionary <long, string>();
            Dictionary <long, string> dictPatDefNames = new Dictionary <long, string>();
            List <Def> insDefs = Defs.GetDefsForCategory(DefCat.InsurancePaymentType, true);
            List <Def> patDefs = Defs.GetDefsForCategory(DefCat.PaymentTypes, true);

            for (int i = 0; i < insDefs.Count; i++)
            {
                dictInsDefNames.Add(insDefs[i].DefNum, insDefs[i].ItemName);
            }
            for (int i = 0; i < patDefs.Count; i++)
            {
                dictPatDefNames.Add(patDefs[i].DefNum, patDefs[i].ItemName);
            }
            dictPatDefNames.Add(0, "Income Transfer");           //Otherwise income transfers show up with a payment type of "Undefined"
            int[] summaryGroups1 = { 1 };
            int[] summaryGroups2 = { 2 };
            int[] summaryGroups3 = { 1, 2 };
            //Insurance Payments Query-------------------------------------
            QueryObject query = report.AddQuery(tableIns, "Insurance Payments", "PayType", SplitByKind.Definition, 1, true, dictInsDefNames, fontSubTitle);

            query.AddColumn("Date", 90, FieldValueType.Date, font);
            //query.GetColumnDetail("Date").SuppressIfDuplicate = true;
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Carrier", 150, FieldValueType.String, font);
            query.AddColumn("Patient Name", 150, FieldValueType.String, font);
            query.AddColumn("Provider", 90, FieldValueType.String, font);
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                query.AddColumn("Clinic", 120, FieldValueType.String, font);
            }
            query.AddColumn("Check#", 75, FieldValueType.String, font);
            query.AddColumn("Amount", 90, FieldValueType.Number, font);
            query.AddGroupSummaryField("Total Insurance Payments:", "Amount", "amt", SummaryOperation.Sum, new List <int>(summaryGroups1), Color.Black, fontBold, 0, 10);
            //Patient Payments Query---------------------------------------
            query = report.AddQuery(tablePat, "Patient Payments", "PayType", SplitByKind.Definition, 2, true, dictPatDefNames, fontSubTitle);
            query.AddColumn("Date", 90, FieldValueType.Date, font);
            //query.GetColumnDetail("Date").SuppressIfDuplicate = true;
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Paying Patient", 270, FieldValueType.String, font);
            query.AddColumn("Provider", 90, FieldValueType.String, font);
            if (!PrefC.GetBool(PrefName.EasyNoClinics))
            {
                query.AddColumn("Clinic", 120, FieldValueType.String, font);
            }
            query.AddColumn("Check#", 75, FieldValueType.String, font);
            query.AddColumn("Amount", 120, FieldValueType.Number, font);
            query.AddGroupSummaryField("Total Patient Payments:", "Amount", "amt", SummaryOperation.Sum, new List <int>(summaryGroups2), Color.Black, fontBold, 0, 10);
            query.AddGroupSummaryField("Total All Payments:", "Amount", "amt", SummaryOperation.Sum, new List <int>(summaryGroups3), Color.Black, fontBold, 0, 10);
            report.AddPageNum(font);
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemplo n.º 30
0
        private void ExecuteReport()
        {
            DateTime dateStart;
            DateTime dateEnd;
            bool     isMedOrClinic;

            if (!DateTime.TryParse(textDateStart.Text, out dateStart))
            {
                MsgBox.Show(this, "Please input a valid date.");
                return;
            }
            if (!DateTime.TryParse(textDateEnd.Text, out dateEnd))
            {
                MsgBox.Show(this, "Please input a valid date.");
                return;
            }
            if (String.IsNullOrWhiteSpace(textCarrier.Text))
            {
                MsgBox.Show(this, "Carrier can not be blank. Please input a value for carrier.");
                return;
            }
            ReportComplex report = new ReportComplex(true, true);

            if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
            {
                isMedOrClinic = true;
            }
            else
            {
                isMedOrClinic = false;
            }
            Font font         = new Font("Tahoma", 9);
            Font fontTitle    = new Font("Tahoma", 17, FontStyle.Bold);
            Font fontSubTitle = new Font("Tahoma", 10, FontStyle.Bold);

            report.AddTitle("Title", Lan.g(this, "Capitation Utilization"), fontTitle);
            report.AddSubTitle("PracTitle", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", textDateStart.Text + " - " + textDateEnd.Text, fontSubTitle);
            DataTable   table = RpCapitation.GetCapitationTable(dateStart, dateEnd, textCarrier.Text, isMedOrClinic);
            QueryObject query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);

            query.AddColumn("Carrier", 150, FieldValueType.String, font);
            query.GetColumnDetail("Carrier").SuppressIfDuplicate = true;
            query.AddColumn("Subscriber", 120, FieldValueType.String, font);
            query.GetColumnDetail("Subscriber").SuppressIfDuplicate = true;
            query.AddColumn("Subsc SSN", 70, FieldValueType.String, font);
            query.GetColumnDetail("Subsc SSN").SuppressIfDuplicate = true;
            query.AddColumn("Patient", 120, FieldValueType.String, font);
            query.AddColumn("Pat DOB", 80, FieldValueType.Date, font);
            if (Clinics.IsMedicalPracticeOrClinic(Clinics.ClinicNum))
            {
                query.AddColumn("Code", 140, FieldValueType.String, font);
                query.AddColumn("Proc Description", 120, FieldValueType.String, font);
                query.AddColumn("Date", 80, FieldValueType.Date, font);
                query.AddColumn("UCR Fee", 60, FieldValueType.Number, font);
                query.AddColumn("Co-Pay", 60, FieldValueType.Number, font);
            }
            else
            {
                query.AddColumn("Code", 50, FieldValueType.String, font);
                query.AddColumn("Proc Description", 120, FieldValueType.String, font);
                query.AddColumn("Tth", 30, FieldValueType.String, font);
                query.AddColumn("Surf", 40, FieldValueType.String, font);
                query.AddColumn("Date", 80, FieldValueType.Date, font);
                query.AddColumn("UCR Fee", 70, FieldValueType.Number, font);
                query.AddColumn("Co-Pay", 70, FieldValueType.Number, font);
            }
            if (!report.SubmitQueries())
            {
                //DialogResult=DialogResult.Cancel;
                return;
            }
            FormReportComplex FormR = new FormReportComplex(report);

            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }