private void LuuPhieuBanHang_WithoutMaKhach(EPhieuBanHang ehanghoa) { try { foreach (DataRow item in dtView.Rows) { DataRow row = dtChiTietPhieuBan.NewRow(); row["MaHang"] = item["MaHang"]; row["SoLuong"] = item["SoLuong"]; row["MaDVT"] = item["MaDVT"]; row["GiaBan"] = item["DonGia"]; row["MaPhieu"] = maPhieu; row["TrangThai"] = 1; row["ChietKhau"] = item["ChietKhau"]; row["HDTrucTiep"] = item["HDTrucTiep"]; row["HDVAT"] = item["HDVAT"]; dtChiTietPhieuBan.Rows.Add(row); } // lưu tblPhieuBan BPhieuBanHang.Insert_WithoutMaKhach(ehanghoa); // lưu tblChiTietPhieuBan //@MaPhieu,@MaHang,@SoLuong,@MaDVT,@GiaBan,@TrangThai BChiTietPhieuBan.Insert_WithoutMaKho(dtChiTietPhieuBan); } catch (Exception ex) { MessageBox.Show("Lỗi: " + ex.ToString()); } }
private void dtpNgayBan_TextChanged(object sender, EventArgs e) { string ngayBan = dtpNgayBan.Text; DateTime time = UnixTime.GetTimeUnix(1538835973); //1539993600 1540079999 int fromTime = UnixTime.GetUnixTime(Convert.ToDateTime(ngayBan + " 00:00:00 AM")); int toTime = UnixTime.GetUnixTime(Convert.ToDateTime(ngayBan + " 23:59:59 PM")); data = BPhieuBanHang.GetSumDay(fromTime, toTime); dtgvHoaDon.DataSource = data; SoHoaDon = data.Rows.Count; for (int i = 0; i < SoHoaDon; i++) { TongDoanhThu = TongDoanhThu + int.Parse(data.Rows[i]["TongTien"].ToString()); } txtTongDoanhThu.Text = TongDoanhThu.ToString(); txtSoHoaDon.Text = SoHoaDon.ToString(); }
private string GetMaPhieu(string date) { return(BPhieuBanHang.GetMaPhieu(date)); }