예제 #1
0
 private void CreateChargeList()
 {
     #region Parse CSV
     _listNewCropCharges = new List <NewCropCharge>();
     string   csvData       = File.ReadAllText(textBillingFilePath.Text);
     string[] arrayCsvLines = csvData.Split(new string[] { "\r\n" }, StringSplitOptions.None);
     for (int i = 2; i < arrayCsvLines.Length; i++)       //Skip the first row (the column names), skip the second row (the totals).
     {
         string[] arrayLineValues = arrayCsvLines[i].Split('\t');
         if (arrayLineValues.Length < 25)
         {
             continue;                    //This often happens on the last line of the file, due to a trailing newline.  Skip this line or any other malformed line.
         }
         for (int j = 0; j < arrayLineValues.Length; j++)
         {
             arrayLineValues[j] = arrayLineValues[j].Trim('\"');                  //Remove leading and trailing double quotes from each cell of the csv table.
         }
         NewCropCharge charge = new NewCropCharge();
         charge.ParentAccount   = arrayLineValues[0];
         charge.AccountName     = arrayLineValues[1];
         charge.AccountId       = arrayLineValues[2];
         charge.SiteId          = arrayLineValues[3];
         charge.LastName        = arrayLineValues[4];
         charge.FirstName       = arrayLineValues[5];
         charge.Dea             = arrayLineValues[6];
         charge.NPI             = arrayLineValues[7];
         charge.DateAdded       = arrayLineValues[8];
         charge.DoctorID        = arrayLineValues[9];
         charge.DoctorType      = arrayLineValues[10];
         charge.FTEPercent      = arrayLineValues[11];
         charge.CompFTEPercent  = arrayLineValues[12];
         charge.BasicFTEPercent = arrayLineValues[13];
         charge.DrugChecks      = arrayLineValues[14];
         charge.ForumaryChecks  = arrayLineValues[15];
         charge.EPCS            = arrayLineValues[16];
         charge.IDP             = arrayLineValues[17];
         charge.Interop         = arrayLineValues[18];
         charge.PatientPortal   = arrayLineValues[19];
         charge.Registries      = arrayLineValues[20];
         charge.Labs            = arrayLineValues[21];
         charge.Genomics        = arrayLineValues[22];
         charge.Direct          = arrayLineValues[23];
         charge.DoctorDirect    = arrayLineValues[24];
         int    patNumLength = charge.AccountId.IndexOf("-");
         string patNumStr    = PIn.String(charge.AccountId.Substring(0, patNumLength));
         charge.PatNumForRegKey = PIn.Long(patNumStr);              //PatNum of registration key used to create the account id.
         if (charge.PatNumForRegKey == 6566)
         {
             //Account 6566 corresponds to our software key in the training database.  These accounts are test accounts.
             continue;                    //Do not show OD test accounts.
         }
         _listNewCropCharges.Add(charge);
     }
     #endregion Parse CSV
     _listErxRepeatCharges = RepeatCharges.GetForErx();
     foreach (NewCropCharge charge in _listNewCropCharges)
     {
         charge.repeatCharge = _listErxRepeatCharges.FirstOrDefault(x => x.ErxAccountId == charge.AccountId && x.Npi == charge.NPI);
     }
 }
예제 #2
0
        private void FormRepeatChargeEdit_Load(object sender, EventArgs e)
        {
            SetPatient();
            if (IsNew)
            {
                FormProcCodes FormP = new FormProcCodes();
                FormP.IsSelectionMode = true;
                FormP.ShowDialog();
                if (FormP.DialogResult != DialogResult.OK)
                {
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                ProcedureCode procCode = ProcedureCodes.GetProcCode(FormP.SelectedCodeNum);
                if (procCode.TreatArea != TreatmentArea.Mouth &&
                    procCode.TreatArea != TreatmentArea.None)
                {
                    MsgBox.Show(this, "Procedure codes that require tooth numbers are not allowed.");
                    DialogResult = DialogResult.Cancel;
                    return;
                }
                RepeatCur.ProcCode     = ProcedureCodes.GetStringProcCode(FormP.SelectedCodeNum);
                RepeatCur.IsEnabled    = true;
                RepeatCur.CreatesClaim = false;
            }
            textCode.Text      = RepeatCur.ProcCode;
            textDesc.Text      = ProcedureCodes.GetProcCode(RepeatCur.ProcCode).Descript;
            textChargeAmt.Text = RepeatCur.ChargeAmt.ToString("F");
            if (RepeatCur.DateStart.Year > 1880)
            {
                textDateStart.Text = RepeatCur.DateStart.ToShortDateString();
            }
            if (RepeatCur.DateStop.Year > 1880)
            {
                textDateStop.Text = RepeatCur.DateStop.ToShortDateString();
            }
            textNote.Text = RepeatCur.Note;
            _isErx        = false;
            if (PrefC.GetBool(PrefName.DistributorKey) && Regex.IsMatch(RepeatCur.ProcCode, "^Z[0-9]{3,}$"))            //Is eRx if HQ and a using an eRx Z code.
            {
                _isErx = true;
                labelPatNum.Visible       = true;
                textPatNum.Visible        = true;
                butMoveTo.Visible         = true;
                labelNpi.Visible          = true;
                textNpi.Visible           = true;
                labelProviderName.Visible = true;
                textProvName.Visible      = true;
                labelErxAccountId.Visible = true;
                textErxAccountId.Visible  = true;
                if (IsNew && RepeatCur.ProcCode == "Z100")               //DoseSpot Procedure Code
                {
                    List <string> listDoseSpotAccountIds = ClinicErxs.GetAccountIdsForPatNum(RepeatCur.PatNum)
                                                           .Union(ProviderErxs.GetAccountIdsForPatNum(RepeatCur.PatNum))
                                                           .Union(
                        RepeatCharges.GetForErx()
                        .FindAll(x => x.PatNum == RepeatCur.PatNum && x.ProcCode == "Z100")
                        .Select(x => x.ErxAccountId)
                        .ToList()
                        )
                                                           .Distinct()
                                                           .ToList()
                                                           .FindAll(x => DoseSpot.IsDoseSpotAccountId(x));
                    if (listDoseSpotAccountIds.Count == 0)
                    {
                        listDoseSpotAccountIds.Add(DoseSpot.GenerateAccountId(RepeatCur.PatNum));
                    }
                    if (listDoseSpotAccountIds.Count == 1)
                    {
                        textErxAccountId.Text = listDoseSpotAccountIds[0];
                    }
                    else if (listDoseSpotAccountIds.Count > 1)
                    {
                        InputBox inputAccountIds = new InputBox(Lans.g(this, "Multiple Account IDs found.  Select one to assign to this repeat charge."), listDoseSpotAccountIds, 0);
                        inputAccountIds.ShowDialog();
                        if (inputAccountIds.DialogResult == DialogResult.OK)
                        {
                            textErxAccountId.Text = listDoseSpotAccountIds[inputAccountIds.SelectedIndex];
                        }
                    }
                }
                else                  //Existing eRx repeating charge.
                {
                    textNpi.Text              = RepeatCur.Npi;
                    textErxAccountId.Text     = RepeatCur.ErxAccountId;
                    textProvName.Text         = RepeatCur.ProviderName;
                    textNpi.ReadOnly          = true;
                    textErxAccountId.ReadOnly = true;
                    textProvName.ReadOnly     = true;
                }
            }
            checkCopyNoteToProc.Checked = RepeatCur.CopyNoteToProc;
            checkCreatesClaim.Checked   = RepeatCur.CreatesClaim;
            checkIsEnabled.Checked      = RepeatCur.IsEnabled;
            if (PrefC.GetBool(PrefName.DistributorKey))             //OD HQ disable the IsEnabled and CreatesClaim checkboxes
            {
                checkCreatesClaim.Enabled = false;
                checkIsEnabled.Enabled    = false;
            }
            if (PrefC.IsODHQ && EServiceCodeLink.IsProcCodeAnEService(RepeatCur.ProcCode))
            {
                if (IsNew)
                {
                    MsgBox.Show(this, "You cannot manually create any eService repeating charges.\r\n"
                                + "Use the Signup Portal instead.\r\n\r\n"
                                + "The Charge Amount can be manually edited after the Signup Portal has created the desired eService repeating charge.");
                    DialogResult = DialogResult.Abort;
                    return;
                }
                //The only things that users should be able to do for eServices are:
                //1. Change the repeating charge amount.
                //2. Manipulate the Start Date.
                //3. Manipulate the Note.
                //4. Manipulate Billing Day because not all customers will have a non-eService repeating charge in order to manipulate.
                //This is because legacy users (versions prior to 17.1) need the ability to manually set their monthly charge amount, etc.
                SetFormReadOnly(this, butOK, butCancel
                                , textChargeAmt, labelChargeAmount
                                , textDateStart, labelDateStart
                                , textNote, labelNote
                                , textBillingDay, labelBillingCycleDay);
            }
            Patient pat = Patients.GetPat(RepeatCur.PatNum);          //pat should never be null. If it is, this will fail.

            //If this is a new repeat charge and no other active repeat charges exist, set the billing cycle day to today
            if (IsNew && !RepeatCharges.ActiveRepeatChargeExists(RepeatCur.PatNum))
            {
                textBillingDay.Text = DateTimeOD.Today.Day.ToString();
            }
            else
            {
                textBillingDay.Text = pat.BillingCycleDay.ToString();
            }
            if (PrefC.GetBool(PrefName.BillingUseBillingCycleDay))
            {
                labelBillingCycleDay.Visible = true;
                textBillingDay.Visible       = true;
            }
            checkUsePrepay.Checked = RepeatCur.UsePrepay;
        }