using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using ABC.GiaoDich;
using ABC.Report;
using ABC.KetNoi;
using DevExpress.XtraGrid.Columns;
using DevExpress.Data.Filtering;
using ABC.BaoCao;
using DevExpress.XtraReports.UI;
using ABC.File;

namespace ABC.CongNo
{
    public partial class fmCongNo_QLSanPham_KetChuyen : DevExpress.XtraEditors.XtraForm
    {

        public fmCongNo_QLSanPham_KetChuyen()
        {
            InitializeComponent();
            Get_CauHinh.NgayTinhNo = Get_CauHinh.Ngay_DN;
           // tailai();
            event_click();
          //  Look_khachhang.Properties.DataSource = DuLieu.List_KhachHang.Tables[0];
            
          //  gv_daluu.CellValueChanged+=new DevExpress.XtraGrid.Views.Base.CellValueChangedEventHandler(gv_daluu_CellValueChanged);
          //  gv_daluu.RowCellClick += new DevExpress.XtraGrid.Views.Grid.RowCellClickEventHandler(gv_daluu_RowCellClick);
          //  txtngay.Text = Get_CauHinh.ngay_text;

            this.Load += new EventHandler(CongNo_SoThuKet_Load);
            //khai bai report truoc
         //   btn_qlmuon.Click += new EventHandler(btn_qlmuon_Click);
          //  btn_chitiet.Click += new EventHandler(btn_chitiet_Click);
            colSTT.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
            gv_daluu.CustomUnboundColumnData += gridView1_CustomUnboundColumnData;
        }
        void gridView1_CustomUnboundColumnData(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDataEventArgs e)
        {
            if (e.IsGetData)
                e.Value = e.ListSourceRowIndex + 1;
        }
#pragma warning disable CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dtGrid' is never used
        DataTable dtGrid;
#pragma warning restore CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dtGrid' is never used
        void btn_chitiet_Click(object sender, EventArgs e)
        {
           // ChiTietMuonKet _ChiTietMuonKet = new ChiTietMuonKet();
           // _ChiTietMuonKet.ShowDialog();
        }
        public void QL_Muon()
        {
            //_T_KhaiBaoCongNo_KetM = new T_KhaiBaoCongNo_KetM();
            //_T_KhaiBaoCongNo_KetM.FormClosed += new FormClosedEventHandler(_T_KhaiBaoCongNo_KetM_FormClosed);
            //if (check_ngay.Checked == true)
            //{
            //    int ng = (int)(Convert.ToDateTime(txtngay.Text) - new DateTime(1900, 1, 1)).TotalDays;
            //    _T_KhaiBaoCongNo_KetM.ngayxem = ng;
            //}
            //else
            //{
            //    _T_KhaiBaoCongNo_KetM.ngayxem = Get_CauHinh.Ngay_DN;
            //}
            //_T_KhaiBaoCongNo_KetM.ShowDialog();
        }

        void _T_KhaiBaoCongNo_KetM_FormClosed(object sender, FormClosedEventArgs e)
        {
            tailai();
        }
#pragma warning disable CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen._T_KhaiBaoCongNo_KetM' is never used
        T_KhaiBaoCongNo_KetM1 _T_KhaiBaoCongNo_KetM;
#pragma warning restore CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen._T_KhaiBaoCongNo_KetM' is never used
        void btn_qlmuon_Click(object sender, EventArgs e)
        {
            QL_Muon();
        }

        void CongNo_SoThuKet_Load(object sender, EventArgs e)
        {
            tailai();
        }

     

        void gv_daluu_RowCellClick(object sender, DevExpress.XtraGrid.Views.Grid.RowCellClickEventArgs e)
        {
            
        }
#pragma warning disable CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.kh_ten_choos' is assigned but its value is never used
        string kh_ten_choos = "";
#pragma warning restore CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.kh_ten_choos' is assigned but its value is never used
#pragma warning disable CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.kh_id_choos' is assigned but its value is never used
        string kh_id_choos = "";        
#pragma warning restore CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.kh_id_choos' is assigned but its value is never used
#pragma warning disable CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.ngay' is assigned but its value is never used
        int ngay = 0;
#pragma warning restore CS0414 // The field 'fmCongNo_QLSanPham_KetChuyen.ngay' is assigned but its value is never used
      
      
      
        #region gv_daluu
        void gv_daluu_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
        {
            if (Pow.kiemtra("CongNo_QLSanPham", "Sua", Get_CauHinh.Dt_Login.Rows[0]["ID"].ToString().ToUpper()) == true)
            {
                string tenFile = e.Column.FieldName;
                if (tenFile.ToLower().Contains("moitra"))
                {
                    DataRow dt_update = gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle);                   
                    #region Sot
                    if (tenFile.ToLower().Contains("sot"))
                    {
                        decimal Tong_No = decimal.Parse(dt_update["TongNo_sot"].ToString());
                        decimal TogTra = decimal.Parse((e.Value.ToString() == "") ? "0" : e.Value.ToString());
                        if (TogTra > Tong_No)
                        {
                            msgbox.dialog_OK_warning("Sọt trả vược mức nợ.");
                            gv_daluu.CancelUpdateCurrentRow();
                        }
                        else
                        {
                            // xoa chi tiet
                            string sql = "Tbl_TraSot_insert ";
                            //@ID_KhachHang uniqueidentifier,
                            sql += "N'" + dt_update["ID_KhachHang"].ToString().ToUpper() + "',";
                            //@Luc nvarchar(200),
                            //  sql += "N'" + DateTime.Now.TimeOfDay.ToString() + "',";
                            //@NgayPhatSinhNo int,
                            sql += "N'" + Get_CauHinh.NgayTinhNo_ket + "',";
                            //@Tien decimal
                            sql += "N'" + e.Value + "'";
                            db.T_exc(sql);
                        }
                    }
                    #endregion
                    #region Ket
                    if (tenFile.ToLower().Contains("ket"))
                    {
                        decimal Tong_No = decimal.Parse(dt_update["TongNo_ket"].ToString());
                        decimal TogTra = decimal.Parse((e.Value.ToString()=="")?"0":e.Value.ToString());
                        if (TogTra > Tong_No)
                        {
                            msgbox.dialog_OK_warning("Két trả vược mức nợ.");
                            gv_daluu.CancelUpdateCurrentRow();
                        }
                        else
                        {
                            // xoa chi tiet
                            string sql = "Tbl_TraKet_insert ";
                            //@ID_KhachHang uniqueidentifier,
                            sql += "N'" + dt_update["ID_KhachHang"].ToString().ToUpper() + "',";
                            //@Luc nvarchar(200),
                            //  sql += "N'" + DateTime.Now.TimeOfDay.ToString() + "',";
                            //@NgayPhatSinhNo int,
                            sql += "N'" + Get_CauHinh.NgayTinhNo_ket + "',";
                            //@Tien decimal
                            sql += "N'" + e.Value + "'";
                            db.T_exc(sql);
                        }
                    }
                    #endregion
                    #region Lu
                    if (tenFile.ToLower().Contains("lu"))
                    {
                        decimal Tong_No = decimal.Parse(dt_update["TongNo_lu"].ToString());
                        decimal TogTra = decimal.Parse((e.Value.ToString() == "") ? "0" : e.Value.ToString());
                        if (TogTra > Tong_No)
                        {
                            msgbox.dialog_OK_warning("Lu trả vược mức nợ.");
                            gv_daluu.CancelUpdateCurrentRow();
                        }
                        else
                        {
                            // xoa chi tiet
                            string sql = "Tbl_TraLu_insert ";
                            //@ID_KhachHang uniqueidentifier,
                            sql += "N'" + dt_update["ID_KhachHang"].ToString().ToUpper() + "',";
                            //@Luc nvarchar(200),
                            //  sql += "N'" + DateTime.Now.TimeOfDay.ToString() + "',";
                            //@NgayPhatSinhNo int,
                            sql += "N'" + Get_CauHinh.NgayTinhNo_ket + "',";
                            //@Tien decimal
                            sql += "N'" + e.Value + "'";
                            db.T_exc(sql);
                        }
                    }
                    #endregion
                    #region Cắt
                    if (tenFile.ToLower().Contains("cat"))
                    {
                        decimal Tong_No = decimal.Parse(dt_update["TongNo_cat"].ToString());
                        decimal TogTra = decimal.Parse((e.Value.ToString() == "") ? "0" : e.Value.ToString());
                        if (TogTra > Tong_No)
                        {
                            msgbox.dialog_OK_warning("Cắt trả vược mức nợ.");
                            gv_daluu.CancelUpdateCurrentRow();
                        }
                        else
                        {
                            // xoa chi tiet
                            string sql = "Tbl_TraCat_insert ";
                            //@ID_KhachHang uniqueidentifier,
                            sql += "N'" + dt_update["ID_KhachHang"].ToString().ToUpper() + "',";
                            //@Luc nvarchar(200),
                            //  sql += "N'" + DateTime.Now.TimeOfDay.ToString() + "',";
                            //@NgayPhatSinhNo int,
                            sql += "N'" + Get_CauHinh.NgayTinhNo_ket + "',";
                            //@Tien decimal
                            sql += "N'" + e.Value + "'";
                            db.T_exc(sql);
                        }
                    }
                    #endregion
                    #region Bơm
                    if (tenFile.ToLower().Contains("bom"))
                    {
                        decimal Tong_No = decimal.Parse(dt_update["TongNo_bom"].ToString());
                        decimal TogTra = decimal.Parse((e.Value.ToString() == "") ? "0" : e.Value.ToString());
                        if (TogTra > Tong_No)
                        {
                            msgbox.dialog_OK_warning("Bơm trả vược mức nợ.");
                            gv_daluu.CancelUpdateCurrentRow();
                        }
                        else
                        {
                            // xoa chi tiet
                            string sql = "Tbl_TraBom_insert ";
                            //@ID_KhachHang uniqueidentifier,
                            sql += "N'" + dt_update["ID_KhachHang"].ToString().ToUpper() + "',";
                            //@Luc nvarchar(200),
                            //  sql += "N'" + DateTime.Now.TimeOfDay.ToString() + "',";
                            //@NgayPhatSinhNo int,
                            sql += "N'" + Get_CauHinh.NgayTinhNo_ket + "',";
                            //@Tien decimal
                            sql += "N'" + e.Value + "'";
                            db.T_exc(sql);
                        }
                    }
                    #endregion
                    tailai();
                    
                }
            }
            else
            {
                gv_daluu.CancelUpdateCurrentRow();
            }

        }
        #endregion

        #region lệnh dùng chung
        public void excel()
        {
        }

        #region cap nhat tien tra
        TienTra _TienTra;
        public void btn_capnhat()
        {
            if (Pow.kiemtra("CongNo_SoThuKet", "Sua", Get_CauHinh.Dt_Login.Rows[0]["ID"].ToString().ToUpper()) == true)
            {
                //_TienTra = new TienTra();
                //_TienTra.FormClosed += new FormClosedEventHandler(_TienTra_FormClosed);
                //_TienTra.TextChanged += new EventHandler(_TienTra_TextChanged);
                //_TienTra.ShowDialog();
            }
            
        }
        string select_khachhang_name;
        
        void _TienTra_TextChanged(object sender, EventArgs e)
        {
            select_khachhang_name = _TienTra.select_khachhang_name;
           // msgbox.dialog_OK_info(select_khachhang_name);
           // gv_daluu.Columns["gridColumn1"].FilterInfo = new ColumnFilterInfo("[gridColumn1] LIKE '" + select_khachhang_name + "'");
           gv_daluu.ActiveFilterString = "[Tbl_KhachHang_Name] = '" + select_khachhang_name + "'";

      

            
        }

        void _TienTra_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_TienTra.DialogResult == DialogResult.OK)
            {
                tailai();
               
            }
            gv_daluu.ClearColumnsFilter();
            //CriteriaOperator expr0 = null;
            //gv_daluu.ActiveFilterCriteria = GroupOperator.And(new CriteriaOperator[] { expr0 });
            _TienTra = new TienTra();
        }
#endregion

        #region
        public void khaibao_nodau()
        {
            if (Pow.kiemtra("CongNo_SoThuKet", "Sua", Get_CauHinh.Dt_Login.Rows[0]["ID"].ToString().ToUpper()) == true)
            {
                #region
                _T_KhaiBaoCongNo_Ket = new T_KhaiBaoCongNo_Ket();
                _T_KhaiBaoCongNo_Ket.FormClosed += new FormClosedEventHandler(_T_KhaiBaoCongNo_Ket_FormClosed);
                _T_KhaiBaoCongNo_Ket.ShowDialog();
                #endregion
            }
            else
            {
                msgbox.dialog_OK_warning("Bạn không có quyền cập nhật");
            }
        }
        T_KhaiBaoCongNo_Ket _T_KhaiBaoCongNo_Ket;
        void _T_KhaiBaoCongNo_Ket_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_T_KhaiBaoCongNo_Ket.DialogResult == DialogResult.OK)
            {
                tailai();
            }
        }
        #endregion

        public void sua()
        {
            if (Pow.kiemtra("CongNo_SoThuKet", "Sua", Get_CauHinh.Dt_Login.Rows[0]["ID"].ToString().ToUpper()) == true)
            {
               
            }
        }
       
        
      
        Class_KetNoi db = new Class_KetNoi();
        DataTable dt_SP_ketChuyen;
#pragma warning disable CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.ngaydetru' is never used
        int ngaydetru;
#pragma warning restore CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.ngaydetru' is never used
        public void tailai()
        {
         
            #region cong no sp
            dt_SP_ketChuyen = db.T_opendataset("sp_CongNoSP_Chot").Tables[0];          
            #endregion
            gc_daluu.DataSource = dt_SP_ketChuyen;
            gv_daluu.ExpandAllGroups();
            colSTT.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
            gv_daluu.CustomUnboundColumnData += gridView1_CustomUnboundColumnData;
            data();

        }
#pragma warning disable CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dts' is never used
        DataSet dts;
#pragma warning restore CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dts' is never used
       
        #endregion

        #region menu click
        public void event_click()
        {
           
           // btn_tratien.Click += new EventHandler(btn_del_Click);          
          //  btn_print1.Click += new EventHandler(btn_all_Click);
          //  btn_In_Sot.Click += new EventHandler(btn_In_Sot_Click);
          //  btn_In_Lu.Click += new EventHandler(btn_In_Lu_Click);
          //  btn_In_Cat.Click += new EventHandler(btn_In_Cat_Click);
          //  btn_In_Bom.Click += new EventHandler(btn_In_Bom_Click);
          ////  btn_print2.Click += new EventHandler(btn_none_Click);
          // // btn_close.Click += new EventHandler(btn_close_Click);
          //  btn_load.Click += new EventHandler(btn_load_Click);
          // // btn_nodau.Click += new EventHandler(btn_in_Click);
          //  btn_bill.Click += new EventHandler(btn_sua_Click);
          //  btn_Sot.Click += new EventHandler(btn_Sot_Click);
          //  btn_Lu.Click += new EventHandler(btn_Lu_Click);
          //  btn_Cat.Click += new EventHandler(btn_Cat_Click);
          //  btn_Bom.Click += new EventHandler(btn_Bom_Click);

          // // btnxemghichu.Click += new EventHandler(btn_ghichu_Click);
          //  btn_muon.Click += new EventHandler(btn_muon_Click);
        }

       
#pragma warning disable CS0649 // Field 'fmCongNo_QLSanPham_KetChuyen._MuonKet' is never assigned to, and will always have its default value null
        MuonKet _MuonKet;
#pragma warning restore CS0649 // Field 'fmCongNo_QLSanPham_KetChuyen._MuonKet' is never assigned to, and will always have its default value null
       
        void _MuonKet_FormClosed(object sender, FormClosedEventArgs e)
        {
            if (_MuonKet.DialogResult == DialogResult.OK)
            {
                tailai();
            }
        }
     
        public void xemghichu()
        {
            #region
           /* DataView dvt = new DataView(dts.Tables[0]);
            DataRow[] ds_can_ghiChu = DuLieu.CongNo_1Ngay_Ket.Tables[0].Select("Ton>0 and MoiTra = 0");

            for (int i = 0; i < ds_can_ghiChu.Length; i++)
            {
                int ngaytra_max = int.Parse(ds_can_ghiChu[i]["NTMAX"].ToString());
                int ngayno_max = int.Parse(ds_can_ghiChu[i]["NNMAX"].ToString());
                if (ngaytra_max > 0)
                {
                    //xem ngay max co phai la ngay cuoi cung khong
                    DataTable dt_ton_ngayMax = db.T_open("xemcongno_1kh_1ngay '" + ds_can_ghiChu[i]["ID_KhachHang"].ToString().ToUpper() + "'," + ngaytra_max + "").Tables[0];
                    if (double.Parse(dt_ton_ngayMax.Rows[0]["Ton"].ToString()) == 0)
                    {
                        // ngay tra max cung la ngay dut diem
                        DataTable dt_ngaymuadautien = db.T_open("xemcongno_1kh_1ngay_sau_ngaytramax '" + ds_can_ghiChu[i]["ID_KhachHang"].ToString().ToUpper() + "'," + ngaydetru + "," + ngaytra_max + "").Tables[0];
                        if (int.Parse(dt_ngaymuadautien.Rows[0]["ngaydautien"].ToString()) == 0)
                        {
                            // chua co ngay dau tien
                            ds_can_ghiChu[i]["SoNgay"] = 0;
                            ds_can_ghiChu[i]["GhiChu"] = "";
                            DuLieu.CongNo_1Ngay_Ket.Tables[0].AcceptChanges();
                        }
                        else
                        {
                            int ngaydautien = int.Parse(dt_ngaymuadautien.Rows[0]["ngaydautien"].ToString());
                            ds_can_ghiChu[i]["SoNgay"] = ngaydetru - ngaydautien;
                            ds_can_ghiChu[i]["GhiChu"] = (ngaydetru - ngaydautien).ToString() + " Ngay";
                            DuLieu.CongNo_1Ngay_Ket.Tables[0].AcceptChanges();
                        }
                    }
                    else
                    {
                        // van con ton no nen su dung ngay nay lam moc tinh tuoi no
                        ds_can_ghiChu[i]["SoNgay"] = ngaydetru - ngaytra_max;
                        if ((ngaydetru - ngaytra_max > 2))
                        {
                            ds_can_ghiChu[i]["GhiChu"] = (ngaydetru - ngaytra_max).ToString() + " Ngay";
                        }
                        else
                        {
                            ds_can_ghiChu[i]["GhiChu"] = "";
                        }
                        DuLieu.CongNo_1Ngay_Ket.Tables[0].AcceptChanges();

                    }
                }
                else
                {
                    #region khong co lich su tra no
                    ds_can_ghiChu[i]["SoNgay"] = ngaydetru - ngayno_max;
                    if ((ngaydetru - ngayno_max > 2))
                    {
                        ds_can_ghiChu[i]["GhiChu"] = (ngaydetru - ngayno_max).ToString() + " Ngay";
                    }
                    else
                    {

                        ds_can_ghiChu[i]["GhiChu"] = "";
                    }
                    DuLieu.CongNo_1Ngay_Ket.Tables[0].AcceptChanges();
                    #endregion
                }

            }
            * */
            #endregion
        }

       
        void btn_in_Click(object sender, EventArgs e)
        {
            khaibao_nodau();
        }

        void btn_load_Click(object sender, EventArgs e)
        {
            tailai();
        }

        void btn_close_Click(object sender, EventArgs e)
        {
           // this.Close();
        }

        void btn_del_Click(object sender, EventArgs e)
        {
            btn_capnhat();
        }

       


        #endregion

        #region data       
#pragma warning disable CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dtv_songay' is never used
        DataView dtv_songay;
#pragma warning restore CS0169 // The field 'fmCongNo_QLSanPham_KetChuyen.dtv_songay' is never used
        public void data()
        {


           // colSTT.UnboundType = DevExpress.Data.UnboundColumnType.Integer;
           // gv_daluu.CustomUnboundColumnData += gridView1_CustomUnboundColumnData;

            //lbnocu.Text = cnocu_sot.SummaryText;
            //lbnomoi.Text = cnomoi_sot.SummaryText;
            //lbtongno.Text = ctongno_sot.SummaryText;
            //lbtongtra.Text = ctongtra_sot.SummaryText;
            //lbton.Text = cton_sot.SummaryText;
            //if (lbnomoi.Text == "")
            //{
            //    lbnomoi.Text = "0";
            //}
            //if (lbnocu.Text == "")
            //{
            //    lbnocu.Text = "0";
            //}
            //if (lbtongno.Text == "")
            //{
            //    lbtongno.Text = "0";
            //}
            //if (lbtongtra.Text == "")
            //{
            //    lbtongtra.Text = "0";
            //}
            //if (lbton.Text == "")
            //{
            //    lbton.Text = "0";
            //}
        }
        #endregion

        private void gv_daluu_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            //if (e.RowHandle >= 0)
            //{
            //    if (e.CellValue.ToString().Trim() == "0")
            //        gv_daluu.SetRowCellValue(e.RowHandle, e.Column.FieldName, "");
            //}
            //try
            //{
            //    double _hanmuc = double.Parse(gv_daluu.GetRowCellValue(e.RowHandle, "HanMuc").ToString().Trim());
            //    double _ton = double.Parse(gv_daluu.GetRowCellValue(e.RowHandle, "Ton").ToString().Trim());
            //    if (_hanmuc < _ton && _hanmuc > 0)
            //    {
            //        e.Appearance.BackColor = Color.Red;
            //        e.Appearance.ForeColor = Color.White;
            //        //gv_daluu.SetRowCellValue(e.RowHandle, "VuotHanMuc", "x");
            //    }
            //}
            //catch (Exception)
            //{


            //}
        }

        //private void simpleButton1_Click(object sender, EventArgs e)
        //{
        //    DataView dv = dtGrid.Copy().DefaultView;
        //    dv.RowFilter = "VuotHanMuc='x'";
        //    frmVuot_DM_CongNo_SoThuKet frm = new frmVuot_DM_CongNo_SoThuKet(dv.ToTable());
        //    frm.ShowDialog();
        //}

        private void gc_daluu_Click(object sender, EventArgs e)
        {

        }


        private void gv_daluu_CustomRowCellEditForEditing(object sender, DevExpress.XtraGrid.Views.Grid.CustomRowCellEditEventArgs e)
        {
            try
            {
                #region
                //string col = e.Column.Caption;
                //string colname = e.Column.FieldName;
                //if (colname.ToLower().Contains("nocu"))
                //{
                //    kh_ten_choos = gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["Tbl_KhachHang_Name"].ToString();
                //    kh_id_choos = gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["ID_KhachHang"].ToString();
                //    // ngay =int.Parse(gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["NgayPhatSinhNo"].ToString());                
                //    xemnocu();
                //}
                //if (colname.ToLower().Contains("nomoi"))
                //{
                //    kh_ten_choos = gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["Tbl_KhachHang_Name"].ToString();
                //    kh_id_choos = gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["ID_KhachHang"].ToString();
                //    //  ngay = int.Parse(gv_daluu.GetDataRow(gv_daluu.FocusedRowHandle)["NgayPhatSinhNo"].ToString());                
                //    xemnomoi();
                //}
                #endregion
            }
            catch (Exception)
            {
               
            }
           
        }


      

       
   

       


        private void gv_daluu_RowStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowStyleEventArgs e)
        {
            
        }

        private void gv_daluu_CustomColumnDisplayText(object sender, DevExpress.XtraGrid.Views.Base.CustomColumnDisplayTextEventArgs e)
        {
            if (e.Column.FieldName.Contains("sot") || e.Column.FieldName.Contains("ket") || e.Column.FieldName.Contains("lu") || e.Column.FieldName.Contains("cat") || e.Column.FieldName.Contains("bom"))
            {
                if (e.Value != null)
                {
                    if (e.Value.ToString().Trim() == "0")
                        e.DisplayText = "";
                }

            }
        }

        private void btn_muon_Click_1(object sender, EventArgs e)
        {

        }

        private void btnxemghichu_Click(object sender, EventArgs e)
        {

        }

        private void ddlTraNo_Click(object sender, EventArgs e)
        {

        }

        private void btn_chitiet_Click_1(object sender, EventArgs e)
        {

        }
    }
}
