///<summary>Inserts one DisplayReport into the database.  Provides option to use the existing priKey.  Doesn't use the cache.</summary>
        public static long InsertNoCache(DisplayReport displayReport, bool useExistingPK)
        {
            bool   isRandomKeys = Prefs.GetBoolNoCache(PrefName.RandomPrimaryKeys);
            string command      = "INSERT INTO displayreport (";

            if (!useExistingPK && isRandomKeys)
            {
                displayReport.DisplayReportNum = ReplicationServers.GetKeyNoCache("displayreport", "DisplayReportNum");
            }
            if (isRandomKeys || useExistingPK)
            {
                command += "DisplayReportNum,";
            }
            command += "InternalName,ItemOrder,Description,Category,IsHidden,IsVisibleInSubMenu) VALUES(";
            if (isRandomKeys || useExistingPK)
            {
                command += POut.Long(displayReport.DisplayReportNum) + ",";
            }
            command +=
                "'" + POut.String(displayReport.InternalName) + "',"
                + POut.Int(displayReport.ItemOrder) + ","
                + "'" + POut.String(displayReport.Description) + "',"
                + POut.Int((int)displayReport.Category) + ","
                + POut.Bool(displayReport.IsHidden) + ","
                + POut.Bool(displayReport.IsVisibleInSubMenu) + ")";
            if (useExistingPK || isRandomKeys)
            {
                Db.NonQ(command);
            }
            else
            {
                displayReport.DisplayReportNum = Db.NonQ(command, true, "DisplayReportNum", "displayReport");
            }
            return(displayReport.DisplayReportNum);
        }
        ///<summary>Commit changes that the user might have made to the display name.</summary>
        private void CommitChange()
        {
            DisplayReportCategory selectedCat = (DisplayReportCategory)_selectedGrid.Tag;
            DisplayReport         clicked     = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y);

            clicked.Description = _selectedGrid.Rows[_selectedCell.Y].Cells[0].Text.Replace(" (hidden)", "");         //Remove (hidden) text
        }
 ///<summary>Returns true if Update(DisplayReport,DisplayReport) would make changes to the database.
 ///Does not make any changes to the database and can be called before remoting role is checked.</summary>
 public static bool UpdateComparison(DisplayReport displayReport, DisplayReport oldDisplayReport)
 {
     if (displayReport.InternalName != oldDisplayReport.InternalName)
     {
         return(true);
     }
     if (displayReport.ItemOrder != oldDisplayReport.ItemOrder)
     {
         return(true);
     }
     if (displayReport.Description != oldDisplayReport.Description)
     {
         return(true);
     }
     if (displayReport.Category != oldDisplayReport.Category)
     {
         return(true);
     }
     if (displayReport.IsHidden != oldDisplayReport.IsHidden)
     {
         return(true);
     }
     if (displayReport.IsVisibleInSubMenu != oldDisplayReport.IsVisibleInSubMenu)
     {
         return(true);
     }
     return(false);
 }
Example #4
0
 ///<summary>Inserts one DisplayReport into the database.  Returns the new priKey.</summary>
 public static long Insert(DisplayReport displayReport)
 {
     if (DataConnection.DBtype == DatabaseType.Oracle)
     {
         displayReport.DisplayReportNum = DbHelper.GetNextOracleKey("displayreport", "DisplayReportNum");
         int loopcount = 0;
         while (loopcount < 100)
         {
             try {
                 return(Insert(displayReport, true));
             }
             catch (Oracle.ManagedDataAccess.Client.OracleException ex) {
                 if (ex.Number == 1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated"))
                 {
                     displayReport.DisplayReportNum++;
                     loopcount++;
                 }
                 else
                 {
                     throw ex;
                 }
             }
         }
         throw new ApplicationException("Insert failed.  Could not generate primary key.");
     }
     else
     {
         return(Insert(displayReport, false));
     }
 }
        ///<summary>Updates one DisplayReport in the database.</summary>
        public static void Update(DisplayReport displayReport)
        {
            string command = "UPDATE displayreport SET "
                             + "InternalName      = '" + POut.String(displayReport.InternalName) + "', "
                             + "ItemOrder         =  " + POut.Int(displayReport.ItemOrder) + ", "
                             + "Description       = '" + POut.String(displayReport.Description) + "', "
                             + "Category          =  " + POut.Int((int)displayReport.Category) + ", "
                             + "IsHidden          =  " + POut.Bool(displayReport.IsHidden) + ", "
                             + "IsVisibleInSubMenu=  " + POut.Bool(displayReport.IsVisibleInSubMenu) + " "
                             + "WHERE DisplayReportNum = " + POut.Long(displayReport.DisplayReportNum);

            Db.NonQ(command);
        }
Example #6
0
 ///<summary>Inserts one DisplayReport into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(DisplayReport displayReport)
 {
     if (DataConnection.DBtype == DatabaseType.MySql)
     {
         return(InsertNoCache(displayReport, false));
     }
     else
     {
         if (DataConnection.DBtype == DatabaseType.Oracle)
         {
             displayReport.DisplayReportNum = DbHelper.GetNextOracleKey("displayreport", "DisplayReportNum");                  //Cacheless method
         }
         return(InsertNoCache(displayReport, true));
     }
 }
Example #7
0
		///<summary>Called from this form to do OpenReportHelper(...) logic and then close when needed.</summary>
		private void OpenReportLocalHelper(DisplayReport displayReport,List<GroupPermission> listReportPermissions,bool doValidatePerm=true)
		{
			RpNonModalSelection=OpenReportHelper(displayReport,listReportPermissions,doValidatePerm);
			switch(displayReport.InternalName) {
				//Non-modal report windows are handled after closing.
				case DisplayReports.ReportNames.UnfinalizedInsPay:
				case DisplayReports.ReportNames.OutstandingInsClaims:
				case DisplayReports.ReportNames.ClaimsNotSent:
				case DisplayReports.ReportNames.CustomAging:
				case DisplayReports.ReportNames.TreatmentFinder:
				case DisplayReports.ReportNames.WebSchedAppointments:
				case DisplayReports.ReportNames.ReferredProcTracking:
				case DisplayReports.ReportNames.IncompleteProcNotes:
					Close();
				break;
			}
		}
        ///<summary>Converts a DataTable to a list of objects.</summary>
        public static List <DisplayReport> TableToList(DataTable table)
        {
            List <DisplayReport> retVal = new List <DisplayReport>();
            DisplayReport        displayReport;

            foreach (DataRow row in table.Rows)
            {
                displayReport = new DisplayReport();
                displayReport.DisplayReportNum   = PIn.Long(row["DisplayReportNum"].ToString());
                displayReport.InternalName       = PIn.String(row["InternalName"].ToString());
                displayReport.ItemOrder          = PIn.Int(row["ItemOrder"].ToString());
                displayReport.Description        = PIn.String(row["Description"].ToString());
                displayReport.Category           = (OpenDentBusiness.DisplayReportCategory)PIn.Int(row["Category"].ToString());
                displayReport.IsHidden           = PIn.Bool(row["IsHidden"].ToString());
                displayReport.IsVisibleInSubMenu = PIn.Bool(row["IsVisibleInSubMenu"].ToString());
                retVal.Add(displayReport);
            }
            return(retVal);
        }
Example #9
0
        static void Main(string[] args)
        {
            Station       ats    = new Station();
            DisplayReport report = new DisplayReport();
            Billing       bs     = new Billing(ats);
            List <Port>   port   = new List <Port>();

            port.Add(new Port(ats, "0001"));
            port.Add(new Port(ats, "0002"));
            port.Add(new Port(ats, "0003"));

            Client client1 = new Client("Stieve", "Stieve", 100);
            Client client2 = new Client("Bob", "Bob", 50);
            Client client3 = new Client("Rick", "Rick", 30);

            client1.PropertyChanged += OnBalacneChanged;
            client2.PropertyChanged += OnBalacneChanged;
            client3.PropertyChanged += OnBalacneChanged;

            Contract c1 = new Contract(client1, port[0].PortNumber, Rate.Absolute);
            Contract c2 = new Contract(client2, port[1].PortNumber, Rate.Ultra);
            Contract c3 = new Contract(client3, port[2].PortNumber, Rate.Absolute);

            c1.Client.AddMoney(20);
            c1.Client.RemoveMoney(15);
            var t1 = ats.GetNewTerminal(c1, port[0]);
            var t2 = ats.GetNewTerminal(c2, port[1]);
            var t3 = ats.GetNewTerminal(c3, port[2]);

            t1.ConnectToPort();
            t2.ConnectToPort();
            t3.ConnectToPort();
            t1.Call(t2.PhoneNumber);
            t2.Call(t3.PhoneNumber);
            t2.Call(t2.PhoneNumber);
            t2.Call("54532");
            Console.Write($"\nList of records of the abonent with number: {t2.PhoneNumber}");
            Console.WriteLine();
            report.Display(bs.GetReport(t2.PhoneNumber));
            report.Sort(bs.GetReport(t2.PhoneNumber), TypeOfSorting.ByCostOfTalk);
            report.DisplaySortedCall(report.Sort(bs.GetReport(t2.PhoneNumber), TypeOfSorting.ByCostOfTalk));
        }
        private void butDown_Click(object sender, EventArgs e)
        {
            if (_selectedCell.Y == -1 || _selectedGrid == null)
            {
                MsgBox.Show(this, "Please select a report first.");
                return;
            }
            DisplayReportCategory selectedCat    = (DisplayReportCategory)_selectedGrid.Tag;
            DisplayReport         selectedReport = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y);

            if (selectedReport.ItemOrder == _selectedGrid.Rows.Count - 1)
            {
                return;                 //the item is already the last in the list and cannot go down anymore.
            }
            DisplayReport switchReport = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y + 1);

            selectedReport.ItemOrder++;
            _selectedCell.Y++;
            switchReport.ItemOrder--;
            FillGrids();
        }
        ///<summary>Returns the appropriate user-friendly internal name.</summary>
        private string GetInternalName(DisplayReport displayReport)
        {
            switch (displayReport.InternalName)
            {
            case "ODToday":
                return("Today");

            case "ODYesterday":
                return("Yesterday");

            case "ODThisMonth":
                return("This Month");

            case "ODLastMonth":
                return("Last Month");

            case "ODThisYear":
                return("This Year");

            case "ODMoreOptions":
                return("More Options");

            case "ODProviderPayrollSummary":
                return("Provider Payroll Summary");

            case "ODProviderPayrollDetailed":
                return("Provider Payroll Detailed");

            case "ODAdjustments":
                return("Adjustments");

            case "ODPayments":
                return("Payments");

            case "ODProcedures":
                return("Procedures");

            case "ODWriteoffs":
                return("Writeoffs");

            case DisplayReports.ReportNames.IncompleteProcNotes:
                return("Incomplete Proc Notes");

            case "ODRoutingSlips":
                return("Routing Slips");

            case "ODAgingAR":
                return("Aging AR");

            case DisplayReports.ReportNames.ClaimsNotSent:
                return("Claims Not Sent");

            case "ODCapitation":
                return("Capitation");

            case "ODFinanceCharge":
                return("Finance Charge");

            case DisplayReports.ReportNames.OutstandingInsClaims:
                return("Outstanding Ins Claims");

            case "ODProcsNotBilled":
                return("Procs Not Billed");

            case "ODPPOWriteoffs":
                return("PPO Writeoffs");

            case "ODPaymentPlans":
                return("Payment Plans");

            case "ODReceivablesBreakdown":
                return("Receivables Breakdown");

            case "ODUnearnedIncome":
                return("Unearned Income");

            case "ODInsuranceOverpaid":
                return("Insurance Overpaid");

            case "ODActivePatients":
                return("Active Patients");

            case "ODAppointments":
                return("Appointments");

            case "ODBirthdays":
                return("Birthdays");

            case "ODBrokenAppointments":
                return("Broken Appointments");

            case "ODInsurancePlans":
                return("Insurance Plans");

            case "ODNewPatients":
                return("New Patients");

            case "ODPatientsRaw":
                return("Patients Raw");

            case "ODPatientNotes":
                return("Patient Notes");

            case "ODPrescriptions":
                return("Prescriptions");

            case "ODProcedureCodes":
                return("Procedure Codes");

            case "ODReferralsRaw":
                return("Referrals Raw");

            case "ODReferralAnalysis":
                return("Referral Analysis");

            case DisplayReports.ReportNames.ReferredProcTracking:
                return("Referred Proc Tracking");

            case DisplayReports.ReportNames.TreatmentFinder:
                return("Treatment Finder");

            case "ODRawScreeningData":
                return("Raw Screening Data");

            case "ODRawPopulationData":
                return("Raw Population Data");

            case "ODEligibilityFile":
                return("Eligibility File");

            case "ODEncounterFile":
                return("Encounter File");

            case "ODPresentedTreatmentProd":
                return("Presented Treatment Prod");

            case "ODTreatmentPresentationStats":
                return("Treatment Presentation Stats");

            case "ODNetProdDetailDaily":
                return("Net Prod Detail Daily");

            case "ODDentalSealantMeasure":
                return("Dental Sealant Measure");

            case "ODInsurancePayPlansPastDue":
                return("Insurance Pay Plans Past Due");

            case DisplayReports.ReportNames.UnfinalizedInsPay:
                return("Unfinalized Insurance");

            case DisplayReports.ReportNames.PatPortionUncollected:
                return("Patient Portion Uncollected");

            case DisplayReports.ReportNames.WebSchedAppointments:
                return("Web Sched Appointments");

            case DisplayReports.ReportNames.InsAging:
                return("Insurance Aging Report");

            default:
                return("");
            }
        }
        ///<summary>This method is used by all grids in this form. If any new grids are added, they will need to be added to this method.</summary>
        private void grid_CellClick(object sender, ODGridClickEventArgs e)
        {
            if (_selectedCell.Y != -1 && _selectedGrid != null)
            {
                //commit change before the new cell is selected to save the old cell's changes.
                CommitChange();
            }
            _selectedCell.X = e.Col;
            _selectedCell.Y = e.Row;
            _selectedGrid   = (ODGrid)sender;
            //this label makes sure the user always has some idea of what the selected report is, even if the DisplayName might be incomprehensible.
            labelODInternal.Text = GetInternalName((DisplayReport)_selectedGrid.Rows[_selectedCell.Y].Tag);
            DisplayReportCategory selectedCat = (DisplayReportCategory)_selectedGrid.Tag;

            //de-select all but the currently selected grid
            if (selectedCat != DisplayReportCategory.ProdInc)
            {
                gridProdInc.SetSelected(-1, true);
            }
            if (selectedCat != DisplayReportCategory.Daily)
            {
                gridDaily.SetSelected(-1, true);
            }
            if (selectedCat != DisplayReportCategory.Monthly)
            {
                gridMonthly.SetSelected(-1, true);
            }
            if (selectedCat != DisplayReportCategory.Lists)
            {
                gridLists.SetSelected(-1, true);
            }
            if (selectedCat != DisplayReportCategory.PublicHealth)
            {
                gridPublicHealth.SetSelected(-1, true);
            }
            DisplayReport clicked = ListDisplayReportAll.Find(x => x.Category == selectedCat && x.ItemOrder == _selectedCell.Y);

            if (_isPermissionMode)
            {
                if (_selectedCell.X == 1)
                {
                    GroupPermission groupPerm = ListGroupPermissionsForReports.Find(x => x.FKey == clicked.DisplayReportNum && x.UserGroupNum == _listUserGroups[comboUserGroup.SelectedIndex].UserGroupNum);
                    if (groupPerm == null)                   //They don't have perm
                    {
                        groupPerm              = new GroupPermission();
                        groupPerm.NewerDate    = DateTime.MinValue;
                        groupPerm.NewerDays    = 0;
                        groupPerm.PermType     = Permissions.Reports;
                        groupPerm.UserGroupNum = _listUserGroups[comboUserGroup.SelectedIndex].UserGroupNum;
                        groupPerm.FKey         = clicked.DisplayReportNum;
                        ListGroupPermissionsForReports.Add(groupPerm);
                    }
                    else
                    {
                        ListGroupPermissionsForReports.Remove(groupPerm);
                    }
                }
            }
            else
            {
                if (_selectedCell.X == 1)
                {
                    clicked.IsVisibleInSubMenu = !clicked.IsVisibleInSubMenu;
                    if (clicked.IsVisibleInSubMenu)
                    {
                        clicked.IsHidden = false;
                    }
                }
                else if (_selectedCell.X == 2)
                {
                    clicked.IsHidden = !clicked.IsHidden;
                    if (clicked.IsHidden)
                    {
                        clicked.IsVisibleInSubMenu = false;
                    }
                }
            }
            FillGrids();
        }
        ///<summary>Updates one DisplayReport in the database.  Uses an old object to compare to, and only alters changed fields.  This prevents collisions and concurrency problems in heavily used tables.  Returns true if an update occurred.</summary>
        public static bool Update(DisplayReport displayReport, DisplayReport oldDisplayReport)
        {
            string command = "";

            if (displayReport.InternalName != oldDisplayReport.InternalName)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "InternalName = '" + POut.String(displayReport.InternalName) + "'";
            }
            if (displayReport.ItemOrder != oldDisplayReport.ItemOrder)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "ItemOrder = " + POut.Int(displayReport.ItemOrder) + "";
            }
            if (displayReport.Description != oldDisplayReport.Description)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Description = '" + POut.String(displayReport.Description) + "'";
            }
            if (displayReport.Category != oldDisplayReport.Category)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "Category = " + POut.Int((int)displayReport.Category) + "";
            }
            if (displayReport.IsHidden != oldDisplayReport.IsHidden)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsHidden = " + POut.Bool(displayReport.IsHidden) + "";
            }
            if (displayReport.IsVisibleInSubMenu != oldDisplayReport.IsVisibleInSubMenu)
            {
                if (command != "")
                {
                    command += ",";
                }
                command += "IsVisibleInSubMenu = " + POut.Bool(displayReport.IsVisibleInSubMenu) + "";
            }
            if (command == "")
            {
                return(false);
            }
            command = "UPDATE displayreport SET " + command
                      + " WHERE DisplayReportNum = " + POut.Long(displayReport.DisplayReportNum);
            Db.NonQ(command);
            return(true);
        }
 ///<summary>Inserts one DisplayReport into the database.  Returns the new priKey.  Doesn't use the cache.</summary>
 public static long InsertNoCache(DisplayReport displayReport)
 {
     return(InsertNoCache(displayReport, false));
 }
Example #15
0
		///<summary>Handles form and logic for most given displayReports.
		///Returns ReportNonModalSelection.None if modal report is provided.
		///If non-modal report is provided returns valid(not none) RpNonModalSelection to be handled later, See FormOpenDental.SpecialReportSelectionHelper(...)</summary>
		public static ReportNonModalSelection OpenReportHelper(DisplayReport displayReport,List<GroupPermission> listReportPermissions=null,bool doValidatePerm=true)
		{
			if(doValidatePerm) {
				if(listReportPermissions==null) {
					listReportPermissions=GroupPermissions.GetPermsForReports().Where(x => Security.CurUser.IsInUserGroup(x.UserGroupNum)).ToList();
				}
				if(!listReportPermissions.Exists(x => x.FKey==displayReport.DisplayReportNum)) {
					MsgBox.Show("FormReportsMore","You do not have permission to run this report.");
					return ReportNonModalSelection.None;
				}
			}
			FormRpProdInc FormPI;//Used for multiple reports
			switch(displayReport.InternalName) {
				case "ODToday"://Today
					FormPI=new FormRpProdInc();
					FormPI.DailyMonthlyAnnual="Daily";
					FormPI.DateStart=DateTime.Today;
					FormPI.DateEnd=DateTime.Today;
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report run for today.");
					break;
				case "ODYesterday"://Yesterday
					FormPI=new FormRpProdInc();
					FormPI.DailyMonthlyAnnual="Daily";
					if(DateTime.Today.DayOfWeek==DayOfWeek.Monday) {
						FormPI.DateStart=DateTime.Today.AddDays(-3);
						FormPI.DateEnd=DateTime.Today.AddDays(-3);
					}
					else {
						FormPI.DateStart=DateTime.Today.AddDays(-1);
						FormPI.DateEnd=DateTime.Today.AddDays(-1);
					}
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report run for yesterday.");
					break;
				case "ODThisMonth"://This Month
					FormPI=new FormRpProdInc();
					FormPI.DailyMonthlyAnnual="Monthly";
					FormPI.DateStart=new DateTime(DateTime.Today.Year,DateTime.Today.Month,1);
					FormPI.DateEnd=new DateTime(DateTime.Today.AddMonths(1).Year,DateTime.Today.AddMonths(1).Month,1).AddDays(-1);
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report run for this month.");
					break;
				case "ODLastMonth"://Last Month
					FormPI=new FormRpProdInc();
					FormPI.DailyMonthlyAnnual="Monthly";
					FormPI.DateStart=new DateTime(DateTime.Today.AddMonths(-1).Year,DateTime.Today.AddMonths(-1).Month,1);
					FormPI.DateEnd=new DateTime(DateTime.Today.Year,DateTime.Today.Month,1).AddDays(-1);
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report run for last month.");
					break;
				case "ODThisYear"://This Year
					FormPI=new FormRpProdInc();
					FormPI.DailyMonthlyAnnual="Annual";
					FormPI.DateStart=new DateTime(DateTime.Today.Year,1,1);
					FormPI.DateEnd=new DateTime(DateTime.Today.Year,12,31);
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report run for this year.");
					break;
				case "ODMoreOptions"://More Options
					FormPI=new FormRpProdInc();
					FormPI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Production and Income report 'more options' accessed.");
					break;
				case "ODProviderPayrollSummary":
					FormRpProviderPayroll FormPP=new FormRpProviderPayroll();
					FormPP.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Provier Payroll Summary report run.");
					break;
				case "ODProviderPayrollDetailed":
					FormRpProviderPayroll FormPPD=new FormRpProviderPayroll(true);
					FormPPD.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Provider Payroll Detailed report run.");
					break;
				case "ODAdjustments"://Adjustments
					if(Security.CurUser.ProvNum==0 && !Security.IsAuthorized(Permissions.ReportDailyAllProviders,true)) {
						MsgBox.Show("FormReportsMore","The current user needs to be a provider or have the 'All Providers' permission for Daily reports");
						break;
					}
					FormRpAdjSheet FormAdjSheet=new FormRpAdjSheet();
					FormAdjSheet.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Adjustments report run.");
					break;
				case "ODPayments"://Payments
					if(Security.CurUser.ProvNum==0 && !Security.IsAuthorized(Permissions.ReportDailyAllProviders,true)) {
						MsgBox.Show("FormReportsMore","The current user needs to be a provider or have the 'All Providers' permission for Daily reports");
						break;
					}
					FormRpPaySheet FormPaySheet=new FormRpPaySheet();
					FormPaySheet.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Daily Payments report run.");
					break;
				case "ODProcedures"://Procedures
					if(Security.CurUser.ProvNum==0 && !Security.IsAuthorized(Permissions.ReportDailyAllProviders,true)) {
						MsgBox.Show("FormReportsMore","The current user needs to be a provider or have the 'All Providers' permission for Daily reports");
						break;
					}
					FormRpProcSheet FormProcSheet=new FormRpProcSheet();
					FormProcSheet.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Daily Procedures report run.");
					break;
				case "ODWriteoffs"://Writeoffs
					if(Security.CurUser.ProvNum==0 && !Security.IsAuthorized(Permissions.ReportDailyAllProviders,true)) {
						MsgBox.Show("FormReportsMore","The current user needs to be a provider or have the 'All Providers' permission for Daily reports");
						break;
					}
					FormRpWriteoffSheet FormW=new FormRpWriteoffSheet();
					FormW.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Daily Writeoffs report run.");
					break;
				case DisplayReports.ReportNames.IncompleteProcNotes://Incomplete Procedure Notes
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Daily Procedure Notes report run.");
					return ReportNonModalSelection.IncompleteProcNotes;
				case "ODRoutingSlips"://Routing Slips
					FormRpRouting FormR=new FormRpRouting();
					FormR.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Routing Slips report run.");
					break;
				case "ODNetProdDetailDaily":
					FormRpNetProdDetail FormNetProdDetail=new FormRpNetProdDetail(true);
					FormNetProdDetail.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Daily Net Prod report run.");
					break;
				case DisplayReports.ReportNames.UnfinalizedInsPay:
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Unfinalized Insurance Payment report run.");
					return ReportNonModalSelection.UnfinalizedInsPay;
				case DisplayReports.ReportNames.PatPortionUncollected:
					FormRpPatPortionUncollected FormPPU=new FormRpPatPortionUncollected();
					FormPPU.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Patient Portion Uncollected report run.");
					break;
				case "ODAgingAR"://Aging of Accounts Receivable Report
					FormRpAging FormA=new FormRpAging();
					FormA.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Aging of A/R report run.");
					break;
				case DisplayReports.ReportNames.ClaimsNotSent://Claims Not Sent
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Claims Not Sent report run.");
					return ReportNonModalSelection.UnsentClaim;
				case "ODCapitation"://Capitation Utilization
					FormRpCapitation FormC=new FormRpCapitation();
					FormC.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Capitation report run.");
					break;
				case "ODFinanceCharge"://Finance Charge Report
					FormRpFinanceCharge FormRpFinance=new FormRpFinanceCharge();
					FormRpFinance.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Finance Charges report run.");
					break;
				case DisplayReports.ReportNames.OutstandingInsClaims://Outstanding Insurance Claims
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Outstanding Insurance Claims report run.");
					return ReportNonModalSelection.OutstandingIns;
				case "ODProcsNotBilled"://Procedures Not Billed to Insurance
					FormRpProcNotBilledIns FormProc=new FormRpProcNotBilledIns();
					FormProc.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Procedures not billed to insurance report run.");
					break;
				case "ODPPOWriteoffs"://PPO Writeoffs
					FormRpPPOwriteoffs FormPPO=new FormRpPPOwriteoffs();
					FormPPO.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"PPO Writeoffs report run.");
					break;
				case "ODPaymentPlans"://Payment Plans
					FormRpPayPlans FormPayPlans=new FormRpPayPlans();
					FormPayPlans.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Payment Plans report run.");
					break;
				case "ODReceivablesBreakdown"://Receivable Breakdown
					FormRpReceivablesBreakdown FormRcv = new FormRpReceivablesBreakdown();
					FormRcv.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Receivable Breakdown report run.");
					break;
				case "ODUnearnedIncome"://Unearned Income
					FormRpUnearnedIncome FormU=new FormRpUnearnedIncome();
					FormU.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Unearned Income report run.");
					break;
				case "ODInsuranceOverpaid"://Insurance Overpaid
					FormRpInsOverpaid FormI=new FormRpInsOverpaid();
					FormI.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Insurance Overpaid report run.");
					break;
				case "ODPresentedTreatmentProd"://Treatment Planned Presenter
					FormRpPresentedTreatmentProduction FormPTP=new FormRpPresentedTreatmentProduction();
					FormPTP.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Treatment Plan Presenter report run.");
					break;
				case "ODTreatmentPresentationStats"://Treatment Planned Presenter
					FormRpTreatPlanPresentationStatistics FormTPS = new FormRpTreatPlanPresentationStatistics();
					FormTPS.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Treatment Plan Presented Procedures report run.");
					break;
				case "ODInsurancePayPlansPastDue"://Insurance Payment Plans
					FormRpInsPayPlansPastDue FormIPP = new FormRpInsPayPlansPastDue();
					FormIPP.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Insurance Payment Plan report run.");
					break;
				case DisplayReports.ReportNames.InsAging://Insurance Aging Report
					FormRpInsAging FormIA=new FormRpInsAging();
					FormIA.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Insurance Aging report run");
					break;
				case DisplayReports.ReportNames.CustomAging://Insurance Aging Report
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Custom Aging report run");
					return ReportNonModalSelection.CustomAging;
				case "ODActivePatients"://Active Patients
					FormRpActivePatients FormAP=new FormRpActivePatients();
					FormAP.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Active Patients report run.");
					break;
				case "ODAppointments"://Appointments
					FormRpAppointments FormAppointments=new FormRpAppointments();
					FormAppointments.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Appointments report run.");
					break;
				case "ODBirthdays"://Birthdays
					FormRpBirthday FormB=new FormRpBirthday();
					FormB.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Birthdays report run.");
					break;
				case "ODBrokenAppointments"://Broken Appointments
					FormRpBrokenAppointments FormBroken=new FormRpBrokenAppointments();
					FormBroken.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Broken Appointments report run.");
					break;
				case "ODInsurancePlans"://Insurance Plans
					FormRpInsCo FormInsCo=new FormRpInsCo();
					FormInsCo.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Insurance Plans report run.");
					break;
				case "ODNewPatients"://New Patients
					FormRpNewPatients FormNewPats=new FormRpNewPatients();
					FormNewPats.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"New Patients report run.");
					break;
				case "ODPatientsRaw"://Patients - Raw
					if(!Security.IsAuthorized(Permissions.UserQuery)) {
						break;
					}
					FormRpPatients FormPatients=new FormRpPatients();
					FormPatients.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Patients - Raw report run.");
					break;
				case "ODPatientNotes"://Patient Notes
					if(!Security.IsAuthorized(Permissions.UserQuery)) {
						break;
					}
					FormSearchPatNotes FormSearchPatNotes=new FormSearchPatNotes();
					FormSearchPatNotes.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Patient Notes report run.");
					break;
				case "ODPrescriptions"://Prescriptions
					FormRpPrescriptions FormPrescript=new FormRpPrescriptions();
					FormPrescript.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Rx report run.");
					break;
				case "ODProcedureCodes"://Procedure Codes
					FormRpProcCodes FormProcCodes=new FormRpProcCodes();
					FormProcCodes.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Procedure Codes report run.");
					break;
				case "ODReferralsRaw"://Referrals - Raw
					if(!Security.IsAuthorized(Permissions.UserQuery)) {
						break;
					}
					FormRpReferrals FormReferral=new FormRpReferrals();
					FormReferral.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Referrals - Raw report run.");
					break;
				case "ODReferralAnalysis"://Referral Analysis
					FormRpReferralAnalysis FormRA=new FormRpReferralAnalysis();
					FormRA.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Referral Analysis report run.");
					break;
				case DisplayReports.ReportNames.ReferredProcTracking://Referred Proc Tracking
					FormReferralProcTrack FormRP=new FormReferralProcTrack();
					FormRP.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"ReferredProcTracking report run.");
					break;
				case DisplayReports.ReportNames.TreatmentFinder://Treatment Finder
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Treatment Finder report run.");
					return ReportNonModalSelection.TreatmentFinder;
				case DisplayReports.ReportNames.WebSchedAppointments://Web Sched Appts
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Web Sched Appointments report run.");
					return ReportNonModalSelection.WebSchedAppointments;
				case "ODRawScreeningData"://Raw Screening Data
					if(!Security.IsAuthorized(Permissions.UserQuery)) {
						break;
					}
					FormRpPHRawScreen FormPH=new FormRpPHRawScreen();
					FormPH.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"PH Raw Screening");
					break;
				case "ODRawPopulationData"://Raw Population Data
					if(!Security.IsAuthorized(Permissions.UserQuery)) {
						break;
					}
					FormRpPHRawPop FormPHR=new FormRpPHRawPop();
					FormPHR.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"PH Raw population");
					break;
				case "ODDentalSealantMeasure"://FQHC Dental Sealant Measure
					FormRpDentalSealantMeasure FormDSM=new FormRpDentalSealantMeasure();
					FormDSM.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"FQHC Dental Sealant Measure report run.");
					break;
				case "ODEligibilityFile"://Eligibility File
					FormRpArizonaPrimaryCareEligibility frapce=new FormRpArizonaPrimaryCareEligibility();
					frapce.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Arizona Primary Care Eligibility");
					break;
				case "ODEncounterFile"://Encounter File
					FormRpArizonaPrimaryCareEncounter frapcn=new FormRpArizonaPrimaryCareEncounter();
					frapcn.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Arizona Primary Care Encounter");
					break;
				case "ODDiscountPlan"://Discount Plans
					FormRpDiscountPlan FormDiscountPlan=new FormRpDiscountPlan();
					FormDiscountPlan.ShowDialog();
					SecurityLogs.MakeLogEntry(Permissions.Reports,0,"Discount Plans report run.");
					break;
				default:
					MsgBox.Show("FormReportsMore","Error finding the report");
					break;
			}
			return ReportNonModalSelection.None;
		}