Exemplo n.º 1
0
        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());
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Thêm mới phiếu bán hàng  có mã khách
 /// </summary>
 public static void Insert(EPhieuBanHang ePhieuBanHang)
 {
     try
     {
         SqlParameter[] para =
         {
             new SqlParameter("@MaPhieu",     ePhieuBanHang.MaPhieu),
             new SqlParameter("@NgayBan",     ePhieuBanHang.NgayBan),
             new SqlParameter("@MaNhanVien",  ePhieuBanHang.MaNhanVien),
             new SqlParameter("@TongTien",    ePhieuBanHang.TongTien),
             new SqlParameter("@MaKhachHang", ePhieuBanHang.MaKhach)
         };
         DataAccess.excuteNonQuery("PhieuBanHang_Add", CommandType.StoredProcedure, para);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
        private void btnLuuVaIn_Click(object sender, EventArgs e)
        {
            //Check tiền nhận
            if (txtTienNhan.Text == "")
            {
                MessageBox.Show("Bạn chưa nhập tiền nhân");
                return;
            }
            if (CheckTienNhan() == false)
            {
                MessageBox.Show("Tiền nhận nhỏ hơn tổng tiền");
                return;
            }
            eThongTinHoaDon.MaPhieu  = maPhieu;
            eThongTinHoaDon.NhanVien = "Thao";
            eThongTinHoaDon.TongTien = double.Parse(txtThanhToan.Text);
            eThongTinHoaDon.KhachTra = double.Parse(txtTienNhan.Text);
            if (txtTienTraLai.Text == "")
            {
                eThongTinHoaDon.TraLaiKhach = 0;
            }
            else
            {
                eThongTinHoaDon.TraLaiKhach = double.Parse(txtTienTraLai.Text);
            }
            EPhieuBanHang ePhieuBanHang = new EPhieuBanHang();

            ePhieuBanHang.MaNhanVien = Session.MaNhanVien;
            ePhieuBanHang.MaPhieu    = maPhieu;
            DateTime date = DateTime.Now;

            ePhieuBanHang.NgayBan      = UnixTime.GetUnixTime((date));
            ePhieuBanHang.TongTien     = Convert.ToDouble(txtThanhToan.Text);
            ePhieuBanHang.TongLoiNhuan = TingTongLoiNhuan();
            // Lưu phiếu
            LuuPhieuBanHang_WithoutMaKhach(ePhieuBanHang);
            // In hóa đơn
            crystalReportViewer1.Visible = true;
            LoadReport(dtView, eThongTinHoaDon);
        }
Exemplo n.º 4
0
 /// <summary>
 ///thêm mới phiếu bán hàng có mã khách
 /// </summary>
 public static void Insert(EPhieuBanHang ePhieuBanHang)
 {
     PhieuBanHangDAO.Insert(ePhieuBanHang);
 }
Exemplo n.º 5
0
 /// <summary>
 ///thêm mới phiếu bán hàng không có mã khách
 /// </summary>
 public static void Insert_WithoutMaKhach(EPhieuBanHang ePhieuBanHang)
 {
     PhieuBanHangDAO.Insert_WithoutMaKhach(ePhieuBanHang);
 }