Example #1
0
        void UpdatePhieuThu()
        {
            if (txtMaKH.Text == "" || txtMaThu.Text == "" || txtTienThu.Text == "" || dtpNgayThu.Value.Date.ToString() == "")
            {
                MessageBox.Show("Vui lòng nhập đầy đủ thông tin");
                return;
            }

            if (IsNumber(txtTienThu.Text) == false)
            {
                MessageBox.Show("Số tiền thu phải là số và không được âm", "Thông báo");
                return;
            }
            string mapt = txtMaThu.Text;
            string makh = txtMaKH.Text;

            int      sotien  = Int32.Parse(txtTienThu.Text);
            DateTime ngaythu = dtpNgayThu.Value.Date;

            KhachHang kh = KhachHangBUS.GetTenKH(txtMaKH.Text);

            int check = Int32.Parse(kh.TongNo) - sotien;

            if (check < 0)
            {
                MessageBox.Show("Số tiền thu không được vượt quá tiền nợ của khách hàng");
                return;
            }
            UpdateTienNoKH();
            ThuTienBUS.UpdatePhieuThu(mapt, makh, ngaythu, sotien);
            MessageBox.Show("Cập nhật phiếu thu thành công");
        }
Example #2
0
        void LoadPhieuThu()
        {
            List <ThuTienDTO> dsTT = ThuTienBUS.GetDS();

            dgvDSHD.DataSource = dsTT;

            for (int i = 0; i < dgvDSHD.Rows.Count; i++)
            {
                dgvDSHD.Rows[i].Cells[0].Value = i + 1;
            }
        }
Example #3
0
        private void btnXoa_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Bạn có chắc muốn xoá phiếu thu này đồng thời cập nhật lại số tiền nợ của khách hàng?", "Thông báo", MessageBoxButtons.OKCancel) == System.Windows.Forms.DialogResult.OK)
            {
                ThuTienBUS.DeletePhieuThu(txtMaThu.Text);
                MessageBox.Show("Xoá phiếu thu thành công!");
                UpdateTongNoKH_Xoa_Sua();

                LoadPhieuThu();
            }
        }
 private void LapPhieuThuTien_Load(object sender, EventArgs e)
 {
     dtNgaythutien.Format       = DateTimePickerFormat.Custom;
     dtNgaythutien.CustomFormat = "dd/MM/yyyy";
     ttBus = new ThuTienBUS();
 }