Пример #1
0
 private void butCopy_Click(object sender, System.EventArgs e)
 {
     if (comboCopyFrom.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please pick a fee schedule first.");
         return;
     }
     if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
     {
         return;
     }
     //clear current
     Fees.ClearFeeSched(SchedNum);
     //copy any values over
     Fees.CopyFees(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum, SchedNum);
     for (int i = 0; i < Fees.Listt.Count; i++)
     {
         //ignore all but the OLD fee schedule.
         if (Fees.Listt[i].FeeSched != FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum)
         {
             continue;
         }
         SecurityLogs.MakeLogEntry(Permissions.ProcFeeEdit, 0, Lan.g(this, "Procedure") + ": " + ProcedureCodes.GetStringProcCode(Fees.Listt[i].CodeNum)
                                   + ", " + Lan.g(this, "Fee") + ": " + Fees.Listt[i].Amount.ToString("c") + ", " + Lan.g(this, "Fee Schedule") + ": " + FeeScheds.GetDescription(Fees.Listt[i].FeeSched)
                                   + ". " + Lan.g(this, "Fee copied from") + " " + FeeScheds.GetDescription(FeeSchedC.ListShort[comboCopyFrom.SelectedIndex].FeeSchedNum) + " " + Lan.g(this, "using Fee Tools."), Fees.Listt[i].CodeNum);
     }
     DialogResult = DialogResult.OK;
 }
Пример #2
0
 private void butClear_Click(object sender, System.EventArgs e)
 {
     if (!MsgBox.Show(this, true, "This will clear all values from the current fee schedule showing in the main window.  Are you sure you want to continue?"))
     {
         return;
     }
     Fees.ClearFeeSched(SchedNum);
     DialogResult = DialogResult.OK;
 }
Пример #3
0
 private void butCopy_Click(object sender, System.EventArgs e)
 {
     if (comboCopyFrom.SelectedIndex == -1)
     {
         MsgBox.Show(this, "Please pick a fee schedule first.");
         return;
     }
     if (!MsgBox.Show(this, true, "This will overwrite all values of the current fee schedule showing in the main window.  Are you sure you want to continue?"))
     {
         return;
     }
     //clear current
     Fees.ClearFeeSched(SchedNum);
     //copy any values over
     Fees.CopyFees(comboCopyFrom.SelectedIndex, SchedNum);
     DialogResult = DialogResult.OK;
 }
Пример #4
0
        private void butImportEcw_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            OpenFileDialog Dlg = new OpenFileDialog();

                        #if DEBUG
            Dlg.InitialDirectory = @"E:\My Documents\Bridge Info\eClinicalWorks\FeeSchedules";
                        #endif
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            if (!File.Exists(Dlg.FileName))
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "File not found");
                return;
            }
            string extension = Path.GetExtension(Dlg.FileName);
            if (extension != ".csv")
            {
                Cursor = Cursors.Default;
                MsgBox.Show(this, "Only .csv files may be imported.");
                return;
            }
            string[] lines = File.ReadAllLines(Dlg.FileName);
            if (lines.Length == 0 || (lines[0] != "Code,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode" &&
                                      lines[0] != "\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\""))
            {
                Cursor = Cursors.Default;
                MessageBox.Show("Unexpected file format. First line in file should be:\r\nCode,Description,Unit Fee,Allowed Fee,POS,TOS,Modifier,RequiresCliaID,GlobalBillingDays,ChargeCode\r\nor\r\n\"Code\",\"Description\",\"UnitFee\",\"AllowedFee\",\"POS\",\"TOS\",\"Modifier\",\"RequiresCliaID\",\"GlobalBillingDays\",\"ChargeCode\"");
                return;
            }
            string   feeSchedName = Path.GetFileNameWithoutExtension(Dlg.FileName);
            FeeSched feesched     = FeeScheds.GetByExactName(feeSchedName, FeeScheduleType.Normal);
            if (feesched == null)
            {
                feesched              = new FeeSched();
                feesched.Description  = feeSchedName;
                feesched.FeeSchedType = FeeScheduleType.Normal;
                feesched.ItemOrder    = FeeSchedC.ListLong[FeeSchedC.ListLong.Count - 1].ItemOrder + 1;
                feesched.IsHidden     = false;
                //feesched.IsNew=true;
                FeeScheds.Insert(feesched);
                DataValid.SetInvalid(InvalidType.FeeScheds);
            }
            else
            {
                if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Fee schedule already exists and all the fees will be overwritten.  Continue?"))
                {
                    Cursor = Cursors.Default;
                    return;
                }
                Fees.ClearFeeSched(feesched.FeeSchedNum);
            }
            bool importAllowed = false;
            if (MsgBox.Show(this, MsgBoxButtons.YesNo, "Import Allowed Fee column instead of Unit Fee column?"))
            {
                importAllowed = true;
            }
            int           imported         = 0;
            int           skippedCode      = 0;
            int           skippedMalformed = 0;
            string[]      fieldArray;
            List <string> fields;
            double        feeAmt       = 0;
            string        codeText     = "";
            bool          formatQuotes = false;
            if (lines.Length > 1)
            {
                if (lines[1].Substring(0, 1) == "\"")
                {
                    formatQuotes = true;
                }
            }
            if (formatQuotes)             //Original format - fields are surrounded by quotes (except first row, above)
            {
                for (int i = 1; i < lines.Length; i++)
                {
                    //fieldArray=lines[i].Split(new string[1] { "\"" },StringSplitOptions.RemoveEmptyEntries);//Removing emtpy entries will misalign the columns
                    fieldArray = lines[i].Split(new string[1] {
                        "\""
                    }, StringSplitOptions.None);                                //half the 'fields' will be commas.
                    fields = new List <string>();
                    for (int f = 1; f < fieldArray.Length - 1; f++)             //this loop skips the first and last elements because they are artifacts of the string splitting.
                    {
                        if (fieldArray[f] == ",")
                        {
                            continue;
                        }
                        fields.Add(fieldArray[f]);
                    }
                    if (fields.Count < 4)
                    {
                        skippedMalformed++;
                        continue;
                    }
                    if (importAllowed)
                    {
                        feeAmt = PIn.Double(fields[3]);
                    }
                    else
                    {
                        feeAmt = PIn.Double(fields[2]);
                    }
                    codeText = fields[0];
                    if (!ProcedureCodes.IsValidCode(codeText))
                    {
                        skippedCode++;
                        continue;
                    }
                    Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum);
                    imported++;
                }
            }
            else              //New format - fields are delimited by commas only (no quotes)
            {
                for (int i = 1; i < lines.Length; i++)
                {
                    fieldArray = lines[i].Split(new string[1] {
                        ","
                    }, StringSplitOptions.None);
                    fields = new List <string>();
                    for (int f = 0; f < fieldArray.Length; f++)
                    {
                        fields.Add(fieldArray[f]);
                    }
                    if (fields.Count < 4)
                    {
                        skippedMalformed++;
                        continue;
                    }
                    if (fields.Count > 10)
                    {
                        MsgBox.Show(this, "Import aborted. Commas are not allowed in text fields. Check your descriptions for commas and try again.");
                        Cursor = Cursors.Default;
                        return;
                    }
                    if (importAllowed)
                    {
                        feeAmt = PIn.Double(fields[3]);
                    }
                    else
                    {
                        feeAmt = PIn.Double(fields[2]);
                    }
                    codeText = fields[0];
                    if (!ProcedureCodes.IsValidCode(codeText))
                    {
                        skippedCode++;
                        continue;
                    }
                    Fees.Import(fields[0], feeAmt, feesched.FeeSchedNum);
                    imported++;
                }
            }
            DataValid.SetInvalid(InvalidType.Fees);
            Cursor = Cursors.Default;
            string displayMsg = "Import complete.\r\nCodes imported: " + imported.ToString();
            if (skippedCode > 0)
            {
                displayMsg += "\r\nCodes skipped because not valid codes in Open Dental: " + skippedCode.ToString();
            }
            if (skippedMalformed > 0)
            {
                displayMsg += "\r\nCodes skipped because malformed line in text file: " + skippedMalformed.ToString();
            }
            MessageBox.Show(displayMsg);
            DialogResult = DialogResult.OK;
        }