Beispiel #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            query.AddChungTu(txtNguoiLap.Text);
            DataTable temp = query.CheckInfor(txtHoTen.Text, txtCMND.Text);

            if (temp.Rows.Count == 1)
            {
                query.AddPhieuThuChi(cbbLoaiPhieu.SelectedValue.ToString(), temp.Rows[0]["Id"].ToString(), nbupSoTien.Value.ToString(), txtNoiDung.Text);
            }
            else
            {
                query.AddNguoi(txtHoTen.Text, txtDienThoai.Text, txtCMND.Text, dateNgayCap.Value.ToString("yyyy/MM/dd"), txtNoiCap.Text, txtDiaChi.Text);
                query.AddPhieuThuChi(cbbLoaiPhieu.SelectedValue.ToString(), query.GetIdNewRecord("nguoi").ToString(), nbupSoTien.Value.ToString(), txtNoiDung.Text);
            }

            if (cbbLoaiPhieu.Text == "Phiếu thu")
            {
                query.LuuLichSu("Thu", nbupSoTien.Value.ToString(), "Phiếu thu của " + txtHoTen.Text);
            }
            else
            {
                query.LuuLichSu("Chi", nbupSoTien.Value.ToString(), "Phiếu chi của " + txtHoTen.Text);
            }

            if (MessageBox.Show("Tạo " + cbbLoaiPhieu.Text + " thành công", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information) == DialogResult.OK)
            {
                this.Close();
            }
        }
Beispiel #2
0
        private void btnLapPhieu_Click(object sender, EventArgs e)
        {
            query.AddChungTu(txtNguoiLap.Text);
            DataTable temp = query.CheckInfor(txtHoTen.Text, txtCMND.Text);

            if (dgrvMainHangHoa.RowCount != 1)
            {
                if (temp.Rows.Count == 1)
                {
                    query.AddPhieuCam(temp.Rows[0]["Id"].ToString(), nbudSoTien.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), DateTime.Now.ToString("yyyy/MM/dd"), dateHanTra.Value.ToString("yyyy/MM/dd"), txtNoiCatTien.Text, txtNoiDung.Text);
                }
                else
                {
                    query.AddNguoi(txtHoTen.Text, txtDienThoai.Text, txtCMND.Text, dateNgayCap.Value.ToString("yyyy/MM/dd"), txtNoiCap.Text, txtDiaChi.Text);
                    query.AddPhieuCam(query.GetIdNewRecord("nguoi").ToString(), nbudSoTien.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), DateTime.Now.ToString("yyyy/MM/dd"), dateHanTra.Value.ToString("yyyy/MM/dd"), txtNoiCatTien.Text, txtNoiDung.Text);
                }

                query.LuuLichSu("Chi", nbudSoTien.Value.ToString(), "Cho " + txtHoTen.Text + " cầm đồ");
                DataRow row;
                for (int i = 0; i < dgrvMainHangHoa.RowCount - 1; i++)
                {
                    row = dataTableHangHoa.Rows[i];
                    query.AddKhoHang(getIdNhomHang(row[0].ToString()).ToString(), query.GetIdNewRecord("phieucam").ToString(), "Hàng khách cầm", row[1].ToString(), row[2].ToString(), row[3].ToString(), "Phiếu cầm của " + txtHoTen.Text);
                }
                MessageBox.Show("Tạo phiếu cầm đồ thành công");
            }
            else
            {
                MessageBox.Show("Bạn chưa nhập hàng hóa, vui lòng nhâp để tạo phiếu cầm đồ hoặc lựa chọn phiếu vay", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Question);
            }
        }
Beispiel #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            query.AddChungTu(txtNguoiLap.Text);
            DataTable temp = query.CheckInfor(txtHoTen.Text, txtCMND.Text);
            if (temp.Rows.Count == 1)
            {
                query.AddPhieuVay(temp.Rows[0]["Id"].ToString(), nbudSoTien.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), DateTime.Now.ToString("yyyy/MM/dd"), dateHanTra.Value.ToString("yyyy/MM/dd"), txtNoiCatTien.Text, txtNoiDung.Text);
            }
            else
            {
                query.AddNguoi(txtHoTen.Text, txtDienThoai.Text, txtCMND.Text, dateNgayCap.Value.ToString("yyyy/MM/dd"), txtNoiCap.Text, txtDiaChi.Text);
                query.AddPhieuVay(query.GetIdNewRecord("nguoi").ToString(), nbudSoTien.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), DateTime.Now.ToString("yyyy/MM/dd"), dateHanTra.Value.ToString("yyyy/MM/dd"), txtNoiCatTien.Text, txtNoiDung.Text);
            }

            query.LuuLichSu("Chi", nbudSoTien.Value.ToString(), "Cho " + txtHoTen.Text + "vay tiền");
            MessageBox.Show("Tạo phiếu vay thành công");


        }
Beispiel #4
0
        private void btnLapPhieu_Click(object sender, EventArgs e)
        {
            query.AddChungTu(txtMaPhieu.Text, txtNguoiLap.Text, txtNgayLap.Text);
            query.AddNguoi(txtHoTen.Text, txtDienThoai.Text, txtCMND.Text, dateNgayCap.Value.ToString(), txtNoiCap.Text, txtDiaChi.Text, nbudCongNo.Value.ToString(), cbbNhomKH.SelectedValue.ToString());
            if (gridView1.RowCount == 0)
            {
                query.AddPhieuCam(nbudSoTien.Value.ToString(), dateHanTra.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), nbudQuaHan.Value.ToString(), txtNoiCatTien.Text, txtNoiDung.Text, "Phiếu vay");
            }
            else
            {
                query.AddPhieuCam(nbudSoTien.Value.ToString(), dateHanTra.Value.ToString(), cbbCachTinhLai.SelectedValue.ToString(), nbudQuaHan.Value.ToString(), txtNoiCatTien.Text, txtNoiDung.Text, "Phiếu cầm");
            }
            DataRow row;

            for (int i = 0; i < gridView1.RowCount - 1; i++)
            {
                row = gridView1.GetDataRow(i);
                query.AddKhoHang(row[0].ToString(), row[1].ToString(), row[2].ToString(), row[3].ToString(), row[4].ToString(), "Phiếu cầm của " + txtHoTen.Text);
            }
            MessageBox.Show("Thành công");
        }