private void butPayments_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            ReportSimpleGrid report = new ReportSimpleGrid();

            report.Query = "SET @pos=0; "
                           + "SELECT @pos:=@pos+1 AS 'Count',patient.PatNum,LName,FName,DateEntry,PayDate,PayNote,PayAmt "
                           + "FROM patient INNER JOIN payment ON payment.PatNum=patient.PatNum "
                           + "INNER JOIN ("
                           + "SELECT ClinicNum,PropertyValue AS PaymentType FROM programproperty "
                           + "WHERE ProgramNum=" + POut.Long(Programs.GetProgramNum(ProgramName.Xcharge)) + " AND PropertyDesc='PaymentType'"
                           + ") paytypes ON paytypes.ClinicNum=payment.ClinicNum AND paytypes.PaymentType=payment.PayType "
                           //Must be DateEntry here. PayDate will not work with recurring charges
                           + "WHERE DateEntry BETWEEN " + POut.Date(date1.SelectionStart) + " AND " + POut.Date(date2.SelectionStart) + " "
                           + "ORDER BY Count ASC";
            FormQuery FormQuery2 = new FormQuery(report);

            FormQuery2.IsReport = true;
            FormQuery2.SubmitReportQuery();
            report.Title = "Payments From " + date1.SelectionStart.ToShortDateString() + " To " + date2.SelectionStart.ToShortDateString();
            report.SubTitle.Add(PrefC.GetString(PrefName.PracticeTitle));
            report.SetColumn(this, 0, "Count", 50);
            report.SetColumn(this, 1, "Pat", 50);         //This name is used to ensure FormQuery does not replace the patnum with the patient name.
            report.SetColumn(this, 2, "LName", 100);
            report.SetColumn(this, 3, "FName", 100);
            report.SetColumn(this, 4, "DateEntry", 100);
            report.SetColumn(this, 5, "PayDate", 100);
            report.SetColumn(this, 6, "PayNote", 150);
            report.SetColumn(this, 7, "PayAmt", 70, HorizontalAlignment.Right);
            Cursor = Cursors.Default;
            FormQuery2.ShowDialog();
        }
Exemple #2
0
 public FormEcwDiag()
 {
     InitializeComponent();
     server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer");
     port   = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort");
     buildConnectionString();
     Lan.F(this);
 }
Exemple #3
0
 public FormEcwDiag()
 {
     InitializeComponent();
     server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer");     //this property will not exist if using Oracle, eCW will never use Oracle
     port   = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort");       //this property will not exist if using Oracle, eCW will never use Oracle
     buildConnectionString();
     Lan.F(this);
 }
 private void FormEcwDiagAdv_Load(object sender, EventArgs e)
 {
     fillQueryList();
     server = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWServer");     //this property will not exist if using Oracle, eCW will never use Oracle
     port   = ProgramProperties.GetPropVal(Programs.GetProgramNum(ProgramName.eClinicalWorks), "eCWPort");       //this property will not exist if using Oracle, eCW will never use Oracle
     buildConnectionString();
     dummyConnString =
         "Server=" + server + ";"
         + "Port=" + port + ";"       //although this does seem to cause a bug in Mono.  We will revisit this bug if needed to exclude the port option only for Mono.
         + "Database=;"               //ecwMaster;"
         //+"Connect Timeout=20;"
         + "User ID=" + username + ";"
         + "Password=;"               //no password information.
         + "SslMode=none;"
         + "CharSet=utf8;"
         + "Treat Tiny As Boolean=false;"
         + "Allow User Variables=true;"
         + "Default Command Timeout=300;"               //default is 30seconds
         + "Pooling=false"
     ;
     textConnString.Text =
         "Server=" + server + ";"
         + "Port=" + port + ";"       //although this does seem to cause a bug in Mono.  We will revisit this bug if needed to exclude the port option only for Mono.
         + "Database=;"               //ecwMaster;"
         //+"Connect Timeout=20;"
         + "User ID=" + username + ";"
         + "Password=;"               //no password information
         + "SslMode=none;"
         + "CharSet=utf8;"
         + "Treat Tiny As Boolean=false;"
         + "Allow User Variables=true;"
         + "Default Command Timeout=300;"               //default is 30seconds
         + "Pooling=false"
     ;;
     //textQuery.Text="SHOW VARIABLES;";
     //Show some relevent variables
     textQuery.Text = "SHOW VARIABLES "
                      + "WHERE Variable_name IN "
                      + "('basedir',"
                      + " 'connect_timout',"
                      + " 'datadir',"
                      + " 'default_storage_engine',"
                      + " 'general_log',"
                      + " 'general_log_file',"
                      + " 'hostname',"
                      + " 'log_error',"
                      + " 'pid_file',"
                      + " 'port',"
                      + " 'storage_engine',"
                      + " 'tmpdir',"
                      + " 'version',"
                      + " 'version_compile_machine',"
                      + " 'version_compile_os'"
                      + ");";
     RunQuery();
     FillTables();
 }
Exemple #5
0
        private void FormClinics_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (IsSelectionMode)
            {
                return;
            }
            bool hasClinicChanges = false;

            if (Clinics.Sync(ListClinics, ListClinicsOld))
            {
                hasClinicChanges = true;
            }
            if (Prefs.UpdateBool(PrefName.ClinicListIsAlphabetical, checkOrderAlphabetical.Checked))
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            _listClinicDefLinksAll.Clear();
            foreach (DefLinkClinic defLinkClinic in _listDefLinkClinicSpecialties)
            {
                if (defLinkClinic.ListDefLink.Exists(x => x.DefLinkNum == 0))
                {
                    defLinkClinic.ListDefLink.ForEach(x => x.FKey = defLinkClinic.Clinic.ClinicNum);
                }
                _listClinicDefLinksAll.AddRange(defLinkClinic.ListDefLink);
            }
            if (DefLinks.Sync(_listClinicDefLinksAll, _listClinicDefLinksAllOld))
            {
                hasClinicChanges = true;
            }
            //Joe - Now that we have called sync on ListClinics we want to make sure that each clinic has program properties for PayConnect and XCharge
            //We are doing this because of a previous bug that caused some customers to have over 3.4 million duplicate rows in their programproperty table
            long payConnectProgNum = Programs.GetProgramNum(ProgramName.PayConnect);
            long xChargeProgNum    = Programs.GetProgramNum(ProgramName.Xcharge);
            //Don't need to do this for PaySimple, because these will get generated as needed in FormPaySimpleSetup
            bool hasChanges = ProgramProperties.InsertForClinic(payConnectProgNum,
                                                                ListClinics.Select(x => x.ClinicNum)
                                                                .Where(x => ProgramProperties.GetListForProgramAndClinic(payConnectProgNum, x).Count == 0).ToList());

            hasChanges = ProgramProperties.InsertForClinic(xChargeProgNum,
                                                           ListClinics.Select(x => x.ClinicNum)
                                                           .Where(x => ProgramProperties.GetListForProgramAndClinic(xChargeProgNum, x).Count == 0).ToList()) || hasChanges;//prevent short curcuit
            if (hasChanges)
            {
                DataValid.SetInvalid(InvalidType.Programs);
            }
            if (hasClinicChanges)
            {
                DataValid.SetInvalid(InvalidType.Providers);
            }
        }
Exemple #6
0
        private void FormClinics_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            if (IsSelectionMode)
            {
                return;
            }
            if (Prefs.UpdateBool(PrefName.ClinicListIsAlphabetical, checkOrderAlphabetical.Checked))
            {
                DataValid.SetInvalid(InvalidType.Prefs);
            }
            bool hasClinicChanges = Clinics.Sync(ListClinics, _listClinicsOld);         //returns true if clinics were updated/inserted/deleted

            //Update the ClinicNum on all specialties associated to each clinic.
            ListClinics.ForEach(x => x.ListClinicSpecialtyDefLinks.ForEach(y => y.FKey = x.ClinicNum));
            List <DefLink> listAllClinicSpecialtyDefLinks = ListClinics.SelectMany(x => x.ListClinicSpecialtyDefLinks).ToList();

            hasClinicChanges |= DefLinks.Sync(listAllClinicSpecialtyDefLinks, _listClinicDefLinksAllOld);
            hasClinicChanges |= CorrectItemOrders();
            //Joe - Now that we have called sync on ListClinics we want to make sure that each clinic has program properties for PayConnect and XCharge
            //We are doing this because of a previous bug that caused some customers to have over 3.4 million duplicate rows in their programproperty table
            long payConnectProgNum = Programs.GetProgramNum(ProgramName.PayConnect);
            long xChargeProgNum    = Programs.GetProgramNum(ProgramName.Xcharge);
            //Don't need to do this for PaySimple, because these will get generated as needed in FormPaySimpleSetup
            bool hasChanges = ProgramProperties.InsertForClinic(payConnectProgNum,
                                                                ListClinics.Select(x => x.ClinicNum).Where(x => ProgramProperties.GetListForProgramAndClinic(payConnectProgNum, x).Count == 0).ToList());

            hasChanges |= ProgramProperties.InsertForClinic(xChargeProgNum,
                                                            ListClinics.Select(x => x.ClinicNum).Where(x => ProgramProperties.GetListForProgramAndClinic(xChargeProgNum, x).Count == 0).ToList());
            if (hasChanges)
            {
                DataValid.SetInvalid(InvalidType.Programs);
            }
            if (hasClinicChanges)
            {
                DataValid.SetInvalid(InvalidType.Providers);
            }
        }
        private void butOK_Click(object sender, System.EventArgs e)
        {
            if (!textAmount.IsValid)
            {
                MsgBox.Show(this, "Please fix debt amount.");
                return;
            }
            double amtDebt = PIn.Double(textAmount.Text);

            if (!textDate.IsValid)
            {
                MsgBox.Show(this, "Date is not valid.");
                return;
            }
            DateTime dateDelinquency = PIn.Date(textDate.Text);

            if (dateDelinquency.Year < 1950)
            {
                MessageBox.Show("Date is not valid.");
                return;
            }
            if (dateDelinquency > DateTime.Today)
            {
                MsgBox.Show(this, "Date cannot be a future date.");
                return;
            }
            long   programNum = Programs.GetProgramNum(ProgramName.TrojanExpressCollect);
            string password   = ProgramProperties.GetPropVal(programNum, "Password");

            if (!Regex.IsMatch(password, @"^[A-Z]{2}\d{4}$"))
            {
                MsgBox.Show(this, "Password is not in correct format. Must be like this: AB1234");
                return;
            }
            string folderPath = ProgramProperties.GetPropVal(programNum, "FolderPath");

            if (string.IsNullOrEmpty(folderPath))
            {
                MsgBox.Show(this, "Export folder has not been setup yet.  Please go to Setup at the top of this window.");
                return;
            }
            long billingType = PIn.Long(ProgramProperties.GetPropVal(programNum, "BillingType"));

            if (billingType == 0)
            {
                MsgBox.Show(this, "Billing type has not been setup yet.  Please go to Setup at the top of this window.");
                return;
            }
            Cursor = Cursors.WaitCursor;
            if (!File.Exists(ODFileUtils.CombinePaths(folderPath, "TROBEN.HB")))
            {
                Cursor = Cursors.Default;
                MessageBox.Show(Lan.g(this, "The Trojan Communicator is not installed or is not configured for the folder") + ": "
                                + folderPath + ".  " + Lan.g(this, "Please contact Trojan Software Support at 800-451-9723 x1 or x2"));
                return;
            }
            try {
                File.Delete(ODFileUtils.CombinePaths(folderPath, "TROBEN.HB"));
            }
            catch (Exception ex) {
                ex.DoNothing();
                Cursor = Cursors.Default;
                MsgBox.Show(this, "There was an error attempting to delete a file from the export folder path.  Check folder permissions and/or try running as administrator.");
                return;
            }
            using (FileSystemWatcher watcher = new FileSystemWatcher(folderPath, "TROBEN.HB")) {
                if (watcher.WaitForChanged(WatcherChangeTypes.Created, 10000).TimedOut)
                {
                    Cursor = Cursors.Default;
                    MsgBox.Show(this, "The Trojan Communicator is not running. Please check it.");
                    return;
                }
            }
            StringBuilder str = new StringBuilder();

            if (radioDiplomatic.Checked)
            {
                str.Append("D*");
            }
            else if (radioFirm.Checked)
            {
                str.Append("F*");
            }
            else if (radioSkip.Checked)
            {
                str.Append("S*");
            }
            str.Append(Clip(_patCur.LName, 18) + "*");
            str.Append(Clip(_patCur.FName, 18) + "*");
            str.Append(Clip(_patCur.MiddleI, 1) + "*");
            str.Append(Clip(_guarCur.LName, 18) + "*");                                                                               //validated
            str.Append(Clip(_guarCur.FName, 18) + "*");                                                                               //validated
            str.Append(Clip(_guarCur.MiddleI, 1) + "*");
            str.Append(_guarCur.SSN.Substring(0, 3) + "-" + _guarCur.SSN.Substring(3, 2) + "-" + _guarCur.SSN.Substring(5, 4) + "*"); //validated
            if (_guarCur.Birthdate.Year >= 1880)
            {
                str.Append(_guarCur.Birthdate.ToShortDateString());
            }
            str.Append("*");
            str.Append(Clip(_guarCur.HmPhone, 13) + "*");
            str.Append(Clip(_empCur?.EmpName, 35) + "*");
            str.Append(Clip(_empCur?.Phone, 13) + "*");
            string address = _guarCur.Address;          //validated

            if (!string.IsNullOrEmpty(_guarCur.Address2))
            {
                address += ", " + _guarCur.Address2;
            }
            str.Append(Clip(address, 30) + "*");
            str.Append(Clip(_guarCur.City, 20) + "*");             //validated
            str.Append(Clip(_guarCur.State, 2) + "*");             //validated
            str.Append(Clip(_guarCur.Zip, 5) + "*");               //validated
            str.Append(amtDebt.ToString("F2") + "*");              //validated
            str.Append(dateDelinquency.ToShortDateString() + "*"); //validated
            str.Append(password + "*");                            //validated
            str.AppendLine(Clip(Security.CurUser.UserName, 25));   //There is always a logged in user
            int    thisNum    = TrojanQueries.GetUniqueFileNum();
            string outputFile = "CT" + thisNum.ToString().PadLeft(6, '0') + ".TRO";

            try {
                File.AppendAllText(ODFileUtils.CombinePaths(folderPath, outputFile), str.ToString());
            }
            catch (Exception ex) {
                ex.DoNothing();
                Cursor = Cursors.Default;
                MsgBox.Show(this, "There was an error writing to the export file.  Check folder permissions and/or try running as administrator.");
                return;
            }
            using (FileSystemWatcher watcher = new FileSystemWatcher(folderPath, outputFile)) {
                if (watcher.WaitForChanged(WatcherChangeTypes.Deleted, 10000).TimedOut)
                {
                    Cursor = Cursors.Default;
                    MsgBox.Show(this, "Warning!! Request was not sent to Trojan within the 10 second limit.");
                    return;
                }
            }
            Patients.UpdateFamilyBillingType(billingType, _patCur.Guarantor);
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
Exemple #8
0
        private void FillAvailable()
        {
            _listReqFields = RequiredFields.GetDeepCopy();
            listAvailableFields.Items.Clear();
            _listFieldNames = new List <RequiredFieldName>();
            if (comboFieldTypes.SelectedIndex >= 0)           //if a selection
            {
                switch (comboFieldTypes.SelectedIndex)
                {
                case 0:
                    _listFieldNames = RequiredFields.GetFieldNamesForType(RequiredFieldType.PatientInfo);
                    break;

                case 1:
                    _listFieldNames = RequiredFields.GetFieldNamesForType(RequiredFieldType.InsPayEdit);
                    break;
                }
            }
            RequiredFieldName[] arrayRequiredFieldNames = (RequiredFieldName[])Enum.GetValues(typeof(RequiredFieldName));
            for (int i = 0; i < arrayRequiredFieldNames.Length; i++)
            {
                switch (arrayRequiredFieldNames[i])
                {
                case RequiredFieldName.AdmitDate:
                    if (PrefC.GetBool(PrefName.EasyHideHospitals))
                    {
                        continue;                                //Don't include AdmitDate in the list if hospitals is not enabled
                    }
                    break;

                case RequiredFieldName.TrophyFolder:
                    if (!Programs.IsEnabled(Programs.GetProgramNum(ProgramName.TrophyEnhanced)))
                    {
                        continue;                                //Don't include TrophyFolder in the list if TrophyEnhanced is not enabled
                    }
                    break;

                case RequiredFieldName.Ward:
                    if (PrefC.GetBool(PrefName.EasyHideHospitals))
                    {
                        continue;                                //Don't include Ward in the list if hospitals is not enabled
                    }
                    break;

                case RequiredFieldName.Clinic:
                    if (!PrefC.HasClinicsEnabled)
                    {
                        continue;                                //Don't include Clinic in the list if clinics is not enabled
                    }
                    break;

                case RequiredFieldName.PatientStatus:
                case RequiredFieldName.Position:
                    continue;                            //There is no way to not select these.

                case RequiredFieldName.MothersMaidenFirstName:
                case RequiredFieldName.MothersMaidenLastName:
                case RequiredFieldName.DateTimeDeceased:
                    if (!PrefC.GetBool(PrefName.ShowFeatureEhr))
                    {
                        continue;                                //EHR features
                    }
                    break;

                case RequiredFieldName.StudentStatus:
                    if (CultureInfo.CurrentCulture.Name.EndsWith("CA")) //Canadian. en-CA or fr-CA
                    {
                        continue;                                       //Canada uses Eligibility Excep. Code instead of Student Status radio buttons
                    }
                    break;

                case RequiredFieldName.EligibilityExceptCode:
                    if (!CultureInfo.CurrentCulture.Name.EndsWith("CA")) // Not Canadian. en-CA or fr-CA
                    {
                        continue;                                        //Don't show EligibilityExceptCode
                    }
                    break;

                case RequiredFieldName.MedicaidID:
                case RequiredFieldName.MedicaidState:
                    if (PrefC.GetBool(PrefName.EasyHideMedicaid))
                    {
                        continue;                                //Don't show Medicaid fields
                    }
                    break;

                case RequiredFieldName.Race:
                case RequiredFieldName.County:
                case RequiredFieldName.Site:
                case RequiredFieldName.GradeLevel:
                case RequiredFieldName.TreatmentUrgency:
                case RequiredFieldName.ResponsibleParty:
                    if (PrefC.GetBool(PrefName.EasyHidePublicHealth))
                    {
                        continue;                                //Don't show Public Health fields
                    }
                    break;

                case RequiredFieldName.Ethnicity:
                    if (PrefC.GetBool(PrefName.EasyHidePublicHealth) ||
                        !PrefC.GetBool(PrefName.ShowFeatureEhr))
                    {
                        continue;                                //Don't show Ethnicity
                    }
                    break;

                default:
                    break;
                }
            }
            List <RequiredFieldName> listReqFieldNames = _listReqFields.Select(y => y.FieldName).Distinct().ToList();

            _listFieldNames = _listFieldNames.FindAll(x => !listReqFieldNames.Any(y => y == x));
            listAvailableFields.Items.AddRange(_listFieldNames.Select(x => x.ToString()).ToArray());
        }
Exemple #9
0
 private void FormTsiHistory_Load(object sender, EventArgs e)
 {
     SetFilterControlsAndAction(() => FillGrid(),
                                datePicker, checkShowPatNums);
     #region Fill Clinics
     _listClinics = new List <Clinic>();
     if (PrefC.HasClinicsEnabled)
     {
         _listClinics.AddRange(
             Clinics.GetForUserod(Security.CurUser, true).OrderBy(x => x.ClinicNum != 0).ThenBy(x => x.ItemOrder)
             );
     }
     else              //clinics disabled
     {
         _listClinics.Add(Clinics.GetPracticeAsClinicZero(Lan.g(this, "Unassigned")));
     }
     #endregion Fill Clinics
     #region Fill Client IDs
     comboBoxMultiClientIDs.Items.Add(Lan.g(this, "All"));
     comboBoxMultiClientIDs.SetSelected(0, true);
     _listClientIDs = new List <string>();
     long progNum = Programs.GetProgramNum(ProgramName.Transworld);
     if (progNum > 0)
     {
         _listClientIDs = ProgramProperties.GetWhere(x => x.ProgramNum == progNum && x.PropertyDesc.In("ClientIdAccelerator", "ClientIdCollection"))
                          .Select(x => x.PropertyValue).Distinct().ToList();
     }
     _listClientIDs.ForEach(x => comboBoxMultiClientIDs.Items.Add(x));
     #endregion Fill Client IDs
     #region Fill Trans Types
     _listTransTypes = Enum.GetValues(typeof(TsiTransType)).OfType <TsiTransType>().ToList();
     comboBoxMultiTransTypes.Items.Add(Lan.g(this, "All"));
     comboBoxMultiTransTypes.SetSelected(0, true);
     _listTransTypes.ForEach(x => comboBoxMultiTransTypes.Items.Add(x.GetDescription()));
     #endregion Fill Trans Types
     #region Fill Account Statuses
     _listAcctStatuses = new[] { "Active", "Suspended", "Inactive" }.ToList();
     comboBoxMultiAcctStatuses.Items.Add(Lan.g(this, "All"));
     comboBoxMultiAcctStatuses.SetSelected(0, true);
     _listAcctStatuses.ForEach(x => comboBoxMultiAcctStatuses.Items.Add(x));
     #endregion Fill Account Statuses
     #region Get Selected Family PatNums
     _listSelectedFamPatNums = new List <long>();
     if (FormOpenDental.CurPatNum > 0)
     {
         Family fam = Patients.GetFamily(FormOpenDental.CurPatNum);
         textPatient.Text        = fam.GetNameInFamLF(FormOpenDental.CurPatNum);
         _listSelectedFamPatNums = fam.ListPats.Select(x => x.PatNum).ToList();
     }
     #endregion Get Selected Family PatNums
     #region Get All TsiTransLogs
     _listTsiTransLogsAll = TsiTransLogs.GetAll();
     #endregion Get All TsiTransLogs
     #region Add ClientIDs No Longer In Use
     List <string> listLogClientIDs = _listTsiTransLogsAll.Select(x => x.ClientId).Distinct().Where(x => !_listClientIDs.Contains(x)).ToList();
     foreach (string clientIDCur in listLogClientIDs)
     {
         _listClientIDs.Add(clientIDCur);
         comboBoxMultiClientIDs.Items.Add(clientIDCur + " (no longer used)");
     }
     #endregion Add ClientIDs No Longer In Use
     _dictPatLims = Patients.GetLimForPats(_listTsiTransLogsAll.Select(x => x.PatNum).Distinct().ToList() /*,true*/).ToDictionary(x => x.PatNum);
     datePicker.SetDateTimeFrom(DateTime.Today.AddDays(-1)); //Set start to yesterday
     datePicker.SetDateTimeTo(DateTime.Today);               //Set stop date to today to limit the number of messages that load immediately
     _selectedLog = null;
     FillGrid();
 }