Exemple #1
0
        //kiem tra thong tin nhap,lay cac thong tin ve phieu thu va luu vao doi tuong phieu thu
        int KiemTra(string makh, int tienthu)
        {
            KhachHangBUS objKH = new KhachHangBUS();

            if (objKH.GetKH(makh) != null)
            {
                if (objKH.GetKH(makh).Rows.Count == 0)
                {
                    MessageBox.Show("Mã khách hàng không đúng");
                    return(0);
                }
                else
                {
                    phieuthu.No      = int.Parse(objKH.GetKH(makh).Rows[0]["no"].ToString());
                    phieuthu.TienThu = tienthu;
                    if (phieuthu.TienThu > phieuthu.No)
                    {
                        MessageBox.Show("tiền thu nhiều hơn số nợ");
                        txtTienthu.Focus();
                        return(0);
                    }
                    else
                    {
                        PhieuThuBUS objPhieuThu = new PhieuThuBUS();
                        if (objPhieuThu.GetPhieuThu() == null)
                        {
                            MessageBox.Show("Lỗi dữ liệu");
                        }
                        else
                        {
                            int    stt     = objPhieuThu.GetPhieuThu().Rows.Count + 1;
                            string sophieu = "P";
                            for (int i = 0; i < 3 - stt.ToString().Length; i++)
                            {
                                sophieu += "0";
                            }
                            sophieu         += stt.ToString();
                            phieuthu.SoPhieu = sophieu;
                        }
                        phieuthu.MaKh    = makh;
                        phieuthu.TenKH   = objKH.GetKH(makh).Rows[0]["tenkh"].ToString();
                        phieuthu.Diachi  = objKH.GetKH(makh).Rows[0]["diachi"].ToString();
                        phieuthu.Email   = objKH.GetKH(makh).Rows[0]["email"].ToString();
                        phieuthu.SDT     = objKH.GetKH(makh).Rows[0]["sdt"].ToString();
                        phieuthu.No      = phieuthu.TienThu - phieuthu.No;
                        phieuthu.NgayThu = DateTime.Today.Month.ToString() + "/" + DateTime.Today.Day.ToString() + "/" + DateTime.Today.Year.ToString();
                        return(1);
                    }
                }
            }
            else
            {
                MessageBox.Show("Lỗi dữ liệu");
                return(0);
            }
        }
Exemple #2
0
        private void DanhSachPhieuThu_Load(object sender, EventArgs e)
        {
            PhieuThuBUS objPhieuThu = new PhieuThuBUS();

            if (objPhieuThu.GetPhieuThu() != null)
            {
                dgvPhieuThu.DataSource = objPhieuThu.GetPhieuThu();
            }
            else
            {
                MessageBox.Show("Lỗi dữ liệu");
            }
        }
 public DataSet PhieuThu_GetPhieuThu(PhieuThu inp, string swhere)
 {
     try
     {
         return(PhieuThu_bus.GetPhieuThu(inp, swhere));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }