Beispiel #1
0
        public List <DichvuLaisuat> LoadAllDVLS()
        {
            List <DichvuLaisuat> list = new List <DichvuLaisuat>();
            string    query           = "SELECT  DV.[MADV],[KYHAN],[TENDV],[NGAYAD],[LASUAT]FROM [QL_TAIKHOAN].[dbo].[DICHVU] DV,  [QL_TAIKHOAN].[dbo].[LAISUAT] LS WHERE DV.MADV = LS.MADV ORDER BY [NGAYAD] DESC ";
            DataTable data            = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                DichvuLaisuat dichvuLaisuat = new DichvuLaisuat(item);
                list.Add(dichvuLaisuat);
            }
            return(list);
        }
Beispiel #2
0
        public DichvuLaisuat GetLaiSuatHienHanh()
        {
            List <DichvuLaisuat> list = new List <DichvuLaisuat>();
            string    query           = "SELECT top(1)  DV.[MADV],[KYHAN],[TENDV],[NGAYAD],[LASUAT]FROM [QL_TAIKHOAN].[dbo].[DICHVU] DV,  [QL_TAIKHOAN].[dbo].[LAISUAT] LS WHERE DV.MADV = LS.MADV AND dv.KYHAN=0 ORDER BY [NGAYAD] DESC	";
            DataTable data            = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                DichvuLaisuat dichvuLaisuat = new DichvuLaisuat(item);
                list.Add(dichvuLaisuat);
            }
            DichvuLaisuat dvls = list[0];

            return(dvls);
        }
Beispiel #3
0
        public DichvuLaisuat LoadDVLSByMaDV(string maDV)
        {
            List <DichvuLaisuat> list = new List <DichvuLaisuat>();
            string    query           = "SELECT  DV.[MADV],[KYHAN],[TENDV],[NGAYAD],[LASUAT]FROM [QL_TAIKHOAN].[dbo].[DICHVU] DV,  [QL_TAIKHOAN].[dbo].[LAISUAT] LS WHERE DV.MADV = LS.MADV AND DV.MADV ='" + maDV + "' ORDER BY [NGAYAD] DESC	";
            DataTable data            = DataProvider.Instance.ExecuteQuery(query);

            foreach (DataRow item in data.Rows)
            {
                DichvuLaisuat dichvuLaisuat = new DichvuLaisuat(item);
                list.Add(dichvuLaisuat);
            }

            DichvuLaisuat dvls = list[0];

            return(dvls);
        }
Beispiel #4
0
        private void cbxMaDV_SelectedValueChanged(object sender, EventArgs e)
        {
            ComboBox cb = sender as ComboBox;

            if (cbxMaDV.SelectedItem == null)
            {
                return;
            }
            Service selected = cbxMaDV.SelectedItem as Service;
            string  maDv     = selected.MaDV;

            try
            {
                DichvuLaisuat dvls = DichvuLaisuatDAO.Instance.LoadDVLSByMaDV(maDv);
                txtTenDV.Text   = dvls.TenDV;
                txtLaiSuat.Text = dvls.LaiSuat.ToString();
                txtKyHan.Text   = dvls.KyHan.ToString();
                int days = dvls.KyHan * 30;
                dateNgayDenHan.Value = DateTime.Today.AddDays(days);
            }
            catch
            {
            }
        }
Beispiel #5
0
        private void cbxMaPhieu_SelectedValueChanged(object sender, EventArgs e)
        {
            ComboBox cb = sender as ComboBox;

            if (cbxMaPhieu.SelectedItem == null)
            {
                return;
            }
            PhieuGui phieu = cbxMaPhieu.SelectedItem as PhieuGui;

            try
            {
                if (phieu != null)
                {
                    txtMaDV.Text         = phieu.MaDV;
                    txtMoney.Text        = Math.Round(phieu.SoTienGui, 0).ToString();
                    txtLaiSuat.Text      = phieu.LaiSuat.ToString();
                    dateNgayGui.Value    = Convert.ToDateTime(phieu.NgayGui);
                    dateNgayDenHan.Value = Convert.ToDateTime(phieu.NgayDenHan);
                    txtKyHan.Text        = phieu.KyHan.ToString();
                    string maDV = phieu.MaDV;
                    try
                    {
                        DichvuLaisuat dvls = DichvuLaisuatDAO.Instance.LoadDVLSByMaDV(maDV);
                        txtTenDV.Text = dvls.TenDV;
                    }
                    catch
                    {
                    }
                }
            }
            catch
            {
            }
            txtTienLai.Text = "";
        }
Beispiel #6
0
        private double tinhLai(DateTime ngayDenHan, DateTime ngayGui, DateTime ngayRut, decimal tienGui, float laiSuat, int kyHan)
        {
            double        tienLai         = 0;
            double        tienGUI         = Convert.ToDouble(tienGui);
            double        tongTien        = tienGUI;
            DichvuLaisuat dvls            = DichvuLaisuatDAO.Instance.GetLaiSuatHienHanh();
            float         laiSuatHienHanh = dvls.LaiSuat;

            if (ngayRut.Date < ngayDenHan.Date)
            {
                double totalDays = (ngayRut.Date - ngayGui.Date).TotalDays;
                tienLai   = tienGUI * (totalDays / 30.0) * laiSuatHienHanh;
                tongTien += tienLai;
            }
            else if (ngayRut.Date == ngayDenHan.Date)
            {
                tienLai = tienGUI * laiSuat * kyHan;
            }
            else
            {
                tienLai = tienGUI * laiSuat * kyHan;
            }
            return(Math.Round(tienLai, 0, MidpointRounding.AwayFromZero));
        }