private void butUnearnedAcctOk_Click(object sender, EventArgs e)
        {
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkUnearnedAcctAllClins.Checked && listUnearnedAcctClins.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            List <long> listClinicNums = new List <long>();                                                                           //stores clinicNums of the selected indices

            listClinicNums.AddRange(listUnearnedAcctClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum)); //empty if "All" is checked.
            ReportComplex report = new ReportComplex(true, false);
            DataTable     table  = RpUnearnedIncome.GetUnearnedAccountData(listClinicNums);

            report.ReportName = "Unearned Accounts Report";
            report.AddTitle("Title", "Unearned Accounts");
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle));
            if (PrefC.HasClinicsEnabled)             //show sub titles if clinics are enabled.
            {
                if (checkUnearnedAcctAllClins.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = string.Join(",", listUnearnedAcctClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.Abbr));
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            QueryObject query;

            if (PrefC.HasClinicsEnabled)
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
                query.AddColumn("Guarantor", 280, FieldValueType.String);
                query.AddColumn("Type", 120, FieldValueType.String);
                query.AddColumn("Clinic", 80, FieldValueType.String);
                query.AddColumn("Amount", 100, FieldValueType.Number);
            }
            else
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
                query.AddColumn("Guarantor", 360, FieldValueType.String);
                query.AddColumn("Type", 120, FieldValueType.String);
                query.AddColumn("Amount", 100, FieldValueType.Number);
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            //Display report
            FormReportComplex FormRC = new FormReportComplex(report);

            FormRC.ShowDialog();
            DialogResult = DialogResult.OK;
        }
        ///<summary>This report has never worked for Oracle.</summary>
        private void butOK_Click(object sender, System.EventArgs e)
        {
            //create the report
            ReportComplex report = new ReportComplex(true, false);
            DataTable     data   = Accounts.GetGeneralLedger(date1.SelectionStart, date2.SelectionStart);

            for (int i = 0; i < data.Rows.Count; i++)
            {
                data.Rows[i]["Balance"] = ODR.Aggregate.RunningSumForAccounts(data.Rows[i]["AccountNum"], data.Rows[i]["DebitAmt"], data.Rows[i]["CreditAmt"], data.Rows[i]["AcctType"]);
            }
            Font font         = new Font("Tahoma", 7);
            Font fontTitle    = new Font("Tahoma", 9);
            Font fontSubTitle = new Font("Tahoma", 8);

            report.ReportName = "General Ledger";
            report.AddTitle("Title", "Detail of General Ledger", fontTitle);
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", date1.SelectionStart.ToShortDateString() + " - " + date2.SelectionStart.ToShortDateString(), fontSubTitle);
            report.Sections[AreaSectionType.ReportHeader].Height -= 20;
            //setup query
            QueryObject query;

            query = report.AddQuery(data, "Accounts", "Description", SplitByKind.Value, 1, true);
            query.GetGroupTitle().Font = new Font("Tahoma", 8);
            // add columns to report
            query.AddColumn("Date", 75, FieldValueType.Date, font);
            //query.GetColumnDetail("Date").SuppressIfDuplicate = true;
            query.GetColumnDetail("Date").StringFormat = "d";
            query.AddColumn("Memo", 175, FieldValueType.String, font);
            query.AddColumn("Splits", 175, FieldValueType.String, font);
            query.AddColumn("Check", 45, FieldValueType.String, font);
            query.AddColumn("Debit", 70, FieldValueType.String, font);
            query.AddColumn("Credit", 70, FieldValueType.String, font);
            query.AddColumn("Balance", 70, FieldValueType.String, font);
            report.AddPageNum(font);
            report.AddGridLines();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            //FormR.MyReport=report;
            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }
Exemple #3
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;
        }
Exemple #4
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;
        }
        private void butLineItemOK_Click(object sender, EventArgs e)
        {
            if (dateLineItemTo.SelectionStart < dateLineItemFrom.SelectionStart)
            {
                MsgBox.Show(this, "End date cannot be before start date.");
                return;
            }
            if (PrefC.HasClinicsEnabled)
            {
                if (!checkLineItemAllClins.Checked && listLineItemClins.SelectedIndices.Count == 0)
                {
                    MsgBox.Show(this, "At least one clinic must be selected.");
                    return;
                }
            }
            List <long> listClinicNums = new List <long>();                                                                       //stores clinicNums of the selected indices

            listClinicNums.AddRange(listLineItemClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.ClinicNum)); //empty if "All" is checked.
            ReportComplex report = new ReportComplex(true, false);
            DataTable     table  = RpUnearnedIncome.GetLineItemUnearnedData(listClinicNums, dateLineItemFrom.SelectionStart, dateLineItemTo.SelectionStart);

            report.ReportName = "Line Item Unearned Income Report";
            report.AddTitle("Title", "Line Item Unearned Income Activity");
            report.AddSubTitle("Practice Title", PrefC.GetString(PrefName.PracticeTitle));
            string dateRange = dateLineItemFrom.SelectionStart.ToShortDateString() + " - " + dateLineItemTo.SelectionStart.ToShortDateString();

            report.AddSubTitle("Date", dateRange);
            if (PrefC.HasClinicsEnabled)             //show sub titles if clinics are enabled.
            {
                if (checkLineItemAllClins.Checked)
                {
                    report.AddSubTitle("Clinics", Lan.g(this, "All Clinics"));
                }
                else
                {
                    string clinNames = string.Join(",", listLineItemClins.SelectedItems.OfType <ODBoxItem <Clinic> >().Select(x => x.Tag.Abbr));
                    report.AddSubTitle("Clinics", clinNames);
                }
            }
            QueryObject query;

            if (PrefC.HasClinicsEnabled)
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
                query.AddColumn("Date", 100, FieldValueType.Date);
                query.AddColumn("Patient", 180, FieldValueType.String);
                query.AddColumn("Type", 120, FieldValueType.String);
                query.AddColumn("Clinic", 80, FieldValueType.String);
                query.AddColumn("Amount", 100, FieldValueType.Number);
            }
            else
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
                query.AddColumn("Date", 100, FieldValueType.String);
                query.AddColumn("Patient", 260, FieldValueType.String);
                query.AddColumn("Type", 120, FieldValueType.String);
                query.AddColumn("Amount", 100, FieldValueType.Number);
            }
            report.AddPageNum();
            report.AddGridLines();
            if (!report.SubmitQueries())
            {
                return;
            }
            //Display report
            FormReportComplex FormRC = new FormReportComplex(report);

            FormRC.ShowDialog();
            DialogResult = DialogResult.OK;
        }
        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;
        }
Exemple #7
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;
        }
Exemple #8
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;
        }
Exemple #9
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();
        }
        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;
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!IsValid())
            {
                return;
            }
            List <long> listClinicNums = new List <long>();

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

            if (checkAllProvs.Checked)
            {
                for (int i = 0; i < _listProviders.Count; i++)
                {
                    listProvNums.Add(_listProviders[i].ProvNum);
                }
            }
            else
            {
                for (int i = 0; i < listProvs.SelectedIndices.Count; i++)
                {
                    listProvNums.Add(_listProviders[listProvs.SelectedIndices[i]].ProvNum);
                }
            }
            ReportComplex     report       = new ReportComplex(true, true);
            DateTime          dateFrom     = PIn.Date(textDateFrom.Text);
            DateTime          dateTo       = PIn.Date(textDateTo.Text);
            DataTable         table        = new DataTable();
            List <ApptStatus> listStatuses = new List <ApptStatus> {
                ApptStatus.Planned, ApptStatus.UnschedList
            };

            if (!checkShowNoteAppts.Checked)
            {
                listStatuses.Add(ApptStatus.PtNote);
                listStatuses.Add(ApptStatus.PtNoteCompleted);
            }
            RpAppointments.SortAndFilterBy sortBy = radioDateAptCreated.Checked ? RpAppointments.SortAndFilterBy.SecDateEntry : RpAppointments.SortAndFilterBy.AptDateTime;
            table = RpAppointments.GetAppointmentTable(dateFrom, dateTo, listProvNums, listClinicNums, _hasClinicsEnabled, checkWebSchedRecall.Checked,
                                                       checkWebSchedNewPat.Checked, checkWebSchedASAP.Checked, sortBy, listStatuses, new List <long>(), nameof(FormRpAppointments));
            //create the report
            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, "Appointments");
            report.AddTitle("Title", Lan.g(this, "Appointments"), fontTitle);
            report.AddSubTitle("PracName", PrefC.GetString(PrefName.PracticeTitle), fontSubTitle);
            report.AddSubTitle("Date", dateFrom.ToShortDateString() + " - " + dateTo.ToShortDateString(), fontSubTitle);
            if (checkAllProvs.Checked)
            {
                report.AddSubTitle("Providers", Lan.g(this, "All Providers"));
            }
            else
            {
                string str = "";
                for (int i = 0; i < listProvs.SelectedIndices.Count; i++)
                {
                    if (i > 0)
                    {
                        str += ", ";
                    }
                    str += _listProviders[listProvs.SelectedIndices[i]].Abbr;
                }
                report.AddSubTitle("Providers", str);
            }
            QueryObject query;

            //setup query
            if (!_hasClinicsEnabled)
            {
                query = report.AddQuery(table, "", "", SplitByKind.None, 1, true);
            }
            else
            {
                query = report.AddQuery(table, "", "ClinicDesc", SplitByKind.Value, 1, true);
            }
            // add columns to report
            if (radioAptDate.Checked)
            {
                query.AddColumn("Date", 80, FieldValueType.Date, font);
                query.GetColumnDetail("Date").SuppressIfDuplicate = true;
                query.GetColumnDetail("Date").StringFormat        = "d";
            }
            else
            {
                query.AddColumn("DateCreated", 80, FieldValueType.Date, font);
                query.GetColumnDetail("DateCreated").SuppressIfDuplicate = true;
                query.GetColumnDetail("DateCreated").StringFormat        = "d";
                query.AddColumn("AptDate", 80, FieldValueType.Date, font);
                query.GetColumnDetail("AptDate").StringFormat = "d";
            }
            query.AddColumn("PatNum", 55, FieldValueType.String, font);
            query.AddColumn("Patient", 150, FieldValueType.String, font);
            query.AddColumn("Age", 45, FieldValueType.Age, font);
            query.AddColumn("Time", 65, FieldValueType.Date, font);
            query.GetColumnDetail("Time").StringFormat     = "t";
            query.GetColumnDetail("Time").ContentAlignment = ContentAlignment.MiddleRight;
            query.GetColumnHeader("Time").ContentAlignment = ContentAlignment.MiddleRight;
            query.AddColumn("Length", 45, FieldValueType.Integer, font);
            query.GetColumnHeader("Length").Location = new Point(
                query.GetColumnHeader("Length").Location.X,
                query.GetColumnHeader("Length").Location.Y);
            query.GetColumnHeader("Length").ContentAlignment = ContentAlignment.MiddleCenter;
            query.GetColumnDetail("Length").ContentAlignment = ContentAlignment.MiddleCenter;
            query.GetColumnDetail("Length").Location         = new Point(
                query.GetColumnDetail("Length").Location.X,
                query.GetColumnDetail("Length").Location.Y);
            query.AddColumn("Description", 170, FieldValueType.String, font);
            query.AddColumn("Home Ph.", 120, FieldValueType.String, font);
            query.AddColumn("Work Ph.", 120, FieldValueType.String, font);
            query.AddColumn("Cell Ph.", 120, FieldValueType.String, font);
            report.AddPageNum(font);
            report.AddGridLines();
            // execute query
            if (!report.SubmitQueries())
            {
                return;
            }
            // display report
            FormReportComplex FormR = new FormReportComplex(report);

            //FormR.MyReport=report;
            FormR.ShowDialog();
            DialogResult = DialogResult.OK;
        }