static TinhToan LuaChonPhepToan(out char pt)
        {
            TinhToan tt = null;

            Console.Write("Lua chon phep tinh: ");
            pt = Console.ReadKey().KeyChar;
            switch (pt)
            {
            case '+':
                tt = new TinhToan(MathOperations.Cong);
                break;

            case '-':
                tt = new TinhToan(MathOperations.Tru);
                break;

            case '*':
                tt = new TinhToan(MathOperations.Nhan);
                break;

            case '/':
                tt = new TinhToan(MathOperations.Chia);
                break;

            default:
                tt = new TinhToan(MathOperations.NA);
                break;
            }

            return(tt);
        }
示例#2
0
        static TinhToan LuaChonPhepToan(out char phepToan)
        {
            // delegate giu ham tinh toan
            TinhToan tt = null;

            Console.Write("Lua chon phep toan: ");
            phepToan = Console.ReadKey().KeyChar;
            switch (phepToan)
            {
            case '+':
                tt = new TinhToan(MathOperations.Cong);
                break;

            case '-':
                tt = new TinhToan(MathOperations.Tru);
                break;

            case '*':
                tt = new TinhToan(MathOperations.Nhan);
                break;

            case '/':
                tt = new TinhToan(MathOperations.Chia);
                break;
            }
            return(tt);
        }
        public decimal GiaInNhanhTheoBang(ref decimal giaTBTrang)//Chưa xài tới
        {
            decimal kq = 0;

            giaTBTrang = 0;
            if (this.DocBangGiaChonTheoNiemYetGia() == null || View.SoTrangA4 <= 0)
            {
                return(kq);
            }
            //Vượt tiép
            LoaiBangGiaS loaiBangGia;
            var          bGiaInNhanh = this.DocBangGiaChonTheoNiemYetGia();

            Enum.TryParse(bGiaInNhanh.LoaiBangGia.Trim(), out loaiBangGia);


            switch (loaiBangGia)
            {
            case LoaiBangGiaS.LuyTien:
                kq = TinhToan.GiaInLuyTien(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, View.SoTrangA4);
                break;

            case LoaiBangGiaS.Buoc:
                kq = TinhToan.GiaBuoc(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, View.SoTrangA4);
                break;

            case LoaiBangGiaS.Goi:
                kq = TinhToan.GiaGoi3(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, View.SoTrangA4);
                break;
            }

            giaTBTrang = Math.Round(kq / View.SoTrangA4);

            return(kq);
        }
        public decimal GiaInNhanh(int iDNiemYetChon, int soTrangA4, BangGiaBase bGiaInNhanh)
        {
            decimal kq = 0;


            if (bGiaInNhanh == null || soTrangA4 < 0)
            {
                return(0);
            }
            //vượt làm tiếp
            switch (bGiaInNhanh.LoaiBangGia.Trim())
            {
            case Global.cBangGiaLuyTien:

                kq = TinhToan.GiaInLuyTien(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, soTrangA4);
                break;

            case Global.cBangGiaBuoc:
                kq = TinhToan.GiaBuoc(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, soTrangA4);
                break;

            case Global.cBangGiaGoi:
                kq = TinhToan.GiaGoi3(bGiaInNhanh.DaySoLuong, bGiaInNhanh.DayGia, soTrangA4);
                break;
            }

            return(kq);
        }
        public int SoConTrenToLon(float toRong, float toCao,
                                  float conRong, float conCao)

        {
            return(TinhToan.SoConTrenToChayDigi(toRong, toCao,
                                                conRong, conCao));
        }
示例#6
0
 static void Main(string[] args)
 {
     do
     {
         int n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         Console.Write("S(" + n + ") = " + TinhToan.Tinh(n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc(1.Tiep, 0.Khong)?") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         float a = SoThuc.NhapSoThuc("Nhap a = ");
         float b = SoThuc.NhapSoThuc("Nhap b = ");
         TinhToan.giapt(a, b);
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ?") != 0);
 }
示例#8
0
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         Console.Write("Tong tat cac uoc so nho hon chinh no la " + TinhToan.tonguoc(n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ? ") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n=");
         Console.Write("Tong cac chu so chan cua " + n + " la " + TinhToan.tong(n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
示例#10
0
 static void Main(string[] args)
 {
     do
     {
         float x = SoThuc.NhapSoThuc("Nhap x = ");
         int   n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         Console.Write("T(" + x + "," + n + ") = " + TinhToan.Tinh(x, n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ?") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n=");
         Console.Write("Chu so lon nhat cua so " + n + " la " + TinhToan.tim(n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
示例#12
0
 public static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap so n:");
         Console.Write("\nS(" + n + ")=" + TinhToan.Tong(n));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
	static void Main(string[] args)
	{			
		do
		{
			int n;
			n=SoNguyen.NhapSoNguyenDuong("Nhap n = ");			
            Console.Write("Tich tat cac uoc so cua so nguyen duong "+n+" la "+TinhToan.tichuoc(n));
		} while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ? ")!=0);
	}
 static void Main(string[] args)
 {
     do
     {
         int a, b;
         a = SoNguyen.NhapSoNguyenDuong("Nhap a = ");
         b = SoNguyen.NhapSoNguyenDuong("Nhap b = ");
         Console.Write("BCNN(" + a + "," + b + ") = " + TinhToan.bcnn(a, b));
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         Console.Write("Uoc so le cua so nguyen duong " + n + "\n");
         TinhToan.lietke(n);
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ? ") != 0);
 }
        public void CapNhatSoToChayLyThuyetTrenToGiayLonOffset()
        {
            var soToChayTrenToGiay = 0;

            if (View.IdGiayOffsetChon > 0 && View.TongSoToChayOffset > 0)
            {
                var giay = Giay.DocGiayTheoId(View.IdGiayOffsetChon);
                soToChayTrenToGiay = TinhToan.SoConTrenToChayDigi(View.ToChayRongOffset,
                                                                  View.ToChayCaoOffset, giay.ChieuNgan, giay.ChieuDai);
            }
            //Cập nhật
            View.SoToChayTrenToLonOffset = soToChayTrenToGiay;
        }
示例#17
0
        public static decimal GiaIn(CauHinhTinhGiaCuon cauHinhTGCuon)
        {
            decimal ketQua = 0;

            var chiPhiIn = TinhToan.PhiIn(cauHinhTGCuon.CHinhIn, cauHinhTGCuon.SoToChayTong);

            //var mucLoiNhuanIn_TP = (double)cauHinhTGCuon.MucLoiNhuanInThanhPham_PCT / 100; //đã cũ theo số cuốn
            var mucLoiNhuanIn = (double)cauHinhTGCuon.MucLoiNhuanIn_TheoSoTrang_PCT / 100;

            //Tinh theo muc loi nhuan gop /doanh thu
            ketQua = chiPhiIn + chiPhiIn * (decimal)mucLoiNhuanIn / (decimal)(1 - mucLoiNhuanIn);

            return(ketQua);
        }
示例#18
0
 private void button_square_root_Click(object sender, EventArgs e)
 {
     if (chuoi1 != null || chuoi2 != null)
     {
         if (!kiemtra)
         {
             chuoi1 = TinhToan.canbac(float.Parse(chuoi1)).ToString();
         }
         else
         {
             chuoi2 = TinhToan.canbac(float.Parse(chuoi2)).ToString();
         }
         hienthi();
     }
 }
 static void Main(string[] args)
 {
     do
     {
         int n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         if (TinhToan.ktdang2k(n))
         {
             Console.Write(n + " co dang 3^k");
         }
         else
         {
             Console.Write(n + " khong co dang 3^k");
         }
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)?") != 0);
 }
示例#20
0
        public int SoToChayTrenToLon()
        {
            var kq = 0;

            if (View.ToChayRong <= 0 || View.ToChayDai <= 0 ||
                View.GiayLonRong <= 0 || View.GiayLonCao <= 0)
            {
                return(kq);
            }

            //vượt
            kq = TinhToan.SoConTrenToChayDigi(View.GiayLonRong, View.GiayLonCao,
                                              View.ToChayRong, View.ToChayDai);

            return(kq);
        }
示例#21
0
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n=");
         if (TinhToan.ktgiamdan(n))
         {
             Console.Write(n + " giam dan tu trai sang phai");
         }
         else
         {
             Console.Write(n + " khong giam dan tu trai sang phai");
         }
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n=");
         if (TinhToan.toanchan(n))
         {
             Console.Write(n + " toan chan");
         }
         else
         {
             Console.Write(n + " khong toan chan");
         }
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong)") != 0);
 }
 static void Main(string[] args)
 {
     do
     {
         int n;
         n = SoNguyen.NhapSoNguyenDuong("Nhap n = ");
         if (TinhToan.ktnt(n))
         {
             Console.Write(n + " la so nguyen to");
         }
         else
         {
             Console.Write(n + " khong la so nguyen to");
         }
     } while (SoNguyen.NhapSoNguyen("\nTiep tuc (1.Tiep, 0.Khong) ? ") != 0);
 }
示例#24
0
        static void Main(string[] args)
        {
            Random  rd = new Random();
            decimal v1, v2;
            char    c = 'a', pt;

            while (c != 'q')
            {
                TinhToan tt = LuaChonPhepToan(out pt);
                v1 = rd.Next(1000);
                v2 = rd.Next(1000);
                Console.WriteLine("\n{0} {1} {2} = {3}", v1, pt, v2, tt(v1, v2));
                Console.Write("Tiep tuc?");
                c = Console.ReadKey().KeyChar;
                Console.WriteLine();
            }
        }
        static void Main(string[] args)
        {
            Random  rd = new Random();
            decimal a, b;
            char    c = 'a', pt;

            while (c != 'q')
            {
                TinhToan tt = LuaChonPhepToan(out pt);
                a = rd.Next(1000);
                b = rd.Next(1000);
                Console.WriteLine("\n{0} {1} {2} = {3}", a, pt, b, tt(a, b));
                Console.Write("Tiep tuc");
                c = Console.ReadKey().KeyChar;
                Console.WriteLine();
            }
        }
示例#26
0
        private void button_equal_Click(object sender, EventArgs e)
        {
            phimbang = true;
            kq       = TinhToan.Tinh(chuoi1, pheptinh, chuoi2).ToString();
            float  kq2      = float.Parse(kq);
            string thoigian = DateTime.Now.ToString("yyyy/MM/dd hh:mm");

            // ScreenButtom.Text = thoigian.ToString();
            hienthi();
            SqlConnection con = new SqlConnection("server=k45A;database=maytinh;Integrated security=true;");
            SqlCommand    cmd = new SqlCommand("insert into cal(kq,thoigian) values('" + kq2 + "','" + thoigian + "')", con);

            con.Open();
            cmd.ExecuteNonQuery();
            con.Close();
            test = true;
        }
示例#27
0
        public static decimal GiaCanMang(CauHinhTinhGiaPhang cauHinhTGPhang, string MA_CAN_MANG)
        {
            ///MA_CAN_MANG dạng: CM-2 đầu là cán màng, cột 2 là số mặt
            decimal ketQua = 0;

            //Xác định có màng cán không bằng cách kiểm tra 2 item cuối của mã giấy áp

            string[] maCanMangs = MA_CAN_MANG.Split('-');

            string aCM      = maCanMangs[0];
            int    soMatCan = int.Parse(maCanMangs[1]);//chắc chắn có giá trị

            //Có thì tìm mã tờ cán phủ
            var maToCanMang = ToCanPhuBDO.LayTatCa().Where(x => x.MA_TO_CAN.Substring(0, 2) == aCM).SingleOrDefault().MA_TO_CAN;

            /*foreach (var tcp in ToCanPhuBDO.LayTatCa())
             * {
             *  if (tcp.MA_TO_CAN.Substring(0, 2) == aCM)
             *  {
             *      maToCanMang = tcp.MA_TO_CAN;
             *      break;
             *  }
             *
             * }*/

            if (string.IsNullOrEmpty(maToCanMang))
            {
                return(0); //thoát luôn nghĩa là không có mã
            }
            var soToChay = cauHinhTGPhang.SoToChayTong;

            var toCanPhuBDO = ToCanPhuBDO.LayTheoID(maToCanMang);

            var cauHinhCan1 = new CauHinhCanPhu(toCanPhuBDO.BHR, toCanPhuBDO.TOC_DO_M2, soMatCan, toCanPhuBDO.THOI_GIAN_CHUAN_BI);

            var chiPhiCanPhu = TinhToan.PhiCanMang(cauHinhCan1, soToChay); //Dùng bên tính toán cuốn để khỏi double.
            //Tinh theo muc loi nhuan gop /doanh thu
            double mucLoiNhuanIn_TP = (double)cauHinhTGPhang.MucLoiNhuanIn_PCT / 100;

            ketQua = chiPhiCanPhu + (decimal)mucLoiNhuanIn_TP * chiPhiCanPhu / (1 - (decimal)mucLoiNhuanIn_TP);

            return(ketQua);
        }
示例#28
0
        public static decimal GiaCanMang(CauHinhTinhGiaCuon cauHinhTGCuon)
        {
            decimal ketQua = 0;


            var maGiayRuot = cauHinhTGCuon.MaGiayAp;

            //Xác định có màng cán không bằng cách kiểm tra 2 item cuối của mã giấy áp

            string[] maGiays = maGiayRuot.Split('-');
            if (maGiays[maGiays.Length - 1] != "CM") //mục cuối dùng
            {
                return(0);
            }
            //Có thì tìm mã tờ cán phủ
            string maToCanMang = "";

            foreach (var tcp in ToCanPhuBDO.LayTatCa())
            {
                if (tcp.MA_TO_CAN.Substring(0, 2) == "CM")
                {
                    maToCanMang = tcp.MA_TO_CAN;
                    break;
                }
            }


            var soToChay = cauHinhTGCuon.SoToChayTong;

            var toCanPhuBDO = ToCanPhuBDO.LayTheoID(maToCanMang);

            var cauHinhCan1 = new CauHinhCanPhu(toCanPhuBDO.BHR, toCanPhuBDO.TOC_DO_M2, 2, toCanPhuBDO.THOI_GIAN_CHUAN_BI);

            var chiPhiCanPhu = TinhToan.PhiCanMang(cauHinhCan1, soToChay);
            //Tinh theo muc loi nhuan gop /doanh thu
            double mucLoiNhuanIn_TP = (double)cauHinhTGCuon.MucLoiNhuanInThanhPham_PCT / 100;

            ketQua = chiPhiCanPhu + (decimal)mucLoiNhuanIn_TP * chiPhiCanPhu / (1 - (decimal)mucLoiNhuanIn_TP);

            return(ketQua);
        }
示例#29
0
        static void ViDu4()
        {
            //1. Không quan tâm đến kiểu dữ liệu đầu vào
            ChaoBan1 chao1 = (string temp) => { Console.WriteLine("Chào bạn " + temp); };
            ChaoBan1 chao2 = (temp) => { Console.WriteLine("Chào bạn " + temp); };

            //2. Để trống nếu không có tham số ()
            ChaoBan2 chao3 = () => { Console.WriteLine("Chào bạn"); };

            //3. Nếu chỉ có một tham số bỏ luôn dấu ()
            ChaoBan1 chao4 = temp => { Console.WriteLine("Chào bạn " + temp); };

            //4. Nếu có nhiều tham số ngăn cách bằng dấu ,
            ChaoBan3 chao5 = (x, y, z) => { Console.WriteLine("Chào bạn " + x + y + z); };

            //5. Nếu phương thức chỉ có 1 câu lệnh thực thi bỏ dấu {}
            ChaoBan3 chao6 = (x, y, z) => Console.WriteLine("Chào bạn " + x + y + z);

            //6. Đối với phương thức return
            TinhToan tinhToan1 = (x, y) => { return(x + y * 100); };
            Check1   check1    = (x, y) => { return(x > 4 && y > 4); };
        }
示例#30
0
        public decimal TinhThuSoTrang(ref string giaTBA4)
        {
            var kq = 0m;

            if (View.IdBangGiaChon <= 0 || View.SoTrangTinhThu <= 0)
            {
                giaTBA4 = "0đ";
                return(kq);
            }
            //
            var bangGia = DanhSachBangGia.DocTheoIdVaLoai(View.IdBangGiaChon, View.LoaiBangGia);

            /* var giaInNhanhNiemYet = new GiaInNhanhNiemYet(View.SoTrangTinhThu, bangGia);
             * kq = giaInNhanhNiemYet.ThanhTienSales(); */
            //Tính thử theo giá của bảng giá chứ không phải niêm yết
            LoaiBangGiaS loaiBangGia;

            Enum.TryParse(bangGia.LoaiBangGia.Trim(), out loaiBangGia);
            switch (loaiBangGia)
            {
            case LoaiBangGiaS.LuyTien:
                kq = TinhToan.GiaInLuyTien(bangGia.DaySoLuong, bangGia.DayGia, View.SoTrangTinhThu);
                break;

            case LoaiBangGiaS.Buoc:
                kq = TinhToan.GiaBuoc(bangGia.DaySoLuong, bangGia.DayGia, View.SoTrangTinhThu);
                break;

            case LoaiBangGiaS.Goi:    //Gói cũ giống Bước
                kq = TinhToan.GiaGoi3(bangGia.DaySoLuong, bangGia.DayGia, View.SoTrangTinhThu);
                break;
            }


            giaTBA4 = string.Format("{0:0,0}đ/A4", Math.Round(kq / View.SoTrangTinhThu));
            return(kq);
        }
示例#31
0
        private void cbThoiHanThuTien_SelectedIndexChanged(object sender, EventArgs e)
        {
            int sothang = cbThoiHanTinhLai.SelectedIndex - 2;
            if (sothang > 0)
            {
                decimal so_tien = (sotiencam / 100) * txtLaiSuatThang.Value * sothang;
                string tien_tam = String.Format("{0:##,##0}", so_tien);
                so_tien = Convert.ToDecimal(tien_tam) - Convert.ToDecimal(tien_tam) % Convert.ToDecimal(Math.Pow(10, 3));
                txtNgayGhiSo.DateTime = ngayghisocamdo.AddMonths(sothang);
                if (cbLoai.SelectedIndex == 0)
                {
                    txtSoTien.Value = sotiencam + so_tien;
                }
                else
                {
                    txtSoTien.Value = so_tien;
                }
                txtTienLai.Value = so_tien;
            }
            else if(sothang == -2)
            {
                if (cbLoai.SelectedIndex != 3)
                {
                    txtNgay.DateTime = DateTime.Now;
                    txtNgayGhiSo.DateTime = DateTime.Now;
                }

                var tinh_toan = new TinhToan();
                //decimal so_tien = tinh_toan.Tinh_Tien_Lai(sotiencam, txtLaiSuatThang.Value, ngayghisocamdo, txtNgayGhiSo.DateTime);
                decimal so_tien = tinh_toan.Tinh_Tien_Lai_Theo_Chung_Tu(txtMaChungTuCamDo.Text, txtNgayGhiSo.DateTime);
                if (cbLoai.SelectedIndex == 0)
                {
                    txtSoTien.Value = sotiencam + so_tien;
                }
                else
                {
                    txtSoTien.Value = so_tien;
                }
                txtTienLai.Value = so_tien;
            }
            else if (sothang == -1)
            {
                var tinh_toan = new TinhToan();
                //decimal so_tien = tinh_toan.Tinh_Tien_Lai(sotiencam, txtLaiSuatThang.Value, ngayghisocamdo, txtNgayGhiSo.DateTime);
                decimal so_tien = tinh_toan.Tinh_Tien_Lai_Theo_Chung_Tu(txtMaChungTuCamDo.Text, txtNgayGhiSo.DateTime);
                if (cbLoai.SelectedIndex == 0)
                {
                    txtSoTien.Value = sotiencam + so_tien;
                }
                else
                {
                    txtSoTien.Value = so_tien;
                }
                txtTienLai.Value = so_tien;
            }
            else if (sothang == 0)
            {
                var tinh_toan = new TinhToan();
                //decimal so_tien = tinh_toan.Tinh_Tien_Lai(sotiencam, txtLaiSuatThang.Value, ngayghisocamdo, txtNgay.DateTime);
                decimal so_tien = tinh_toan.Tinh_Tien_Lai_Theo_Chung_Tu(txtMaChungTuCamDo.Text, txtNgayGhiSo.DateTime);
                if (cbLoai.SelectedIndex == 0)
                {
                    txtSoTien.Value = sotiencam + so_tien;
                }
                else
                {
                    txtSoTien.Value = so_tien;
                }
                txtTienLai.Value = so_tien;
            }
        }
示例#32
0
        public void Thiet_Lap(string ma_chung_tu_cam_do, string so, string ten_khach_hang, string so_cmnd, decimal so_tien_cam, decimal lai_suat_thang, DateTime ngay_ghi_so_cam_do ,int loai_thu)
        {
            machungtucamdo = ma_chung_tu_cam_do;
            socamdo = so;
            tenkhachhang = ten_khach_hang;
            socmnd = so_cmnd;
            sotiencam = so_tien_cam;
            ngayghisocamdo = ngay_ghi_so_cam_do;
            loaithu = loai_thu;

            txtMaChungTuCamDo.Text = ma_chung_tu_cam_do;
            txtSo.Text = so;
            txtTenKhachhang.Text = ten_khach_hang;
            txtSoCMND.Text = so_cmnd;
            txtLaiSuatThang.Value = lai_suat_thang;
            txtSoTienCam.Value = so_tien_cam;
            txtNgayCamDo.DateTime = ngay_ghi_so_cam_do;

            txtMaChungTuCamDo.Properties.ReadOnly = true;
            txtSo.Properties.ReadOnly = true;
            txtTenKhachhang.Properties.ReadOnly = true;

            var tinhToan = new TinhToan();
            //decimal tien_lai = tinhToan.Tinh_Tien_Lai(so_tien_cam, lai_suat_thang, ngay_ghi_so_cam_do, txtNgayGhiSo.DateTime);
            decimal tien_lai = tinhToan.Tinh_Tien_Lai_Theo_Chung_Tu(txtMaChungTuCamDo.Text, txtNgayGhiSo.DateTime);

            txtTienLai.Value = tien_lai;
            if (loai_thu == 0) // chuộc
            {
                txtSoTien.EditValue = so_tien_cam + tien_lai;
            }
            else if (loai_thu == 1) // khách trả tiền lời
            {
                txtSoTien.EditValue = tien_lai;
            }
            else if (loai_thu == 2) // khách trả bớt tiền
            {
                txtSoTien.EditValue = 0;
            }
            else
            {
                txtSoTien.EditValue = 0;
                lyThoiHanTinhLai.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
                lyLaiSuatThang.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Never;
            }
            cbLoai.SelectedIndex = loai_thu;
        }