private void rptBcngay_Load(object sender, System.EventArgs e) { manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (ttb.bQuanlynguon(i_nhom)) { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } nhomcc.DisplayMember = "TEN"; nhomcc.ValueMember = "ID"; if (ttb.bQuanlynhomcc(i_nhom)) { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where nhom=" + i_nhom + " order by stt").Tables[0]; } else { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dt = ttb.get_data("select * from ttb_dmbd where nhom=" + i_nhom + " order by id").Tables[0]; sql = "select * from ttb_dmkho where nhom=" + i_nhom; if (s_makho != "") { sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")"; } sql += " order by stt"; dtdmkho = ttb.get_data(sql).Tables[0]; kho.DisplayMember = "TEN"; kho.ValueMember = "ID"; kho.DataSource = dtdmkho; dsngay.ReadXml("..\\..\\..\\xml\\ttb_tsngay.xml"); }
private void rptXuatkho_Load(object sender, System.EventArgs e) { kho.DisplayMember = "TEN"; kho.ValueMember = "ID"; sql = "select * from ttb_dmkho where nhom=" + i_nhom; if (s_kho != "") { sql += " and id in (" + s_kho.Substring(0, s_kho.Length - 1) + ")"; } sql += " order by stt"; dtdmkho = ttb.get_data(sql).Tables[0]; kho.DataSource = dtdmkho; dtdmnhom = ttb.get_data("select * from ttb_dmnhom where stt<>0 and nhom=" + i_nhom + " order by stt").Tables[0]; manhom.DisplayMember = "TEN"; manhom.ValueMember = "ID"; manhom.DataSource = dtdmnhom; manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (ttb.bQuanlynguon(i_nhom)) { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } nhomcc.DisplayMember = "TEN"; nhomcc.ValueMember = "ID"; if (ttb.bQuanlynhomcc(i_nhom)) { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where nhom=" + i_nhom + " order by stt").Tables[0]; } else { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } sql = "select a.*, b.stt tt, b.ten nhombd, a.maloai idnn, f.ten noingoai from ttb_dmbd a, ttb_dmnhom b, ttb_dmhang e, ttb_dmloai f"; sql += " where a.manhom=b.id and a.mahang=e.id and a.maloai=f.id and a.nhom=" + i_nhom + " order by a.id"; dt = ttb.get_data(sql).Tables[0]; ds.ReadXml("..\\..\\..\\xml\\ttb_dasudung.xml"); dsxml.ReadXml("..\\..\\..\\xml\\ttb_dasudung.xml"); }
private void rptBctheonhom_Load(object sender, System.EventArgs e) { ds.ReadXml("..\\..\\..\\xml\\ttb_bctheoloai.xml"); dsxml.ReadXml("..\\..\\..\\xml\\ttb_bctheoloai.xml"); dtdmnhom = ttb.get_data("select * from ttb_dmnhom where stt<>0 and nhom=" + i_nhom + " order by stt").Tables[0]; manguon.DisplayMember = "TEN"; manguon.ValueMember = "ID"; if (ttb.bQuanlynguon(i_nhom)) { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where nhom=" + i_nhom + " order by stt").Tables[0]; } else { manguon.DataSource = ttb.get_data("select * from ttb_dmnguon where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } nhomcc.DisplayMember = "TEN"; nhomcc.ValueMember = "ID"; if (ttb.bQuanlynhomcc(i_nhom)) { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where nhom=" + i_nhom + " order by stt").Tables[0]; } else { nhomcc.DataSource = ttb.get_data("select * from ttb_nhomcc where id=0 or nhom=" + i_nhom + " order by stt").Tables[0]; } dt = ttb.get_data("select a.*,b.ten tennhom from ttb_dmbd a,ttb_dmnhom b where a.manhom=b.id and a.nhom=" + i_nhom + " order by a.id").Tables[0]; sql = "select * from ttb_dmkho where nhom=" + i_nhom; if (s_makho != "") { sql += " and id in (" + s_makho.Substring(0, s_makho.Length - 1) + ")"; } sql += " order by stt"; dtdmkho = ttb.get_data(sql).Tables[0]; kho.DisplayMember = "TEN"; kho.ValueMember = "ID"; kho.DataSource = dtdmkho; manhom.DisplayMember = "TEN"; manhom.ValueMember = "ID"; manhom.DataSource = dtdmnhom; s_manhom = ttb.Thongso("manhom").Trim(); }
private void AddGridTableStyle() { DataGridTableStyle ts = new DataGridTableStyle(); ts.MappingName = dtct.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; DataGridTextBoxColumn TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "stt"; TextCol.HeaderText = ""; TextCol.Width = 0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "doituong"; TextCol.HeaderText = ""; TextCol.Width = 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 = "ten"; TextCol.HeaderText = "Tên"; TextCol.Width = (bGiaban)?200:230; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tenhc"; TextCol.HeaderText = ""; TextCol.Width = 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 = "tenkho"; TextCol.HeaderText = "Kho xuất"; TextCol.Width = 70; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tennguon"; TextCol.HeaderText = "Nguồn"; TextCol.Width = (ttb.bQuanlynguon(i_nhom))?80:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tennhomcc"; TextCol.HeaderText = "Nhà cung cấp"; TextCol.Width = (ttb.bQuanlynhomcc(i_nhom))?90:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "handung"; TextCol.HeaderText = "Date"; TextCol.Width = (ttb.bQuanlyhandung(i_nhom))?30:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "losx"; TextCol.HeaderText = "Số hiệu"; TextCol.Width = (ttb.bQuanlylosx(i_nhom))?50:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "soluong"; TextCol.HeaderText = "Số lượng"; TextCol.Width = 70; TextCol.Format = "#,###,##0.00"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "dongia"; TextCol.HeaderText = "Đơn giá"; TextCol.Width = 80; TextCol.Format = "###,###,###,##0.000"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "sotien"; TextCol.HeaderText = "Số tiền"; TextCol.Width = 100; TextCol.Format = "###,###,###,##0.000"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "giaban"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.Format = "###,###,###,##0"; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }
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 = (ttb.bQuanlynguon(i_nhom))?80:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tennhomcc"; TextCol.HeaderText = "Nhóm cung cấp"; TextCol.Width = (ttb.bQuanlynhomcc(i_nhom))?90: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 = 200; 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 = "handung"; TextCol.HeaderText = "Date"; TextCol.Width = (ttb.bQuanlyhandung(i_nhom))?30:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "losx"; TextCol.HeaderText = "Số hiệu"; TextCol.Width = (ttb.bQuanlylosx(i_nhom))?50:0; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "giamua"; TextCol.HeaderText = "Đơn gía"; TextCol.Width = 80; TextCol.Format = format_dongia; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "tondau"; TextCol.HeaderText = "Tồn đầu"; TextCol.Width = 80; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "sttondau"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.Format = format_sotien; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "slnhap"; TextCol.HeaderText = "Nhập"; TextCol.Width = 80; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "stnhap"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.Format = format_sotien; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "slxuat"; TextCol.HeaderText = "Xuất"; TextCol.Width = 80; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "stxuat"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.Format = format_sotien; 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 = 80; TextCol.Format = format_soluong; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); TextCol = new DataGridTextBoxColumn(); TextCol.MappingName = "sttoncuoi"; TextCol.HeaderText = ""; TextCol.Width = 0; TextCol.Format = format_sotien; TextCol.Alignment = HorizontalAlignment.Right; ts.GridColumnStyles.Add(TextCol); dataGrid1.TableStyles.Add(ts); }