예제 #1
0
        ///<summary>Sends text message to callfire.  If patNum=0 will not create commlog entry.</summary>
        private bool SendCallFire(long patNum, string wirelessPhone, string message)
        {
            string key = ProgramProperties.GetPropVal(ProgramName.CallFire, "Key From CallFire");
            string msg = wirelessPhone + "," + message.Replace(",", "");     //ph#,msg Commas in msg cause error.

            try {
                CallFireService.SMSService callFire = new CallFireService.SMSService();
                callFire.sendSMSCampaign(
                    key,
                    new string[] { msg },
                    "Open Dental");
            }
            catch (Exception ex) {
                MsgBox.Show(this, "Error sending text message.\r\n\r\n" + ex.Message);
                return(false);
            }
            if (patNum == 0)             //No patient selected, do not make commlog.
            {
                return(true);
            }
            Commlog commlog = new Commlog();

            commlog.CommDateTime   = DateTime.Now;
            commlog.DateTStamp     = DateTime.Now;
            commlog.CommType       = Commlogs.GetTypeAuto(CommItemTypeAuto.TEXT);
            commlog.Mode_          = CommItemMode.Text;
            commlog.Note           = msg;//phone,note
            commlog.PatNum         = patNum;
            commlog.SentOrReceived = CommSentOrReceived.Sent;
            commlog.UserNum        = Security.CurUser.UserNum;
            commlog.DateTimeEnd    = DateTime.Now;
            Commlogs.Insert(commlog);
            SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, commlog.PatNum, "Insert Text Message");
            return(true);
        }
예제 #2
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     //this button is disabled if user does not have permision to edit.
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;              //causes claimPayment to be deleted.
         return;
     }
     if (!MsgBox.Show(this, true, "Delete this insurance check?"))
     {
         return;
     }
     try{
         ClaimPayments.Delete(ClaimPaymentCur);
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     for (int i = 0; i < splits.Count; i++)
     {
         if (splits[i].ClaimPaymentNum == ClaimPaymentCur.ClaimPaymentNum)
         {
             SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, splits[i].PatNum,
                                       "Delete for patient: "
                                       + Patients.GetLim(splits[i].PatNum).GetNameLF() + ", "
                                       + Lan.g(this, "Total Amt: ") + ClaimPaymentCur.CheckAmt.ToString("c") + ", "
                                       + Lan.g(this, "Claim Split: ") + splits[i].InsPayAmt.ToString("c"));
         }
     }
     DialogResult = DialogResult.OK;
 }
예제 #3
0
        private void butDelete_Click(object sender, System.EventArgs e)
        {
            ProcTPs.Delete(ProcCur);
            SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, ProcCur.PatNum, "Delete tp proc: " + ProcCur.Descript);

            DialogResult = DialogResult.OK;
        }
예제 #4
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (listRelationship.SelectedIndex < 0)
     {
         MsgBox.Show(this, "Relationship required.");
         return;
     }
     if (textName.Text.Trim() == "")
     {
         MsgBox.Show(this, "Name required.");
         return;
     }
     if (DisDefCur == null)
     {
         MsgBox.Show(this, "Problem required.");
         return;
     }
     FamilyHealthCur.DiseaseDefNum = DisDefCur.DiseaseDefNum;
     FamilyHealthCur.Relationship  = (FamilyRelationship)listRelationship.SelectedIndex;
     FamilyHealthCur.PersonName    = textName.Text;
     if (FamilyHealthCur.IsNew)
     {
         SecurityLogs.MakeLogEntry(Permissions.PatFamilyHealthEdit, FamilyHealthCur.PatNum, FamilyHealthCur.PersonName + " " + FamilyHealthCur.Relationship + " added");
         FamilyHealths.Insert(FamilyHealthCur);
     }
     else
     {
         FamilyHealths.Update(FamilyHealthCur);
         SecurityLogs.MakeLogEntry(Permissions.PatFamilyHealthEdit, FamilyHealthCur.PatNum, FamilyHealthCur.PersonName + " " + FamilyHealthCur.Relationship + " edited");
     }
     DialogResult = DialogResult.OK;
 }
예제 #5
0
        ///<summary>Creates and inserts a payment similar to the load logic for the income transfer manager.</summary>
        private Payment CreatePaymentTransferHelper(Patient pat)
        {
            Payment payCur = new Payment();

            payCur.ClinicNum = 0;
            if (PrefC.HasClinicsEnabled)             //if clinics aren't enabled default to 0
            {
                payCur.ClinicNum = Clinics.ClinicNum;
                if ((PayClinicSetting)PrefC.GetInt(PrefName.PaymentClinicSetting) == PayClinicSetting.PatientDefaultClinic ||
                    (Clinics.ClinicNum == 0 && (PayClinicSetting)PrefC.GetInt(PrefName.PaymentClinicSetting) == PayClinicSetting.SelectedExceptHQ))
                {
                    payCur.ClinicNum = pat.ClinicNum;
                }
            }
            payCur.DateEntry     = DateTime.Now;
            payCur.PatNum        = pat.PatNum;
            payCur.PayDate       = datePicker.Value;
            payCur.PaymentSource = CreditCardSource.None;
            payCur.ProcessStatus = ProcessStat.OfficeProcessed;
            payCur.PayType       = 0;                       //Income transfer (will always be income transfer).
            payCur.PayAmt        = 0;                       //Income transfer payment.
            payCur.PayNum        = Payments.Insert(payCur); //Insert and get the payment PayNum which is used with linking the splits.
            SecurityLogs.MakeLogEntry(Permissions.PaymentCreate, pat.PatNum, $"{Patients.GetLim(pat.PatNum).GetNameLF()}, created by Family Balancer tool.");
            return(payCur);
        }
예제 #6
0
        ///<summary>Throws Exception.  Exports all medications to the passed in filename. Throws Exceptions.</summary>
        public static int ExportMedications(string filename, List <Medication> listMedications)
        {
            StringBuilder strBldrOutput = new StringBuilder();

            string encapsulate(string text)
            {
                return("\"" + text.Replace("\"", "\\\"") + "\"");
            }

            foreach (Medication med in listMedications)             //Loop through medications.
            {
                strBldrOutput.AppendLine(encapsulate(med.MedName) + '\t' + encapsulate(Medications.GetGenericName(med.GenericNum)) + '\t' + encapsulate(med.Notes)
                                         + '\t' + encapsulate(POut.Long(med.RxCui)));
            }
            if (ODBuild.IsWeb())
            {
                ThinfinityUtils.ExportForDownload(filename, strBldrOutput.ToString());
            }
            else
            {
                File.WriteAllText(filename, strBldrOutput.ToString());               //Allow Exception to trickle up.
            }
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0,
                                      Lans.g("Medications", "Exported") + " " + POut.Int(listMedications.Count) + " " + Lans.g("Medications", "medications to:") + " " + filename
                                      );
            return(listMedications.Count);
        }
예제 #7
0
        private void butActivateThankYou_Click(object sender, EventArgs e)
        {
            //todo Discuss if this feature should be tied to eConfirmations...seems more likely that it should work like reminders.
            //or does it need its own eServiceCode?
            //if(!WebServiceMainHQProxy.IsEServiceActive(_signupOut,eServiceCode.ConfirmationRequest)) { //Not yet activated with HQ.
            //	MsgBox.Show(this,"You must first signup for eConfirmations via the Signup tab before activating eConfirmations.");
            //	return;
            //}
            bool isApptThankYouAutoEnabled = PrefC.GetBool(PrefName.ApptThankYouAutoEnabled);

            isApptThankYouAutoEnabled = !isApptThankYouAutoEnabled;
            Prefs.UpdateBool(PrefName.ApptConfirmAutoEnabled, isApptThankYouAutoEnabled);
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Automated appointment eThankYou " + (isApptThankYouAutoEnabled ? "activated" : "deactivated") + ".");
            Prefs.RefreshCache();
            Signalods.SetInvalid(InvalidType.Prefs);
            FillECRActivationButtons();
            //Add a default confirmation rule if none exists.
            if (isApptThankYouAutoEnabled && _dictClinicRules[0].Count(x => x.TypeCur == ApptReminderType.ScheduleThankYou) == 0)
            {
                //defaults to 0 days, 0 hours after appt created.
                ApptReminderRule arr = ApptReminderRules.CreateDefaultReminderRule(ApptReminderType.ScheduleThankYou, 0);
                _dictClinicRules[0].Add(arr);
                FillRemindConfirmData();
            }
        }
예제 #8
0
 private void butCopy_Click(object sender, System.EventArgs e)
 {
     if (comboCopyFrom.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please pick a fee schedule first.");
         return;
     }
     if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
     {
         return;
     }
     //clear current
     Fees.ClearFeeSched(SchedNum);
     //copy any values over
     Fees.CopyFees(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum, SchedNum);
     for (int i = 0; i < Fees.Listt.Count; i++)
     {
         //ignore all but the OLD fee schedule.
         if (Fees.Listt[i].FeeSched != FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum)
         {
             continue;
         }
         SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(Fees.Listt[i].CodeNum)
                                   + ", " + Lan.g(this, "Fee") + ": " + Fees.Listt[i].Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(Fees.Listt[i].FeeSched)
                                   + ". " + Lan.g(this, "Fee copied from") + " " + FeeScheds.GetDescription(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum) + " " + Lan.g(this, "using Fee Tools."), Fees.Listt[i].CodeNum);
     }
     DialogResult = DialogResult.OK;
 }
예제 #9
0
 private InsPlan InsertOrUpdateInsPlan(InsPlan insPlan, Hx834_Member member, Carrier carrier, bool isInsertAllowed = true)
 {
     //The code below mimics how insurance plans are created in ContrFamily.ToolButIns_Click().
     if (insPlan == null)
     {
         insPlan = new InsPlan();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupName            = "";
         insPlan.GroupNum             = member.GroupNum;
         insPlan.PlanNote             = "";
         insPlan.FeeSched             = 0;
         insPlan.PlanType             = "";
         insPlan.ClaimFormNum         = PrefC.GetLong(PrefName.DefaultClaimForm);
         insPlan.UseAltCode           = false;
         insPlan.ClaimsUseUCR         = false;
         insPlan.CopayFeeSched        = 0;
         insPlan.EmployerNum          = 0;
         insPlan.CarrierNum           = carrier.CarrierNum;
         insPlan.AllowedFeeSched      = 0;
         insPlan.TrojanID             = "";
         insPlan.DivisionNo           = "";
         insPlan.IsMedical            = false;
         insPlan.FilingCode           = 0;
         insPlan.DentaideCardSequence = 0;
         insPlan.ShowBaseUnits        = false;
         insPlan.CodeSubstNone        = false;
         insPlan.IsHidden             = false;
         insPlan.MonthRenew           = 0;
         insPlan.FilingCodeSubtype    = 0;
         insPlan.CanadianPlanFlag     = "";
         insPlan.CobRule            = EnumCobRule.Basic;
         insPlan.HideFromVerifyList = false;
         if (isInsertAllowed)
         {
             InsPlans.Insert(insPlan);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanCreate, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' created from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834,
                                       DateTime.MinValue);   //new insplan, no date needed
         }
     }
     else
     {
         InsPlan insPlanOld = insPlan.Copy();
         if (member.InsFiling != null)
         {
             insPlan.FilingCode = member.InsFiling.InsFilingCodeNum;
         }
         insPlan.GroupNum = member.GroupNum;
         if (OpenDentBusiness.Crud.InsPlanCrud.UpdateComparison(insPlan, insPlanOld))
         {
             InsPlans.Update(insPlan, insPlanOld);
             SecurityLogs.MakeLogEntry(Permissions.InsPlanEdit, 0, "Insurance plan for carrier '" + carrier.CarrierName + "' and groupnum "
                                       + "'" + insPlan.GroupNum + "' edited from Import Ins Plans 834.", insPlan.PlanNum, LogSources.InsPlanImport834, insPlanOld.SecDateTEdit);
         }
     }
     return(insPlan);
 }
예제 #10
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textFeeAmt.errorProvider1.GetError(textFeeAmt) != "" ||
         textPriInsAmt.errorProvider1.GetError(textPriInsAmt) != "" ||
         textSecInsAmt.errorProvider1.GetError(textSecInsAmt) != "" ||
         textDiscount.errorProvider1.GetError(textDiscount) != "" ||
         textPatAmt.errorProvider1.GetError(textPatAmt) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (comboPriority.SelectedIndex == 0)
     {
         ProcCur.Priority = 0;
     }
     else
     {
         ProcCur.Priority = DefC.Short[(int)DefCat.TxPriorities][comboPriority.SelectedIndex - 1].DefNum;
     }
     ProcCur.ToothNumTP = textToothNumTP.Text;
     ProcCur.Surf       = textSurf.Text;
     ProcCur.ProcCode   = textCode.Text;
     ProcCur.Descript   = textDescript.Text;
     ProcCur.FeeAmt     = PIn.Double(textFeeAmt.Text);
     ProcCur.PriInsAmt  = PIn.Double(textPriInsAmt.Text);
     ProcCur.SecInsAmt  = PIn.Double(textSecInsAmt.Text);
     ProcCur.Discount   = PIn.Double(textDiscount.Text);
     ProcCur.PatAmt     = PIn.Double(textPatAmt.Text);
     ProcCur.Prognosis  = textPrognosis.Text;
     ProcCur.Dx         = textDx.Text;
     ProcTPs.InsertOrUpdate(ProcCur, false);           //IsNew not applicable here
     SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, ProcCur.PatNum, "Edit proc: " + ProcCur.Descript);
     DialogResult = DialogResult.OK;
 }
예제 #11
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textFee.errorProvider1.GetError(textFee) != "")
            {
                MessageBox.Show(Lan.g(this, "Please fix data entry error first."));
                return;
            }
            DateTime datePrevious = FeeCur.SecDateTEdit;

            if (textFee.Text == "")
            {
                Fees.Delete(FeeCur);
            }
            else
            {
                FeeCur.Amount = PIn.Double(textFee.Text);
                //Fee object always created and inserted externally first
                Fees.Update(FeeCur);
            }
            SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(FeeCur.CodeNum)
                                      + ", " + Lan.g(this, "Fee: ") + "" + FeeCur.Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(FeeCur.FeeSched)
                                      + ". " + Lan.g(this, "Manual edit in Edit Fee window."), FeeCur.CodeNum, DateTime.MinValue);
            SecurityLogs.MakeLogEntry(Permissions.LogFeeEdit, 0, Lan.g(this, "Fee Updated"), FeeCur.FeeNum, datePrevious);
            //FeeCur.UseDefaultCov=checkDefCov.Checked;
            //FeeCur.UseDefaultFee=checkDefFee.Checked;
            DialogResult = DialogResult.OK;
        }
예제 #12
0
 private void butNewRx_Click(object sender, EventArgs e)
 {
     //This code is a copy of ContrChart.Tool_Rx_Click().  Any changes to this code need to be changed there too.
     if (!Security.IsAuthorized(Permissions.RxCreate))
     {
         return;
     }
     if (Programs.UsingEcwTightOrFullMode() && Bridges.ECW.UserId != 0)
     {
         VBbridges.Ecw.LoadRxForm((int)Bridges.ECW.UserId, Bridges.ECW.EcwConfigPath, (int)Bridges.ECW.AptNum);
         //refresh the right panel:
         try {
             string strAppServer = VBbridges.Ecw.GetAppServer((int)Bridges.ECW.UserId, Bridges.ECW.EcwConfigPath);
             labelECWerror.Visible = false;
         }
         catch (Exception ex) {
             labelECWerror.Text    = "Error: " + ex.Message;
             labelECWerror.Visible = true;
         }
     }
     else
     {
         FormRxSelect FormRS = new FormRxSelect(_patCur);
         FormRS.ShowDialog();
         if (FormRS.DialogResult != DialogResult.OK)
         {
             return;
         }
         SecurityLogs.MakeLogEntry(Permissions.RxCreate, _patCur.PatNum, "Created prescription.");
     }
     FillGrid();
 }
 /// <summary>Deletes the selected insurance payment selected.</summary>
 private void deleteEOBToolStripMenuItem_Click(object sender, EventArgs e)
 {
     RpUnfinalizedInsPay.UnfinalizedInsPay unfinalPay = (RpUnfinalizedInsPay.UnfinalizedInsPay)gridMain.ListGridRows[gridMain.SelectedIndices[0]].Tag;
     if (unfinalPay.ClaimPaymentCur == null)
     {
         MsgBox.Show(this, "This claim payment has been deleted.");
         return;
     }
     //Most likely this claim payment is marked as partial. Everyone should have permission to delete a partial payment.
     //Added a check to make sure user has permission and claimpayment is not partial.
     if (!Security.IsAuthorized(Permissions.InsPayEdit, unfinalPay.ClaimPaymentCur.CheckDate) && !unfinalPay.ClaimPaymentCur.IsPartial)
     {
         return;
     }
     if (!MsgBox.Show(this, true, "Delete this insurance check?"))
     {
         return;
     }
     try {
         ClaimPayments.Delete(unfinalPay.ClaimPaymentCur);
         SecurityLogs.MakeLogEntry(Permissions.InsPayEdit, 0, "Claim Payment Deleted: " + unfinalPay.ClaimPaymentCur.ClaimPaymentNum);
     }
     catch (ApplicationException ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     LoadData();
     FillGrid();
 }
예제 #14
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateTL.errorProvider1.GetError(textDateTL) != ""
         )
     {
         MessageBox.Show(Lan.g(this, "Please fix data entry errors first."));
         return;
     }
     Cur.Descript = textDescript.Text;
     Cur.DateTL   = PIn.Date(textDateTL.Text);
     Cur.DateType = (TaskDateType)listDateType.SelectedIndex;
     if (!checkFromNum.Checked)            //user unchecked the box
     {
         Cur.FromNum = 0;
     }
     Cur.ObjectType = (TaskObjectType)listObjectType.SelectedIndex;
     try{
         if (IsNew)
         {
             TaskLists.Insert(Cur);
             SecurityLogs.MakeLogEntry(Permissions.TaskListCreate, 0, Cur.Descript + " " + Lan.g(this, "added"));
         }
         else
         {
             TaskLists.Update(Cur);
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.Message);
         return;
     }
     DialogResult = DialogResult.OK;
 }
예제 #15
0
        private void butEditFeeSched_Click(object sender, System.EventArgs e)
        {
            //won't even be visible if no permission
            int selectedSched = 0;

            if (listFeeSched.SelectedIndex != -1)
            {
                selectedSched = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum;
            }
            FormDefinitions FormD = new FormDefinitions(DefCat.FeeSchedNames);

            FormD.ShowDialog();
            DataValid.SetInvalid(InvalidTypes.Defs | InvalidTypes.Fees);
            Fees.Refresh();
            ProcedureCodes.Refresh();
            changed = true;
            FillFeeSchedules();
            for (int i = 0; i < DefB.Short[(int)DefCat.FeeSchedNames].Length; i++)
            {
                if (DefB.Short[(int)DefCat.FeeSchedNames][i].DefNum == selectedSched)
                {
                    listFeeSched.SelectedIndex = i;
                }
            }
            FillGrid();
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Definitions");
            //FillGrid();//will be done automatically because of lines above
        }
예제 #16
0
        private void butPrint_Click(object sender, EventArgs e)
        {
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
            pd.DefaultPageSettings.Margins = new Margins(25, 25, 40, 40);
            //pd.OriginAtMargins=true;
            if (pd.DefaultPageSettings.PrintableArea.Height == 0)
            {
                pd.DefaultPageSettings.PaperSize = new PaperSize("default", 850, 1100);
            }
                        #if DEBUG
            //pd.Print();
            MessageBox.Show("Printed");
                        #else
            PrintDialog dialog = new PrintDialog();
            dialog.UseEXDialog = true;
            DialogResult result = dialog.ShowDialog();
            if (result == DialogResult.OK)
            {
                try {
                    pd.PrinterSettings = dialog.PrinterSettings;
                    pd.Print();
                    //Create audit log entry for printing.  PatNum can be 0.
                    SecurityLogs.MakeLogEntry(Permissions.Printing, 0, "Patient List Printed");
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message);
                }
            }
                        #endif
        }
예제 #17
0
        private void butImport_Click(object sender, EventArgs e)
        {
            OpenFileDialog openDlg = new OpenFileDialog();

            openDlg.InitialDirectory = PrefB.GetString("ExportPath");
            if (openDlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int rowsInserted = 0;

            try {
                rowsInserted = ImportProcCodes(openDlg.FileName, true);
            }
            catch (ApplicationException ex) {
                MessageBox.Show(ex.Message);
                FillGrid();
                return;
            }
            MessageBox.Show("Procedure codes inserted: " + rowsInserted);
            DataValid.SetInvalid(InvalidTypes.Defs);
            changed = true;
            FillCats();
            FillGrid();
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Imported Procedure Codes");
        }
예제 #18
0
        private void butDelete_Click(object sender, EventArgs e)
        {
            if (IsNew)
            {
                //This code is never hit in current implementation 09/26/2013.
                DialogResult = DialogResult.Cancel;
                return;
            }
            List <Vitalsign> listVitals = Vitalsigns.GetListFromPregDiseaseNum(DiseaseCur.DiseaseNum);

            if (listVitals.Count > 0)           //if attached to vital sign exam, block delete
            {
                string dates = "";
                for (int i = 0; i < listVitals.Count; i++)
                {
                    if (i > 5)
                    {
                        break;
                    }
                    dates += "\r\n" + listVitals[i].DateTaken.ToShortDateString();
                }
                MsgBox.Show(this, "Not allowed to delete this problem.  It is attached to " + listVitals.Count.ToString() + "vital sign exams with dates including:" + dates + ".");
                return;
            }
            else
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?"))
                {
                    return;
                }
            }
            SecurityLogs.MakeLogEntry(Permissions.PatProblemListEdit, DiseaseCur.PatNum, DiseaseDefs.GetName(DiseaseCur.DiseaseDefNum) + " deleted");
            Diseases.Delete(DiseaseCur);
            DialogResult = DialogResult.OK;
        }
예제 #19
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     else
     {
         if (_listSplitsForAdjustment.Count > 0)
         {
             MsgBox.Show(this, "Cannot delete adjustment while a payment split is attached.");
             return;
         }
         bool isAttachedToPayPlan = PayPlanLinks.GetForFKeyAndLinkType(_adjustmentCur.AdjNum, PayPlanLinkType.Adjustment).Count > 0;
         if (isAttachedToPayPlan)
         {
             MsgBox.Show(this, "Cannot delete adjustment that is attached to a dynamic payment plan");
             return;
         }
         if (_listSplitsForAdjustment.Count > 0 &&
             !MsgBox.Show(this, MsgBoxButtons.YesNo, "There are payment splits associated to this adjustment.  Do you want to continue deleting?"))
         {                //There are splits for this adjustment
             return;
         }
         SecurityLogs.MakeLogEntry(Permissions.AdjustmentEdit, _adjustmentCur.PatNum
                                   , "Delete for patient: " + _patCur.GetNameLF() + ", " + _adjustmentCur.AdjAmt.ToString("c"), 0, _adjustmentCur.SecDateTEdit);
         Adjustments.Delete(_adjustmentCur);
         DialogResult = DialogResult.OK;
     }
 }
예제 #20
0
        private void butAddCustom_Click(object sender, EventArgs e)
        {
            if (!Security.IsAuthorized(Permissions.RefAttachAdd))
            {
                return;
            }
            FormReferralSelect FormRS = new FormReferralSelect();

            FormRS.IsSelectionMode = true;
            FormRS.ShowDialog();
            if (FormRS.DialogResult != DialogResult.OK)
            {
                return;
            }
            RefAttach refattach = new RefAttach();

            refattach.ReferralNum        = FormRS.SelectedReferral.ReferralNum;
            refattach.PatNum             = PatNum;
            refattach.RefType            = ReferralType.RefCustom;
            refattach.RefDate            = DateTimeOD.Today;
            refattach.IsTransitionOfCare = false;
            refattach.ItemOrder          = RefAttachList.Select(x => x.ItemOrder + 1).OrderByDescending(x => x).FirstOrDefault();//Max+1 or 0
            RefAttaches.Insert(refattach);
            SecurityLogs.MakeLogEntry(Permissions.RefAttachAdd, PatNum, "Referred (custom) " + Referrals.GetNameFL(refattach.ReferralNum));
            FillGrid();
            for (int i = 0; i < RefAttachList.Count; i++)
            {
                if (RefAttachList[i].RefAttachNum == refattach.RefAttachNum)
                {
                    gridMain.SetSelected(i, true);
                    break;
                }
            }
        }
예제 #21
0
 private void butOK_Click(object sender, System.EventArgs e)
 {
     if (textDateTP.errorProvider1.GetError(textDateTP) != ""
         )
     {
         MsgBox.Show(this, "Please fix data entry errors first.");
         return;
     }
     if (textDateTP.Text == "")
     {
         MsgBox.Show(this, "Please enter a date first.");
         return;
     }
     PlanCur.DateTP  = PIn.Date(textDateTP.Text);
     PlanCur.Heading = textHeading.Text;
     PlanCur.Note    = textNote.Text;
     if (_presenterCur != null)
     {
         PlanCur.UserNumPresenter = _presenterCur.UserNum;
     }
     else
     {
         PlanCur.UserNumPresenter = 0;
     }
     //PlanCur.SecUserNumEntry is updated automatically by MySQL.
     TreatPlans.Update(PlanCur);
     SecurityLogs.MakeLogEntry(Permissions.TreatPlanEdit, PlanCur.PatNum, "Edit TP: " + PlanCur.DateTP.ToShortDateString());
     if (_presenterCur != null && (_presenterOld == null || _presenterCur.UserNum != _presenterOld.UserNum))
     {
         SecurityLogs.MakeLogEntry(Permissions.TreatPlanPresenterEdit, PlanCur.PatNum,
                                   "TP Presenter Changed from " + (_presenterOld == null?"\"null\"":_presenterOld.UserName) + " to " + _presenterCur.UserName + ".");
     }
     DialogResult = DialogResult.OK;
 }
예제 #22
0
        private void butRun_Click(object sender, EventArgs e)
        {
            if (!checkTcodes.Checked && !checkNcodes.Checked && !checkDcodes.Checked && !checkAutocodes.Checked &&
                !checkProcButtons.Checked && !checkApptProcsQuickAdd.Checked)
            {
                MsgBox.Show(this, "Please select at least one tool first.");
                return;
            }
            Changed = true;
            int rowsInserted = 0;

            if (checkTcodes.Checked)
            {
                ProcedureCodes.TcodesClear();
                //yes, this really does refresh before moving on.
                DataValid.SetInvalid(InvalidTypes.Defs | InvalidTypes.ProcCodes | InvalidTypes.Fees);
            }
            if (checkNcodes.Checked)
            {
                try {
                    rowsInserted += FormProcCodes.ImportProcCodes("", new List <ProcedureCode>(), Properties.Resources.NoFeeProcCodes);
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                DataValid.SetInvalid(InvalidTypes.Defs | InvalidTypes.ProcCodes | InvalidTypes.Fees);
                //fees are included because they are grouped by defs.
            }
            if (checkDcodes.Checked)
            {
                try {
                    rowsInserted += FormProcCodes.ImportProcCodes("", codeList, "");
                }
                catch (ApplicationException ex) {
                    MessageBox.Show(ex.Message);
                }
                DataValid.SetInvalid(InvalidTypes.Defs | InvalidTypes.ProcCodes | InvalidTypes.Fees);
            }
            if (checkNcodes.Checked || checkDcodes.Checked)
            {
                MessageBox.Show("Procedure codes inserted: " + rowsInserted);
            }
            if (checkAutocodes.Checked)
            {
                AutoCodes.SetToDefault();
                DataValid.SetInvalid(InvalidTypes.AutoCodes);
            }
            if (checkProcButtons.Checked)
            {
                ProcButtons.SetToDefault();
                DataValid.SetInvalid(InvalidTypes.ProcButtons | InvalidTypes.Defs);
            }
            if (checkApptProcsQuickAdd.Checked)
            {
                ProcedureCodes.ResetApptProcsQuickAdd();
                DataValid.SetInvalid(InvalidTypes.Defs);
            }
            MessageBox.Show(Lan.g(this, "Done."));
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "New Customer Procedure codes tool was run.");
        }
예제 #23
0
        private void butMoveTo_Click(object sender, EventArgs e)
        {
            if (gridMain.GetSelectedIndex() < 0)
            {
                MsgBox.Show(this, "Please select a card first.");
                return;
            }
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Move this credit card information to a different patient account?"))
            {
                return;
            }
            FormPatientSelect form = new FormPatientSelect();

            if (form.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            int        selected   = gridMain.GetSelectedIndex();
            CreditCard creditCard = _listCreditCards[selected];
            long       patNumOrig = creditCard.PatNum;

            creditCard.PatNum = form.SelectedPatNum;
            CreditCards.Update(creditCard);
            FillGrid();
            MsgBox.Show(this, "Credit card moved successfully");
            SecurityLogs.MakeLogEntry(Permissions.CreditCardMove, patNumOrig, $"Credit card moved to PatNum: {form.SelectedPatNum}");
            SecurityLogs.MakeLogEntry(Permissions.CreditCardMove, form.SelectedPatNum, $"Credit card moved from PatNum: {patNumOrig}");
        }
예제 #24
0
        ///<summary>Checks if Repeating Charges are already running on another workstation or by the OpenDental Service.  If less than 24 hours have
        ///passed since the tool was started, user will be blocked from running Repeating Charges.  Otherwise, SecurityAdmin users can restart the tool.
        ///</summary>
        private bool CheckBeginDateTime()
        {
            Prefs.RefreshCache();            //Just to be sure we don't miss someone who has just started running repeating charges.
            if (PrefC.GetString(PrefName.RepeatingChargesBeginDateTime) == "")
            {
                return(true);
            }
            DateTime repeatingChargesBeginDateTime = PrefC.GetDateT(PrefName.RepeatingChargesBeginDateTime);

            if ((MiscData.GetNowDateTime() - repeatingChargesBeginDateTime).TotalHours < 24)
            {
                MsgBox.Show(this, "Repeating charges already running on another workstation, you must wait for them to finish before continuing.");
                return(false);
            }
            //It's been more than 24 hours since repeat charges started.
            if (Security.IsAuthorized(Permissions.SecurityAdmin, true))
            {
                string message = Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString()
                                 + Lans.g(this, ".  Restart repeating charges?");
                if (MsgBox.Show(MsgBoxButtons.OKCancel, message))
                {
                    SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, "Restarted repeating charges. Previous Repeating Charges Begin DateTime was "
                                              + repeatingChargesBeginDateTime.ToString() + ".");
                    return(true);
                }
                return(false);               //Security admin doesn't want to restart repeat charges.
            }
            //User isn't a security admin.
            MsgBox.Show(Lans.g(this, "Repeating Charges last started on") + " " + repeatingChargesBeginDateTime.ToString()
                        + Lans.g(this, ".  Contact a user with SecurityAdmin permission to restart repeating charges."));
            return(false);
        }
예제 #25
0
 private void FormSchedule_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (changed)
     {
         SecurityLogs.MakeLogEntry(Permissions.Schedules, 0, "");
     }
 }
예제 #26
0
        private void butOK_Click(object sender, EventArgs e)
        {
            if (!CheckBeginDateTime())
            {
                return;
            }
            //If the AvaTax API is not available at HQ show popup and return.
            if (AvaTax.IsEnabled() && !AvaTax.PingAvaTax())
            {
                MsgBox.Show(this, "Unable to connect to AvaTax API.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            RepeatChargeResult result  = RepeatCharges.RunRepeatingCharges(MiscData.GetNowDateTime(), checkRunAging.Checked);
            string             metrics = result.ProceduresAddedCount + " " + Lan.g(this, "procedures added.") + "\r\n" + result.ClaimsAddedCount + " "
                                         + Lan.g(this, "claims added.");

            SecurityLogs.MakeLogEntry(Permissions.RepeatChargeTool, 0, "Repeat Charge Tool ran.\r\n" + metrics);
            Cursor = Cursors.Default;
            MessageBox.Show(metrics);
            if (!string.IsNullOrEmpty(result.ErrorMsg))
            {
                SecurityLogs.MakeLogEntry(Permissions.RepeatChargeTool, 0, "Repeat Charge Tool Error: " + result.ErrorMsg);
                MessageBox.Show(result.ErrorMsg);
            }
            DialogResult = DialogResult.OK;
        }
예제 #27
0
 private void butUndo_Click(object sender, EventArgs e)
 {
     if (radioFinanceCharge.Checked)
     {
         if (MessageBox.Show(Lan.g(this, "Undo all finance charges for ") + textDateUndo.Text + "?", "", MessageBoxButtons.OKCancel)
             != DialogResult.OK)
         {
             return;
         }
         long rowsAffected = Adjustments.UndoFinanceCharges(PIn.Date(textDateUndo.Text));
         MessageBox.Show(Lan.g(this, "Finance charge adjustments deleted: ") + rowsAffected.ToString());
         Ledgers.RunAging();
         SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Finance Charges undo. Date " + textDateUndo.Text);
         DialogResult = DialogResult.OK;
     }
     else if (radioBillingCharge.Checked)
     {
         if (MessageBox.Show(Lan.g(this, "Undo all billing charges for ") + textDateUndo.Text + "?", "", MessageBoxButtons.OKCancel)
             != DialogResult.OK)
         {
             return;
         }
         long rowsAffected = Adjustments.UndoBillingCharges(PIn.Date(textDateUndo.Text));
         MessageBox.Show(Lan.g(this, "Billing charge adjustments deleted: ") + rowsAffected.ToString());
         Ledgers.RunAging();
         SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Billing Charges undo. Date " + textDateUndo.Text);
         DialogResult = DialogResult.OK;
     }
 }
예제 #28
0
        private void butEditCategories_Click(object sender, EventArgs e)
        {
            //won't even be visible if no permission
            ArrayList selected = new ArrayList();

            for (int i = 0; i < listCategories.SelectedIndices.Count; i++)
            {
                selected.Add(CatList[listCategories.SelectedIndices[i]].DefNum);
            }
            FormDefinitions FormD = new FormDefinitions(DefCat.ProcCodeCats);

            FormD.ShowDialog();
            DataValid.SetInvalid(InvalidTypes.Defs);
            changed = true;
            FillCats();
            for (int i = 0; i < CatList.Length; i++)
            {
                if (selected.Contains(CatList[i].DefNum))
                {
                    listCategories.SetSelected(i, true);
                }
            }
            //we need to move security log to within the definition window for more complete tracking
            SecurityLogs.MakeLogEntry(Permissions.Setup, 0, "Definitions");
            FillGrid();
        }
예제 #29
0
 private void butImport_Click(object sender, EventArgs e)
 {
     try {
         using (OpenFileDialog openDialog = ImportDialogSetup()) {
             if (openDialog.ShowDialog() != DialogResult.OK)
             {
                 return;                         //User cancelled out of OpenFileDialog
             }
             string fileContents          = File.ReadAllText(openDialog.FileName);
             TransferableAutoNotes import = JsonConvert.DeserializeObject <TransferableAutoNotes>(fileContents);
             AutoNoteControls.RemoveDuplicatesFromList(import.AutoNoteControls, import.AutoNotes);
             AutoNoteControls.InsertBatch(import.AutoNoteControls);
             AutoNotes.InsertBatch(import.AutoNotes);
             DataValid.SetInvalid(InvalidType.AutoNotes);
             AutoNoteL.FillListTree(treeNotes, _userOdCurPref);
             SecurityLogs.MakeLogEntry(Permissions.AutoNoteQuickNoteEdit, 0,
                                       $"Auto Note Import. {import.AutoNotes.Count} new Auto Notes, {import.AutoNoteControls.Count} new Prompts");
             MsgBox.Show(Lans.g(this, "Auto Notes successfully imported!") + "\r\n" + import.AutoNotes.Count + " " + Lans.g(this, "new Auto Notes")
                         + "\r\n" + import.AutoNoteControls.Count + " " + Lans.g(this, "new Prompts"));
         }
     }
     catch (Exception err) {
         FriendlyException.Show(Lans.g(this, "Auto Note(s) failed to import."), err);
     }
 }
예제 #30
0
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (textDate.errorProvider1.GetError(textDate) != "" || textDays.errorProvider1.GetError(textDays) != "")
            {
                MsgBox.Show(this, "Please fix data entry errors first.");
                return;
            }
            int newerDays = PIn.Int(textDays.Text);

            if (newerDays > GroupPermissions.NewerDaysMax)
            {
                MsgBox.Show(this, $"Days must be less than {GroupPermissions.NewerDaysMax.ToString()}.");
                return;
            }
            Cur.NewerDays = newerDays;
            Cur.NewerDate = PIn.Date(textDate.Text);
            try{
                if (Cur.IsNew)
                {
                    GroupPermissions.Insert(Cur);
                }
                else
                {
                    GroupPermissions.Update(Cur);
                }
                SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, 0, $"Permission '{Cur.PermType}' granted to " +
                                          $"'{UserGroups.GetGroup(Cur.UserGroupNum).Description}'");
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            DialogResult = DialogResult.OK;
        }