private void frmTT_pttt_thuoc_Load(object sender, System.EventArgs e) { user = m.user; dtdt = m.get_data("select * from " + user + ".d_doituong order by madoituong").Tables[0]; if (d.bQuanlynguon(i_nhom)) { dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dsdm.ReadXml("..//..//..//xml//d_dmbd.xml"); dsdm.Tables[0].Columns.Add("Chon", typeof(bool)); load_grid(); AddGridTableStyle(); this.disabledBackBrush = new SolidBrush(Color.FromArgb(255, 255, 192)); this.disabledTextBrush = new SolidBrush(Color.FromArgb(255, 0, 0)); this.alertBackBrush = new SolidBrush(SystemColors.HotTrack); this.alertFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Bold); this.alertTextBrush = new SolidBrush(Color.White); this.currentRowFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Regular); this.currentRowBackBrush = new SolidBrush(Color.FromArgb(0, 255, 255)); ds.ReadXml("..//..//..//xml//m_pttt_thuoc.xml"); AddGridTableStyle1(); load_chitiet(); }
private void rptXuat_khoa_Load(object sender, System.EventArgs e) { user = d.user; stime = "'" + d.f_ngay + "'"; i_dongia = d.d_dongia_le(i_nhom); format_soluong = d.format_soluong(i_nhom); sql = "select a.*, b.stt as sttnhom, b.ten as tennhom from " + user + ".d_dmbd a, " + user + ".d_dmnhom b"; sql += " where a.manhom=b.id and a.nhom=" + i_nhom + " order by a.id"; dt = d.get_data(sql).Tables[0]; manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (d.bQuanlynguon(i_nhom)) { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } sql = "select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom; if (s_kho != "") { sql += " and id in (" + s_kho.Substring(0, s_kho.Length - 1) + ")"; } sql += " order by stt"; dtdmkho = d.get_data(sql).Tables[0]; makho.DataSource = dtdmkho; makho.DisplayMember = "TEN"; makho.ValueMember = "ID"; }
private void frmPttt_thuoc_Load(object sender, System.EventArgs e) { // DataTable dt=d.get_data("select id from d_duyet where nhom="+i_nhom+" and to_char(ngay,'dd/mm/yyyy')='"+ngay+"'"+" and loai="+loai+" and phieu="+phieu+" and makhoa="+makp).Tables[0]; // if (dt.Rows.Count!=0) l_duyet=long.Parse(dt.Rows[0][0].ToString()); // else l_duyet=0; dtdt = m.get_data("select * from d_doituong order by madoituong").Tables[0]; if (d.bQuanlynguon(i_nhom)) { dtnguon = d.get_data("select * from d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { dtnguon = d.get_data("select * from d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dsdm.ReadXml("..\\..\\..\\xml\\d_tutructh.xml"); dsdm.Tables[0].Columns.Add("Chon", typeof(bool)); load_grid(); AddGridTableStyle(); this.disabledBackBrush = new SolidBrush(Color.FromArgb(255, 255, 192)); this.disabledTextBrush = new SolidBrush(Color.FromArgb(255, 0, 0)); this.alertBackBrush = new SolidBrush(SystemColors.HotTrack); this.alertFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Bold); this.alertTextBrush = new SolidBrush(Color.White); this.currentRowFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Regular); this.currentRowBackBrush = new SolidBrush(Color.FromArgb(0, 255, 255)); ds.ReadXml("..\\..\\..\\xml\\m_pttt_thuoc.xml"); AddGridTableStyle1(); load_chitiet(); }
private void frmPttt_thuoc_Load(object sender, System.EventArgs e) { user = d.user; dtdt = m.get_data("select * from " + user + ".d_doituong order by madoituong").Tables[0]; if (d.bQuanlynguon(i_nhom)) { dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { dtnguon = d.get_data("select * from " + user + ".d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dsdm.ReadXml("..//..//..//xml//d_tutructh.xml"); dsdm.Tables[0].Columns.Add("Chon", typeof(bool)); if (mapt != "") { foreach (DataRow r in m.get_data("select mavp from " + user + ".dmpttt where mapt='" + mapt + "'").Tables[0].Rows) { l_mavp = decimal.Parse(r["mavp"].ToString()); } } load_grid(); AddGridTableStyle(); f_soluong = d.format_soluong(i_nhom); this.disabledBackBrush = new SolidBrush(Color.FromArgb(255, 255, 192)); this.disabledTextBrush = new SolidBrush(Color.FromArgb(255, 0, 0)); this.alertBackBrush = new SolidBrush(SystemColors.HotTrack); this.alertFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Bold); this.alertTextBrush = new SolidBrush(Color.White); this.currentRowFont = new Font(this.dataGrid1.Font.Name, this.dataGrid1.Font.Size, FontStyle.Regular); this.currentRowBackBrush = new SolidBrush(Color.FromArgb(0, 255, 255)); ds.ReadXml("..//..//..//xml//m_pttt_thuoc.xml"); AddGridTableStyle1(); load_chitiet(); }
private void rptChiphidon_Load(object sender, System.EventArgs e) { user = d.user; stime = "'" + d.f_ngay + "'"; i_songay = d.Ngay_toa_bhyt(i_nhom); psothe.Enabled = d.sothe_doituong(i_madoituong); s_thetrongtinh = d.thetrongtinh(i_nhom); s_thetrongtinh_vitri = d.thetrongtinh_vitri(i_nhom); bCongkham = d.bcongkham_bhyt(i_nhom); bSotien = d.bSotien_bhyt(i_nhom); manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (d.bQuanlynguon(i_nhom)) { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dt = d.get_data("select * from " + user + ".d_dmbd where nhom=" + i_nhom + " order by id").Tables[0]; sql = "select * from " + user + ".d_dmkho where hide=0 and nhom=" + i_nhom; if (s_makho != "") { sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")"; } sql += " order by stt"; dtdmkho = d.get_data(sql).Tables[0]; kho.DataSource = dtdmkho; kho.DisplayMember = "TEN"; kho.ValueMember = "ID"; sql = "select * from " + user + ".doituong"; if (i_madoituong == 1) { sql += " where madoituong=1"; } else { sql += " where madoituong<>1"; } sql += " order by madoituong"; madoituong.DisplayMember = "DOITUONG"; madoituong.ValueMember = "MADOITUONG"; madoituong.DataSource = d.get_data(sql).Tables[0]; dc = new DataColumn(); dc.ColumnName = "id"; dc.DataType = Type.GetType("System.Decimal"); dtnhomvp.Columns.Add(dc); dc = new DataColumn(); dc.ColumnName = "stt"; dc.DataType = Type.GetType("System.Decimal"); dtnhomvp.Columns.Add(dc); dc = new DataColumn(); dc.ColumnName = "ten"; dc.DataType = Type.GetType("System.String"); dtnhomvp.Columns.Add(dc); dc = new DataColumn(); dc.ColumnName = "tc"; dc.DataType = Type.GetType("System.Decimal"); dtnhomvp.Columns.Add(dc); }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dt.TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.RowHeaderWidth = 10; DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tennguon"; TextCol.HeaderText = "Nguồn"; TextCol.Width = (d.bQuanlynguon(i_nhom) || i_loai == 2)?80:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "ma"; TextCol.HeaderText = "Mã số"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenbd"; TextCol.HeaderText = "Tên"; TextCol.Width = (d.bHoatchat && i_loai == 1)?200:270; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenhc"; TextCol.HeaderText = "Hoạt chất"; TextCol.Width = (d.bHoatchat && i_loai == 1)?200:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "dang"; TextCol.HeaderText = "ĐVT"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tondau"; TextCol.HeaderText = "Tồn đầu"; TextCol.Width = 72; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "slnhap"; TextCol.HeaderText = "Nhập"; TextCol.Width = 72; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "slxuat"; TextCol.HeaderText = "Xuất"; TextCol.Width = 72; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "toncuoi"; TextCol.HeaderText = "Tồn cuối"; TextCol.Width = 72; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenkho"; TextCol.HeaderText = "Kho"; TextCol.Width = 100; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
private void AddGridTableStyle() { DataGridColoredTextBoxColumn TextCol; delegateGetColorRowCol de = new delegateGetColorRowCol(MyGetColorRowCol); DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dt.TableName; ts.AlternatingBackColor = Color.Beige; ts.BackColor = Color.GhostWhite; ts.ForeColor = Color.MidnightBlue; ts.GridLineColor = Color.RoyalBlue; ts.HeaderBackColor = Color.MidnightBlue; ts.HeaderForeColor = Color.Lavender; ts.SelectionBackColor = Color.Teal; ts.SelectionForeColor = Color.PaleGreen; ts.ReadOnly = false; ts.RowHeaderWidth = 5; TextCol = new DataGridColoredTextBoxColumn(de, 0); TextCol.MappingName = "tennguon"; TextCol.HeaderText = "Nguồn"; TextCol.Width = (d.bQuanlynguon(i_nhom))?80:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 1); TextCol.MappingName = "ma"; TextCol.HeaderText = "Mã số"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 2); TextCol.MappingName = "ten"; TextCol.HeaderText = "Tên"; TextCol.Width = (d.bHoatchat)?200:270; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 3); TextCol.MappingName = "tenhc"; TextCol.HeaderText = "Hoạt chất"; TextCol.Width = (d.bHoatchat)?200:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 4); TextCol.MappingName = "dang"; TextCol.HeaderText = "ĐVT"; TextCol.Width = 50; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridColoredTextBoxColumn(de, 5); TextCol.MappingName = "soluong"; TextCol.HeaderText = "Tồn kho"; TextCol.Width = 60; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
private void frmKhoacstt_Load(object sender, System.EventArgs e) { s_makho = ""; user = d.user; stime = "'" + d.f_ngay + "'"; foreach (DataRow r in d.get_data("select kho from " + user + ".d_dmphieu where id=2").Tables[0].Rows) { s_makho = r["kho"].ToString(); } makho.DisplayMember = "TEN"; makho.ValueMember = "ID"; string sql = "select * from " + user + ".d_dmkho where hide=0 and loai=" + i_loai; if (i_loai == 1) { sql += " and nhom=" + i_nhom; if (s_makho != "") { sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")"; } } else { sql += " and nhom<>" + i_nhom; if (s_nhomkho != "") { sql += " and nhom in (" + s_nhomkho.Substring(0, s_nhomkho.Length - 1) + ")"; } } sql += " order by stt"; dtdmkho = d.get_data(sql).Tables[0]; makho.DataSource = dtdmkho; if (makho.Items.Count > 0) { makho.SelectedIndex = 0; } makp.DisplayMember = "TEN"; makp.ValueMember = "ID"; sql = "select * from " + user + ".d_duockp where nhom like '%" + i_nhom.ToString() + ",%'"; if (s_makp != "") { string s = s_makp.Replace(",", "','"); sql += " and makp in ('" + s.Substring(0, s.Length - 3) + "')"; } sql += " order by stt"; dtkp = d.get_data(sql).Tables[0]; makp.DataSource = dtkp; if (makp.Items.Count > 0) { makp.SelectedIndex = 0; } ds.ReadXml("..//..//..//xml//d_khoacstt.xml"); dsxml.ReadXml("..//..//..//xml//d_khoacstt.xml"); format_soluong = d.format_soluong(i_nhom); sql = "select a.*, b.stt as sttnhom, b.ten as tennhom,c.ten as tenhang,d.ten as nuocsx from " + user + ".d_dmbd a, " + user + ".d_dmnhom b," + user + ".d_dmhang c," + user + ".d_dmnuoc d"; sql += " where a.manhom=b.id and a.mahang=c.id and a.manuoc=d.id and a.nhom=" + i_nhom + " order by a.id"; dt = d.get_data(sql).Tables[0]; manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (d.bQuanlynguon(i_nhom)) { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = d.get_data("select * from " + user + ".d_dmnguon where nhom=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } }