private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e) { try { if (hienthi == null) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } ///////////////////////////////MRK FIX List <Entities.BCThue> tem0 = new List <Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthi) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthi; dtgvhienthi.DataSource = tem0.ToArray(); //dtgvhienthi.DataSource = hienthi; } catch { } finally { fix(); } }
private void tsslexcel_Click(object sender, EventArgs e) { this.Enabled = false; try { saveFileDialog1.Filter = "Excel |*.xls"; saveFileDialog1.FileName = ""; if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ///////////////////////////////MRK FIX Hiển thị List <Entities.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList(); //Entities.BCThue dau = new Entities.BCThue(); //dau = tem0[0]; Entities.BCThue cuoi = new Entities.BCThue(); cuoi = tem0[tem0.Count - 1]; //tem0.Remove(dau); tem0.Remove(cuoi); //////////////////////////////////////////////// hienthibaocao = tem0.ToArray(); //hienthibaocao = (Entities.BCThue[])dtgvhienthi.DataSource; frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau, saveFileDialog1.FileName, "Excel"); } } catch { } finally { this.Enabled = true; } }
private void tsslchitiet_Click(object sender, EventArgs e) { this.Enabled = false; try { ///////////////////////////////MRK FIX Hiển thị List <Entities.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList(); //Entities.BCThue dau = new Entities.BCThue(); //dau = tem0[0]; Entities.BCThue cuoi = new Entities.BCThue(); cuoi = tem0[tem0.Count - 1]; //tem0.Remove(dau); tem0.Remove(cuoi); //////////////////////////////////////////////// hienthibaocao = tem0.ToArray(); //hienthibaocao = (Entities.BCThue[])dtgvhienthi.DataSource; frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau); a.ShowDialog(); } catch { } finally { this.Enabled = true; } }
public void TongTienNhanVien() { try { List<Entities.HangHoa> hh = new List<Entities.HangHoa>(); foreach (Entities.HangHoa item in hanghoa) { if (item.MaThueGiaTriGiaTang == mathue) { hh.Add(item); } } giatrithue = 0; foreach (Entities.Thue item1 in thue) { if (item1.MaThue == mathue) { giatrithue = int.Parse(item1.GiaTriThue); break; } } List<Entities.BCThue> temp = new List<Entities.BCThue>(); foreach (Entities.HangHoa item in hh) { double tongthue = 0; foreach (Entities.ChiTietHDBanHang item1 in chitiethdbanhang) { if (item.MaHangHoa == item1.MaHangHoa) { double cktm = 0; double dongia = 0; foreach (Entities.HDBanHang item2 in hdbanhang) { if (item2.NgayBan.Date <= sau.Date && item2.NgayBan.Date >= truoc.Date) { if (item1.MaHDBanHang == item2.MaHDBanHang) { if (item2.LoaiHoaDon) { dongia = double.Parse(item.GiaBanLe) - ((double.Parse(item.GiaBanLe) * (item1.PhanTramChietKhau))) / 100; break; } else { dongia = double.Parse(item.GiaBanBuon) - ((double.Parse(item.GiaBanBuon) * (item1.PhanTramChietKhau))) / 100; break; } } } } tongthue += ((dongia * item1.SoLuong) * giatrithue) / 100; } } Entities.BCThue te = new Entities.BCThue(); te.DVT = item.TenDonViTinh; te.MaHangHoa = item.MaHangHoa; te.TenHangHoa = item.TenHangHoa; te.TongThue = tongthue; temp.Add(te); } hienthi = (Entities.BCThue[])temp.ToArray(); ///////////////////////////////MRK FIX List<Entities.BCThue> tem0 = new List<Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthi) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthi; dtgvhienthi.DataSource = tem0.ToArray(); if (hienthi.Length > 0) { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true; } else { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false; } } catch { } finally { fix(); } }
private void txttimkiem_TextChanged(object sender, EventArgs e) { try { if (rdbtimkiem3.Checked == true) { return; } if (txttimkiem.Text.Length == 0) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } int soluong = 0; if (hienthi != null) { if (rdbtimkiem1.Checked == true) { for (int i = 0; i < hienthi.Length; i++) { int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper()); if (kiemtra >= 0) { soluong++; } } if (soluong == 0) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } Entities.BCThue[] hienthitheoid = new Entities.BCThue[soluong]; soluong = 0; for (int i = 0; i < hienthi.Length; i++) { int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper()); if (kiemtra >= 0) { hienthitheoid[soluong] = hienthi[i]; soluong++; } } ///////////////////////////////MRK FIX List<Entities.BCThue> tem0 = new List<Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthitheoid) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthitheoid; dtgvhienthi.DataSource = tem0.ToArray(); } if (dtgvhienthi.RowCount > 0) { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true; } else { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false; } } } finally { fix(); } }
private void tsslWord_Click(object sender, EventArgs e) { this.Enabled = false; try { saveFileDialog1.Filter = "Word |*.doc"; saveFileDialog1.FileName = ""; if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK) { ///////////////////////////////MRK FIX Hiển thị List<Entities.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList(); //Entities.BCThue dau = new Entities.BCThue(); //dau = tem0[0]; Entities.BCThue cuoi = new Entities.BCThue(); cuoi = tem0[tem0.Count -1]; //tem0.Remove(dau); tem0.Remove(cuoi); //////////////////////////////////////////////// hienthibaocao = tem0.ToArray(); //hienthibaocao = (Entities.BCThue[])dtgvhienthi.DataSource; frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau, saveFileDialog1.FileName, "Word"); } } catch { } finally { this.Enabled = true; } }
private void tsslchitiet_Click(object sender, EventArgs e) { this.Enabled = false; try { ///////////////////////////////MRK FIX Hiển thị List<Entities.BCThue> tem0 = ((Entities.BCThue[])dtgvhienthi.DataSource).ToList(); //Entities.BCThue dau = new Entities.BCThue(); //dau = tem0[0]; Entities.BCThue cuoi = new Entities.BCThue(); cuoi = tem0[tem0.Count -1]; //tem0.Remove(dau); tem0.Remove(cuoi); //////////////////////////////////////////////// hienthibaocao = tem0.ToArray(); //hienthibaocao = (Entities.BCThue[])dtgvhienthi.DataSource; frmBaoCaorpt a = new frmBaoCaorpt(hienthibaocao, mathue, giatrithue, truoc, sau); a.ShowDialog(); } catch { } finally { this.Enabled = true; } }
private void rdbtimkiem3_CheckedChanged(object sender, EventArgs e) { try { if (hienthi == null) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } ///////////////////////////////MRK FIX List<Entities.BCThue> tem0 = new List<Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthi) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthi; dtgvhienthi.DataSource = tem0.ToArray(); //dtgvhienthi.DataSource = hienthi; } catch { } finally { fix(); } }
public void TongTienNhanVien() { try { List <Entities.HangHoa> hh = new List <Entities.HangHoa>(); foreach (Entities.HangHoa item in hanghoa) { if (item.MaThueGiaTriGiaTang == mathue) { hh.Add(item); } } giatrithue = 0; foreach (Entities.Thue item1 in thue) { if (item1.MaThue == mathue) { giatrithue = int.Parse(item1.GiaTriThue); break; } } List <Entities.BCThue> temp = new List <Entities.BCThue>(); foreach (Entities.HangHoa item in hh) { double tongthue = 0; foreach (Entities.ChiTietHDBanHang item1 in chitiethdbanhang) { if (item.MaHangHoa == item1.MaHangHoa) { double cktm = 0; double dongia = 0; foreach (Entities.HDBanHang item2 in hdbanhang) { if (item2.NgayBan.Date <= sau.Date && item2.NgayBan.Date >= truoc.Date) { if (item1.MaHDBanHang == item2.MaHDBanHang) { if (item2.LoaiHoaDon) { dongia = double.Parse(item.GiaBanLe) - ((double.Parse(item.GiaBanLe) * (item1.PhanTramChietKhau))) / 100; break; } else { dongia = double.Parse(item.GiaBanBuon) - ((double.Parse(item.GiaBanBuon) * (item1.PhanTramChietKhau))) / 100; break; } } } } tongthue += ((dongia * item1.SoLuong) * giatrithue) / 100; } } Entities.BCThue te = new Entities.BCThue(); te.DVT = item.TenDonViTinh; te.MaHangHoa = item.MaHangHoa; te.TenHangHoa = item.TenHangHoa; te.TongThue = tongthue; temp.Add(te); } hienthi = (Entities.BCThue[])temp.ToArray(); ///////////////////////////////MRK FIX List <Entities.BCThue> tem0 = new List <Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthi) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthi; dtgvhienthi.DataSource = tem0.ToArray(); if (hienthi.Length > 0) { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true; } else { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false; } } catch { } finally { fix(); } }
private void txttimkiem_TextChanged(object sender, EventArgs e) { try { if (rdbtimkiem3.Checked == true) { return; } if (txttimkiem.Text.Length == 0) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } int soluong = 0; if (hienthi != null) { if (rdbtimkiem1.Checked == true) { for (int i = 0; i < hienthi.Length; i++) { int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper()); if (kiemtra >= 0) { soluong++; } } if (soluong == 0) { dtgvhienthi.DataSource = new Entities.BCThue[0]; return; } Entities.BCThue[] hienthitheoid = new Entities.BCThue[soluong]; soluong = 0; for (int i = 0; i < hienthi.Length; i++) { int kiemtra = hienthi[i].MaHangHoa.ToString().ToUpper().IndexOf(txttimkiem.Text.ToUpper()); if (kiemtra >= 0) { hienthitheoid[soluong] = hienthi[i]; soluong++; } } ///////////////////////////////MRK FIX List <Entities.BCThue> tem0 = new List <Entities.BCThue>(); double tong0 = 0; foreach (Entities.BCThue item in hienthitheoid) { tong0 += item.TongThue; tem0.Add(item); } Entities.BCThue tem1 = new Entities.BCThue(); tem1.TenHangHoa = "Tổng: "; tem1.TongThue = tong0; tem0.Add(tem1); ////////////////////////////////////// //dtgvhienthi.DataSource = hienthitheoid; dtgvhienthi.DataSource = tem0.ToArray(); } if (dtgvhienthi.RowCount > 0) { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = true; } else { tsslexcel.Enabled = tsslPdf.Enabled = tsslWord.Enabled = tsslchitiet.Enabled = false; } } } finally { fix(); } }