示例#1
0
        private void butExport_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            SaveFileDialog Dlg = new SaveFileDialog();

            if (Directory.Exists(PrefB.GetString("ExportPath")))
            {
                Dlg.InitialDirectory = PrefB.GetString("ExportPath");
            }
            else if (Directory.Exists("C:\\"))
            {
                Dlg.InitialDirectory = "C:\\";
            }
            Dlg.FileName = "Fees" + DefB.GetName(DefCat.FeeSchedNames, SchedNum) + ".txt";
            if (Dlg.ShowDialog() != DialogResult.OK)
            {
                Cursor = Cursors.Default;
                return;
            }
            //MessageBox.Show(Dlg.FileName);//includes full path
            //OverwritePrompt is already set to true
            DataTable table = ProcedureCodes.GetProcTable("", "", "", new int[0], SchedNum, 0, 0);
            double    fee;

            using (StreamWriter sr = File.CreateText(Dlg.FileName)){
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    sr.Write(PIn.PString(table.Rows[i]["ADACode"].ToString()) + "\t");
                    fee = PIn.PDouble(table.Rows[i]["FeeAmt1"].ToString());
                    if (fee != -1)
                    {
                        sr.Write(fee.ToString("n"));
                    }
                    sr.Write("\t");
                    sr.Write(PIn.PString(table.Rows[i]["AbbrDesc"].ToString()) + "\t");
                    sr.WriteLine(PIn.PString(table.Rows[i]["Descript"].ToString()));
                }
            }
            Cursor       = Cursors.Default;
            DialogResult = DialogResult.OK;
        }
示例#2
0
        private void FillGrid()
        {
            if (listFeeSched.Items.Count == 0)
            {
                gridMain.BeginUpdate();
                gridMain.Rows.Clear();
                gridMain.EndUpdate();
                MsgBox.Show(this, "You must have at least one fee schedule created.");
                return;
            }
            string selected = "";

            if (gridMain.GetSelectedIndex() != -1)
            {
                selected = ProcTable.Rows[gridMain.GetSelectedIndex()][3].ToString();
            }
            int scroll = gridMain.ScrollValue;

            int[] cats = new int[listCategories.SelectedIndices.Count];
            for (int i = 0; i < listCategories.SelectedIndices.Count; i++)
            {
                cats[i] = CatList[listCategories.SelectedIndices[i]].DefNum;
            }
            int feeSched      = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].DefNum;
            int feeSchedComp1 = 0;

            if (comboCompare1.SelectedIndex != 0)
            {
                feeSchedComp1 = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].DefNum;
            }
            int feeSchedComp2 = 0;

            if (comboCompare2.SelectedIndex != 0)
            {
                feeSchedComp2 = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].DefNum;
            }
            ProcTable = ProcedureCodes.GetProcTable(textAbbreviation.Text, textDescription.Text, textCode.Text, cats, feeSched,
                                                    feeSchedComp1, feeSchedComp2);
            gridMain.BeginUpdate();
            gridMain.Columns.Clear();
            ODGridColumn col = new ODGridColumn(Lan.g("TableProcedures", "Category"), 90);

            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Description"), 150);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Abbr"), 90);
            gridMain.Columns.Add(col);
            col = new ODGridColumn(Lan.g("TableProcedures", "Code"), 50);
            gridMain.Columns.Add(col);
            string heading = DefB.Short[(int)DefCat.FeeSchedNames][listFeeSched.SelectedIndex].ItemName;

            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            heading = "";
            if (comboCompare1.SelectedIndex != 0)
            {
                heading = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare1.SelectedIndex - 1].ItemName;
            }
            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            heading = "";
            if (comboCompare2.SelectedIndex != 0)
            {
                heading = DefB.Short[(int)DefCat.FeeSchedNames][comboCompare2.SelectedIndex - 1].ItemName;
            }
            if (heading.Length > 8)
            {
                heading = heading.Substring(0, 8);
            }
            col = new ODGridColumn(heading, 50, HorizontalAlignment.Right);
            gridMain.Columns.Add(col);
            gridMain.Rows.Clear();
            ODGridRow row;

            for (int i = 0; i < ProcTable.Rows.Count; i++)
            {
                row = new ODGridRow();
                if (i == 0 || ProcTable.Rows[i - 1]["ProcCat"].ToString() != ProcTable.Rows[i]["ProcCat"].ToString())
                {
                    row.Cells.Add(DefB.GetName(DefCat.ProcCodeCats, PIn.PInt(ProcTable.Rows[i]["ProcCat"].ToString())));
                }
                else
                {
                    row.Cells.Add("");
                }
                row.Cells.Add(ProcTable.Rows[i]["Descript"].ToString());
                row.Cells.Add(ProcTable.Rows[i]["AbbrDesc"].ToString());
                row.Cells.Add(ProcTable.Rows[i]["ADACode"].ToString());
                if (ProcTable.Rows[i]["FeeAmt1"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt1"].ToString()).ToString("n"));
                }

                if (ProcTable.Rows[i]["FeeAmt2"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt2"].ToString()).ToString("n"));
                }
                if (ProcTable.Rows[i]["FeeAmt3"].ToString() == "-1")
                {
                    row.Cells.Add("");
                }
                else
                {
                    row.Cells.Add(PIn.PDouble(ProcTable.Rows[i]["FeeAmt3"].ToString()).ToString("n"));
                }
                gridMain.Rows.Add(row);
            }
            gridMain.EndUpdate();
            gridMain.ScrollValue = scroll;
            if (selected != "")          //if a row was previously selected
            {
                for (int i = 0; i < ProcTable.Rows.Count; i++)
                {
                    if (ProcTable.Rows[i][3].ToString() == selected)
                    {
                        gridMain.SetSelected(i, true);
                        break;
                    }
                }
            }
        }