private void gridView1_ValidateRow(object sender, DevExpress.XtraGrid.Views.Base.ValidateRowEventArgs e)
        {
            try
            {
                GridView view = sender as GridView;

                //validation
                GridColumn thangCol = view.Columns["THANG"];
                GridColumn ma_ctCol = view.Columns["MA_CT"];
                string thang = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, thangCol), "");
                string ma_ct = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, ma_ctCol), "");
                if (thang.Trim().Length == 0 || ma_ct.Trim().Length == 0)
                {
                    e.Valid = false;
                    if (thang.Trim().Length == 0)
                        view.SetColumnError(thangCol, "Tháng không được rổng");
                    if (ma_ct.Trim().Length == 0)
                        view.SetColumnError(ma_ctCol, "Mã công trình không được rổng");

                    return;
                }

                _KTGTCTTHANGRepo = new KTGTCTTHANGRepo();
                //Kiểm tra đây là dòng dữ liệu mới hay cũ, nếu là mới thì mình insert
                if (view.IsNewItemRow(e.RowHandle))
                {
                    //e.RowHandle trả về giá trị int là thứ tự của dòng hiện tại
                    KT_GTCT_THANG obj = new KT_GTCT_THANG();

                    obj.THANG = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "THANG"), 0);
                    obj.MA_CT = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "MA_CT"), "");
                    obj.TEN_CT = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TEN_CT"), "");
                    obj.HOAN_THANH = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "HOAN_THANH"), 0);
                    DateTime? temp = null;
                    if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_HD"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_HD"), DateTime.MinValue);
                    obj.NGAY_HD = temp;
                    obj.SO_HD = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "SO_HD"), "");
                    obj.NOI_DUNG = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "NOI_DUNG"), "");
                    obj.GIA_TRI = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_TRI"), 0);
                    obj.GIA_TRI_NT = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_TRI_NT"), 0);
                    obj.SO_NGAY_LAM = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "SO_NGAY_LAM"), 0);
                    temp = null;
                    if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_NT"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_NT"), DateTime.MinValue);
                    obj.NGAY_NT = temp;
                    temp = null;
                    if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_KC"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_KC"), DateTime.MinValue);
                    obj.NGAY_KC = temp;
                    obj.CP_DK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_621"), 0);
                    obj.CP_DK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_622"), 0);
                    obj.CP_DK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_623"), 0);
                    obj.CP_DK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_627"), 0);
                    obj.DO_DANG_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DO_DANG_DK"), 0);
                    obj.DOANH_THU_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_DK"), 0);
                    obj.DOANH_THU_TK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_TK"), 0);
                    obj.DOANH_THU_LK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_LK"), 0);
                    obj.DOANH_THU_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_CK"), 0);
                    obj.THUE_VAT_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_DK"), 0);
                    obj.THUE_VAT_TK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_TK"), 0);
                    obj.THUE_VAT_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_CK"), 0);
                    obj.DS_HD_DK = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DS_HD_DK"), "");
                    obj.DS_HD_TK = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DS_HD_TK"), "");
                    obj.PSTK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_621"), 0);
                    obj.PSTK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_622"), 0);
                    obj.PSTK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_623"), 0);
                    obj.PSTK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_627"), 0);
                    obj.PSTK_TONG = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_TONG"), 0);
                    obj.PSLK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_621"), 0);
                    obj.PSLK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_622"), 0);
                    obj.PSLK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_623"), 0);
                    obj.PSLK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_627"), 0);
                    obj.TONG_CP = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "TONG_CP"), 0);
                    obj.CP_CK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_621"), 0);
                    obj.CP_CK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_622"), 0);
                    obj.CP_CK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_623"), 0);
                    obj.CP_CK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_627"), 0);
                    obj.DO_DANG_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DO_DANG_CK"), 0);
                    obj.LAI_GOP = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "LAI_GOP"), 0);
                    obj.TY_LE_LAI = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "TY_LE_LAI"), 0);
                    obj.PSNO_154 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSNO_154"), 0);
                    obj.PSCO_154 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154"), 0);
                    obj.GIA_VON_DK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_DK"), 0);
                    obj.GIA_VON_TK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_TK"), 0);
                    obj.GIA_VON_CK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_CK"), 0);
                    obj.TK_DO_DANG = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TK_DO_DANG"), "");
                    obj.TK_GIA_VON = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TK_GIA_VON"), "");
                    obj.TY_LE_PB = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "TY_LE_PB"), 0);
                    obj.DANH_DAU = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DANH_DAU"), "");
                    obj.GIA_VON_LK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_LK"), 0);
                    obj.PSCO_154_MTC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_MTC"), 0);
                    obj.PSCO_154_NC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_NC"), 0);
                    obj.PSCO_154_NVL = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_NVL"), 0);
                    obj.PSCO_154_SXC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_SXC"), 0);
                    obj.TRANG_THAI = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "TRANG_THAI"), 0);


                    _KTGTCTTHANGRepo.Create(obj);

                }
                //Cũ thì update
                else
                {
                    int id = Utils.CIntDef(view.GetRowCellValue(gridView1.FocusedRowHandle, "ID"), 0);
                    KT_GTCT_THANG obj = _KTGTCTTHANGRepo.GetById(id);
                    if (obj != null)
                    {
                        obj.THANG = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "THANG"), 0);
                        obj.MA_CT = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "MA_CT"), "");
                        obj.TEN_CT = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TEN_CT"), "");
                        obj.HOAN_THANH = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "HOAN_THANH"), 0);
                        DateTime? temp = null;
                        if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_HD"), DateTime.MinValue) != DateTime.MinValue)
                            temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_HD"), DateTime.MinValue);
                        obj.NGAY_HD = temp;
                        obj.SO_HD = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "SO_HD"), "");
                        obj.NOI_DUNG = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "NOI_DUNG"), "");
                        obj.GIA_TRI = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_TRI"), 0);
                        obj.GIA_TRI_NT = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_TRI_NT"), 0);
                        obj.SO_NGAY_LAM = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "SO_NGAY_LAM"), 0);
                        temp = null;
                        if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_NT"), DateTime.MinValue) != DateTime.MinValue)
                            temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_NT"), DateTime.MinValue);
                        obj.NGAY_NT = temp;
                        temp = null;
                        if (Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_KC"), DateTime.MinValue) != DateTime.MinValue)
                            temp = Utils.CDateDef(view.GetRowCellValue(e.RowHandle, "NGAY_KC"), DateTime.MinValue);
                        obj.NGAY_KC = temp;
                        obj.CP_DK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_621"), 0);
                        obj.CP_DK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_622"), 0);
                        obj.CP_DK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_623"), 0);
                        obj.CP_DK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_DK_627"), 0);
                        obj.DO_DANG_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DO_DANG_DK"), 0);
                        obj.DOANH_THU_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_DK"), 0);
                        obj.DOANH_THU_TK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_TK"), 0);
                        obj.DOANH_THU_LK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_LK"), 0);
                        obj.DOANH_THU_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DOANH_THU_CK"), 0);
                        obj.THUE_VAT_DK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_DK"), 0);
                        obj.THUE_VAT_TK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_TK"), 0);
                        obj.THUE_VAT_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "THUE_VAT_CK"), 0);
                        obj.DS_HD_DK = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DS_HD_DK"), "");
                        obj.DS_HD_TK = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DS_HD_TK"), "");
                        obj.PSTK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_621"), 0);
                        obj.PSTK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_622"), 0);
                        obj.PSTK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_623"), 0);
                        obj.PSTK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_627"), 0);
                        obj.PSTK_TONG = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSTK_TONG"), 0);
                        obj.PSLK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_621"), 0);
                        obj.PSLK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_622"), 0);
                        obj.PSLK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_623"), 0);
                        obj.PSLK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSLK_627"), 0);
                        obj.TONG_CP = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "TONG_CP"), 0);
                        obj.CP_CK_621 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_621"), 0);
                        obj.CP_CK_622 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_622"), 0);
                        obj.CP_CK_623 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_623"), 0);
                        obj.CP_CK_627 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "CP_CK_627"), 0);
                        obj.DO_DANG_CK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "DO_DANG_CK"), 0);
                        obj.LAI_GOP = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "LAI_GOP"), 0);
                        obj.TY_LE_LAI = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "TY_LE_LAI"), 0);
                        obj.PSNO_154 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSNO_154"), 0);
                        obj.PSCO_154 = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154"), 0);
                        obj.GIA_VON_DK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_DK"), 0);
                        obj.GIA_VON_TK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_TK"), 0);
                        obj.GIA_VON_CK = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_CK"), 0);
                        obj.TK_DO_DANG = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TK_DO_DANG"), "");
                        obj.TK_GIA_VON = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "TK_GIA_VON"), "");
                        obj.TY_LE_PB = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "TY_LE_PB"), 0);
                        obj.DANH_DAU = Utils.CStrDef(view.GetRowCellValue(e.RowHandle, "DANH_DAU"), "");
                        obj.GIA_VON_LK = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "GIA_VON_LK"), 0);
                        obj.PSCO_154_MTC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_MTC"), 0);
                        obj.PSCO_154_NC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_NC"), 0);
                        obj.PSCO_154_NVL = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_NVL"), 0);
                        obj.PSCO_154_SXC = Utils.CDblDef(view.GetRowCellValue(e.RowHandle, "PSCO_154_SXC"), 0);
                        obj.TRANG_THAI = Utils.CIntDef(view.GetRowCellValue(e.RowHandle, "TRANG_THAI"), 0);

                        _KTGTCTTHANGRepo.Update(obj);
                    }

                }
                Load_Data();
            }
            catch (Exception ex)
            {
                e.Valid = false;
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void Save_Duplicate()
        {
            try
            {                
                if (MessageBox.Show("Bạn có muốn copy dòng này thành dòng mới?", "Thông báo", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    _KTGTCTTHANGRepo = new KTGTCTTHANGRepo();
                    KT_GTCT_THANG obj = new KT_GTCT_THANG();

                    obj.THANG = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THANG"), 0);
                    obj.MA_CT = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "MA_CT"), "");
                    obj.TEN_CT = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TEN_CT"), "");
                    obj.HOAN_THANH = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "HOAN_THANH"), 0);
                    DateTime? temp = null;
                    if (Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_HD"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_HD"), DateTime.MinValue);
                    obj.NGAY_HD = temp;
                    obj.SO_HD = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SO_HD"), "");
                    obj.NOI_DUNG = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NOI_DUNG"), "");
                    obj.GIA_TRI = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_TRI"), 0);
                    obj.GIA_TRI_NT = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_TRI_NT"), 0);
                    obj.SO_NGAY_LAM = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "SO_NGAY_LAM"), 0);
                    temp = null;
                    if (Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_NT"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_NT"), DateTime.MinValue);
                    obj.NGAY_NT = temp;
                    temp = null;
                    if (Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_KC"), DateTime.MinValue) != DateTime.MinValue)
                        temp = Utils.CDateDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "NGAY_KC"), DateTime.MinValue);
                    obj.NGAY_KC = temp;
                    obj.CP_DK_621 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_DK_621"), 0);
                    obj.CP_DK_622 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_DK_622"), 0);
                    obj.CP_DK_623 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_DK_623"), 0);
                    obj.CP_DK_627 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_DK_627"), 0);
                    obj.DO_DANG_DK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DO_DANG_DK"), 0);
                    obj.DOANH_THU_DK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DOANH_THU_DK"), 0);
                    obj.DOANH_THU_TK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DOANH_THU_TK"), 0);
                    obj.DOANH_THU_LK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DOANH_THU_LK"), 0);
                    obj.DOANH_THU_CK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DOANH_THU_CK"), 0);
                    obj.THUE_VAT_DK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THUE_VAT_DK"), 0);
                    obj.THUE_VAT_TK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THUE_VAT_TK"), 0);
                    obj.THUE_VAT_CK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "THUE_VAT_CK"), 0);
                    obj.DS_HD_DK = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DS_HD_DK"), "");
                    obj.DS_HD_TK = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DS_HD_TK"), "");
                    obj.PSTK_621 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSTK_621"), 0);
                    obj.PSTK_622 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSTK_622"), 0);
                    obj.PSTK_623 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSTK_623"), 0);
                    obj.PSTK_627 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSTK_627"), 0);
                    obj.PSTK_TONG = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSTK_TONG"), 0);
                    obj.PSLK_621 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSLK_621"), 0);
                    obj.PSLK_622 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSLK_622"), 0);
                    obj.PSLK_623 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSLK_623"), 0);
                    obj.PSLK_627 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSLK_627"), 0);
                    obj.TONG_CP = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TONG_CP"), 0);
                    obj.CP_CK_621 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_CK_621"), 0);
                    obj.CP_CK_622 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_CK_622"), 0);
                    obj.CP_CK_623 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_CK_623"), 0);
                    obj.CP_CK_627 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "CP_CK_627"), 0);
                    obj.DO_DANG_CK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DO_DANG_CK"), 0);
                    obj.LAI_GOP = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "LAI_GOP"), 0);
                    obj.TY_LE_LAI = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TY_LE_LAI"), 0);
                    obj.PSNO_154 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSNO_154"), 0);
                    obj.PSCO_154 = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSCO_154"), 0);
                    obj.GIA_VON_DK = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_VON_DK"), 0);
                    obj.GIA_VON_TK = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_VON_TK"), 0);
                    obj.GIA_VON_CK = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_VON_CK"), 0);
                    obj.TK_DO_DANG = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TK_DO_DANG"), "");
                    obj.TK_GIA_VON = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TK_GIA_VON"), "");
                    obj.TY_LE_PB = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TY_LE_PB"), 0);
                    obj.DANH_DAU = Utils.CStrDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "DANH_DAU"), "");
                    obj.GIA_VON_LK = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "GIA_VON_LK"), 0);
                    obj.PSCO_154_MTC = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSCO_154_MTC"), 0);
                    obj.PSCO_154_NC = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSCO_154_NC"), 0);
                    obj.PSCO_154_NVL = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSCO_154_NVL"), 0);
                    obj.PSCO_154_SXC = Utils.CDblDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "PSCO_154_SXC"), 0);
                    obj.TRANG_THAI = Utils.CIntDef(gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "TRANG_THAI"), 0);

                    _KTGTCTTHANGRepo.Create(obj);
                    MessageBox.Show("Đã copy dòng này vào cuối bảng!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 partial void UpdateKT_GTCT_THANG(KT_GTCT_THANG instance);
 partial void DeleteKT_GTCT_THANG(KT_GTCT_THANG instance);
 partial void InsertKT_GTCT_THANG(KT_GTCT_THANG instance);