Esempio n. 1
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;
        }
Esempio n. 2
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;
        }