Пример #1
0
 private void btnThu_Click(object sender, EventArgs e)
 {
     if (txtTienThu.Text.Equals("") == false)
     {
         float tienNo  = (float)Convert.ToDouble(txtTienNo.Text);
         float tienThu = (float)Convert.ToDouble(txtTienThu.Text);
         if (tienThu <= tienNo)
         {
             int              id        = dsIdDL[cbDaiLy.SelectedIndex];
             DateTime         ngayThu   = dtNgayThu.Value;
             float            soTienThu = (float)Convert.ToDouble(txtTienThu.Text);
             string           cmnd      = nhanVien.Cmnd;
             DTO_PhieuThuTien pt        = new DTO_PhieuThuTien(0, ngayThu, soTienThu, id, cmnd);
             BUS_PhieuThuTien.ThemPhieuThu(pt);
             float tienNoMoi = tienNo - tienThu;
             int   kq        = BUS_DaiLy.UpdateTienNo(id, tienNoMoi);
             if (kq == 1)
             {
                 MessageBox.Show("Thu thành công");
                 txtTienNo.Text  = BUS_DaiLy.GetTienNo(id).ToString();
                 txtTienThu.Text = "";
             }
             else if (kq == 2)
             {
                 MessageBox.Show("tiền nợ vượt quá quy định");
             }
             else
             {
                 MessageBox.Show("Thu thất bại");
             }
         }
     }
 }
Пример #2
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (txtTienThu.Text.Equals("") == false)
     {
         float tienNo  = (float)Convert.ToDouble(txtTienNo.Text);
         float tienThu = (float)Convert.ToDouble(txtTienThu.Text);
         if (tienThu <= tienNo)
         {
             int              id        = dsIdDL[cbDaiLy.SelectedIndex];
             DateTime         ngayThu   = dtNgayThu.Value;
             float            soTienThu = (float)Convert.ToDouble(txtTienThu.Text);
             string           cmnd      = nhanVien.Cmnd;
             DTO_PhieuThuTien pt        = new DTO_PhieuThuTien(0, ngayThu, soTienThu, id, cmnd);
             BUS_PhieuThuTien.ThemPhieuThu(pt);
             float tienNoMoi = tienNo - tienThu;
             BUS_DaiLy.UpdateTienNo(id, tienNoMoi);
         }
     }
 }