private void btnThem_Click(object sender, EventArgs e)
        {
            if (dgvSPN.Rows.Count > 1)
            {
                et_hdn.MaNCC    = cboTenNCC.SelectedValue.ToString();
                et_hdn.NgayNhap = dateTimePicker1.Value;
                string ma = hd.InsertHDN(et_hdn);

                for (int i = 0; i < dgvSPN.Rows.Count - 1; i++)
                {
                    et_cthd.MaHD      = ma;
                    et_cthd.MaSP      = et_sp.MaSP = dgvSPN.Rows[i].Cells[1].Value.ToString();
                    et_sp.SoLuong     = et_cthd.SoLuong = int.Parse(dgvSPN.Rows[i].Cells[2].Value.ToString());
                    et_cthd.GiaNhap   = long.Parse(dgvSPN.Rows[i].Cells[3].Value.ToString());
                    et_cthd.ThanhTien = long.Parse(dgvSPN.Rows[i].Cells[4].Value.ToString());
                    cthd.InsertCTHD(et_cthd);
                    sp.UpdateSoLuong(et_sp);
                }
                MessageBox.Show("Thêm dữ liệu thành công !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnTao_Click(sender, e);

                frmInHDB frm = new frmInHDB(ma, false);
                frm.Show();
            }
        }
Esempio n. 2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Bạn Muốn In Hóa Đơn Này?", "Question", MessageBoxButtons.OK) == DialogResult.OK)
     {
         frmInHDB frm = new frmInHDB(dgvHoaDon.Rows[dong].Cells[1].Value.ToString(), true);
         frm.Show();
     }
 }
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if(MessageBox.Show("Bạn Muốn In Hóa Đơn Này?", "Question", MessageBoxButtons.OK) == DialogResult.OK)
     {
         frmInHDB frm = new frmInHDB(dgvHoaDon.Rows[dong].Cells[1].Value.ToString(), true);
         frm.Show();
     }
 }
Esempio n. 4
0
 private void btnLuu_Click_1(object sender, EventArgs e)
 {
     if (MessageBox.Show("Lưu hóa đơn này ?", "", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         this.Close();
     }
     else
     {
         MaHDB = hdb.InsertHDB(txtMaKHHDB.Text, DateTime.Parse(txtNgayBanHDB.Text), long.Parse(txtTongTienHDB.Text));
         for (int i = 0; i < dgvCTHD.RowCount - 1; i++)
         {
             cthd.InsertCTHD(MaHDB, dgvCTHD.Rows[i].Cells[0].Value.ToString(), dgvCTHD.Rows[i].Cells[2].Value.ToString(), dgvCTHD.Rows[i].Cells[3].Value.ToString());
             sp.UpdateSoLuongSauBan(dgvCTHD.Rows[i].Cells[0].Value.ToString(), int.Parse(dgvCTHD.Rows[i].Cells[2].Value.ToString()));
         }
         frmInHDB frm = new frmInHDB(MaHDB, true);
         frm.Show();
         dgvCTHD.Rows.Clear();
         KhoiTaotxtsKH(); KhoiTaotxtsSP();
         HienThi();
     }
 }
Esempio n. 5
0
        private void btnThem_Click(object sender, EventArgs e)
        {
            if (dgvSPN.Rows.Count > 1)
            {
                et_hdn.MaNCC = cboTenNCC.SelectedValue.ToString();
                et_hdn.NgayNhap = dateTimePicker1.Value;
                string ma = hd.InsertHDN(et_hdn);

                for (int i = 0; i < dgvSPN.Rows.Count - 1; i++)
                {
                    et_cthd.MaHD = ma;
                    et_cthd.MaSP = et_sp.MaSP = dgvSPN.Rows[i].Cells[1].Value.ToString();
                    et_sp.SoLuong = et_cthd.SoLuong = int.Parse(dgvSPN.Rows[i].Cells[2].Value.ToString());
                    et_cthd.GiaNhap = long.Parse(dgvSPN.Rows[i].Cells[3].Value.ToString());
                    et_cthd.ThanhTien = long.Parse(dgvSPN.Rows[i].Cells[4].Value.ToString());
                    cthd.InsertCTHD(et_cthd);
                    sp.UpdateSoLuong(et_sp);
                }
                MessageBox.Show("Thêm dữ liệu thành công !!!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                btnTao_Click(sender, e);

                frmInHDB frm = new frmInHDB(ma, false);
                frm.Show();
            }
        }
Esempio n. 6
0
 private void btnLuu_Click_1(object sender, EventArgs e)
 {
     if (MessageBox.Show("Lưu hóa đơn này ?", "", MessageBoxButtons.YesNo) == DialogResult.No)
     {
         this.Close();
     }
     else
     {
         MaHDB = hdb.InsertHDB(txtMaKHHDB.Text, DateTime.Parse(txtNgayBanHDB.Text), long.Parse(txtTongTienHDB.Text));
         for (int i = 0; i < dgvCTHD.RowCount - 1; i++)
         {
             cthd.InsertCTHD(MaHDB, dgvCTHD.Rows[i].Cells[0].Value.ToString(), dgvCTHD.Rows[i].Cells[2].Value.ToString(), dgvCTHD.Rows[i].Cells[3].Value.ToString());
             sp.UpdateSoLuongSauBan(dgvCTHD.Rows[i].Cells[0].Value.ToString(), int.Parse(dgvCTHD.Rows[i].Cells[2].Value.ToString()));
         }
         frmInHDB frm = new frmInHDB(MaHDB, true);
         frm.Show();
         dgvCTHD.Rows.Clear();
         KhoiTaotxtsKH(); KhoiTaotxtsSP();
         HienThi();
     }
 }