private void butOK_Click(object sender, System.EventArgs e) { if (checkConnectServer.Checked) { LoadMiddleTierProxySettings(); string originalURI = RemotingClient.ServerURI; RemotingClient.ServerURI = textURI.Text; bool useEcwAlgorithm = checkUsingEcw.Checked; try{ string password = textPassword2.Text; if (useEcwAlgorithm) { password = Userods.EncryptPassword(password, true); } //ecw requires hash, but non-ecw requires actual password Userod user = Security.LogInWeb(textUser2.Text, password, "", Application.ProductVersion, useEcwAlgorithm); Security.CurUser = user; Security.PasswordTyped = password; //for ecw, this is already encrypted.//textPassword2.Text; RemotingClient.RemotingRole = RemotingRole.ClientWeb; } catch (Exception ex) { RemotingClient.ServerURI = originalURI; MessageBox.Show(ex.Message); return; } } else { OpenDentBusiness.DataConnection dcon; //Try to connect to the database directly try { DataConnection.DBtype = DatabaseType.MySql; if (listType.SelectedIndex == 1) { DataConnection.DBtype = DatabaseType.Oracle; } dcon = new OpenDentBusiness.DataConnection(DataConnection.DBtype); if (textConnectionString.Text.Length > 0) { dcon.SetDb(textConnectionString.Text, "", DataConnection.DBtype); } else { dcon.SetDb(comboComputerName.Text, comboDatabase.Text, textUser.Text, textPassword.Text, "", "", DataConnection.DBtype); } //a direct connection does not utilize lower privileges. } catch (Exception ex) { MessageBox.Show( //Lan.g(this,"Could not establish connection to database.")); ex.Message); return; } RemotingClient.RemotingRole = RemotingRole.ClientDirect; } try{ XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = (" "); using (XmlWriter writer = XmlWriter.Create(ODFileUtils.CombinePaths(Application.StartupPath, "FreeDentalConfig.xml"), settings)) { writer.WriteStartElement("ConnectionSettings"); if (textConnectionString.Text != "") { writer.WriteStartElement("ConnectionString"); writer.WriteString(textConnectionString.Text); writer.WriteEndElement(); } else if (RemotingClient.RemotingRole == RemotingRole.ClientDirect) { writer.WriteStartElement("DatabaseConnection"); writer.WriteStartElement("ComputerName"); writer.WriteString(comboComputerName.Text); writer.WriteEndElement(); writer.WriteStartElement("Database"); writer.WriteString(comboDatabase.Text); writer.WriteEndElement(); writer.WriteStartElement("User"); writer.WriteString(textUser.Text); writer.WriteEndElement(); writer.WriteStartElement("Password"); writer.WriteString(textPassword.Text); writer.WriteEndElement(); writer.WriteStartElement("NoShowOnStartup"); if (checkNoShow.Checked) { writer.WriteString("True"); } else { writer.WriteString("False"); } writer.WriteEndElement(); writer.WriteEndElement(); } else if (RemotingClient.RemotingRole == RemotingRole.ClientWeb) { writer.WriteStartElement("ServerConnection"); writer.WriteStartElement("URI"); writer.WriteString(textURI.Text); writer.WriteEndElement(); writer.WriteStartElement("UsingEcw"); if (checkUsingEcw.Checked) { writer.WriteString("True"); } else { writer.WriteString("False"); } writer.WriteEndElement(); writer.WriteEndElement(); } writer.WriteStartElement("DatabaseType"); if (listType.SelectedIndex == 0) { writer.WriteString("MySql"); } else { writer.WriteString("Oracle"); } writer.WriteEndElement(); writer.WriteEndElement(); writer.Flush(); } //using writer } catch { //data not saved. } //fyiReporting.RDL.DataSource.SetOpenDentalConnectionString( // "Server="+ComputerName+";Database="+Database+";User ID="+DbUser+";Password="******";CharSet=utf8"); DialogResult = DialogResult.OK; }
private void butNewClaims_Click(object sender, EventArgs e) { if (gridMain.SelectedIndices.Length == 0) //No selections made. { MsgBox.Show(this, "Please select at least one procedure."); return; } if (!ClaimL.CheckClearinghouseDefaults()) { return; } //Ignore date lock for now, we just want to check the general permission for the button. if (!Security.IsAuthorized(Permissions.NewClaimsProcNotBilled, DateTime.Today)) { return; } //Generate List and Table---------------------------------------------------------------------------------------------------------------------- //List of all procedures being shown. //Pulls procedures based off of the PatNum, if the row was selected in gridMain and if it has been attached to a claim. List <ProcNotBilled> listNotBilledProcs = new List <ProcNotBilled>(); List <long> listPatNums = new List <long>(); Patient patOld = new Patient(); List <Claim> listPatClaims = new List <Claim>(); List <ClaimProc> listPatClaimProcs = new List <ClaimProc>(); List <ClaimProc> listCurClaimProcs = new List <ClaimProc>(); //find the date user is restricted by for this permission so it doesn't get called in a loop. General permission was already checked. DateTime dateRestricted = GroupPermissions.GetDateRestrictedForPermission(Permissions.NewClaimsProcNotBilled, Security.CurUser.GetGroups(true).Select(x => x.UserGroupNum).ToList()); //Table rows need to be 1:1 with gridMain rows due to logic in ContrAccount.toolBarButIns_Click(...). DataTable table = new DataTable(); //Required columns as mentioned by ContrAccount.toolBarButIns_Click(). table.Columns.Add("ProcNum"); table.Columns.Add("chargesDouble"); table.Columns.Add("ProcNumLab"); List <long> listProcNumsPastLockDate = new List <long>(); for (int i = 0; i < gridMain.ListGridRows.Count; i++) //Loop through every row in gridMain to construct datatable and listNotBilledProcs. //Table is passed to toolBarButIns_Click(...) and must contain data for every row in the grid. { DataRow rowCur = (DataRow)gridMain.ListGridRows[i].Tag; long procNumCur = PIn.Long(rowCur["ProcNum"].ToString()); Procedure procCur = Procedures.GetOneProc(procNumCur, false); if (procCur.ProcDate <= dateRestricted) //current procedure is past or on the lock date. { listProcNumsPastLockDate.Add(procNumCur); } long patNumCur = procCur.PatNum; if (patOld.PatNum != patNumCur) //Procedures in gridMain are ordered by patient, so when the patient changes, we know previous patient is complete. { listPatClaims = Claims.Refresh(patNumCur); listPatClaimProcs = ClaimProcs.Refresh(patNumCur); patOld = Patients.GetPat(procCur.PatNum); } listCurClaimProcs = ClaimProcs.GetForProc(listPatClaimProcs, procNumCur); bool hasPriClaim = false; bool hasSecClaim = false; for (int j = 0; j < listCurClaimProcs.Count; j++) { ClaimProc claimProcCur = listCurClaimProcs[j]; if (claimProcCur.ClaimNum > 0 && claimProcCur.Status != ClaimProcStatus.Preauth && claimProcCur.Status != ClaimProcStatus.Estimate) { Claim claimCur = Claims.GetFromList(listPatClaims, claimProcCur.ClaimNum); switch (claimCur.ClaimType) { case "P": hasPriClaim = true; break; case "S": hasSecClaim = true; break; } } } bool isSelected = gridMain.SelectedIndices.Contains(i); listNotBilledProcs.Add(new ProcNotBilled(patOld, procNumCur, i, isSelected, hasPriClaim, hasSecClaim, procCur.ClinicNum, procCur.PlaceService)); DataRow row = table.NewRow(); row["ProcNum"] = procNumCur; #region Calculate chargesDouble double writeOffCapSum = listPatClaimProcs.Where(x => x.Status == ClaimProcStatus.CapComplete).Sum(y => y.WriteOff); row["chargesDouble"] = procCur.ProcFeeTotal - writeOffCapSum; row["ProcNumLab"] = procCur.ProcNumLab; #endregion Calculate chargesDouble table.Rows.Add(row); if (listPatNums.Contains(patNumCur)) { continue; } listPatNums.Add(patNumCur); } List <List <ProcNotBilled> > listGroupedProcs = new List <List <ProcNotBilled> >(); Patient patCur = null; List <PatPlan> listPatPlans = null; List <InsSub> listInsSubs = null; List <InsPlan> listInsPlans = null; List <Procedure> listPatientProcs = null; ProcNotBilled procNotBilled = new ProcNotBilled(); //When automatically grouping, this is used as the procedure to group by. long patNumOld = 0; int claimCreatedCount = 0; int patIndex = 0; //The procedures show in the grid ordered by patient. Also listPatNums contains unique patnums which are in the same order as the grid. while (patIndex < listPatNums.Count) { List <ProcNotBilled> listProcs = listNotBilledProcs.Where(x => x.Patient.PatNum == listPatNums[patIndex] && x.IsRowSelected && !x.IsAttached && !x.ProcNum.In(listProcNumsPastLockDate)).ToList(); if (listProcs.Count == 0) { patNumOld = listPatNums[patIndex]; patIndex++; //No procedures were selected for this patient. continue; } else { //Maintain the same patient, in order to create one or more additional claims for the remaining procedures. //Currently will only happen for specific instances; //--Canadian customers who are attempting to create a claim with over 7 procedures. //--When checkAutoGroupProcs is checked and when there are multiple procedure groupings by GroupKey status, ClinicNum, and placeService. } if (patNumOld != listPatNums[patIndex]) //The patient could repeat if we had to group the procedures for the patinet into multiple claims. { patCur = Patients.GetPat(listPatNums[patIndex]); listPatPlans = PatPlans.Refresh(patCur.PatNum); listInsSubs = InsSubs.RefreshForFam(Patients.GetFamily(patCur.PatNum)); listInsPlans = InsPlans.RefreshForSubList(listInsSubs); listPatientProcs = Procedures.Refresh(patCur.PatNum); } if (checkAutoGroupProcs.Checked) //Automatically Group Procedures. { procNotBilled = listProcs[0]; //Update listProcs to reflect those that match the procNotBilled values. listProcs = listProcs.FindAll(x => x.HasPriClaim == procNotBilled.HasPriClaim && x.HasSecClaim == procNotBilled.HasSecClaim); if (PrefC.HasClinicsEnabled) //Group by clinic only if clinics enabled. { listProcs = listProcs.FindAll(x => x.ClinicNum == procNotBilled.ClinicNum); } else if (!PrefC.GetBool(PrefName.EasyHidePublicHealth)) //Group by Place of Service only if Public Health feature is enabled. { listProcs = listProcs.FindAll(x => x.PlaceService == procNotBilled.PlaceService); } } GetUniqueDiagnosticCodes(listProcs, listPatientProcs, listPatPlans, listInsSubs, listInsPlans); if (listProcs.Count > 7 && CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA { listProcs = listProcs.Take(7).ToList(); //Returns first 7 items of the list. } listProcs.ForEach(x => x.IsAttached = true); //This way we can not attach procedures to multiple claims thanks to the logic above. if (listProcs.Any(x => listProcs[0].PlaceService != x.PlaceService) || listProcs.Any(x => listProcs[0].ClinicNum != x.ClinicNum)) { //Regardless if we are automatically grouping or not, //if all procs in our list at this point do not share the same PlaceService or ClinicNum then claims will not be made. } else //Basic validation passed. { if (!listProcs[0].HasPriClaim && //Medical claim. PatPlans.GetOrdinal(PriSecMed.Medical, listPatPlans, listInsPlans, listInsSubs) > 0 && //Has medical ins. PatPlans.GetOrdinal(PriSecMed.Primary, listPatPlans, listInsPlans, listInsSubs) == 0 && //Does not have primary dental ins. PatPlans.GetOrdinal(PriSecMed.Secondary, listPatPlans, listInsPlans, listInsSubs) == 0) //Does not have secondary dental ins. { claimCreatedCount++; } else //Not a medical claim. { if (!listProcs[0].HasPriClaim && PatPlans.GetOrdinal(PriSecMed.Primary, listPatPlans, listInsPlans, listInsSubs) > 0) //Primary claim. { claimCreatedCount++; } if (!listProcs[0].HasSecClaim && PatPlans.GetOrdinal(PriSecMed.Secondary, listPatPlans, listInsPlans, listInsSubs) > 0) //Secondary claim. { claimCreatedCount++; } } } listGroupedProcs.Add(listProcs); } if (claimCreatedCount <= 0 && listProcNumsPastLockDate.Count > 0) //No claims can be created because of the lock date. { MsgBox.Show(this, "No claims can be created because all procedure dates extend past the lock date for this report."); return; } if (!MsgBox.Show(this, true, "Clicking OK will create up to " + POut.Int(claimCreatedCount) + " claims and cannot be undone, except by manually going to each account. " + "Some claims may not be created if there are validation issues.\r\n" + "Click OK to continue, otherwise click Cancel.")) { return; } //Create Claims-------------------------------------------------------------------------------------------------------------------------------- claimCreatedCount = 0; string claimErrors = ""; foreach (List <ProcNotBilled> listProcs in listGroupedProcs) { patCur = listProcs[0].Patient; gridMain.SetSelected(false); //Need to deslect all rows each time so that ContrAccount.toolBarButIns_Click(...) only uses pertinent rows. for (int j = 0; j < listProcs.Count; j++) { gridMain.SetSelected(listProcs[j].RowIndex, true); //Select the pertinent rows so that they will be attached to the claim below. } int[] arraySelectedIndices = (int[])gridMain.SelectedIndices.Clone(); CreateClaimDataWrapper createClaimDataWrapper = ClaimL.GetCreateClaimDataWrapper(patCur, Patients.GetFamily(patCur.PatNum) , ClaimL.GetCreateClaimItems(table, arraySelectedIndices), false); createClaimDataWrapper = ClaimL.CreateClaimFromWrapper(false, createClaimDataWrapper, procNotBilled.HasPriClaim, procNotBilled.HasSecClaim); string errorTitle = patCur.PatNum + " " + patCur.GetNameLFnoPref() + " - "; if (patNumOld == patCur.PatNum && !string.IsNullOrEmpty(createClaimDataWrapper.ErrorMessage)) { claimErrors += "\t\t" + createClaimDataWrapper.ErrorMessage + "\r\n"; } else if (!string.IsNullOrEmpty(createClaimDataWrapper.ErrorMessage)) { claimErrors += errorTitle + createClaimDataWrapper.ErrorMessage + "\r\n"; } claimCreatedCount += createClaimDataWrapper.ClaimCreatedCount; SecurityLogs.MakeLogEntry(Permissions.ClaimEdit, patCur.PatNum, "New claim created for " + patCur.LName + "," + patCur.FName); patNumOld = patCur.PatNum; } FillGrid(); if (claimCreatedCount > 0) { OnPostClaimCreation?.Invoke(); } if (!string.IsNullOrEmpty(claimErrors)) { MsgBoxCopyPaste form = new MsgBoxCopyPaste(claimErrors); form.ShowDialog(); } MessageBox.Show(Lan.g(this, "Number of claims created") + ": " + claimCreatedCount); }
///<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; }
private void butOK_Click(object sender, System.EventArgs e) { if (textDate.Text == "") { MsgBox.Show(this, "Please enter a date."); return; } if (textCarrierName.Text == "") { MsgBox.Show(this, "Please enter a carrier."); return; } if (textDate.errorProvider1.GetError(textDate) != "" || textAmount.errorProvider1.GetError(textAmount) != "" || textDateIssued.errorProvider1.GetError(textDateIssued) != "") { MsgBox.Show(this, "Please fix data entry errors first."); return; } if (textAmount.Text == "") { MsgBox.Show(this, "Please enter an amount."); return; } if (IsNew) { //prevents backdating of initial check if (!Security.IsAuthorized(Permissions.InsPayCreate, PIn.Date(textDate.Text))) { return; } //prevents attaching claimprocs with a date that is older than allowed by security. } else { //Editing an old entry will already be blocked if the date was too old, and user will not be able to click OK button. //This catches it if user changed the date to be older. if (!Security.IsAuthorized(Permissions.InsPayEdit, PIn.Date(textDate.Text))) { return; } } if (!PrefC.GetBool(PrefName.EasyNoClinics)) { if (comboClinic.SelectedIndex == 0) { ClaimPaymentCur.ClinicNum = 0; } else { ClaimPaymentCur.ClinicNum = Clinics.List[comboClinic.SelectedIndex - 1].ClinicNum; } } ClaimPaymentCur.CheckDate = PIn.Date(textDate.Text); ClaimPaymentCur.DateIssued = PIn.Date(textDateIssued.Text); ClaimPaymentCur.CheckAmt = PIn.Double(textAmount.Text); ClaimPaymentCur.CheckNum = textCheckNum.Text; ClaimPaymentCur.BankBranch = textBankBranch.Text; ClaimPaymentCur.CarrierName = textCarrierName.Text; ClaimPaymentCur.Note = textNote.Text; try{ if (IsNew) { ClaimPayments.Insert(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. SecurityLogs.MakeLogEntry(Permissions.InsPayCreate, 0, Lan.g(this, "Carrier Name: ") + ClaimPaymentCur.CarrierName + ", " + Lan.g(this, "Total Amount: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Check Date: ") + ClaimPaymentCur.CheckDate.ToShortDateString() + ", " //Date the check is entered in the system (i.e. today) + "ClaimPaymentNum: " + ClaimPaymentCur.ClaimPaymentNum); //Column name, not translated. } else { ClaimPayments.Update(ClaimPaymentCur); //error thrown if trying to change amount and already attached to a deposit. SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, 0, Lan.g(this, "Carrier Name: ") + ClaimPaymentCur.CarrierName + ", " + Lan.g(this, "Total Amount: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", " + Lan.g(this, "Check Date: ") + ClaimPaymentCur.CheckDate.ToShortDateString() + ", " //Date the check is entered in the system + "ClaimPaymentNum: " + ClaimPaymentCur.ClaimPaymentNum); //Column name, not translated. } } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } ClaimProcs.SynchDateCP(ClaimPaymentCur.ClaimPaymentNum, ClaimPaymentCur.CheckDate); DialogResult = DialogResult.OK; }