Exemplo n.º 1
0
 public FormCreditCardEdit(Patient pat)
 {
     InitializeComponent();
     Lan.F(this);
     PatCur    = pat;
     IsXCharge = Programs.IsEnabled(ProgramName.Xcharge);
 }
Exemplo n.º 2
0
		private void FormReportsMore_Load(object sender,EventArgs e) {
			Plugins.HookAddCode(this,"FormReportsMore.FormReportsMore_Load_beginning");
			butPW.Visible=Programs.IsEnabled(ProgramName.PracticeWebReports);
			//hiding feature for 13.3
			//butPatList.Visible=PrefC.GetBool(PrefName.ShowFeatureEhr);
			butPatExport.Visible=PrefC.GetBool(PrefName.ShowFeatureEhr);
			FillLists();
			if(ProgramProperties.IsAdvertisingDisabled(ProgramName.Podium)) {
				groupPatientReviews.Visible=false;
			}
			if(ProgramProperties.IsAdvertisingDisabled(ProgramName.DentalIntel)
				&& ProgramProperties.IsAdvertisingDisabled(ProgramName.PracticeByNumbers)) 
			{
				groupBusiness.Visible=false;
			}
			else if(ProgramProperties.IsAdvertisingDisabled(ProgramName.DentalIntel)
				|| (!Programs.GetCur(ProgramName.DentalIntel).Enabled && Programs.GetCur(ProgramName.PracticeByNumbers).Enabled))
			{
				//Don't show the marketing button if:
				//1.  HQ wants to hide the button
				//2.  The office wants to hide the button
				//3.  The office is using PBN but not DentalIntel
				pictureDentalIntel.Visible=false;
			}
			else if(ProgramProperties.IsAdvertisingDisabled(ProgramName.PracticeByNumbers) 
				|| (!Programs.GetCur(ProgramName.PracticeByNumbers).Enabled && Programs.GetCur(ProgramName.DentalIntel).Enabled))
			{
				//Don't show the marketing button if:
				//1.  HQ wants to hide the button
				//2.  The office wants to hide the button
				//3.  The office is using DentalIntel but not PBN
				picturePracticeByNumbers.Visible=false;
			}
		}
Exemplo n.º 3
0
		private void FormConfirmList_Load(object sender, System.EventArgs e) {
			comboShowRecall.SelectedIndex=0;//Default to show all.
			textDateFrom.Text=AddWorkDays(1,DateTime.Today).ToShortDateString();
			textDateTo.Text=AddWorkDays(2,DateTime.Today).ToShortDateString();
			comboProv.Items.Add(Lan.g(this,"All"));
			comboProv.SelectedIndex=0;
			for(int i=0;i<ProviderC.ListShort.Count;i++) {
				comboProv.Items.Add(ProviderC.ListShort[i].GetLongDesc());
			}
			//textPostcardMessage.Text=PrefC.GetString(PrefName.ConfirmPostcardMessage");
			comboStatus.Items.Clear();
			for(int i=0;i<DefC.Short[(int)DefCat.ApptConfirmed].Length;i++){
				comboStatus.Items.Add(DefC.Short[(int)DefCat.ApptConfirmed][i].ItemName);
			}
			if(PrefC.GetBool(PrefName.EasyNoClinics)) {
				comboClinic.Visible=false;
				labelClinic.Visible=false;
			}
			else {
				comboClinic.Items.Add(Lan.g(this,"All"));
				comboClinic.SelectedIndex=0;
				for(int i=0;i<Clinics.List.Length;i++) {
					comboClinic.Items.Add(Clinics.List[i].Description);
				}
			}
			if(!Programs.IsEnabled(ProgramName.CallFire)) {
				butText.Enabled=false;
			}
			FillMain();
			Plugins.HookAddCode(this,"FormConfirmList.Load_End",butText);
		}
Exemplo n.º 4
0
 public FormCreditCardEdit(Patient pat)
 {
     InitializeComponent();
     Lan.F(this);
     PatCur               = pat;
     _isXChargeEnabled    = Programs.IsEnabled(ProgramName.Xcharge);
     _isPayConnectEnabled = Programs.IsEnabled(ProgramName.PayConnect);
     _isPaySimpleEnabled  = Programs.IsEnabled(ProgramName.PaySimple);
 }
Exemplo n.º 5
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            gridMain.Columns.Add(new ODGridColumn("Card Number", 140));
            if (Programs.IsEnabled(ProgramName.Xcharge))
            {
                gridMain.Columns.Add(new ODGridColumn("X-Charge", 70, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PayConnect))
            {
                gridMain.Columns.Add(new ODGridColumn("PayConnect", 85, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PaySimple))
            {
                gridMain.Columns.Add(new ODGridColumn("PaySimple", 80, HorizontalAlignment.Center));
            }
            if (PrefC.HasOnlinePaymentEnabled())
            {
                gridMain.Columns.Add(new ODGridColumn("XWeb", 45, HorizontalAlignment.Center));
            }
            gridMain.Rows.Clear();
            ODGridRow row;

            _listCreditCards = CreditCards.Refresh(PatCur.PatNum);
            foreach (CreditCard cc in _listCreditCards)
            {
                row = new ODGridRow();
                string ccNum = cc.CCNumberMasked;
                if (Regex.IsMatch(ccNum, "^\\d{12}(\\d{0,7})"))                 //Credit cards can have a minimum of 12 digits, maximum of 19
                {
                    int idxLast4Digits = (ccNum.Length - 4);
                    ccNum = (new string('X', 12)) + ccNum.Substring(idxLast4Digits);               //replace the first 12 with 12 X's
                }
                row.Cells.Add(ccNum);
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && !cc.IsXWeb()?"X":"");
                }
                if (Programs.IsEnabled(ProgramName.PayConnect))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PayConnectToken) ? "X" : "");
                }
                if (Programs.IsEnabled(ProgramName.PaySimple))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PaySimpleToken) ? "X" : "");
                }
                if (PrefC.HasOnlinePaymentEnabled())
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && cc.IsXWeb()?"X":"");
                }
                row.Tag = cc;
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 6
0
        /// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though. Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually  disabled if it is not OK, but this is needed for Confirmations, Recalls, etc.) </summary>
        public void SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk)
        {
            if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk))
            {
                return;
            }
            if (wirelessPhone == "")
            {
                MsgBox.Show(this, "Please enter a phone number.");
                return;
            }
            if (!Programs.IsEnabled(ProgramName.CallFire))
            {
                MsgBox.Show(this, "CallFire Program Link must be enabled.");
                return;
            }
            if (txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo))
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            if (txtMsgOk == YN.No)
            {
                MsgBox.Show(this, "It is not OK to text this patient.");
                return;
            }
            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;
            }
            Commlog commlog = new Commlog();

            commlog.CommDateTime   = DateTime.Now;
            commlog.DateTStamp     = DateTime.Now;
            commlog.CommType       = DefC.Short[(int)DefCat.CommLogTypes][0].DefNum; //The first one in the list.  We can enhance later.
            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");
        }
Exemplo n.º 7
0
 private void FormFeeSchedTools_Load(object sender, System.EventArgs e)
 {
     for (int i = 0; i < FeeSchedC.ListShort.Count; i++)
     {
         comboCopyFrom.Items.Add(FeeSchedC.ListShort[i].Description);
     }
     if (!Programs.IsEnabled(ProgramName.eClinicalWorks))
     {
         butImportEcw.Visible = false;
     }
 }
Exemplo n.º 8
0
 private void FormCreditCardManage_Load(object sender, EventArgs e)
 {
     if (PrefC.GetBool(PrefName.StoreCCnumbers) &&
         (Programs.IsEnabled(ProgramName.Xcharge) ||
          Programs.IsEnabled(ProgramName.PayConnect) ||
          Programs.IsEnabled(ProgramName.PaySimple)))                          //tokens supported by Xcharge and PayConnect
     {
         labelStoreCCNumWarning.Visible = true;
     }
     FillGrid();
 }
Exemplo n.º 9
0
 private void FormCreditCardManage_Load(object sender, EventArgs e)
 {
     if (PrefC.GetBool(PrefName.StoreCCnumbers) && Programs.IsEnabled(ProgramName.Xcharge))
     {
         labelXChargeWarning.Visible = true;
     }
     RefreshCardList();
     if (creditCards.Count > 0)
     {
         listCreditCards.SelectedIndex = 0;
     }
 }
Exemplo n.º 10
0
        ///<summary>Returns a list of toolbutitems for the specified toolbar. Used when laying out toolbars.</summary>
        public static ArrayList GetForToolBar(ToolBarsAvail toolbar)
        {
            ArrayList retVal = new ArrayList();

            for (int i = 0; i < List.Length; i++)
            {
                if (List[i].ToolBar == toolbar && Programs.IsEnabled(List[i].ProgramNum))
                {
                    retVal.Add(List[i]);
                }
            }
            return(retVal);
        }
Exemplo n.º 11
0
 private void menuItemSetup_Click(object sender, EventArgs e)
 {
     using (FormTrojanCollectSetup FormT = new FormTrojanCollectSetup()) {
         if (FormT.ShowDialog() == DialogResult.Cancel)
         {
             return;
         }
     }
     if (!Programs.IsEnabled(ProgramName.TrojanExpressCollect))
     {
         DialogResult = DialogResult.Cancel;
         return;
     }
 }
Exemplo n.º 12
0
 private void FormFeeSchedTools_Load(object sender, System.EventArgs e)
 {
     for (int i = 0; i < FeeSchedC.ListShort.Count; i++)
     {
         comboCopyFrom.Items.Add(FeeSchedC.ListShort[i].Description);
     }
     if (!Programs.IsEnabled(ProgramName.eClinicalWorks))
     {
         butImportEcw.Visible = false;
     }
     if (!CultureInfo.CurrentCulture.Name.EndsWith("CA"))             //Canadian. en-CA or fr-CA
     {
         butImportCanada.Visible = false;
     }
 }
Exemplo n.º 13
0
 private void FormReportsMore_Load(object sender, EventArgs e)
 {
     butPW.Visible = Programs.IsEnabled("PracticeWebReports");
     listProdInc.Items.AddRange(new string[] {
         Lan.g(this, "Today"),
         Lan.g(this, "Yesterday"),
         Lan.g(this, "This Month"),
         Lan.g(this, "Last Month"),
         Lan.g(this, "This Year"),
         Lan.g(this, "More Options")
     });
     listDaily.Items.AddRange(new string[] {
         Lan.g(this, "Adjustments"),
         Lan.g(this, "Payments"),
         Lan.g(this, "Procedures"),
         Lan.g(this, "Writeoffs"),
         Lan.g(this, "Incomplete Procedure Notes"),
         Lan.g(this, "Routing Slips")
     });
     listMonthly.Items.AddRange(new string[] {
         Lan.g(this, "Aging Report"),
         Lan.g(this, "Claims Not Sent"),
         Lan.g(this, "Capitation Utilization"),
         Lan.g(this, "Finance Charge Report"),
         Lan.g(this, "Outstanding Insurance Claims"),
         Lan.g(this, "Procedures Not Billed to Insurance"),
         Lan.g(this, "PPO Writeoffs")
     });
     listLists.Items.AddRange(new string[] {
         Lan.g(this, "Appointments"),
         Lan.g(this, "Birthdays"),
         Lan.g(this, "Insurance Plans"),
         Lan.g(this, "Patients"),
         Lan.g(this, "Prescriptions"),
         Lan.g(this, "Procedure Codes"),
         Lan.g(this, "Referrals"),
         Lan.g(this, "Routing Slips")
     });
     listPublicHealth.Items.AddRange(new string[] {
         Lan.g(this, "Raw Screening Data"),
         Lan.g(this, "Raw Population Data")
     });
 }
Exemplo n.º 14
0
        ///<summary>This runs when first opening the program.  If MySql is not at 5.5 or higher, it reminds the user, but does not force them to upgrade.</summary>
        public static void MySqlVersion55Remind()
        {
            if (DataConnection.DBtype != DatabaseType.MySql)
            {
                return;
            }
            string thisVersion  = MiscData.GetMySqlVersion();
            float  floatVersion = PIn.Float(thisVersion.Substring(0, 3));

            //doing it this way will be needed later to handle two digit version numbers.
            //We may then combine them into a single float, remembering to left pad single digit minor versions.
            //int majVer=int.Parse(thisVersion.Split(',','.')[0]);
            //int minVer=int.Parse(thisVersion.Split(',','.')[1]);
            //if((majVer<5 || (majVer=5 && minVer<5))	&& !Programs.IsEnabled(ProgramName.eClinicalWorks)){//Do not show msg if MySQL version is 5.5 or greater or eCW is enabled
            if (floatVersion < 5.5f && !Programs.IsEnabled(ProgramName.eClinicalWorks))             //Do not show msg if MySQL version is 5.5 or greater or eCW is enabled
            {
                MsgBox.Show("Prefs", "You should upgrade to MySQL 5.5 using the installer posted on our website.  It's not urgent, but until you upgrade, you are likely to get a few errors each day which will require restarting the MySQL service.");
            }
        }
Exemplo n.º 15
0
 ///<summary>Fill the rest of the UI with the current bridge settings.</summary>
 private void FillSettings()
 {
     //Set Enabled
     checkEnabled.Checked = Programs.IsEnabled(ProgramName.AvaTax);
     //Set radio buttons
     if (AvaTax.IsProduction)
     {
         radioProdEnv.Checked = true;
     }
     else
     {
         radioTestEnv.Checked = true;
     }
     //Set username and password
     textUsername.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Username);
     textPassword.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, ProgramProperties.PropertyDescs.Password);
     //Fill Log Level options
     listBoxLogLevel.Items.Clear();
     foreach (LogLevel lv in Enum.GetValues(typeof(LogLevel)))
     {
         ODBoxItem <LogLevel> currentItem = new ODBoxItem <LogLevel>(lv.ToString(), lv);
         listBoxLogLevel.Items.Add(currentItem);
         if (currentItem.Tag == AvaTax.LogDetailLevel)
         {
             listBoxLogLevel.SelectedItem = currentItem;
         }
     }
     //Set company code and sales tax def
     textCompanyCode.Text             = AvaTax.CompanyCode;
     _defCurrentSalesTaxAdjType       = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxAdjType);
     textAdjType.Text                 = _defCurrentSalesTaxAdjType.ItemName;
     _defCurrentSalesTaxReturnAdjType = Defs.GetDef(DefCat.AdjTypes, AvaTax.SalesTaxReturnAdjType) ?? new Def();
     textReturnAdjType.Text           = _defCurrentSalesTaxReturnAdjType.ItemName;
     _patFieldDefCurrentTaxExempt     = AvaTax.TaxExemptPatField;
     textTaxExempt.Text               = (_patFieldDefCurrentTaxExempt != null) ? _patFieldDefCurrentTaxExempt.FieldName : "";
     validTaxLockDate.Text            = AvaTax.TaxLockDate.ToShortDateString();
     //Set list of procCodes
     textPrePayCodes.Text   = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Prepay Proc Codes");
     textDiscountCodes.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Discount Proc Codes");
     //Set the list of overrides
     textOverrides.Text = ProgramProperties.GetPropVal(ProgramName.AvaTax, "Tax Code Overrides");
 }
Exemplo n.º 16
0
 private void checkEnabled_Click(object sender, EventArgs e)
 {
     if (checkEnabled.Checked)
     {
         bool isHL7Enabled = HL7Defs.IsExistingHL7Enabled(HL7DefCur.HL7DefNum);
         if (isHL7Enabled)
         {
             checkEnabled.Checked = false;
             MsgBox.Show(this, "Only one HL7 process can be enabled.  Another HL7 definition is enabled.");
             return;
         }
         if (Programs.IsEnabled(ProgramName.eClinicalWorks))
         {
             MsgBox.Show(this, "The eClinicalWorks program link is enabled.  This definition will now control the HL7 messages.");
         }
     }
     else
     {
         //
     }
 }
Exemplo n.º 17
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            if (!PrefC.GetBool(PrefName.StoreCCnumbers))
            {
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    Program prog = Programs.GetCur(ProgramName.Xcharge);
                    if (!File.Exists(prog.Path))
                    {
                        MsgBox.Show(this, "Path is not valid.");
                        if (Security.IsAuthorized(Permissions.Setup))
                        {
                            FormXchargeSetup FormX = new FormXchargeSetup();
                            FormX.ShowDialog();
                            if (FormX.DialogResult != DialogResult.OK)
                            {
                                return;
                            }
                        }
                    }
                    string           user       = ProgramProperties.GetPropVal(prog.ProgramNum, "Username");
                    string           password   = ProgramProperties.GetPropVal(prog.ProgramNum, "Password");
                    ProcessStartInfo info       = new ProcessStartInfo(prog.Path);
                    string           resultfile = Path.Combine(Path.GetDirectoryName(prog.Path), "XResult.txt");
                    File.Delete(resultfile);                    //delete the old result file.
                    info.Arguments  = "";
                    info.Arguments += "/TRANSACTIONTYPE:ArchiveVaultAdd /LOCKTRANTYPE ";
                    info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                    info.Arguments += "/USERID:" + user + " ";
                    info.Arguments += "/PASSWORD:"******" ";
                    info.Arguments += "/VALIDATEARCHIVEVAULTACCOUNT ";
                    info.Arguments += "/STAYONTOP ";
                    info.Arguments += "/SMARTAUTOPROCESS ";
                    info.Arguments += "/AUTOCLOSE ";
                    info.Arguments += "/HIDEMAINWINDOW ";
                    info.Arguments += "/SMALLWINDOW ";
                    info.Arguments += "/NORESULTDIALOG ";
                    info.Arguments += "/TOOLBAREXITBUTTON ";
                    Cursor          = Cursors.WaitCursor;
                    Process process = new Process();
                    process.StartInfo           = info;
                    process.EnableRaisingEvents = true;
                    process.Start();
                    while (!process.HasExited)
                    {
                        Application.DoEvents();
                    }
                    Thread.Sleep(200);                    //Wait 2/10 second to give time for file to be created.
                    Cursor = Cursors.Default;
                    string resulttext    = "";
                    string line          = "";
                    string xChargeToken  = "";
                    string accountMasked = "";
                    string exp           = "";;
                    bool   insertCard    = false;
                    using (TextReader reader = new StreamReader(resultfile)) {
                        line = reader.ReadLine();
                        while (line != null)
                        {
                            if (resulttext != "")
                            {
                                resulttext += "\r\n";
                            }
                            resulttext += line;
                            if (line.StartsWith("RESULT="))
                            {
                                if (line != "RESULT=SUCCESS")
                                {
                                    break;
                                }
                                insertCard = true;
                            }
                            if (line.StartsWith("XCACCOUNTID="))
                            {
                                xChargeToken = PIn.String(line.Substring(12));
                            }
                            if (line.StartsWith("ACCOUNT="))
                            {
                                accountMasked = PIn.String(line.Substring(8));
                            }
                            if (line.StartsWith("EXPIRATION="))
                            {
                                exp = PIn.String(line.Substring(11));
                            }
                            line = reader.ReadLine();
                        }
                        if (insertCard && xChargeToken != "")                       //Might not be necessary but we've had successful charges with no tokens returned before.
                        {
                            CreditCard        creditCardCur  = new CreditCard();
                            List <CreditCard> itemOrderCount = CreditCards.Refresh(PatCur.PatNum);
                            creditCardCur.PatNum         = PatCur.PatNum;
                            creditCardCur.ItemOrder      = itemOrderCount.Count;
                            creditCardCur.CCNumberMasked = accountMasked;
                            creditCardCur.XChargeToken   = xChargeToken;
                            creditCardCur.CCExpiration   = new DateTime(Convert.ToInt32("20" + PIn.String(exp.Substring(2, 2))), Convert.ToInt32(PIn.String(exp.Substring(0, 2))), 1);
                            CreditCards.Insert(creditCardCur);
                        }
                    }
                    RefreshCardList();
                    return;
                }
                else
                {
                    MsgBox.Show(this, "Not allowed to store credit cards.");
                    return;
                }
            }
            bool remember  = false;
            int  placement = listCreditCards.SelectedIndex;

            if (placement != -1)
            {
                remember = true;
            }
            FormCreditCardEdit FormCCE = new FormCreditCardEdit(PatCur);

            FormCCE.CreditCardCur       = new CreditCard();
            FormCCE.CreditCardCur.IsNew = true;
            FormCCE.ShowDialog();
            RefreshCardList();
            if (remember)             //in case they canceled and had one selected
            {
                listCreditCards.SelectedIndex = placement;
            }
            if (FormCCE.DialogResult == DialogResult.OK && creditCards.Count > 0)
            {
                listCreditCards.SelectedIndex = 0;
            }
        }
Exemplo n.º 18
0
 /// <summary>May be called from other parts of the program without showing this form. You must still create an instance of this form though.
 /// Checks CallFire bridge, if it is OK to send a text, etc. (Buttons to load this form are usually disabled if it is not OK,
 /// but this is needed for Confirmations, Recalls, etc.). CanIncreaseLimit will prompt the user to increase the spending limit if sending the
 /// text would exceed that limit. Should only be true when this method is called from this form. </summary>
 public bool SendText(long patNum, string wirelessPhone, string message, YN txtMsgOk, long clinicNum, SmsMessageSource smsMessageSource, bool canIncreaseLimit = false)
 {
     if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start", patNum, wirelessPhone, message, txtMsgOk))
     {
         return(false);
     }
     if (Plugins.HookMethod(this, "FormTxtMsgEdit.SendText_Start2", patNum, wirelessPhone, message, txtMsgOk))
     {
         return(true);
     }
     if (wirelessPhone == "")
     {
         MsgBox.Show(this, "Please enter a phone number.");
         return(false);
     }
     if (SmsPhones.IsIntegratedTextingEnabled())
     {
         if (!PrefC.HasClinicsEnabled && PrefC.GetDateT(PrefName.SmsContractDate).Year < 1880)                //Checking for practice (clinics turned off).
         {
             MsgBox.Show(this, "Integrated Texting has not been enabled.");
             return(false);
         }
         else if (PrefC.HasClinicsEnabled && !Clinics.IsTextingEnabled(clinicNum))                  //Checking for specific clinic.
         //This is likely to happen a few times per office until they setup texting properly.
         {
             if (clinicNum != 0)
             {
                 MessageBox.Show(Lans.g(this, "Integrated Texting has not been enabled for the following clinic") + ":\r\n" + Clinics.GetClinic(clinicNum).Description + ".");
             }
             else
             {
                 //Should never happen. This message is precautionary.
                 MsgBox.Show(this, "The default texting clinic has not been set.");
             }
             return(false);
         }
     }
     else if (!Programs.IsEnabled(ProgramName.CallFire))
     {
         MsgBox.Show(this, "CallFire Program Link must be enabled.");
         return(false);
     }
     if (patNum != 0 && txtMsgOk == YN.Unknown && PrefC.GetBool(PrefName.TextMsgOkStatusTreatAsNo))
     {
         MsgBox.Show(this, "It is not OK to text this patient.");
         return(false);
     }
     if (patNum != 0 && txtMsgOk == YN.No)
     {
         MsgBox.Show(this, "It is not OK to text this patient.");
         return(false);
     }
     if (SmsPhones.IsIntegratedTextingEnabled())
     {
         try {
             SmsToMobiles.SendSmsSingle(patNum, wirelessPhone, message, clinicNum, smsMessageSource, user: Security.CurUser);                //Can pass in 0 as PatNum if no patient selected.
             return(true);
         }
         catch (Exception ex) {
             //ProcessSendSmsException handles the spending limit has been reached error, or returns false if the exception is different.
             if (!canIncreaseLimit || !FormEServicesSetup.ProcessSendSmsException(ex))
             {
                 MsgBox.Show(this, ex.Message);
             }
             return(false);
         }
     }
     else
     {
         if (message.Length > 160)           //only a limitation for CallFire
         {
             MsgBox.Show(this, "Text length must be less than 160 characters.");
             return(false);
         }
         return(SendCallFire(patNum, wirelessPhone, message));               //Can pass in 0 as PatNum if no patient selected.
     }
 }
Exemplo n.º 19
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());
        }
Exemplo n.º 20
0
        private void FormRecurringCharges_Load(object sender, EventArgs e)
        {
            if (Programs.HasMultipleCreditCardProgramsEnabled())
            {
                gridMain.HScrollVisible = true;
            }
            if (!PrefC.IsODHQ)
            {
                checkHideBold.Checked = true;
                checkHideBold.Visible = false;
            }
            Program progCur = null;

            if (Programs.IsEnabled(ProgramName.PaySimple))
            {
                progCur = Programs.GetCur(ProgramName.PaySimple);
                labelUpdated.Visible         = false;
                checkForceDuplicates.Checked = false;
                checkForceDuplicates.Visible = false;              //PaySimple always rejects identical transactions made within 5 minutes of eachother.
            }
            if (Programs.IsEnabled(ProgramName.PayConnect))
            {
                progCur = Programs.GetCur(ProgramName.PayConnect);
                labelUpdated.Visible         = false;
                checkForceDuplicates.Visible = true;
                checkForceDuplicates.Checked = PIn.Bool(ProgramProperties.GetPropValForClinicOrDefault(progCur.ProgramNum,
                                                                                                       PayConnect.ProgramProperties.PayConnectForceRecurringCharge, Clinics.ClinicNum));
            }
            if (Programs.IsEnabled(ProgramName.Xcharge))
            {
                progCur = Programs.GetCur(ProgramName.Xcharge);
                labelUpdated.Visible         = true;
                checkForceDuplicates.Visible = true;
                string xPath = Programs.GetProgramPath(progCur);
                checkForceDuplicates.Checked = PIn.Bool(ProgramProperties.GetPropValForClinicOrDefault(progCur.ProgramNum,
                                                                                                       ProgramProperties.PropertyDescs.XCharge.XChargeForceRecurringCharge, Clinics.ClinicNum));
                if (!File.Exists(xPath))                 //program path is invalid
                //if user has setup permission and they want to edit the program path, show the X-Charge setup window
                {
                    if (Security.IsAuthorized(Permissions.Setup) &&
                        MsgBox.Show(this, MsgBoxButtons.YesNo, "The X-Charge path is not valid.  Would you like to edit the path?"))
                    {
                        FormXchargeSetup FormX = new FormXchargeSetup();
                        FormX.ShowDialog();
                        if (FormX.DialogResult == DialogResult.OK)
                        {
                            //The user could have correctly enabled the X-Charge bridge, we need to update our local _programCur and _xPath variable2
                            progCur = Programs.GetCur(ProgramName.Xcharge);
                            xPath   = Programs.GetProgramPath(progCur);
                        }
                    }
                    //if the program path still does not exist, whether or not they attempted to edit the program link, tell them to edit and close the form
                    if (!File.Exists(xPath))
                    {
                        MsgBox.Show(this, "The X-Charge program path is not valid.  Edit the program link in order to use the CC Recurring Charges feature.");
                        Close();
                        return;
                    }
                }
            }
            if (progCur == null)
            {
                MsgBox.Show(this, "The PayConnect, PaySimple, or X-Charge program link must be enabled in order to use the CC Recurring Charges feature.");
                Close();
                return;
            }
            _isSelecting     = true;
            _listUserClinics = new List <Clinic>();
            if (PrefC.HasClinicsEnabled)
            {
                if (!Security.CurUser.ClinicIsRestricted)
                {
                    _listUserClinics.Add(new Clinic()
                    {
                        Description = Lan.g(this, "Unassigned")
                    });
                }
                Clinics.GetForUserod(Security.CurUser).ForEach(x => _listUserClinics.Add(x));
                for (int i = 0; i < _listUserClinics.Count; i++)
                {
                    listClinics.Items.Add(_listUserClinics[i].Description);
                    listClinics.SetSelected(i, true);
                }
                //checkAllClin.Checked=true;//checked true by default in designer so we don't trigger the event to select all and fill grid
            }
            else
            {
                groupClinics.Visible = false;
            }
            _charger = new RecurringChargerator(new ShowErrors(this), true);
            _charger.SingleCardFinished = new Action(() => {
                this.Invoke(() => {
                    labelCharged.Text = Lans.g(this, "Charged=") + _charger.Success;
                    labelFailed.Text  = Lans.g(this, "Failed=") + _charger.Failed;
                    labelUpdated.Text = Lans.g(this, "Updated=") + _charger.Updated;
                });
            });
            GeneralProgramEvent.Fired += StopRecurringCharges;          //This is so we'll be alerted in case of a shutdown.
            labelCharged.Text          = Lan.g(this, "Charged=") + "0";
            labelFailed.Text           = Lan.g(this, "Failed=") + "0";
            FillGrid(true);
            gridMain.SetSelected(true);
            labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
        }
Exemplo n.º 21
0
        ///<summary>The DataTable used to fill the grid will only be refreshed from the db if isFromDb is true.  Otherwise the grid will be refilled using
        ///the existing table.  Only get from the db on load or if the Refresh button is pressed, not when the user is selecting the clinic(s).</summary>
        private void FillGrid(bool isFromDb = false)
        {
            Cursor = Cursors.WaitCursor;
            if (isFromDb)
            {
                _charger.FillCharges(_listUserClinics);
            }
            List <long> listSelectedClinicNums = listClinics.SelectedIndices.OfType <int>().Select(x => _listUserClinics[x].ClinicNum).ToList();
            List <RecurringChargeData> listChargesCur;

            if (PrefC.HasClinicsEnabled)
            {
                listChargesCur = _charger.ListRecurringChargeData.Where(x => listSelectedClinicNums.Contains(x.RecurringCharge.ClinicNum)).ToList();
            }
            else
            {
                listChargesCur = _charger.ListRecurringChargeData;
            }
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "PatNum"), 55));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Name"), PrefC.HasClinicsEnabled?190:220));
            if (PrefC.HasClinicsEnabled)
            {
                gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Clinic"), 65));
            }
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Date"), PrefC.HasClinicsEnabled?80:80, HorizontalAlignment.Right));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Family Bal"), PrefC.HasClinicsEnabled?70:85, HorizontalAlignment.Right));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "PayPlan Due"), PrefC.HasClinicsEnabled?75:85, HorizontalAlignment.Right));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Total Due"), PrefC.HasClinicsEnabled?65:80, HorizontalAlignment.Right));
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Repeat Amt"), PrefC.HasClinicsEnabled?75:90, HorizontalAlignment.Right));         //RptChrgAmt
            gridMain.ListGridColumns.Add(new GridColumn(Lan.g("TableRecurring", "Charge Amt"), PrefC.HasClinicsEnabled?85:100, HorizontalAlignment.Right));
            if (Programs.HasMultipleCreditCardProgramsEnabled())
            {
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    gridMain.ListGridColumns.Add(new GridColumn("X-Charge", PrefC.HasClinicsEnabled ? 70 : 80, HorizontalAlignment.Center));
                }
                if (Programs.IsEnabled(ProgramName.PayConnect))
                {
                    gridMain.ListGridColumns.Add(new GridColumn("PayConnect", PrefC.HasClinicsEnabled ? 85 : 95, HorizontalAlignment.Center));
                }
                if (Programs.IsEnabled(ProgramName.PaySimple))
                {
                    gridMain.ListGridColumns.Add(new GridColumn("PaySimple", PrefC.HasClinicsEnabled ? 80 : 90, HorizontalAlignment.Center));
                }
            }
            gridMain.ListGridRows.Clear();
            GridRow row;

            foreach (RecurringChargeData chargeCur in listChargesCur)
            {
                row = new GridRow();
                double famBalTotal  = chargeCur.RecurringCharge.FamBal;             //pat bal+payplan due, but if pat bal<0 and payplan due>0 then just payplan due
                double payPlanDue   = chargeCur.RecurringCharge.PayPlanDue;
                double chargeAmt    = chargeCur.RecurringCharge.ChargeAmt;
                double rptChargeAmt = chargeCur.RecurringCharge.RepeatAmt;              //includes repeat charge (from procs if ODHQ) and attached payplan
                row.Cells.Add(chargeCur.RecurringCharge.PatNum.ToString());
                row.Cells.Add(chargeCur.PatName);
                if (PrefC.HasClinicsEnabled)
                {
                    Clinic clinicCur = _listUserClinics.FirstOrDefault(x => x.ClinicNum == chargeCur.RecurringCharge.ClinicNum);
                    row.Cells.Add(clinicCur != null?clinicCur.Description:"");                  //get description from cache if clinics are enabled
                }
                int billingDay = 0;
                if (PrefC.GetBool(PrefName.BillingUseBillingCycleDay))
                {
                    billingDay = chargeCur.BillingCycleDay;
                }
                else
                {
                    billingDay = chargeCur.RecurringChargeDate.Day;
                }
                DateTime startBillingCycle = DateTimeOD.GetMostRecentValidDate(DateTime.Today.Year, DateTime.Today.Month, billingDay);
                if (startBillingCycle > DateTime.Today)
                {
                    startBillingCycle = startBillingCycle.AddMonths(-1);             //Won't give a date with incorrect day.  AddMonths will give the end of the month if needed.
                }
                DateTime dateExcludeIfBefore = PIn.Date(textDate.Text);              //If entry is invalid, all charges will be included because this will be MinDate.
                if (startBillingCycle < dateExcludeIfBefore)
                {
                    continue;                    //Don't show row in grid
                }
                row.Cells.Add(startBillingCycle.ToShortDateString());
                row.Cells.Add(famBalTotal.ToString("c"));
                if (!payPlanDue.IsZero())
                {
                    row.Cells.Add(payPlanDue.ToString("c"));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(chargeCur.RecurringCharge.TotalDue.ToString("c"));
                row.Cells.Add(rptChargeAmt.ToString("c"));
                row.Cells.Add(chargeAmt.ToString("c"));
                if (!checkHideBold.Checked)
                {
                    double diff = (Math.Max(famBalTotal, 0) + Math.Max(payPlanDue, 0)) - rptChargeAmt;
                    if (diff.IsZero() || (diff < 0 && RecurringCharges.CanChargeWhenNoBal(chargeCur.CanChargeWhenNoBal)))
                    {
                        //don't bold anything
                    }
                    else if (diff > 0)
                    {
                        row.Cells[6].Bold = YN.Yes;                      //"Repeating Amt"
                        row.Cells[7].Bold = YN.Yes;                      //"Charge Amt"
                    }
                    else if (diff < 0)
                    {
                        row.Cells[5].Bold = YN.Yes;                      //"Total Due"
                        row.Cells[7].Bold = YN.Yes;                      //"Charge Amt"
                    }
                }
                if (Programs.HasMultipleCreditCardProgramsEnabled())
                {
                    if (Programs.IsEnabled(ProgramName.Xcharge))
                    {
                        row.Cells.Add(!string.IsNullOrEmpty(chargeCur.XChargeToken) ? "X" : "");
                    }
                    if (Programs.IsEnabled(ProgramName.PayConnect))
                    {
                        row.Cells.Add(!string.IsNullOrEmpty(chargeCur.PayConnectToken) ? "X" : "");
                    }
                    if (Programs.IsEnabled(ProgramName.PaySimple))
                    {
                        row.Cells.Add(!string.IsNullOrEmpty(chargeCur.PaySimpleToken) ? "X" : "");
                    }
                }
                row.Tag = chargeCur;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
            labelTotal.Text    = Lan.g(this, "Total=") + gridMain.ListGridRows.Count.ToString();
            labelSelected.Text = Lan.g(this, "Selected=") + gridMain.SelectedIndices.Length.ToString();
            Cursor             = Cursors.Default;
        }
Exemplo n.º 22
0
        private void FormReportsMore_Load(object sender, EventArgs e)
        {
            butPW.Visible = Programs.IsEnabled(ProgramName.PracticeWebReports);
            listProdInc.Items.AddRange(new string[] {
                Lan.g(this, "Today"),
                Lan.g(this, "Yesterday"),
                Lan.g(this, "This Month"),
                Lan.g(this, "Last Month"),
                Lan.g(this, "This Year"),
                Lan.g(this, "More Options")
            });
            listDaily.Items.AddRange(new string[] {
                Lan.g(this, "Adjustments"),
                Lan.g(this, "Payments"),
                Lan.g(this, "Procedures"),
                Lan.g(this, "Writeoffs"),
                Lan.g(this, "Incomplete Procedure Notes"),
                Lan.g(this, "Routing Slips")
            });
            listMonthly.Items.AddRange(new string[] {
                Lan.g(this, "Aging Report"),
                Lan.g(this, "Claims Not Sent"),
                Lan.g(this, "Capitation Utilization"),
                Lan.g(this, "Finance Charge Report"),
                Lan.g(this, "Outstanding Insurance Claims"),
                Lan.g(this, "Procedures Not Billed to Insurance"),
                Lan.g(this, "PPO Writeoffs"),
                Lan.g(this, "Payment Plans"),
                Lan.g(this, "Receivable Breakdown"),
                Lan.g(this, "Unearned Income"),
                Lan.g(this, "Insurance Overpaid"),
            });
            listLists.Items.AddRange(new string[] {
                Lan.g(this, "Appointments"),
                Lan.g(this, "Birthdays"),
                Lan.g(this, "Insurance Plans"),
                Lan.g(this, "New Patients"),
                Lan.g(this, "Patients - Raw"),
                Lan.g(this, "Patients Notes"),
                Lan.g(this, "Prescriptions"),
                Lan.g(this, "Procedure Codes"),
                Lan.g(this, "Referrals - Raw"),
                Lan.g(this, "Referral Analysis"),
                Lan.g(this, "Referred Proc Tracking"),
                Lan.g(this, "Treatment Finder")
                //Lan.g(this,"Treatment Plan Manager")//js too buggy
            });
            listPublicHealth.Items.AddRange(new string[] {
                Lan.g(this, "Raw Screening Data"),
                Lan.g(this, "Raw Population Data")
            });
            listArizonaPrimaryCare.Items.AddRange(new string[] {
                Lan.g(this, "Eligibility File"),
                Lan.g(this, "Encounter File")
            });
            //Arizona primary care list and label must only be visible when the Arizona primary
            //care option is checked in the miscellaneous options.
            if (UsingArizonaPrimaryCare())
            {
                labelArizonaPrimaryCare.Visible = true;
                listArizonaPrimaryCare.Visible  = true;
            }
            //Notify user if partial batch ins payments exist.
            List <ClaimPayment> listClaimPay = ClaimPayments.GetForDateRange(DateTime.Now.AddMonths(-1), DateTime.Now, 0);

            for (int i = 0; i < listClaimPay.Count; i++)
            {
                if (listClaimPay[i].IsPartial)
                {
                    MsgBox.Show(this, "Reports will not be accurate until partial insurance payments are completed.");
                    break;
                }
            }
        }
Exemplo n.º 23
0
        private void FillGrid()
        {
            gridMain.BeginUpdate();
            gridMain.ListGridColumns.Clear();
            gridMain.ListGridColumns.Add(new GridColumn("Card Number", 140));
            if (Programs.IsEnabled(ProgramName.Xcharge))
            {
                gridMain.ListGridColumns.Add(new GridColumn("X-Charge", 70, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PayConnect))
            {
                gridMain.ListGridColumns.Add(new GridColumn("PayConnect", 85, HorizontalAlignment.Center));
            }
            if (Programs.IsEnabled(ProgramName.PaySimple))
            {
                gridMain.ListGridColumns.Add(new GridColumn("PaySimple", 80, HorizontalAlignment.Center));
                gridMain.ListGridColumns.Add(new GridColumn("ACH", 40, HorizontalAlignment.Center));
            }
            if (PrefC.HasOnlinePaymentEnabled(out ProgramName progNameForPayments))
            {
                if (progNameForPayments == ProgramName.Xcharge)
                {
                    gridMain.ListGridColumns.Add(new GridColumn("XWeb", 45, HorizontalAlignment.Center));
                }
                else
                {
                    gridMain.ListGridColumns.Add(new GridColumn("PayConnect\r\nPortal", 85, HorizontalAlignment.Center));
                }
            }
            if (gridMain.ListGridColumns.Sum(x => x.ColWidth) > gridMain.Width)
            {
                gridMain.HScrollVisible = true;
            }
            gridMain.ListGridRows.Clear();
            GridRow row;

            _listCreditCards = CreditCards.Refresh(PatCur.PatNum);
            foreach (CreditCard cc in _listCreditCards)
            {
                row = new GridRow();
                string ccNum = cc.CCNumberMasked;
                if (Regex.IsMatch(ccNum, "^\\d{12}(\\d{0,7})"))                 //Credit cards can have a minimum of 12 digits, maximum of 19
                {
                    int idxLast4Digits = (ccNum.Length - 4);
                    ccNum = (new string('X', 12)) + ccNum.Substring(idxLast4Digits);               //replace the first 12 with 12 X's
                }
                row.Cells.Add(ccNum);
                if (Programs.IsEnabled(ProgramName.Xcharge))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && !cc.IsXWeb()?"X":"");
                }
                if (Programs.IsEnabled(ProgramName.PayConnect))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PayConnectToken) && !cc.IsPayConnectPortal() ? "X" : "");
                }
                if (Programs.IsEnabled(ProgramName.PaySimple))
                {
                    row.Cells.Add(!string.IsNullOrEmpty(cc.PaySimpleToken) ? "X" : "");
                    row.Cells.Add(cc.CCSource == CreditCardSource.PaySimpleACH ? "X" : "");
                }
                if (PrefC.HasOnlinePaymentEnabled(out progNameForPayments))
                {
                    if (progNameForPayments == ProgramName.Xcharge)
                    {
                        row.Cells.Add(!string.IsNullOrEmpty(cc.XChargeToken) && cc.IsXWeb() ? "X" : "");
                    }
                    else                      //PayConnectPortal
                    {
                        row.Cells.Add(!string.IsNullOrEmpty(cc.PayConnectToken) && cc.IsPayConnectPortal() ? "X" : "");
                    }
                }
                row.Tag = cc;
                gridMain.ListGridRows.Add(row);
            }
            gridMain.EndUpdate();
        }
Exemplo n.º 24
0
        private void butAdd_Click(object sender, EventArgs e)
        {
            if (!PrefC.GetBool(PrefName.StoreCCnumbers))
            {
                bool hasXCharge    = false;
                bool hasPayConnect = false;
                bool hasPaySimple  = false;
                Dictionary <string, int> dictEnabledProcessors = new Dictionary <string, int>();
                int  idx = 0;
                bool hasXChargePreventCcAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.Xcharge).ProgramNum,
                                                                                    ProgramProperties.PropertyDescs.XCharge.XChargePreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.Xcharge) && !hasXChargePreventCcAdd)
                {
                    dictEnabledProcessors["X-Charge"] = idx++;
                }
                bool hasPayConnectPreventCcAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.PayConnect).ProgramNum,
                                                                                       PayConnect.ProgramProperties.PayConnectPreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.PayConnect) && !hasPayConnectPreventCcAdd)
                {
                    dictEnabledProcessors["PayConnect"] = idx++;
                }
                bool hasPaySimplePreventCCAdd = PIn.Bool(ProgramProperties.GetPropVal(Programs.GetCur(ProgramName.PaySimple).ProgramNum,
                                                                                      PaySimple.PropertyDescs.PaySimplePreventSavingNewCC, Clinics.ClinicNum));
                if (Programs.IsEnabled(ProgramName.PaySimple) && !hasPaySimplePreventCCAdd)
                {
                    dictEnabledProcessors["PaySimple"] = idx++;
                }
                if (dictEnabledProcessors.Count > 1)
                {
                    List <string> listCCProcessors = dictEnabledProcessors.Select(x => x.Key).ToList();
                    InputBox      chooseProcessor  =
                        new InputBox(Lan.g(this, "For which credit card processing company would you like to add this card?"), listCCProcessors, true);
                    if (chooseProcessor.ShowDialog() == DialogResult.Cancel)
                    {
                        return;
                    }
                    hasXCharge    = dictEnabledProcessors.ContainsKey("X-Charge") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["X-Charge"]);
                    hasPayConnect = dictEnabledProcessors.ContainsKey("PayConnect") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["PayConnect"]);
                    hasPaySimple  = dictEnabledProcessors.ContainsKey("PaySimple") && chooseProcessor.SelectedIndices.Contains(dictEnabledProcessors["PaySimple"]);
                }
                else if (Programs.IsEnabled(ProgramName.Xcharge) && !hasXChargePreventCcAdd)
                {
                    hasXCharge = true;
                }
                else if (Programs.IsEnabled(ProgramName.PayConnect) && !hasPayConnectPreventCcAdd)
                {
                    hasPayConnect = true;
                }
                else if (Programs.IsEnabled(ProgramName.PaySimple) && !hasPaySimplePreventCCAdd)
                {
                    hasPaySimple = true;
                }
                else                  //not storing CC numbers and both PayConnect and X-Charge are disabled
                {
                    MsgBox.Show(this, "Not allowed to store credit cards.");
                    return;
                }
                CreditCard creditCardCur = null;
                if (hasXCharge)
                {
                    if (ODBuild.IsWeb())
                    {
                        MsgBox.Show(this, "XCharge is not available while viewing through the web.");
                        return;
                    }
                    Program prog      = Programs.GetCur(ProgramName.Xcharge);
                    string  path      = Programs.GetProgramPath(prog);
                    string  xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum).Trim();
                    string  xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum).Trim();
                    //Force user to retry entering information until it's correct or they press cancel
                    while (!File.Exists(path) || string.IsNullOrEmpty(xPassword) || string.IsNullOrEmpty(xUsername))
                    {
                        MsgBox.Show(this, "The Path, Username, and/or Password for X-Charge have not been set or are invalid.");
                        if (!Security.IsAuthorized(Permissions.Setup))
                        {
                            return;
                        }
                        FormXchargeSetup FormX = new FormXchargeSetup();                 //refreshes program and program property caches on OK click
                        FormX.ShowDialog();
                        if (FormX.DialogResult != DialogResult.OK)                       //if user presses cancel, return
                        {
                            return;
                        }
                        prog      = Programs.GetCur(ProgramName.Xcharge);                 //refresh local variable prog to reflect any changes made in setup window
                        path      = Programs.GetProgramPath(prog);
                        xUsername = ProgramProperties.GetPropVal(prog.ProgramNum, "Username", Clinics.ClinicNum).Trim();
                        xPassword = ProgramProperties.GetPropVal(prog.ProgramNum, "Password", Clinics.ClinicNum).Trim();
                    }
                    xPassword = CodeBase.MiscUtils.Decrypt(xPassword);
                    ProcessStartInfo info       = new ProcessStartInfo(path);
                    string           resultfile = PrefC.GetRandomTempFile("txt");
                    try {
                        File.Delete(resultfile);                        //delete the old result file.
                    }
                    catch {
                        MsgBox.Show(this, "Could not delete XResult.txt file.  It may be in use by another program, flagged as read-only, or you might not have sufficient permissions.");
                        return;
                    }
                    info.Arguments  = "";
                    info.Arguments += "/TRANSACTIONTYPE:ArchiveVaultAdd /LOCKTRANTYPE ";
                    info.Arguments += "/RESULTFILE:\"" + resultfile + "\" ";
                    info.Arguments += "/USERID:" + xUsername + " ";
                    info.Arguments += "/PASSWORD:"******" ";
                    info.Arguments += "/VALIDATEARCHIVEVAULTACCOUNT ";
                    info.Arguments += "/STAYONTOP ";
                    info.Arguments += "/SMARTAUTOPROCESS ";
                    info.Arguments += "/AUTOCLOSE ";
                    info.Arguments += "/HIDEMAINWINDOW ";
                    info.Arguments += "/SMALLWINDOW ";
                    info.Arguments += "/NORESULTDIALOG ";
                    info.Arguments += "/TOOLBAREXITBUTTON ";
                    Cursor          = Cursors.WaitCursor;
                    Process process = new Process();
                    process.StartInfo           = info;
                    process.EnableRaisingEvents = true;
                    process.Start();
                    while (!process.HasExited)
                    {
                        Application.DoEvents();
                    }
                    Thread.Sleep(200);                    //Wait 2/10 second to give time for file to be created.
                    Cursor = Cursors.Default;
                    string resulttext    = "";
                    string line          = "";
                    string xChargeToken  = "";
                    string accountMasked = "";
                    string exp           = "";;
                    bool   insertCard    = false;
                    try {
                        using (TextReader reader = new StreamReader(resultfile)) {
                            line = reader.ReadLine();
                            while (line != null)
                            {
                                if (resulttext != "")
                                {
                                    resulttext += "\r\n";
                                }
                                resulttext += line;
                                if (line.StartsWith("RESULT="))
                                {
                                    if (line != "RESULT=SUCCESS")
                                    {
                                        throw new Exception();
                                    }
                                    insertCard = true;
                                }
                                if (line.StartsWith("XCACCOUNTID="))
                                {
                                    xChargeToken = PIn.String(line.Substring(12));
                                }
                                if (line.StartsWith("ACCOUNT="))
                                {
                                    accountMasked = PIn.String(line.Substring(8));
                                }
                                if (line.StartsWith("EXPIRATION="))
                                {
                                    exp = PIn.String(line.Substring(11));
                                }
                                line = reader.ReadLine();
                            }
                            if (insertCard && xChargeToken != "")                           //Might not be necessary but we've had successful charges with no tokens returned before.
                            {
                                creditCardCur = new CreditCard();
                                List <CreditCard> itemOrderCount = CreditCards.Refresh(PatCur.PatNum);
                                creditCardCur.PatNum         = PatCur.PatNum;
                                creditCardCur.ItemOrder      = itemOrderCount.Count;
                                creditCardCur.CCNumberMasked = accountMasked;
                                creditCardCur.XChargeToken   = xChargeToken;
                                creditCardCur.CCExpiration   = new DateTime(Convert.ToInt32("20" + PIn.String(exp.Substring(2, 2))), Convert.ToInt32(PIn.String(exp.Substring(0, 2))), 1);
                                creditCardCur.Procedures     = PrefC.GetString(PrefName.DefaultCCProcs);
                                creditCardCur.CCSource       = CreditCardSource.XServer;
                                creditCardCur.ClinicNum      = Clinics.ClinicNum;
                                CreditCards.Insert(creditCardCur);
                            }
                        }
                    }
                    catch (Exception) {
                        MsgBox.Show(this, "There was a problem adding the credit card.  Please try again.");
                    }
                }
                if (hasPayConnect)
                {
                    FormPayConnect FormPC = new FormPayConnect(Clinics.ClinicNum, PatCur, (decimal)0.01, creditCardCur, true);
                    FormPC.ShowDialog();
                }
                if (hasPaySimple)
                {
                    FormPaySimple formPS = new FormPaySimple(Clinics.ClinicNum, PatCur, (decimal)0.01, creditCardCur, true);
                    formPS.ShowDialog();
                }
                FillGrid();
                if (gridMain.ListGridRows.Count > 0 && creditCardCur != null)
                {
                    gridMain.SetSelected(gridMain.ListGridRows.Count - 1, true);
                }
                return;
            }
            //storing CC numbers allowed from here down
            FormCreditCardEdit FormCCE = new FormCreditCardEdit(PatCur);

            FormCCE.CreditCardCur            = new CreditCard();
            FormCCE.CreditCardCur.IsNew      = true;
            FormCCE.CreditCardCur.Procedures = PrefC.GetString(PrefName.DefaultCCProcs);
            FormCCE.ShowDialog();
            if (FormCCE.DialogResult == DialogResult.OK)
            {
                FillGrid();
                if (gridMain.ListGridRows.Count > 0)
                {
                    gridMain.SetSelected(gridMain.ListGridRows.Count - 1, true);
                }
            }
        }