Exemple #1
0
		private void OnSelectedGroupChanged(GridEXGroup group)
		{
			if (group != null)
			{
				if (group.CustomGroup != null)
				{
					if (group.CustomGroup.CustomGroupType == CustomGroupType.ConditionalGroupRows)
					{
						this.CreateFilterGroupControl(group);
					}
					else
					{
						this.CreateCompositeColumnsGroupControl(group);
					}
				}
				else
				{
					this.CreateColumnGroupControl(group);
				}
			}
			else
			{
				this.ActiveGroupControl = null;
			}

			this.EnableControls();
		}
        void cboHoadon_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Utility.Int32Dbnull(cboHoadon.SelectedValue, -1) == 0)
            {
                grdList.RootTable.Groups.Clear();
                chkMaQuyen.Enabled = false;
                pnlQuyen.Enabled = false;
            }
            else
            {
                chkMaQuyen.Enabled = true;
                chkMaQuyen_CheckedChanged(chkMaQuyen, e);
                grdList.RootTable.Groups.Clear();

                GridEXColumn gridExColumn = grdList.RootTable.Columns["mau_hoadon"];
                    var gridExGroup = new GridEXGroup(gridExColumn);
                    gridExGroup.GroupPrefix = "Mẫu hóa đơn: ";
                    grdList.RootTable.Groups.Add(gridExGroup);

                     gridExColumn = grdList.RootTable.Columns["ma_quyen"];
                     gridExGroup = new GridEXGroup(gridExColumn);
                    gridExGroup.GroupPrefix = "Mã quyển: ";
                    grdList.RootTable.Groups.Add(gridExGroup);

            }
        }
        private void UpdateGroup()
        {
            if (!Utility.isValidGrid(grdLuotkham))
            {
                return;
            }
            var counts = ((DataView)grdLuotkham.DataSource).Table.AsEnumerable()
                         .GroupBy(x => x.Field <string>("ma_doituong_kcb"))
                         .Select(g => new { g.Key, Count = g.Count() });

            if (counts.Count() >= 2)
            {
                if (grdLuotkham.RootTable.Groups.Count <= 0)
                {
                    GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
                    var          gridExGroup  = new GridEXGroup(gridExColumn)
                    {
                        GroupPrefix = "Nhóm đối tượng KCB: "
                    };
                    grdLuotkham.RootTable.Groups.Add(gridExGroup);
                }
            }
            else
            {
                GridEXColumn gridExColumn = grdLuotkham.RootTable.Columns["ma_doituong_kcb"];
                var          gridExGroup  = new GridEXGroup(gridExColumn);
                grdLuotkham.RootTable.Groups.Clear();
            }
            grdLuotkham.UpdateData();
            grdLuotkham.Refresh();
        }
Exemple #4
0
 void UpdateGroup()
 {
     try
     {
         var counts = m_dtData.AsEnumerable().GroupBy(x => x.Field <string>("ten_loainhom"))
                      .Select(g => new { g.Key, Count = g.Count() });
         if (counts.Count() >= 2)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loainhom"];
                 var          gridExGroup  = new GridEXGroup(gridExColumn);
                 gridExGroup.GroupPrefix = "";
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loainhom"];
             var          gridExGroup  = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }
Exemple #5
0
        void cboHoadon_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (Utility.Int32Dbnull(cboHoadon.SelectedValue, -1) == 0)
            {
                grdList.RootTable.Groups.Clear();
                chkMaQuyen.Enabled = false;
                pnlQuyen.Enabled   = false;
            }
            else
            {
                chkMaQuyen.Enabled = true;
                chkMaQuyen_CheckedChanged(chkMaQuyen, e);
                grdList.RootTable.Groups.Clear();

                GridEXColumn gridExColumn = grdList.RootTable.Columns["mau_hoadon"];
                var          gridExGroup  = new GridEXGroup(gridExColumn);
                gridExGroup.GroupPrefix = "Mẫu hóa đơn: ";
                grdList.RootTable.Groups.Add(gridExGroup);

                gridExColumn            = grdList.RootTable.Columns["ma_quyen"];
                gridExGroup             = new GridEXGroup(gridExColumn);
                gridExGroup.GroupPrefix = "Mã quyển: ";
                grdList.RootTable.Groups.Add(gridExGroup);
            }
        }
 void UpdateGroup()
 {
     try
     {
         var counts = m_dtPatient.AsEnumerable().GroupBy(x => x.Field <string>("ma_doituong_kcb"))
                      .Select(g => new { g.Key, Count = g.Count() });
         if (counts.Count() >= 2)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
                 var          gridExGroup  = new GridEXGroup(gridExColumn);
                 gridExGroup.GroupPrefix = "Nhóm đối tượng KCB: ";
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
             var          gridExGroup  = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }
		public CompositeColumnsGroupcontrol(GridEXGroup group, GridEXTable table)
		{

			// This call is required by the Windows Form Designer.
			InitializeComponent();

			mCompositeColumns = new List<GridEXColumn>();

			this.CreateGridsTable();
			if (group.Table != null)
			{
				this.Table = group.Table;
			}
			else
			{
				this.Table = table;
			}
			// Add any initialization after the InitializeComponent() call.

			this.mGroup = group;
			if (mGroup.CustomGroup != null)
			{
				this.CustomGroup = mGroup.CustomGroup;
			}
			else
			{
				GridEXCustomGroup newCustomGroup = new GridEXCustomGroup();
				newCustomGroup.CustomGroupType = CustomGroupType.CompositeColumns;
				this.CustomGroup = newCustomGroup;
				mGroup.CustomGroup = newCustomGroup;
			}

		}
Exemple #8
0
 void UpdateGroup()
 {
     try
     {
         if (m_dtReport == null || m_dtReport.Columns.Count <= 0)
         {
             return;
         }
         var counts = m_dtReport.AsEnumerable().GroupBy(x => x.Field <string>("tennhom"))
                      .Select(g => new { g.Key, Count = g.Count() });
         if (chkTheoNhomThuoc.Checked)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["tennhom"];
                 var          gridExGroup  = new GridEXGroup(gridExColumn);
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["tennhom"];
             var          gridExGroup  = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }
Exemple #9
0
		private GridEXGroup AddNewGroup()
		{
			GridEXGroup group = new GridEXGroup();
			this.groupCollection.Add(group);
			this.grdGroupList.Refetch();
			this.grdGroupList.MoveLast();
			return group;
		}
Exemple #10
0
        public ColumnGroupControl(GridEXGroup group, GridEXTable table)
        {

            // This call is required by the Windows Form Designer.
            InitializeComponent();

            this.mGroup = group;
            this.FillGroupIntervalCombo();
            if (group.Column != null)
            {
                this.Table = group.Column.Table;
            }
            else if (group.Table != null)
            {
                this.Table = group.Table;
            }
            else
            {
                this.Table = table;
            }

            if (this.Table.ChildTables.Count > 0 || this.Table.ParentTable != null)
            {
                bool allowChildTables = false;
                if (this.Table.AllowChildTableGroups == InheritableBoolean.Default)
                {
                    allowChildTables = this.Table.GridEX.AllowChildTableGroups;
                }
                else if (this.Table.AllowChildTableGroups == InheritableBoolean.True)
                {
                    allowChildTables = true;
                }
                if (allowChildTables)
                {
                    this.FillTablesCombo();
                    this.grbTable.Visible = true;
                    if (this.Table.ChildTables.Count == 0)
                    {
                        this.cboTables.ReadOnly = true;
                    }
                }
                else
                {
                    this.grbTable.Visible = false;
                }
            }
            else
            {
                this.grbTable.Visible = false;
            }

            this.Column = group.Column;
            // Add any initialization after the InitializeComponent() call.

        }
Exemple #11
0
		private void CreateFilterGroupControl(GridEXGroup group)
		{
			if (group == null)
			{
				group = this.AddNewGroup();
			}
			ConditionalGroupControl filterBasedControl = new ConditionalGroupControl(group, this.Table);
			filterBasedControl.Dock = DockStyle.Fill;

			this.ActiveGroupControl = filterBasedControl;
		}
Exemple #12
0
		private void CreateColumnGroupControl(GridEXGroup group)
		{
			if (group == null)
			{
				group = this.AddNewGroup();
			}
			ColumnGroupControl columnBasedControl = new ColumnGroupControl(group, this.Table);
			columnBasedControl.Dock = DockStyle.Fill;

			this.ActiveGroupControl = columnBasedControl;
		}
Exemple #13
0
 private void CauHinh()
 {
     cmdHuyDonThuoc.Visible  = PropertyLib._HisDuocProperties.HuyXacNhan;
     dtNgayPhatThuoc.Enabled = PropertyLib._HisDuocProperties.ChoPhepChinhNgayDuyet;
     grdPresDetail.RootTable.Groups.Clear();
     if (PropertyLib._ThamKhamProperties.Hienthinhomthuoc)
     {
         GridEXColumn gridExColumn = grdPresDetail.RootTable.Columns["ma_loaithuoc"];
         var          gridExGroup  = new GridEXGroup(gridExColumn);
         gridExGroup.GroupPrefix = "Loại thuốc: ";
         grdPresDetail.RootTable.Groups.Add(gridExGroup);
     }
 }
Exemple #14
0
		private void MoveUp()
		{
			if (this.grdGroupList.Row > 0)
			{
				int index = this.grdGroupList.Row;
				GridEXGroup group = (GridEXGroup)this.groupCollection[index];

				this.groupCollection.RemoveAt(index);

				this.groupCollection.Insert(index - 1, group);
				this.grdGroupList.Refetch();
				this.grdGroupList.MoveTo(index - 1);
			}
		}
Exemple #15
0
		private void MoveDown()
		{
			if (this.grdGroupList.Row < this.groupCollection.Count - 1)
			{
				int index = this.grdGroupList.Row;
				GridEXGroup group = (GridEXGroup)this.groupCollection[index];

				this.groupCollection.RemoveAt(index);

				this.groupCollection.Insert(index + 1, group);
				this.grdGroupList.Refetch();
				this.grdGroupList.MoveTo(index + 1);
			}
		}
		public ConditionalGroupControl(GridEXGroup group, GridEXTable table)
		{

			// This call is required by the Windows Form Designer.
			InitializeComponent();
			if (group.Table != null)
			{
				this.mTable = group.Table;
			}
			else
			{
				this.mTable = table;
			}
			// Add any initialization after the InitializeComponent() call.
			this.FillCustomGroupsCombo();

			this.Group = group;
		}
        private void button1_Click(object sender, EventArgs e)
        {
            GridEXCustomGroup customGroup = new GridEXCustomGroup();

            GridEXCustomGroupRow groupRow;
            groupRow = new GridEXCustomGroupRow("US Customers",this.gridEX1.RootTable.Columns["Country"],"USA");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            groupRow = new GridEXCustomGroupRow("Foreign Customers");
            groupRow.Condition = new GridEXFilterCondition(gridEX1.RootTable.Columns["Country"], ConditionOperator.NotEqual, "USA");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            this.gridEX1.RootTable.Groups.Clear();
            GridEXGroup group = new GridEXGroup(customGroup);
            group.HeaderCaption = "US and foreign customers";
            this.gridEX1.RootTable.Groups.Add(group);
            this.gridEX1.GetRow(0).Expanded = true;
        }
        private void button2_Click(object sender, System.EventArgs e)
        {
            GridEXCustomGroup customGroup = new GridEXCustomGroup();
            GridEXCustomGroupRow groupRow;
            groupRow = new GridEXCustomGroupRow("Owner", this.gridEX1.RootTable.Columns["ContactTitle"], "Owner");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            groupRow = new GridEXCustomGroupRow("Other");
            groupRow.Condition = new GridEXFilterCondition(gridEX1.RootTable.Columns["ContactTitle"], ConditionOperator.NotEqual, "Owner");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            this.gridEX1.RootTable.Groups.Clear();
            GridEXGroup group = new GridEXGroup(customGroup);
            group.GroupPrefix = "Contact Title:";
            group.HeaderCaption = "Contact Title";
            this.gridEX1.RootTable.Groups.Add(group);
            this.gridEX1.GetRow(0).Expanded = true;
        }
        private void button2_Click(object sender, System.EventArgs e)
        {
            GridEXCustomGroup    customGroup = new GridEXCustomGroup();
            GridEXCustomGroupRow groupRow;

            groupRow = new GridEXCustomGroupRow("Owner", this.gridEX1.RootTable.Columns["ContactTitle"], "Owner");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            groupRow               = new GridEXCustomGroupRow("Other");
            groupRow.Condition     = new GridEXFilterCondition(gridEX1.RootTable.Columns["ContactTitle"], ConditionOperator.NotEqual, "Owner");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            this.gridEX1.RootTable.Groups.Clear();
            GridEXGroup group = new GridEXGroup(customGroup);

            group.GroupPrefix   = "Contact Title:";
            group.HeaderCaption = "Contact Title";
            this.gridEX1.RootTable.Groups.Add(group);
            this.gridEX1.GetRow(0).Expanded = true;
        }
Exemple #20
0
		private bool ValidateGroup(GridEXGroup group)
		{
			if (group == null)
			{
				return true;
			}

			if (group.CustomGroup != null)
			{
				return ValidateCustomGroup(group.CustomGroup);
			}
			if (group.Column != null)
			{
				return true;
			}
			else
			{
				MessageBox.Show("Select a field for the group or remove the group", MainQD.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			}

			return false;
		}
        private void button1_Click(object sender, EventArgs e)
        {
            GridEXCustomGroup customGroup = new GridEXCustomGroup();

            GridEXCustomGroupRow groupRow;

            groupRow = new GridEXCustomGroupRow("US Customers", this.gridEX1.RootTable.Columns["Country"], "USA");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            groupRow               = new GridEXCustomGroupRow("Foreign Customers");
            groupRow.Condition     = new GridEXFilterCondition(gridEX1.RootTable.Columns["Country"], ConditionOperator.NotEqual, "USA");
            groupRow.ShowWhenEmpty = true;
            customGroup.GroupRows.Add(groupRow);

            this.gridEX1.RootTable.Groups.Clear();
            GridEXGroup group = new GridEXGroup(customGroup);

            group.HeaderCaption = "US and foreign customers";
            this.gridEX1.RootTable.Groups.Add(group);
            this.gridEX1.GetRow(0).Expanded = true;
        }
Exemple #22
0
		private bool CreateGroups()
		{
            try
            {
                if (groupCollection != null)
                {
                    this.Table.Groups.Clear();

                    if (groupCollection.Count > 0)
                    {
                        GridEXGroup[] groups = new GridEXGroup[groupCollection.Count];
                        this.groupCollection.CopyTo(groups);
                        this.Table.Groups.AddRange(groups);
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message, MainQD.MessageCaption, MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }
            return true;
		}
Exemple #23
0
		private void grdGroupList_FormattingRow(object sender, Janus.Windows.GridEX.RowLoadEventArgs e)
		{
			if (e.Row.Cells.Count > 0)
			{
				if (e.Row.Cells["HeaderCaption"].Text.Length == 0)
				{
					e.Row.Cells["HeaderCaption"].Text = "New group";
				}
				GridEXGroup group = (GridEXGroup)e.Row.DataRow;
				if (group.CustomGroup != null)
				{
					if (group.CustomGroup.CustomGroupType == CustomGroupType.CompositeColumns)
					{
						e.Row.Cells["HeaderCaption"].ImageIndex = 7;
					}
					else
					{
						e.Row.Cells["HeaderCaption"].ImageIndex = 1;

					}
				}
				else
				{
					if (group.Column != null)
					{
						e.Row.Cells["HeaderCaption"].ImageIndex = 3;
					}
					else
					{
						e.Row.Cells["HeaderCaption"].ImageIndex = 4;
					}

				}

			}

		}
        private void CauHinh()
        {
            cmdHuyDonThuoc.Visible = PropertyLib._HisDuocProperties.HuyXacNhan;

            dtNgayPhatThuoc.Enabled = PropertyLib._HisDuocProperties.ChoPhepChinhNgayDuyet;

            grdPresDetail.RootTable.Groups.Clear();
            if (PropertyLib._ThamKhamProperties.Hienthinhomthuoc)
            {
                GridEXColumn gridExColumn = grdPresDetail.RootTable.Columns["ma_loaithuoc"];
                var gridExGroup = new GridEXGroup(gridExColumn);
                gridExGroup.GroupPrefix = "Loại thuốc: ";
                grdPresDetail.RootTable.Groups.Add(gridExGroup);
            }
        }
        private void btnSearchModification_Click(object sender, EventArgs e)
        {
            try
            {
                string strTestTypeID = "";
                if (Utility.Int32Dbnull(cboTestType.SelectedValue) > 0)
                    strTestTypeID = Utility.sDbnull(cboTestType.SelectedValue);
                else
                {
                    foreach (DataRow row in dtTestType.Rows)
                    {
                        strTestTypeID += Utility.sDbnull(row["TestType_ID"]) + ",";
                    }
                    if (strTestTypeID.EndsWith(",")) strTestTypeID = strTestTypeID.Remove(strTestTypeID.Length - 1);
                }

                dtResultModification =
                    SPs.SpGetResultForUpdatePatientInfo(dtpDateFrom.Value.Date,
                                                        dtpDateTo.Value.Date.AddDays(1).AddSeconds(-1),
                                                        strTestTypeID, Utility.Int32Dbnull(cboDevice.SelectedValue)).
                        GetDataSet().Tables[0];

                if (dtResultModification.Columns.Contains("Patient_InPut_Method"))
                {
                    int count = (from dr in dtResultModification.AsEnumerable()
                                 where (dr.Field<string>("Patient_InPut_Method") == ("Auto Generate"))
                                 select dr).Count();
                    grdTestInfoModification.RootTable.Groups.Clear();
                    if (count > 0)
                    {
                        GridEXGroup exGroup = new GridEXGroup();
                        exGroup.Column = grdTestInfoModification.RootTable.Columns["Patient_InPut_Method"];
                        exGroup.GroupPrefix = "";
                        exGroup.SortOrder = SortOrder.Descending;
                        grdTestInfoModification.RootTable.Groups.Add(exGroup);
                    }
                }

                grdTestInfoModification.DataSource = dtResultModification;
                grdTestInfoModification.Focus();
                grdTestInfoModification.MoveFirst();
            }
            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
        private void BwRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            try
            {

                {

                    {
                        txtMessageDisplay.Text = string.Format("Tìm thấy {0} bệnh nhân !", mv_DTPatientInfor.Rows.Count);
                        rbtPrint_Checked_Changed(sender, new EventArgs());
                        grdPatients.DataSource = mv_DTPatientInfor;
                        ckbHasResult_CheckedChanged(sender, new EventArgs());
                        grdPatients_SelectionChanged(sender, new EventArgs());
                        grdPatients.SelectionChanged += grdPatients_SelectionChanged;

                        progressBar.Style = ProgressBarStyle.Blocks;
                        progressBar.Visible = false;

                        if (mv_DTPatientInfor.Columns.Contains("AutoGeneratePatient"))
                        {
                            int count = (from dr in mv_DTPatientInfor.AsEnumerable()
                                         where (dr.Field<string>("AutoGeneratePatient") == ("Auto Generate"))
                                         select dr).Count();
                            if (count == 0)
                                grdPatients.RootTable.Groups.Clear();
                            else if (grdPatients.RootTable.Groups.Count == 0)
                            {
                                GridEXGroup exGroup = new GridEXGroup();
                                exGroup.Column = grdPatients.RootTable.Columns["AutoGeneratePatient"];
                                exGroup.GroupPrefix = "";
                                exGroup.SortOrder = SortOrder.Descending;
                                grdPatients.RootTable.Groups.Add(exGroup);
                            }
                        }
                        grdPatients.Focus();
                        grdPatients.MoveFirst();
                    }
                }
            }

            catch (Exception ex)
            {
                Utility.ShowMsg(ex.Message);
            }
        }
 private void chkHienthithuoctheonhom_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         PropertyLib._ThamKhamProperties.Hienthinhomthuoc = this.chkHienthithuoctheonhom.Checked;
         PropertyLib.SaveProperty(PropertyLib._ThamKhamProperties);
         this.grdPresDetail.RootTable.Groups.Clear();
         if (this.chkHienthithuoctheonhom.Checked)
         {
             GridEXColumn column = this.grdPresDetail.RootTable.Columns["ma_loaithuoc"];
             GridEXGroup group = new GridEXGroup(column)
             {
                 GroupPrefix = "Loại thuốc: "
             };
             this.grdPresDetail.RootTable.Groups.Add(group);
         }
     }
     catch
     {
     }
 }
 private void frm_KE_DONTHUOC_BN_NEW_Load(object sender, EventArgs e)
 {
     try
     {
         try
         {
             cboPatientSex.SelectedIndex = 0;
             this.AutoloadSaveAndPrintConfig();
             this.BindDoctorAssignInfo();
             this.GetStockRelatedToDoctor();
             this.LoadLaserPrinters();
             this.txtCachDung.Init();
             this.GetData();
             this.GetDataPresDetail();
             this.txtChanDoan.Init();
             m_dtqheCamchidinhChungphieu = new Select().From(QheCamchidinhChungphieu.Schema).Where(QheCamchidinhChungphieu.Columns.Loai).IsEqualTo(1).ExecuteDataSet().Tables[0];
             bool gridView = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KEDONTHUOC_SUDUNGLUOI", "0", true), 0) == 1;
             if (!gridView)
             {
                 gridView = PropertyLib._AppProperties.GridView;
             }
             this.txtdrug.GridView = gridView;
             this.isLoaded = true;
             this.AllowTextChanged = true;
             this.blnHasLoaded = true;
             if (this.dtStockList.Select(TDmucKho.Columns.IdKho + "= " + globalVariables.KHOKEDON).Length > 0)
             {
                 this.cboStock.SelectedIndex = Utility.GetSelectedIndex(this.cboStock, globalVariables.KHOKEDON.ToString());
                 this.cboStock_SelectedIndexChanged(this.cboStock, new EventArgs());
             }
             else
             {
                 this.cboStock.SelectedIndex = -1;
             }
             if (this.cboStock.Items.Count == 0)
             {
                 Utility.ShowMsg(string.Format("Bệnh nhân {0} thuộc đối tượng {1} chưa Có kho thuốc để kê đơn", this.txtTEN_BN.Text.Trim(), this.txtObjectName.Text.Trim()));
                 base.Close();
             }
             this.grdPresDetail.RootTable.Groups.Clear();
             if (this.chkHienthithuoctheonhom.Checked)
             {
                 GridEXColumn column = this.grdPresDetail.RootTable.Columns["ma_loaithuoc"];
                 GridEXGroup group = new GridEXGroup(column)
                 {
                     GroupPrefix = "Loại thuốc: "
                 };
                 this.grdPresDetail.RootTable.Groups.Add(group);
             }
             this.txtTEN_BN.Focus();
             this.txtTEN_BN.Select();
         }
         catch
         {
         }
     }
     finally
     {
     }
 }
 void UpdateGroup()
 {
     try
     {
         if (m_dtReport == null || m_dtReport.Columns.Count <= 0) return;
         var counts = m_dtReport.AsEnumerable().GroupBy(x => x.Field<string>("ten_loaithuoc"))
             .Select(g => new { g.Key, Count = g.Count() });
         if (chkTheoNhomThuoc.Checked)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loaithuoc"];
                 var gridExGroup = new GridEXGroup(gridExColumn);
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loaithuoc"];
             var gridExGroup = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }
 void chkHienthithuoctheonhom_CheckedChanged(object sender, EventArgs e)
 {
     try
     {
         PropertyLib._ThamKhamProperties.Hienthinhomthuoc = chkHienthithuoctheonhom.Checked;
         PropertyLib.SaveProperty(PropertyLib._ThamKhamProperties);
         grdPresDetail.RootTable.Groups.Clear();
         if (chkHienthithuoctheonhom.Checked)
         {
             GridEXColumn gridExColumn = grdPresDetail.RootTable.Columns["ma_loaithuoc"];
             var gridExGroup = new GridEXGroup(gridExColumn);
             gridExGroup.GroupPrefix = "Loại thuốc: ";
             // if(grdList.RootTable.Groups)
             grdPresDetail.RootTable.Groups.Add(gridExGroup);
         }
     }
     catch
     {
     }
 }
        private void frm_KCB_KeVacxin_Tiemchung_Load(object sender, EventArgs e)
        {
            try
            {
                chkAdditional.Checked = forced2Add;
                chkAdditional.Visible = !forced2Add && objLuotkham.TrangthaiNoitru>0;

                txtptramdauthe.Visible = objLuotkham.IdLoaidoituongKcb == 0;
                lblphantramdauthe.Visible = objLuotkham.IdLoaidoituongKcb == 0;
                pnlChandoanNgoaitru.Visible = objLuotkham.TrangthaiNoitru <= 0;
                m_dtDulieuTiemchungBN = KCB_KEDONTHUOC.KcbThamkhamDulieuTiemchungTheoBenhnhan(objLuotkham.IdBenhnhan);
                m_dtqheCamchidinhChungphieu = new Select().From(QheCamchidinhChungphieu.Schema).Where(QheCamchidinhChungphieu.Columns.Loai).IsEqualTo(1).ExecuteDataSet().Tables[0];
                BHYT_PTRAM_TRAITUYENNOITRU = Utility.DecimaltoDbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("BHYT_PTRAM_TRAITUYENNOITRU", "0", false), 0m);
                m_intKieudonthuoc = KIEU_THUOC_VT == "THUOC" ? 2 : 1;
                txtCachDung.LOAI_DANHMUC = KIEU_THUOC_VT == "THUOC" ? "CDDT" :"CHIDAN_KEVATTU";
                this.AutoloadSaveAndPrintConfig();
                this.LayDanhsachBSKham();
                this.LayDanhsachKhoVacxin();
                this.LoadLaserPrinters();
                this.txtCachDung.Init();
                txtLydotiem.Init();
                LayCongtiem();
                this.GetData();
                this.GetDataPresDetail();
                this.txtChanDoan.Init();
                this.LoadBenh();
                mnuThuoctutuc.Visible = THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb);
                chkTutuc.Visible = THU_VIEN_CHUNG.IsBaoHiem(objLuotkham.IdLoaidoituongKcb);
                if (!chkTutuc.Visible) chkTutuc.Checked = false;
                this.MaDoiTuong = objLuotkham.MaDoituongKcb;
                if (this._KcbChandoanKetluan == null)
                {
                    this._KcbChandoanKetluan = new KcbChandoanKetluan();
                    this._KcbChandoanKetluan.IsNew = true;
                }
                else
                {
                    this._KcbChandoanKetluan.IsNew = false;
                    this._KcbChandoanKetluan.MarkOld();
                }
                bool gridView = Utility.Int32Dbnull(THU_VIEN_CHUNG.Laygiatrithamsohethong("KEDONTHUOC_SUDUNGLUOI", "0", true), 0) == 1;
                if (!gridView)
                {
                    gridView = PropertyLib._AppProperties.GridView;
                }
                this.txtdrug.GridView = gridView;
                this.isLoaded = true;
                this.AllowTextChanged = true;
                this.blnHasLoaded = true;
                if (KIEU_THUOC_VT == "THUOC")
                    globalVariables.KHOKEDON = PropertyLib._ThamKhamProperties.IDKho;
                else
                    globalVariables.KHOKEDON = PropertyLib._ThamKhamProperties.IDKhoVT;

                if (this.dtStockList.Select(TDmucKho.Columns.IdKho + "= " + globalVariables.KHOKEDON).Length > 0)
                {
                    this.cboStock.SelectedIndex = Utility.GetSelectedIndex(this.cboStock, globalVariables.KHOKEDON.ToString());
                    this.cboStock_SelectedIndexChanged(this.cboStock, new EventArgs());
                }
                else
                {
                    this.cboStock.SelectedIndex = -1;
                }
                if (this.cboStock.Items.Count == 0)
                {
                    Utility.ShowMsg(string.Format("Bệnh nhân {0} thuộc đối tượng {1} chưa Có kho " + (KIEU_THUOC_VT == "THUOC" ? "thuốc" : "vật tư") + " để kê đơn", this.txtPatientName.Text.Trim(), this.txtObjectName.Text.Trim()));
                    base.Close();
                }
                this.grdPresDetail.RootTable.Groups.Clear();
                if (this.chkHienthithuoctheonhom.Checked)
                {
                    GridEXColumn column = this.grdPresDetail.RootTable.Columns["ma_loaithuoc"];
                    GridEXGroup group = new GridEXGroup(column)
                    {
                        GroupPrefix = "Loại " + KIEU_THUOC_VT == "THUOC" ? "thuốc" : "vật tư" + " : "
                    };
                    this.grdPresDetail.RootTable.Groups.Add(group);
                }
                this.txtdrug.Focus();
                this.txtdrug.Select();
            }
            catch(Exception ex)
            {
                Utility.CatchException(ex);
            }
            finally
            {
            }
        }
 void UpdateGroup()
 {
     try
     {
         if (!Utility.isValidGrid(grdLuotkham)) return;
         var counts =((DataView) grdLuotkham.DataSource).Table.AsEnumerable().GroupBy(x => x.Field<string>("ma_doituong_kcb"))
             .Select(g => new { g.Key, Count = g.Count() });
         if (counts.Count() >= 2)
         {
             if (grdLuotkham.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
                 var gridExGroup = new GridEXGroup(gridExColumn);
                 gridExGroup.GroupPrefix = "Nhóm đối tượng KCB: ";
                 grdLuotkham.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdLuotkham.RootTable.Columns["ma_doituong_kcb"];
             var gridExGroup = new GridEXGroup(gridExColumn);
             grdLuotkham.RootTable.Groups.Clear();
         }
         grdLuotkham.UpdateData();
         grdLuotkham.Refresh();
     }
     catch
     {
     }
 }
 void UpdateGroup()
 {
     try
     {
         var counts = m_dtPatient.AsEnumerable().GroupBy(x => x.Field<string>("ma_doituong_kcb"))
             .Select(g => new { g.Key, Count = g.Count() });
         if (counts.Count() >= 2)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
                 var gridExGroup = new GridEXGroup(gridExColumn);
                 gridExGroup.GroupPrefix = "Nhóm đối tượng KCB: ";
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["ma_doituong_kcb"];
             var gridExGroup = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }
 void UpdateGroup()
 {
     try
     {
         var counts = m_dtData.AsEnumerable().GroupBy(x => x.Field<string>("ten_loainhom"))
             .Select(g => new { g.Key, Count = g.Count() });
         if (counts.Count() >= 2)
         {
             if (grdList.RootTable.Groups.Count <= 0)
             {
                 GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loainhom"];
                 var gridExGroup = new GridEXGroup(gridExColumn);
                 gridExGroup.GroupPrefix = "";
                 grdList.RootTable.Groups.Add(gridExGroup);
             }
         }
         else
         {
             GridEXColumn gridExColumn = grdList.RootTable.Columns["ten_loainhom"];
             var gridExGroup = new GridEXGroup(gridExColumn);
             grdList.RootTable.Groups.Clear();
         }
         grdList.UpdateData();
         grdList.Refresh();
     }
     catch
     {
     }
 }