private void gridProcedureAdjustments_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Hx835_Adj       adj    = (Hx835_Adj)gridProcedureAdjustments.Rows[e.Row].Tag;
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(adj.AdjCode + " " + adj.AdjustRemarks + "\r\r" + adj.ReasonDescript + "\r\n" + adj.AdjAmt.ToString("f2"));

            msgbox.Show(this);            //This window is just used to display information.
        }
        private void butPreview_Click(object sender, EventArgs e)
        {
            if (!VerifyOutputs())
            {
                return;
            }
            StringBuilder sb = new StringBuilder();

            sb.AppendLine("------ " + Lan.g(this, "Notification email that will be sent to the patient's email address:"));
            if (_allowSendNotificationMessage)
            {
                sb.AppendLine(Lan.g(this, "Subject") + ": " + SubjectInsecure);
                sb.AppendLine(Lan.g(this, "Body") + ": " + BodyTextInsecure);
            }
            else
            {
                sb.AppendLine(Lan.g(this, "------ " + Lan.g(this, "Notification email settings are not set up.  Click Setup from the web mail message edit window"
                                                            + " to set up notification emails") + " ------"));
            }
            sb.AppendLine();
            sb.AppendLine("------ " + Lan.g(this, "Secure web mail message that will be sent to the patient's portal:"));
            sb.AppendLine(Lan.g(this, "Subject") + ": " + textSubject.Text);
            sb.AppendLine(Lan.g(this, "Body") + ": " + textBody.Text.Replace("\n", "\r\n"));
            MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(sb.ToString());

            msgBox.ShowDialog();
        }
        /// <summary>Returns true if ClaimProcAllowCreditsGreaterThanProcFee preference allows the user to add credits greater than the proc fee. Otherwise returns false </summary>
        private bool isClaimProcGreaterThanProcFee()
        {
            ClaimProcCreditsGreaterThanProcFee creditsGreaterPref = (ClaimProcCreditsGreaterThanProcFee)PrefC.GetInt(PrefName.ClaimProcAllowCreditsGreaterThanProcFee);

            if (creditsGreaterPref == ClaimProcCreditsGreaterThanProcFee.Allow)
            {
                return(true);
            }
            List <Procedure>  listProcs                 = Procedures.GetManyProc(ClaimProcsToEdit.Select(x => x.ProcNum).ToList(), false);
            List <ClaimProc>  listClaimProcsForPat      = ClaimProcs.Refresh(PatCur.PatNum);
            List <PaySplit>   listPaySplitForSelectedCP = PaySplits.GetPaySplitsFromProcs(ClaimProcsToEdit.Select(x => x.ProcNum).ToList());
            List <Adjustment> listAdjForSelectedCP      = Adjustments.GetForProcs(ClaimProcsToEdit.Select(x => x.ProcNum).ToList());
            bool          isCreditGreater               = false;
            List <string> listProcDescripts             = new List <string>();

            for (int i = 0; i < ClaimProcsToEdit.Length; i++)
            {
                ClaimProc claimProcCur = ClaimProcsToEdit[i];
                int       insPayIdx    = gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Ins Pay"));
                int       writeoffIdx  = gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Writeoff"));
                int       feeAcctIdx   = gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Fee"));
                decimal   insPayAmt    = (decimal)ClaimProcs.ProcInsPay(listClaimProcsForPat.FindAll(x => x.ClaimProcNum != claimProcCur.ClaimProcNum), claimProcCur.ProcNum)
                                         + PIn.Decimal(gridMain.ListGridRows[i].Cells[insPayIdx].Text);
                decimal writeOff = (decimal)ClaimProcs.ProcWriteoff(listClaimProcsForPat.FindAll(x => x.ClaimProcNum != claimProcCur.ClaimProcNum), claimProcCur.ProcNum)
                                   + PIn.Decimal(gridMain.ListGridRows[i].Cells[writeoffIdx].Text);
                decimal feeAcct   = PIn.Decimal(gridMain.ListGridRows[i].Cells[feeAcctIdx].Text);
                decimal adj       = listAdjForSelectedCP.Where(x => x.ProcNum == claimProcCur.ProcNum).Select(x => (decimal)x.AdjAmt).Sum();
                decimal patPayAmt = listPaySplitForSelectedCP.Where(x => x.ProcNum == claimProcCur.ProcNum).Select(x => (decimal)x.SplitAmt).Sum();
                //Any changes to this calculation should also consider FormClaimProc.IsClaimProcGreaterThanProcFee().
                decimal creditRem = feeAcct - patPayAmt - insPayAmt - writeOff + adj;
                isCreditGreater |= (creditRem.IsLessThanZero());
                if (creditRem.IsLessThanZero())
                {
                    Procedure proc = listProcs.FirstOrDefault(x => x.ProcNum == claimProcCur.ProcNum);
                    listProcDescripts.Add((proc == null ? "" : ProcedureCodes.GetProcCode(proc.CodeNum).ProcCode)
                                          + "\t" + Lan.g(this, "Fee") + ": " + feeAcct.ToString("F")
                                          + "\t" + Lan.g(this, "Credits") + ": " + (Math.Abs(-patPayAmt - insPayAmt - writeOff + adj)).ToString("F")
                                          + "\t" + Lan.g(this, "Remaining") + ": (" + Math.Abs(creditRem).ToString("F") + ")");
                }
            }
            if (!isCreditGreater)
            {
                return(true);
            }
            if (creditsGreaterPref == ClaimProcCreditsGreaterThanProcFee.Block)
            {
                MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(Lan.g(this, "Remaining amount is negative for the following procedures") + ":\r\n"
                                                             + string.Join("\r\n", listProcDescripts) + "\r\n" + Lan.g(this, "Not allowed to continue."));
                msgBox.Text = Lan.g(this, "Overpaid Procedure Warning");
                msgBox.ShowDialog();
                return(false);
            }
            if (creditsGreaterPref == ClaimProcCreditsGreaterThanProcFee.Warn)
            {
                return(MessageBox.Show(Lan.g(this, "Remaining amount is negative for the following procedures") + ":\r\n"
                                       + string.Join("\r\n", listProcDescripts.Take(10)) + "\r\n" + (listProcDescripts.Count > 10?"...\r\n":"") + Lan.g(this, "Continue?")
                                       , Lan.g(this, "Overpaid Procedure Warning"), MessageBoxButtons.OKCancel) == DialogResult.OK);
            }
            return(true);           //should never get to this line, only possible if another enum value is added to allow, warn, and block
        }
        private void gridRemarks_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            string          remark = (string)gridRemarks.Rows[e.Row].Tag;
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(remark);

            msgbox.Show(this);            //This window is just used to display information.
        }
Beispiel #5
0
 private void butDelete_Click(object sender, System.EventArgs e)
 {
     if (IsNew)
     {
         DialogResult = DialogResult.Cancel;
     }
     else
     {
         string inuseby = ReqStudents.InUseBy(ReqCur.ReqNeededNum);
         if (inuseby != "")
         {
             MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(Lan.g(this, "Requirement is already in use by student(s) with grade point(s) attached."
                                                                + "\r\n" + Lan.g(this, "Delete anyway?  Student grades will not be affected."))
                                                          + "\r\n" + inuseby);
             msgBox.ShowDialog();
             if (msgBox.DialogResult != DialogResult.OK)
             {
                 return;
             }
         }
         if (!MsgBox.Show(this, true, "Delete this Requirement?"))
         {
             return;
         }
     }
     ReqCur       = null;
     DialogResult = DialogResult.OK;
 }
        private void gridSupplementalInfo_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Hx835_Info      info   = (Hx835_Info)gridSupplementalInfo.Rows[e.Row].Tag;
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(info.FieldName + "\r\n" + info.FieldValue);

            msgbox.Show(this);            //This window is just used to display information.
        }
Beispiel #7
0
        private void butShow_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MessageBox.Show("Please select lab panels first.");
                return;
            }
            List <LabPanel> panels = new List <LabPanel>();

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                panels.Add(listLP[gridMain.SelectedIndices[i]]);
            }
            OpenDentBusiness.HL7.EhrORU oru = new OpenDentBusiness.HL7.EhrORU();
            Cursor = Cursors.WaitCursor;
            try {
                oru.Initialize(panels);
            }
            catch (ApplicationException ex) {
                Cursor = Cursors.Default;
                MessageBox.Show(ex.Message);
                return;
            }
            string outputStr = oru.GenerateMessage();

            Cursor = Cursors.Default;
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(outputStr);

            msgbox.ShowDialog();
        }
Beispiel #8
0
        /// <summary>Will only convert to MyISAM if default storage engine set to MyISAM.</summary>
        private void butToMyIsam_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will convert all tables in the database to the MyISAM storage engine.  This may take several minutes.\r\nContinue?"))
            {
                return;
            }
            if (InnoDb.GetDefaultEngine() == "InnoDB")
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDB", "You will first need to change your default storage engine to MyISAM.  Make sure that the following line is in your my.ini file: \r\n"
                          + "default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            if (!Shared.MakeABackup(BackupLocation.InnoDbTool))
            {
                return;                //A message has already shown that the backup failed.
            }
            Cursor         = Cursors.WaitCursor;
            textBox1.Text += Lans.g("FormInnoDb", "Default Storage Engine: " + InnoDb.GetDefaultEngine().ToString() + "\r\n");
            Application.DoEvents();
            int numchanged = InnoDb.ConvertTables("InnoDB", "MyISAM");

            textBox1.Text += Lan.g("FormInnoDb", "Number of tables converted to MyISAM: ") + numchanged.ToString() + "\r\n";
            Application.DoEvents();
            textBox1.Text += InnoDb.GetEngineCount();
            Application.DoEvents();
            Cursor = Cursors.Default;
        }
Beispiel #9
0
 ///<summary>only visible if Canadian</summary>
 private void butPrintAck_Click(object sender, EventArgs e)
 {
     try {
         new FormCCDPrint(AckCur, textAckMessage.Text, false);              //Show the form on screen and make the user print manually if they desire to print.
     }
     catch (Exception ex) {
         MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(Lan.g(this, "Failed to preview acknowledgment.") + "\r\n" + ex.Message);
         msgBox.ShowDialog();
     }
 }
Beispiel #10
0
        private void butRun_Click(object sender, EventArgs e)
        {
            List <ClaimPaySplit> splits = Claims.GetInsPayNotAttachedForFixTool();

            if (splits.Count == 0)
            {
                MsgBox.Show(this, "There are currently no insurance payments that are not attached to an insurance check.");
                DialogResult = DialogResult.OK;              //Close the window because there is nothing else to do
                return;
            }
            Cursor = Cursors.WaitCursor;
            string   invalidClaimDate = "";
            DateTime curDate          = MiscData.GetNowDateTime().Date;

            for (int i = 0; i < splits.Count; i++)
            {
                Claim claim = Claims.GetClaim(splits[i].ClaimNum);
                if (claim == null)
                {
                    continue;
                }
                if (claim.DateReceived.Date > curDate && !PrefC.GetBool(PrefName.AllowFutureInsPayments) && !PrefC.GetBool(PrefName.FutureTransDatesAllowed))
                {
                    invalidClaimDate += "\r\n" + Lan.g(this, "PatNum") + " " + claim.PatNum + ", " + claim.DateService.ToShortDateString();
                    continue;
                }
                ClaimPayment cp = new ClaimPayment();
                cp.CheckDate   = claim.DateReceived;
                cp.CheckAmt    = splits[i].InsPayAmt;
                cp.ClinicNum   = claim.ClinicNum;
                cp.CarrierName = splits[i].Carrier;
                cp.PayType     = Defs.GetFirstForCategory(DefCat.InsurancePaymentType, true).DefNum;
                ClaimPayments.Insert(cp);
                List <ClaimProc> claimP = ClaimProcs.RefreshForClaim(splits[i].ClaimNum);
                for (int j = 0; j < claimP.Count; j++)
                {
                    if (claimP[j].ClaimPaymentNum != 0 || claimP[j].InsPayAmt == 0) //If claimpayment already attached to claimproc or ins didn't pay.
                    {
                        continue;                                                   //Do not change
                    }
                    claimP[j].DateCP          = claim.DateReceived;
                    claimP[j].ClaimPaymentNum = cp.ClaimPaymentNum;
                    ClaimProcs.Update(claimP[j]);
                }
            }
            Cursor = Cursors.Default;
            if (invalidClaimDate != "")
            {
                invalidClaimDate = "\r\n" + Lan.g(this, "Cannot make future-dated insurance payments for these claims:") + invalidClaimDate;
            }
            MsgBoxCopyPaste messageBox = new MsgBoxCopyPaste(Lan.g(this, "Insurance checks created:") + " " + splits.Count + invalidClaimDate);

            messageBox.Show();
            DialogResult = DialogResult.OK;          //Close the window because there is nothing else to do
        }
        private void butShowXml_Click(object sender, EventArgs e)
        {
            string strCcd = File.ReadAllText(StrXmlFilePath);

            //Reformat to add newlines after each element to make more readable.
            strCcd = strCcd.Replace("\r\n", "").Replace("\n", "").Replace("\r", "");       //Remove existsing newlines.
            strCcd = strCcd.Replace(">", ">\r\n");
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(strCcd);

            msgbox.ShowDialog();
        }
Beispiel #12
0
        private void checkIsHidden_Click(object sender, EventArgs e)
        {
            //Don't allow fees to be hidden if they are in use by a provider.
            if (!checkIsHidden.Checked)
            {
                return;                //Unhiding a fee. OK.
            }
            if (FeeSchedCur.FeeSchedType != FeeScheduleType.Normal)
            {
                return;                //Not Normal fee. Not in use by a provider.
            }
            List <InsPlan> listInsPlanForFeeSched = InsPlans.GetForFeeSchedNum(FeeSchedCur.FeeSchedNum);

            if (listInsPlanForFeeSched.Count > 0)
            {
                string insPlanMsg = Lan.g(this, "This fee schedule is tied to") + " "
                                    + listInsPlanForFeeSched.Count + " " + Lan.g(this, "insurance plans.") + " " + Lan.g(this, "Continue?");
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, insPlanMsg))
                {
                    checkIsHidden.Checked = false;
                    return;
                }
            }
            string providersUsingFee = "";

            for (int i = 0; i < _listProviders.Count; i++)
            {
                if (FeeSchedCur.FeeSchedNum == _listProviders[i].FeeSched)
                {
                    if (providersUsingFee != "")                  //There is a name before this on the list
                    {
                        providersUsingFee += ", ";
                    }
                    providersUsingFee += _listProviders[i].Abbr;
                }
            }
            if (providersUsingFee != "")
            {
                MessageBox.Show(Lan.g(this, "Cannot hide. Fee schedule is currently in use by the following providers") + ":\r\n" + providersUsingFee);
                checkIsHidden.Checked = false;
            }
            string patsUsingFee = "";
            //Don't allow fee schedules to be hidden if they are in use by a non-deleted patient.
            List <Patient> listPats = Patients.GetForFeeSched(FeeSchedCur.FeeSchedNum).FindAll(x => x.PatStatus != PatientStatus.Deleted);

            patsUsingFee = string.Join("\r\n", listPats.Select(x => x.LName + ", " + x.FName));
            if (patsUsingFee != "")
            {
                MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(Lan.g(this, "Cannot hide. Fee schedule currently in use by the following non-deleted patients")
                                                               + ":\r\n" + patsUsingFee);
                msgBoxCP.ShowDialog();
                checkIsHidden.Checked = false;
            }
        }
Beispiel #13
0
        private void butGenerateQuery_Click(object sender, EventArgs e)
        {
            if (!Validation())
            {
                return;
            }
            string          queryStr = RpAging.GetQueryString(GetParamsFromForm());
            MsgBoxCopyPaste msgBox   = new MsgBoxCopyPaste(queryStr);

            msgBox.Show(this);
        }
Beispiel #14
0
        private void gridProviderAdjustments_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            Hx835_ProvAdj   provAdj = (Hx835_ProvAdj)gridProviderAdjustments.ListGridRows[e.Row].Tag;
            MsgBoxCopyPaste msgbox  = new MsgBoxCopyPaste(
                provAdj.Npi + "\r\n"
                + provAdj.DateFiscalPeriod.ToShortDateString() + "\r\n"
                + provAdj.ReasonCode + " " + provAdj.ReasonCodeDescript + "\r\n"
                + provAdj.RefIdentification + "\r\n"
                + provAdj.AdjAmt.ToString("f2"));

            msgbox.Show(this);            //This window is just used to display information.
        }
Beispiel #15
0
        private void butExport_Click(object sender, EventArgs e)
        {
            if (gridCustomSheet.GetSelectedIndex() == -1)
            {
                MsgBox.Show(this, "Please select a sheet from the list first.");
                return;
            }
            SheetDef             sheetdef           = SheetDefs.GetSheetDef(_listSheetDefs[gridCustomSheet.GetSelectedIndex()].SheetDefNum);
            List <SheetFieldDef> listFieldDefImages = sheetdef.SheetFieldDefs
                                                      .Where(x => x.FieldType == SheetFieldType.Image && x.FieldName != "Patient Info.gif")
                                                      .ToList();

            if (!listFieldDefImages.IsNullOrEmpty())             //Alert them of any images they need to copy if there are any.
            {
                string sheetImagesPath = "";
                ODException.SwallowAnyException(() => {
                    sheetImagesPath = SheetUtil.GetImagePath();
                });
                StringBuilder strBuilder = new StringBuilder();
                strBuilder.AppendLine(Lan.g(this, "The following images will need to be manually imported with the same file name when importing this "
                                            + "sheet to a new environment."));
                strBuilder.AppendLine();
                listFieldDefImages.ForEach(x => strBuilder.AppendLine(ODFileUtils.CombinePaths(sheetImagesPath, x.FieldName)));
                MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(strBuilder.ToString());
                msgBox.ShowDialog();
            }
            XmlSerializer serializer = new XmlSerializer(typeof(SheetDef));
            string        filename   = "SheetDefCustom.xml";

            if (ODBuild.IsWeb())
            {
                StringBuilder strbuild = new StringBuilder();
                using (XmlWriter writer = XmlWriter.Create(strbuild)) {
                    serializer.Serialize(writer, sheetdef);
                }
                ThinfinityUtils.ExportForDownload(filename, strbuild.ToString());
            }
            else
            {
                SaveFileDialog saveDlg = new SaveFileDialog();
                saveDlg.InitialDirectory = PrefC.GetString(PrefName.ExportPath);
                saveDlg.FileName         = filename;
                if (saveDlg.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                using (TextWriter writer = new StreamWriter(saveDlg.FileName)) {
                    serializer.Serialize(writer, sheetdef);
                }
            }
            MsgBox.Show(this, "Exported");
        }
        private void ShowRawMessage_Clicked(object sender, System.EventArgs e)
        {
            //accessed by right clicking on history
            if (gridHistory.SelectedIndices.Length != 1)
            {
                MsgBox.Show(this, "Please select exactly one item first.");
                return;
            }
            Etrans          et     = Etranss.GetEtrans(PIn.PInt(tableHistory.Rows[gridHistory.SelectedIndices[0]]["EtransNum"].ToString()));
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(et.MessageText);

            msgbox.ShowDialog();
        }
        private void butShowXml_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                ccd = EhrCCD.GenerateElectronicCopy(PatCur);
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(ccd);

            msgbox.ShowDialog();
        }
Beispiel #18
0
        private void butManEdit_Click(object sender, EventArgs e)
        {
            //PumpGridIntoTable();
            Markup = GenerateMarkup();
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(Markup);

            msgbox.ShowDialog();
            if (msgbox.DialogResult != DialogResult.OK)
            {
                return;
            }
            Markup = msgbox.textMain.Text;
            ParseMarkup();
            FillGrid();
        }
Beispiel #19
0
        private void ManuallyEdit()
        {
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(Markup);

            msgbox.ShowDialog();
            if (msgbox.DialogResult == DialogResult.OK)
            {
                Markup = msgbox.textMain.Text;
                ParseMarkup();                //try again
            }
            else
            {
                DialogResult = DialogResult.Cancel;
            }
        }
Beispiel #20
0
        /// <summary>Will only convert to InnoDB if default storage engine set to InnoDB and skip-innodb is not in my.ini file, which disables InnoDB engine.</summary>
        private void butToInnoDb_Click(object sender, EventArgs e)
        {
            if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "This will convert all tables in the database to the InnoDB storage engine.  This may take several minutes.\r\nContinue?"))
            {
                return;
            }
            if (!InnoDb.IsInnodbAvail())
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDb", "InnoDB storage engine is disabled.  In order for InnoDB tables to work you must comment out the skip-innodb line in your my.ini file, like this:\r\n"
                          + "#skip-innodb\r\n"
                          + "and, if present, comment out the default-storage-engine line like this: \r\n"
                          + "#default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            if (InnoDb.GetDefaultEngine() == "MyISAM")
            {
                MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(
                    Lan.g("FormInnoDB", "You will first need to change your default storage engine to InnoDB.  In your my.ini file, comment out the default-storage-engine line like this: \r\n"
                          + "#default-storage-engine=MyISAM.\r\n"
                          + "Then, restart the MySQL service and return here."));
                msgbox.ShowDialog();
                return;
            }
            try {
                MiscData.MakeABackup();
            }
            catch (Exception ex) {
                if (ex.Message != "")
                {
                    MessageBox.Show(ex.Message);
                }
                MsgBox.Show("FormInnoDb", "Backup failed. Your database has not been altered.");
                return;
            }
            Cursor         = Cursors.WaitCursor;
            textBox1.Text += Lans.g("FormInnoDb", "Default Storage Engine: " + InnoDb.GetDefaultEngine().ToString() + "\r\n");
            Application.DoEvents();
            int numchanged = InnoDb.ConvertTables("MyISAM", "InnoDB");

            textBox1.Text += Lan.g("FormInnoDb", "Number of tables converted to InnoDB: ") + numchanged.ToString() + "\r\n";
            Application.DoEvents();
            textBox1.Text += InnoDb.GetEngineCount();
            Application.DoEvents();
            Cursor = Cursors.Default;
        }
        private void butRun_Click(object sender, EventArgs e)
        {
            if (gridMain.SelectedIndices.Length == 0)
            {
                MsgBox.Show(this, "Please make a selection first");
                return;
            }
            string patientStatus  = Lan.g("enumPatientStatus", "Patient");
            string inactiveStatus = Lan.g("enumPatientStatus", "Inactive");
            string msgText        = Lan.g(this, "This will change the status for selected patients from") + " "
                                    + (_isConvertToPatient? inactiveStatus : patientStatus) + " "
                                    + Lans.g(this, "to") + " "
                                    + (_isConvertToPatient ? patientStatus : inactiveStatus) + ".\r\n" +
                                    Lan.g(this, "Do you wish to continue?");

            if (MessageBox.Show(msgText, "", MessageBoxButtons.YesNo) != DialogResult.Yes)
            {
                return;                //The user chose not to change the statuses.
            }
            StringBuilder builder     = new StringBuilder();
            List <long>   listPatNums = new List <long>();

            foreach (int index in gridMain.SelectedIndices)
            {
                Patient patOld = (Patient)gridMain.ListGridRows[index].Tag;
                Patient patCur = patOld.Copy();
                listPatNums.Add(patCur.PatNum);
                patCur.PatStatus = (_isConvertToPatient?PatientStatus.Patient:PatientStatus.Inactive);
                Patients.UpdateRecalls(patCur, patOld, "Patient Status Tool");
                Patients.Update(patCur, patOld);
                builder.AppendLine(
                    Lans.g(this, "Patient") + " " + POut.Long(patCur.PatNum) + ": " + patCur.GetNameLF() + " "
                    + Lans.g(this, "patient status changed from") + " " + (_isConvertToPatient ? inactiveStatus : patientStatus) + " "
                    + Lans.g(this, "to") + " " + (_isConvertToPatient ? patientStatus : inactiveStatus)
                    );            //Like "Patient 123: John Doe patient status changed from X to Y"
            }
            MsgBoxCopyPaste msg = new MsgBoxCopyPaste(builder.ToString());

            msg.Text = Lans.g(this, "Done");
            msg.ShowDialog();
            SecurityLogs.MakeLogEntry(Permissions.SecurityAdmin, listPatNums, Lans.g(this, "Patient status changed from") + " "
                                      + (_isConvertToPatient ? inactiveStatus : patientStatus) + " "
                                      + Lans.g(this, "to") + " " + (_isConvertToPatient ? patientStatus : inactiveStatus)
                                      + Lans.g(this, " by the Patient Status Setter tool."));
            DialogResult = DialogResult.OK;
        }
        ///<summary>Returns true if InsPayNoWriteoffMoreThanProc preference is turned on and the sum of write off amount is greater than the proc fee.
        ///Otherwise returns false </summary>
        private bool IsWriteOffGreaterThanProcFee()
        {
            if (!PrefC.GetBool(PrefName.InsPayNoWriteoffMoreThanProc))
            {
                return(false);               //InsPayNoWriteoffMoreThanProc preference is off. No need to check.
            }
            List <ClaimProc>  listClaimProcsForPat  = ClaimProcs.Refresh(PatCur.PatNum);
            List <Adjustment> listAdjustmentsForPat = Adjustments.GetForProcs(ClaimProcsToEdit.Select(x => x.ProcNum).Where(x => x != 0).ToList());
            bool          isWriteoffGreater         = false;
            List <string> listProcDescripts         = new List <string>();

            for (int i = 0; i < ClaimProcsToEdit.Length; i++)
            {
                ClaimProc claimProcCur = ClaimProcsToEdit[i];
                //Fetch all adjustments for the given procedure.
                List <Adjustment> listClaimProcAdjustments = listAdjustmentsForPat.Where(x => x.ProcNum == claimProcCur.ProcNum).ToList();
                int     writeoffIdx = gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Writeoff"));
                int     feeAcctIdx  = gridMain.ListGridColumns.GetIndex(Lan.g("TableClaimProc", "Fee"));
                decimal writeOff    = (decimal)ClaimProcs.ProcWriteoff(listClaimProcsForPat.FindAll(x => x.ClaimProcNum != claimProcCur.ClaimProcNum), claimProcCur.ProcNum)
                                      + PIn.Decimal(gridMain.ListGridRows[i].Cells[writeoffIdx].Text);
                decimal feeAcct = PIn.Decimal(gridMain.ListGridRows[i].Cells[feeAcctIdx].Text);
                decimal adjAcct = listClaimProcAdjustments.Sum(x => (decimal)x.AdjAmt);
                //Any changes to this calculation should also consider FormClaimProc.IsWriteOffGreaterThanProc().
                decimal writeoffRem = feeAcct - writeOff + adjAcct;
                isWriteoffGreater |= (writeoffRem.IsLessThanZero() && writeOff.IsGreaterThanZero());
                if (writeoffRem.IsLessThanZero() && writeOff.IsGreaterThanZero())
                {
                    Procedure proc = Procedures.GetProcFromList(ProcList, claimProcCur.ProcNum);                 //will return a new procedure if none found.
                    listProcDescripts.Add((proc == null ? "" : ProcedureCodes.GetProcCode(proc.CodeNum).ProcCode)
                                          + "\t" + Lan.g(this, "Fee") + ": " + feeAcct.ToString("F")
                                          + "\t" + Lan.g(this, "Adjustments") + ": " + adjAcct.ToString("F")
                                          + "\t" + Lan.g(this, "Write-off") + ": " + (Math.Abs(-writeOff)).ToString("F")
                                          + "\t" + Lan.g(this, "Remaining") + ": (" + Math.Abs(writeoffRem).ToString("F") + ")");
                }
            }
            if (isWriteoffGreater)
            {
                MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(Lan.g(this, "Write-off amount is greater than the adjusted procedure fee for the following "
                                                                   + "procedure(s)") + ":\r\n" + string.Join("\r\n", listProcDescripts) + "\r\n" + Lan.g(this, "Not allowed to continue."));
                msgBox.Text = Lan.g(this, "Excessive Write-off");
                msgBox.ShowDialog();
                return(true);
            }
            return(false);
        }
Beispiel #23
0
        private void butGenerateQuery_Click(object sender, EventArgs e)
        {
            if (!Validation())
            {
                return;
            }
            DateTime     asOfDate               = PIn.Date(textDate.Text);
            List <long>  listProvNums           = new List <long>();
            List <long>  listClinicNums         = new List <long>();
            List <long>  listBillingTypeDefNums = new List <long>();
            AgeOfAccount accountAge             = GenerateLists(listProvNums, listClinicNums, listBillingTypeDefNums);
            bool         isForInsAging          = false;
            string       queryStr               = RpAging.GetQueryString(asOfDate, checkAgeWriteoffs.Checked, checkHasDateLastPay.Checked, radioGroupByFam.Checked, checkOnlyNeg.Checked,
                                                                         accountAge, checkIncludeNeg.Checked, checkExcludeInactive.Checked, checkBadAddress.Checked, listProvNums, listClinicNums, listBillingTypeDefNums,
                                                                         checkExcludeArchive.Checked, checkIncludeInsNoBal.Checked, checkOnlyInsNoBal.Checked, checkAgeNegAdjs.Checked, isForInsAging,
                                                                         checkAgePatPayPlanPayments.Checked);
            MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(queryStr);

            msgBox.Show(this);
        }
        private void gridMain_CellDoubleClick(object sender, ODGridClickEventArgs e)
        {
            MethodInfo method = _listDbmMethodsGrid[e.Row];

            if (!DatabaseMaintenances.MethodHasBreakDown(method))
            {
                return;
            }
            //We know that this method supports giving the user a break down and shall call the method's fix section where the break down results should be.
            //TODO: Make sure that DBM methods with break downs ALWAYS have the break down in the fix section.
            if (_patNum < 1)
            {
                MsgBox.Show(this, "Select a patient first.");
                return;
            }
            DbmMethodAttr methodAttributes = (DbmMethodAttr)Attribute.GetCustomAttribute(method, typeof(DbmMethodAttr));
            //We always send verbose and modeCur into all DBM methods.
            List <object> parameters = new List <object>()
            {
                checkShow.Checked, DbmMode.Breakdown
            };

            //There are optional paramaters available to some methods and adding them in the following order is very important.
            if (methodAttributes.HasPatNum)
            {
                parameters.Add(_patNum);
            }
            Cursor = Cursors.WaitCursor;
            string result = (string)method.Invoke(null, parameters.ToArray());

            if (result == "")           //Only possible if running a check / fix in non-verbose mode and nothing happened or needs to happen.
            {
                result = Lan.g("FormDatabaseMaintenance", "Done.  No maintenance needed.");
            }
            SaveLogToFile(method.Name + ":\r\n" + result);
            //Show the result of the dbm method in a simple copy paste msg box.
            MsgBoxCopyPaste msgBoxCP = new MsgBoxCopyPaste(result);

            Cursor = Cursors.Default;
            msgBoxCP.Show();            //Let this window be non-modal so that they can keep it open while they fix their problems.
        }
Beispiel #25
0
 private void butOK_Click(object sender, EventArgs e)
 {
     if (_fromInsPlan == null || InsPlans.GetPlan(_fromInsPlan.PlanNum, new List <InsPlan>()) == null)
     {
         MsgBox.Show(this, "Please pick a valid plan to move subscribers from.");
         return;
     }
     if (_intoInsPlan == null || InsPlans.GetPlan(_intoInsPlan.PlanNum, new List <InsPlan>()) == null)
     {
         MsgBox.Show(this, "Please pick a valid plan to move subscribers to.");
         return;
     }
     if (_fromInsPlan.PlanNum == _intoInsPlan.PlanNum)
     {
         MsgBox.Show(this, "Can not move a plan into itself.");
         return;
     }
     if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Moving subscribers is irreversible.  Always make a full backup before moving subscribers.  "
                      + "Patient specific benefits, subscriber notes, benefit notes, and effective dates will not be copied to the other plan."
                      + "\r\n\r\nRunning this tool can take several minutes to run.  We recommend running it after business hours or when network usage is low."
                      + "\r\n\r\nClick OK to continue, or click Cancel to abort."))
     {
         return;
     }
     try {
         Cursor = Cursors.WaitCursor;
         long insSubModifiedCount = InsSubs.MoveSubscribers(_fromInsPlan.PlanNum, _intoInsPlan.PlanNum);
         Cursor = Cursors.Default;
         MessageBox.Show(Lan.g(this, "Count of Subscribers Moved") + ": " + insSubModifiedCount);
     }
     catch (ApplicationException ex) {                             //The tool was blocked due to validation failure.
         Cursor = Cursors.Default;
         MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(ex.Message); //No translaion here, because translation was done in the business layer.
         msgBox.ShowDialog();
         return;                                                   //Since this exception is due to validation failure, do not close the form.  Let the user manually click Cancel so they know what happened.
     }
     SecurityLogs.MakeLogEntry(Permissions.InsPlanChangeSubsc, 0, Lan.g(this, "Subscribers Moved from") + " " + _fromInsPlan.PlanNum + " " + Lan.g(this, "to") + " " + _intoInsPlan.PlanNum);
     DialogResult = DialogResult.OK;          //Closes the form.
 }
        private void butShow_Click(object sender, EventArgs e)
        {
            if (comboProv.SelectedIndex == -1)
            {
                MessageBox.Show("Please select a provider first.");
                return;
            }
            try {
                DateTime.Parse(textDateStart.Text);
                DateTime.Parse(textDateEnd.Text);
            }
            catch {
                MessageBox.Show("Invalid dates.");
                return;
            }
            if (listQ == null)
            {
                MessageBox.Show("Click Refresh first.");
                return;
            }
            MsgBoxCopyPaste MsgBoxCP = new MsgBoxCopyPaste(GeneratePQRS_xml());

            MsgBoxCP.ShowDialog();
        }
Beispiel #27
0
        private void butShowXml_Click(object sender, EventArgs e)
        {
            string ccd = "";

            try {
                FormEhrExportCCD FormEEC = new FormEhrExportCCD(PatCur);
                FormEEC.ShowDialog();
                if (FormEEC.DialogResult == DialogResult.OK)
                {
                    ccd = FormEEC.CCD;
                }
                else
                {
                    return;
                }
            }
            catch (Exception ex) {
                MessageBox.Show(ex.Message);
                return;
            }
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(ccd);

            msgbox.ShowDialog();
        }
        private void butExport_Click(object sender, EventArgs e)
        {
            string strCcdValidationErrors = EhrCCD.ValidateSettings();

            if (strCcdValidationErrors != "")            //Do not even try to export if global settings are invalid.
            {
                MessageBox.Show(strCcdValidationErrors); //We do not want to use translations here, because the text is dynamic. The errors are generated in the business layer, and Lan.g() is not available there.
                return;
            }
            FolderBrowserDialog dlg    = new FolderBrowserDialog();
            DialogResult        result = dlg.ShowDialog();

            if (result != DialogResult.OK)
            {
                return;
            }
            DateTime dateNow    = DateTime.Now;
            string   folderPath = ODFileUtils.CombinePaths(dlg.SelectedPath, (dateNow.Year + "_" + dateNow.Month + "_" + dateNow.Day));

            if (Directory.Exists(folderPath))
            {
                int loopCount = 1;
                while (Directory.Exists(folderPath + "_" + loopCount))
                {
                    loopCount++;
                }
                folderPath = folderPath + "_" + loopCount;
            }
            try {
                Directory.CreateDirectory(folderPath);
            }
            catch {
                MessageBox.Show("Error, Could not create folder");
                return;
            }
            this.Cursor = Cursors.WaitCursor;
            Patient patCur;
            string  fileName;
            int     numSkipped      = 0;   //Number of patients skipped. Set to -1 if only one patient was selected and had CcdValidationErrors.
            string  patientsSkipped = "";  //Names of the patients that were skipped, so we can tell the user which ones didn't export correctly.

            for (int i = 0; i < gridMain.SelectedIndices.Length; i++)
            {
                patCur = Patients.GetPat((long)gridMain.Rows[gridMain.SelectedIndices[i]].Tag);              //Cannot use GetLim because more information is needed in the CCD message generation below.
                strCcdValidationErrors = EhrCCD.ValidatePatient(patCur);
                if (strCcdValidationErrors != "")
                {
                    if (gridMain.SelectedIndices.Length == 1)
                    {
                        numSkipped = -1;                       //Set to -1 so we know below to not show the "exported" message.
                        MessageBox.Show(Lan.g(this, "Patient not exported due to the following errors") + ":\r\n" + strCcdValidationErrors);
                        continue;
                    }
                    //If one patient is missing the required information for export, then simply skip the patient. We do not want to popup a message,
                    //because it would be hard to get through the export if many patients were missing required information.
                    numSkipped++;
                    patientsSkipped += "\r\n" + patCur.LName + ", " + patCur.FName;
                    continue;
                }
                fileName = "";
                string lName = patCur.LName;
                for (int j = 0; j < lName.Length; j++)             //Strip all non-letters from FName
                {
                    if (Char.IsLetter(lName, j))
                    {
                        fileName += lName.Substring(j, 1);
                    }
                }
                fileName += "_";
                string fName = patCur.FName;
                for (int k = 0; k < fName.Length; k++)             //Strip all non-letters from LName
                {
                    if (Char.IsLetter(fName, k))
                    {
                        fileName += fName.Substring(k, 1);
                    }
                }
                fileName += "_" + patCur.PatNum;              //LName_FName_PatNum
                string ccd = EhrCCD.GeneratePatientExport(patCur);
                try {
                    File.WriteAllText(ODFileUtils.CombinePaths(folderPath, fileName + ".xml"), ccd);
                }
                catch {
                    MessageBox.Show("Error, Could not create xml file");
                    this.Cursor = Cursors.Default;
                    return;
                }
            }
            if (numSkipped == -1)               //Will be -1 if only one patient was selected, and it did not export correctly.
            {
                this.Cursor = Cursors.Default;
                return;                //Don't display "Exported" to the user because the CCD was not exported.
            }
            try {
                File.WriteAllText(ODFileUtils.CombinePaths(folderPath, "CCD.xsl"), FormEHR.GetEhrResource("CCD"));
            }
            catch {
                MessageBox.Show("Error, Could not create stylesheet file");
            }
            string strMsg = Lan.g(this, "Exported");

            if (numSkipped > 0)
            {
                strMsg += ". " + Lan.g(this, "Patients skipped due to missing information") + ": " + numSkipped + patientsSkipped;
                MsgBoxCopyPaste msgCP = new MsgBoxCopyPaste(strMsg);
                msgCP.Show();
            }
            else
            {
                MessageBox.Show(strMsg);
            }
            this.Cursor = Cursors.Default;
        }
Beispiel #29
0
        private void butRawMessage_Click(object sender, EventArgs e)
        {
            MsgBoxCopyPaste msgbox = new MsgBoxCopyPaste(MessageText835);

            msgbox.Show(this);            //This window is just used to display information.
        }
        ///<summary>Tries to import the 834. Will return false if the user cancelled out of importing.</summary>
        private bool TryImport834()
        {
            if (checkDropExistingIns.Checked &&
                !MsgBox.Show(MsgBoxButtons.YesNo, "Insurance plans for patients will be automatically replaced with the new plans. Continue?"))
            {
                return(false);
            }
            if (!MsgBox.Show(this, true, "Importing insurance plans is a database intensive operation and can take 10 minutes or more to run.  "
                             + "It is best to import insurance plans after hours or during another time period when database usage is otherwise low.\r\n"
                             + "Click OK to import insurance plans now, or click Cancel."))
            {
                return(false);
            }
            checkIsPatientCreate.Enabled = false;
            checkDropExistingIns.Enabled = false;
            gridInsPlans.Enabled         = false;
            butOK.Enabled     = false;
            butCancel.Enabled = false;
            Cursor            = Cursors.WaitCursor;
            Prefs.UpdateBool(PrefName.Ins834DropExistingPatPlans, checkDropExistingIns.Checked);
            Prefs.UpdateBool(PrefName.Ins834IsPatientCreate, checkIsPatientCreate.Checked);
            //Create all of our count variables.
            int createdPatsCount, updatedPatsCount, skippedPatsCount, createdCarrierCount, createdInsPlanCount, updatedInsPlanCount, createdInsSubCount,
                updatedInsSubCount, createdPatPlanCount, droppedPatPlanCount, updatedPatPlanCount;
            StringBuilder sbErrorMessages;

            EtransL.ImportInsurancePlans(_x834, _listPatients, checkIsPatientCreate.Checked, checkDropExistingIns.Checked, out createdPatsCount,
                                         out updatedPatsCount, out skippedPatsCount, out createdCarrierCount, out createdInsPlanCount, out updatedInsPlanCount, out createdInsSubCount,
                                         out updatedInsSubCount, out createdPatPlanCount, out droppedPatPlanCount, out updatedPatPlanCount, out sbErrorMessages, (rowIndex, pat) => {
                ShowStatus("Progress " + (rowIndex).ToString().PadLeft(6) + "/" + gridInsPlans.ListGridRows.Count.ToString().PadLeft(6)
                           + "  Importing plans for patient " + pat.GetNameLF());
            });
            Cursor = Cursors.Default;
            #region summary output
            string msg = Lan.g(this, "Done.");
            if (createdPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients created:") + " " + createdPatsCount;
            }
            if (updatedPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients updated:") + " " + updatedPatsCount;
            }
            if (skippedPatsCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients skipped:") + " " + skippedPatsCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdCarrierCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of carriers created:") + " " + createdCarrierCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdInsPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance plans created:") + " " + createdInsPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedInsPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance plan updates:") + " " + updatedInsPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdInsSubCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance subscriptions created:") + " " + createdInsSubCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedInsSubCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of insurance subscriptions updated:") + " " + updatedInsSubCount;
                msg += sbErrorMessages.ToString();
            }
            if (createdPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients added to insurance:") + " " + createdPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (droppedPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients dropped from insurance:") + " " + droppedPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            if (updatedPatPlanCount > 0)
            {
                msg += "\r\n" + Lan.g(this, "Number of patients insurance information updated:") + " " + updatedPatPlanCount;
                msg += sbErrorMessages.ToString();
            }
            #endregion summary output
            MsgBoxCopyPaste msgBox = new MsgBoxCopyPaste(msg);
            msgBox.ShowDialog();
            return(true);
        }