Inheritance: IP.Core.IPUserService.US_Object
 internal void display_for_update(US_GD_THU_NHAP_KHAC v_us)
 {
     m_e_form_mode = DataEntryFormMode.UpdateDataState;
     set_init_form_load();
     m_us_gd_tnk = v_us;
     us_2_form(v_us);
     this.ShowDialog();
 }
 private void load_data_to_grid()
 {
     CHRMCommon.make_stt(m_grv);
     DataSet v_ds = new DataSet();
     US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
     v_ds.Tables.Add(new DataTable());
     v_us.filldatasetTNKNgoaiBangLuong(v_ds, m_txt_thang.ToString(), m_txt_nam.ToString());
     m_grc.DataSource = v_ds.Tables[0];
 }
 private bool check_quy_tien_dang_su_dung_yn(decimal id_quy_tnk)
 {
     US_GD_THU_NHAP_KHAC v_us_gd_tnk = new US_GD_THU_NHAP_KHAC();
     DS_GD_THU_NHAP_KHAC v_ds_gd_tnk = new DS_GD_THU_NHAP_KHAC();
     v_us_gd_tnk.LayDuLieuThuNhapKhacTheoIDQuy(v_ds_gd_tnk, id_quy_tnk);
     if (v_ds_gd_tnk.Tables[0].Rows.Count != 0)
         return true;
     else return false;
 }
 private void load_data_to_grid()
 {
     CHRMCommon.make_stt(m_grv_hs_bs_hs_athk);
     DataSet v_ds = new DataSet();
     US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
     v_ds.Tables.Add(new DataTable());
     v_us.filldatasetBaoCaoThuNhapLDNgoaiBangLuong(v_ds, m_txt_chon_thang.ToString(), m_txt_chon_nam.ToString(), m_sle_nhom_ld.EditValue.ToString());
     m_grc_bc_thu_lao.DataSource = v_ds.Tables[0];
     this.Load += F481_bao_cao_thu_lao_hdqt_Load;
     m_dat_thang.DateTimeChanged += M_dat_thang_DateTimeChanged;
 }
 private void delete_gd_thu_nhap_khac(US_GD_QUY_THU_NHAP_KHAC v_us_gd_quy_tnk)
 {
     US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
     DS_GD_THU_NHAP_KHAC v_ds = new DS_GD_THU_NHAP_KHAC();
     v_us.XoaTNKTheoIDQuy(v_us_gd_quy_tnk.dcID);
     //for (int i = 0; i < m_dt_thu_nhap_khac.Rows.Count; i++)
     //{
     //    US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC(decimal.Parse(m_dt_thu_nhap_khac.Rows[i][0].ToString()));
     //    v_us.Delete();
     //}
 }
        public void Display_for_insert(decimal ip_dc_id_quy_thu_nhap_khac)
        {
            US_GD_QUY_THU_NHAP_KHAC v_us_quy = new US_GD_QUY_THU_NHAP_KHAC(ip_dc_id_quy_thu_nhap_khac);

            m_us_gd_tnk = new US_GD_THU_NHAP_KHAC();
            m_us_gd_tnk.dcID_QUY_THU_NHAP_KHAC = v_us_quy.dcID;
            m_us_gd_tnk.dcID_LOAI_THU_NHAP_KHAC = v_us_quy.dcID_LOAI_QUY_THU_NHAP_KHAC;
            m_us_gd_tnk.dcNAM = Convert.ToDecimal(v_us_quy.strNAM);
            m_us_gd_tnk.dcTHANG = Convert.ToDecimal(v_us_quy.strTHANG);
            m_e_form_mode = DataEntryFormMode.InsertDataState;
            ShowDialog();
        }
 void m_cmd_delete_Click(object sender, EventArgs e)
 {
     string v_str_confirm = "Bạn có chắc chắn muốn xóa khoản thu nhập này";
     if (CHRM_BaseMessages.MsgBox_Confirm (v_str_confirm))
     {
         var v_dr = m_grv.GetDataRow(m_grv.FocusedRowHandle);
         US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC(CIPConvert.ToDecimal(v_dr[2].ToString()));
         v_us.Delete();
         XtraMessageBox.Show("Xóa thành công!");
         load_data_to_grid();
     }
 }
 private bool check_quy_tien_dang_su_dung_yn(US_GD_QUY_THU_NHAP_KHAC v_us)
 {
     m_dt_thu_nhap_khac.Clear();
     US_GD_THU_NHAP_KHAC v_us_gd_tnk = new US_GD_THU_NHAP_KHAC();
     DS_GD_THU_NHAP_KHAC v_ds_gd_tnk = new DS_GD_THU_NHAP_KHAC();
     v_us_gd_tnk.LayDuLieuThuNhapKhacTheoIDQuy(v_ds_gd_tnk, v_us.dcID);
     if (v_ds_gd_tnk.Tables[0].Rows.Count != 0)
     {
         m_dt_thu_nhap_khac = v_ds_gd_tnk.Tables[0];
         return true;
     }
     else return false;
 }
        public void Display_for_update(decimal ip_dc_id_thu_nhap_khac)
        {
            m_e_form_mode = DataEntryFormMode.UpdateDataState;
            m_us_gd_tnk = new US_GD_THU_NHAP_KHAC(ip_dc_id_thu_nhap_khac);

            m_sle_chon_nhan_vien.EditValue = m_us_gd_tnk.dcID_NHAN_VIEN;
            m_sle_chon_nhan_vien.ReadOnly = true;

            m_txt_he_so.EditValue = m_us_gd_tnk.dcHE_SO;
            m_txt_so_tien.EditValue = m_us_gd_tnk.dcSO_TIEN;
            m_txt_so_tien_nop_thue.EditValue = m_us_gd_tnk.dcSO_TIEN_NOP_THUE;
            m_txt_so_tien_thuc_linh.EditValue = m_us_gd_tnk.dcSO_TIEN_THUC_LINH;

            ShowDialog();
        }
        private void data_row_2_us(DataRow ip_dr_du_lieu_1_nv, ref US_GD_THU_NHAP_KHAC ref_us)
        {
            ref_us.dcID_NHAN_VIEN = (decimal)ip_dr_du_lieu_1_nv["ID_NHAN_VIEN"];
            ref_us.dcSO_TIEN = Convert.ToDecimal(ip_dr_du_lieu_1_nv["SO_TIEN_THUONG_NV"]);
            ref_us.dcTHANG = Convert.ToDecimal(m_us_v_gd_quy_tien_thuong.strTHANG);
            ref_us.dcNAM = Convert.ToDecimal(m_us_v_gd_quy_tien_thuong.strNAM);
            ref_us.dcID_CACH_TINH_THUE = m_us_v_gd_quy_tien_thuong.dcID_CACH_TINH_THUE;
            ref_us.dcID_LOAI_THU_NHAP_KHAC = CONST_ID_LOAI_THU_NHAP_KHAC.LINH_CO_THUE;
            ref_us.dcID_QUY_TIEN_THUONG = m_us_v_gd_quy_tien_thuong.dcID;

            ref_us.dcSO_TIEN_GIAM_TRU = Convert.ToDecimal(ip_dr_du_lieu_1_nv["SO_TIEN_GIAM_TRU"]);
            ref_us.dcSO_TIEN_NOP_THE = Convert.ToDecimal(ip_dr_du_lieu_1_nv["SO_THUE_PHAI_NOP"]);
            ref_us.dcSO_TIEN_THUC_LINH = Convert.ToDecimal(ip_dr_du_lieu_1_nv["THUC_LINH"]);
            ref_us.dcTONG_HS_ATHK = Convert.ToDecimal(ip_dr_du_lieu_1_nv["TONG_HS_ATHK"]);
            ref_us.dcTRUY_LINH = 0;
            ref_us.dcTRUY_THU = 0;
            ref_us.dcTHUC_LINH_CUOI_CUNG = ref_us.dcSO_TIEN - ref_us.dcSO_TIEN_NOP_THE;
        }
 private void delete_tnk()
 {
     if(m_grv_main.FocusedRowHandle < 0)
     {
         XtraMessageBox.Show("Bạn chưa chọn dòng dữ liệu nào để xóa!", "THÔNG BÁO", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return;
     }
     var dlg = XtraMessageBox.Show("Bạn có chắc chắn muốn xóa dữ liệu? Dữ liệu đã xóa không thể khôi phục được!", "THÔNG BÁO", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
     if(dlg == System.Windows.Forms.DialogResult.Yes)
     {
         var v_dc_id_gd_thu_nhap_khac = Convert.ToDecimal(m_grv_main.GetFocusedDataRow()[GD_THU_NHAP_KHAC.ID]);
         US_GD_THU_NHAP_KHAC v_us_gd_tnk = new US_GD_THU_NHAP_KHAC();
         v_us_gd_tnk.DeleteByID(v_dc_id_gd_thu_nhap_khac);
         load_data_to_grid();
     }
     else
     {
         return;
     }
 }
        private void data_row_2_us(DataRow ip_dr_du_lieu_1_nv, ref US_GD_THU_NHAP_KHAC ref_us)
        {
            var v_dr = (DataRow)m_sle_quy_tien_thuong.Properties.View.GetFocusedDataRow();

            ref_us.dcID_NHAN_VIEN = Convert.ToDecimal(ip_dr_du_lieu_1_nv["ID"]);
            ref_us.dcSO_TIEN = Convert.ToDecimal(ip_dr_du_lieu_1_nv["THANH_TIEN"]);
            ref_us.dcTHANG = Convert.ToDecimal(v_dr["THANG"]);
            ref_us.dcNAM = Convert.ToDecimal(v_dr["NAM"]);
            ref_us.dcID_CACH_TINH_THUE = (decimal)m_cach_tinh_thue;
            ref_us.dcID_LOAI_THU_NHAP_KHAC = CONST_ID_LOAI_THU_NHAP_KHAC.LINH_CO_THUE;
            ref_us.dcID_QUY_TIEN_THUONG = Convert.ToDecimal(m_sle_quy_tien_thuong.EditValue);

            // ref_us.dcSO_TIEN_GIAM_TRU =
            ref_us.dcSO_TIEN_NOP_THE = Convert.ToDecimal(ip_dr_du_lieu_1_nv["THUE"]);
            ref_us.dcSO_TIEN_THUC_LINH = Convert.ToDecimal(ip_dr_du_lieu_1_nv["THUC_LINH"]);
            ref_us.dcTRUY_LINH = Convert.ToDecimal(ip_dr_du_lieu_1_nv["TRUY_LINH"]);
            ref_us.dcTRUY_THU = Convert.ToDecimal(ip_dr_du_lieu_1_nv["TRUY_THU"]);
            ref_us.dcTHUC_LINH_CUOI_CUNG = ref_us.dcSO_TIEN_THUC_LINH + ref_us.dcTRUY_LINH - ref_us.dcTRUY_THU;

            // ref_us.dcTONG_HS_ATHK = Convert.ToDecimal(ip_dr_du_lieu_1_nv["TONG_HS_ATHK"]);
        }
        public void display_athk(decimal ip_dc_id_quy_tien)
        {
            fill_data_quy_tien_thuong();

            US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
            DataSet v_ds = new DataSet();
            v_ds.Tables.Add();

            v_us.LayDuLieuThuNhapKhac(v_ds, ip_dc_id_quy_tien);
            m_grc_luong_thuong.DataSource = v_ds.Tables[0];
            //US_DUNG_CHUNG v_us = new US_DUNG_CHUNG();
            //DataSet v_ds = new DataSet();
            //v_ds.Tables.Add();

            //v_us.FillDatasetWithQuery(v_ds, "select * from V_GD_THU_NHAP_KHAC_2 where id_quy_tien_thuong = " + ip_dc_id_quy_tien);
            //m_grc_luong_thuong.DataSource = v_ds.Tables[0];
            CHRMCommon.make_stt_indicator(m_grv_luong_thuong);
            m_sle_quy_thuong.EditValue = ip_dc_id_quy_tien;

            m_grv_luong_thuong.Columns["TRUY_LINH"].Visible = false;
            m_grv_luong_thuong.Columns["TRUY_THU"].Visible = false;
            m_grv_luong_thuong.Columns["THUC_LINH_CUOI_CUNG"].Visible = false;
            ShowDialog();
        }
 private void us_2_form(US_GD_THU_NHAP_KHAC v_us)
 {
     m_sle_chon_nhan_vien.EditValue = v_us.dcID_NHAN_VIEN;
     m_sle_quy_tien.EditValue = v_us.dcID_QUY_THU_NHAP_KHAC;
     m_txt_so_tien.Text = v_us.dcSO_TIEN.ToString();
     m_txt_ly_do.Text = v_us.strLY_DO;
     //m_txt_thang.Text = v_us.dcTHANG.ToString();
     //m_txt_nam.Text = v_us.dcNAM.ToString();
        // m_sle_loai_thue.EditValue = v_us.dcID_CACH_TINH_THUE;
     m_txt_so_tien_thue.Text = v_us.dcSO_TIEN_NOP_THUE.ToString();
     m_txt_thuc_linh.Text = v_us.dcSO_TIEN_THUC_LINH.ToString();
 }
 private void us_obj_2_form(decimal ip_dc_id_gd_thu_nhap_khac)
 {
     US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC(ip_dc_id_gd_thu_nhap_khac);
     m_sle_chon_nhan_vien.EditValue = v_us.dcID_NHAN_VIEN;
     m_txt_chon_thang.Text = v_us.dcTHANG.ToString();
     m_txt_chon_nam.Text = v_us.dcNAM.ToString();
     m_sle_loai_thu_nhap.EditValue = v_us.dcID_LOAI_THU_NHAP_KHAC;
     m_sle_cach_tinh_thue.EditValue = v_us.dcID_CACH_TINH_THUE;
     m_txt_so_tien.Text = v_us.dcSO_TIEN.ToString();
     CHRMCommon.format_text_2_money(m_txt_so_tien);
     m_txt_ly_do.Text = v_us.strLY_DO;
 }
 private void save_data(ref decimal v_id_gd_thu_nhap_khac)
 {
     US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();
     form_2_us_obj(v_us_gd_thu_nhap_khac);
     try
     {
         switch (m_e_form_mode)
         {
             case DataEntryFormMode.InsertDataState:
                 v_us_gd_thu_nhap_khac.BeginTransaction();
                 v_us_gd_thu_nhap_khac.Insert();
                 v_us_gd_thu_nhap_khac.CommitTransaction();
                 v_id_gd_thu_nhap_khac = v_us_gd_thu_nhap_khac.dcID;
                 CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_LUU_DU_LIEU_THANH_CONG);
                 break;
             case DataEntryFormMode.UpdateDataState:
                 v_us_gd_thu_nhap_khac.BeginTransaction();
                 v_us_gd_thu_nhap_khac.dcID = CIPConvert.ToDecimal(m_grv_quan_ly_thu_nhap_khac.GetRowCellValue(m_grv_quan_ly_thu_nhap_khac.FocusedRowHandle, "ID").ToString());
                 v_us_gd_thu_nhap_khac.Update();
                 v_us_gd_thu_nhap_khac.CommitTransaction();
                 CHRM_BaseMessages.MsgBox_Infor(CONST_ID_MSGBOX.INFOR_DU_LIEU_DA_DUOC_CAP_NHAT);
                 break;
             default:
                 break;
         }
     }
     catch (Exception v_e)
     {
         throw v_e;
     }
 }
 void m_cmd_delete_Click(object sender, EventArgs e)
 {
     try
     {
         if (m_grv_quan_ly_thu_nhap_khac.RowCount != 0)
         {
             decimal v_id_gd_thu_nhap_khac = CIPConvert.ToDecimal(m_grv_quan_ly_thu_nhap_khac.GetRowCellValue(m_grv_quan_ly_thu_nhap_khac.FocusedRowHandle, "ID").ToString());
             US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC(v_id_gd_thu_nhap_khac);
             v_us_gd_thu_nhap_khac.Delete();
         }
     }
     catch (Exception v_e)
     {
         CSystemLog_301.ExceptionHandle(v_e);
     }
 }
 //save data
 private void form_2_us_obj(US_GD_THU_NHAP_KHAC ip_us)
 {
     ip_us.dcID_NHAN_VIEN = CIPConvert.ToDecimal(m_sle_chon_nhan_vien.EditValue);
     ip_us.dcSO_TIEN = CIPConvert.ToDecimal(m_txt_so_tien.Text.Trim());
     ip_us.dcTHANG = CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim());
     ip_us.dcNAM = CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim());
     ip_us.dcID_LOAI_THU_NHAP_KHAC = CIPConvert.ToDecimal(m_sle_loai_thu_nhap.EditValue);
     if (m_sle_cach_tinh_thue.EditValue != null && m_sle_cach_tinh_thue.EditValue != "")
     {
         ip_us.dcID_CACH_TINH_THUE = CIPConvert.ToDecimal(m_sle_cach_tinh_thue.EditValue);
     }
     ip_us.strLY_DO = m_txt_ly_do.Text.Trim();
 }
        private void focus_new_row_created(decimal v_id_gd_thu_nhap_khac)
        {
            int v_row_index = 0;
            decimal v_id_gd_moi_lap = 0;

            US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
            DS_GD_THU_NHAP_KHAC v_ds = new DS_GD_THU_NHAP_KHAC();

            v_id_gd_moi_lap = v_id_gd_thu_nhap_khac;

            v_us.FillDataset(v_ds);

            for (v_row_index = 0; v_row_index < v_ds.Tables[0].Rows.Count; v_row_index++)
            {
                var v_id_gd_qd = CIPConvert.ToDecimal(m_grv_quan_ly_thu_nhap_khac.GetDataRow(v_row_index)["ID"].ToString());

                if (v_id_gd_qd == v_id_gd_moi_lap)
                {
                    break;
                }
            }

            m_grv_quan_ly_thu_nhap_khac.FocusedRowHandle = v_row_index;
        }
 //private void luu_thang_da_giam_tru()
 //{
 //    US_GD_THANG_DA_GIAM_TRU v_us_thang_da_giam_tru = new US_GD_THANG_DA_GIAM_TRU();
 //    decimal op_dc_thang_da_giam_tru = 0;
 //    v_us_thang_da_giam_tru.kiem_tra_thang_da_giam_tru_chua(m_dat_thang_thuong.DateTime.Month
 //                                                                    , m_dat_thang_thuong.DateTime.Year
 //                                                                    , ref op_dc_thang_da_giam_tru);
 //    if(op_dc_thang_da_giam_tru == 1)
 //    {
 //        return;
 //    }
 //    v_us_thang_da_giam_tru.strTHANG = m_dat_thang_thuong.DateTime.Month.ToString();
 //    v_us_thang_da_giam_tru.strNAM = m_dat_thang_thuong.DateTime.Year.ToString();
 //    v_us_thang_da_giam_tru.strGIAM_TRU_YN = "Y";
 //    v_us_thang_da_giam_tru.strNGUOI_LAP = CAppContext_201.getCurrentUserName();
 //    v_us_thang_da_giam_tru.datNGAY_LAP = DateTime.Now.Date;
 //    v_us_thang_da_giam_tru.strDA_XOA = "N";
 //    v_us_thang_da_giam_tru.Insert();
 //}
 private DS_DM_NHAN_VIEN lay_danh_sach_nhan_vien_chua_tinh_thuong()
 {
     US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();
     DS_DM_NHAN_VIEN op_ds;
     v_us_gd_thu_nhap_khac.Get_tat_ca_nhan_vien_can_tinh_thuong(out op_ds, m_us_v_gd_quy_tien_thuong.dcID);
     return op_ds;
 }
 void m_cmd_update_Click(object sender, EventArgs e)
 {
     var v_dr = m_grv.GetDataRow(m_grv.FocusedRowHandle);
     US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC(CIPConvert.ToDecimal(v_dr[2].ToString()));
     f304_tnk_ngoai_bang_luong_detail v_f = new f304_tnk_ngoai_bang_luong_detail();
     v_f.display_for_update(v_us);
     load_data_to_grid();
 }
 private void form_2_us_gd_thu_nhap_khac(US_GD_THU_NHAP_KHAC ip_us, decimal ip_dc_id_nv, DataRow v_data_row)
 {
     ip_us.dcID_NHAN_VIEN = ip_dc_id_nv;
     ip_us.dcSO_TIEN = CIPConvert.ToDecimal(v_data_row[4].ToString());
     ip_us.dcTHANG = CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim());
     ip_us.dcNAM = CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim());
     ip_us.dcID_LOAI_THU_NHAP_KHAC = find_id_loai_thu_nhap_khac(v_data_row[2].ToString());
     ip_us.dcID_CACH_TINH_THUE = find_id_cach_tinh_thue(v_data_row[3].ToString());
     ip_us.strLY_DO = v_data_row[5].ToString();
 }
        private DataRow lay_du_lieu_tien_thuong_hsbs_1_nhan_vien(decimal ip_dc_id_nhan_vien)
        {
            US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();
            DataSet v_ds_du_lieu_thu_nhap_khac = new DataSet();
            v_ds_du_lieu_thu_nhap_khac.Tables.Add();

            v_us_gd_thu_nhap_khac.load_du_lieu_bang_luong_1nv_theo_hs_bs(v_ds_du_lieu_thu_nhap_khac
                                                                                , m_us_v_gd_quy_tien_thuong.datTU_NGAY_XET_THUONG
                                                                                , m_us_v_gd_quy_tien_thuong.datDEN_NGAY_XET_THUONG
                                                                                , m_us_v_gd_quy_tien_thuong.dcSO_TIEN
                                                                                , m_us_v_gd_quy_tien_thuong.strGIAM_TRU_YN
                                                                                , Convert.ToInt32(m_us_v_gd_quy_tien_thuong.strTHANG)
                                                                                , Convert.ToInt32(m_us_v_gd_quy_tien_thuong.strNAM)
                                                                                , ip_dc_id_nhan_vien
                                                                                , m_us_v_gd_quy_tien_thuong.dcID_CACH_TINH_THUE);
            return v_ds_du_lieu_thu_nhap_khac.Tables[0].Rows[0];
        }
        private void save_data_tien_thuong_nhan_vien()
        {
            //B1: Lấy danh sách nhân viên chưa tính tiền thưởng
            var v_ds_nhan_vien_canh_tinh = lay_danh_sach_nhan_vien_chua_tinh_thuong();

            //B1.1: Luu thang da giam tru
            //luu_thang_da_giam_tru();

            var rowLimit = v_ds_nhan_vien_canh_tinh.DM_NHAN_VIEN.Count;
            for(int rowToComput = 0; rowToComput < rowLimit; rowToComput++)
            {
                var v_id_nv = (decimal)v_ds_nhan_vien_canh_tinh.DM_NHAN_VIEN.Rows[rowToComput][DM_NHAN_VIEN.ID];
                //B2: Tinh thu nhap khac cho nhan vien nay
                DataRow v_dr_du_lieu_1_nv = null;
                if(m_us_v_gd_quy_tien_thuong.dcID_LOAI_QUY_TIEN == CONST_ID_TIEN_THUONG.THUONG_ATHK)
                {
                    v_dr_du_lieu_1_nv = lay_du_lieu_tien_thuong_athk_1_nhan_vien(v_id_nv);
                }
                else if(m_us_v_gd_quy_tien_thuong.dcID_LOAI_QUY_TIEN == CONST_ID_TIEN_THUONG.THUONG_HS_BS)
                {
                    v_dr_du_lieu_1_nv = lay_du_lieu_tien_thuong_hsbs_1_nhan_vien(v_id_nv);
                }

                //B3: Chuyen doi du lieu tu DataRow sang US de insert
                US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();
                data_row_2_us(v_dr_du_lieu_1_nv, ref v_us_gd_thu_nhap_khac);
                v_us_gd_thu_nhap_khac.Insert();
                m_bgwk.ReportProgress((rowToComput + 1) * 100 / rowLimit);
            }
            mark_complete_tinh_thuong();
        }
 private void save_data()
 {
     for (int i = 0; i < m_grv.RowCount; i++)
     {
         var v_dr = m_grv.GetDataRow(i);
         US_GD_THU_NHAP_KHAC v_us = new US_GD_THU_NHAP_KHAC();
         v_us.dcID_NHAN_VIEN = get_id_nhan_vien_by_ma_nv(v_dr[1].ToString());
         v_us.dcTHANG = m_dat_thang.DateTime.Month;
         v_us.dcNAM = m_dat_thang.DateTime.Year;
         v_us.dcHE_SO = 0;
         v_us.dcSO_TIEN = return_so_tien(v_dr[4].ToString());
         v_us.dcSO_TIEN_NOP_THUE = return_so_tien(v_dr[5].ToString());
         v_us.dcSO_TIEN_THUC_LINH = return_so_tien(v_dr[6].ToString());
         v_us.dcID_LOAI_THU_NHAP_KHAC = 756;
         v_us.dcID_QUY_THU_NHAP_KHAC = decimal.Parse(m_sle_quy_tien.EditValue.ToString());
         if (i == 0)
             v_us.BeginTransaction();
         else
         {
             v_us.UseTransOfUSObject(m_us);
         }
         m_us = v_us;
         v_us.Insert();
     }
     m_us.CommitTransaction();
 }
        private void save_data()
        {
            try
            {
                var rowCount = m_grv_main.RowCount;
                US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();
                splashScreenManager1.ShowWaitForm();

                for(int i = 0; i < rowCount; i++)
                {
                    var dr = m_grv_main.GetDataRow(i);
                    var is_exist = v_us_gd_thu_nhap_khac.KiemTraXemDaInsertThuong2014Chua(Convert.ToDecimal(m_sle_quy_tien_thuong.EditValue), Convert.ToDecimal(dr["ID"]));
                    if(is_exist)
                    {
                        continue;
                    }
                    if(dr["HS_THUONG"].ToString() == "")
                    {
                        continue;
                    }
                    data_row_2_us(dr, ref v_us_gd_thu_nhap_khac);
                    v_us_gd_thu_nhap_khac.Insert();
                }
                //
            }
            catch(Exception)
            {
                throw;
            }
            finally
            {
                splashScreenManager1.CloseWaitForm();
            }
        }
        private void kiem_tra_va_thuc_hien_nhap_du_lieu(ref decimal v_count, ref int v_int_khong_nhap_duoc, decimal v_selectedRowCount)
        {
            if (CHRMCommon.thang_da_chot_bang_luong(CIPConvert.ToDecimal(m_txt_chon_thang.Text.Trim()), CIPConvert.ToDecimal(m_txt_chon_nam.Text.Trim())))
            {
                CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_THANG_DA_CHOT_BANG_LUONG);
                return;
            }
            else
            {

                for (int i = 0; i < v_selectedRowCount; i++)
                {
                    decimal v_id_nv = 0;
                    US_DUNG_CHUNG v_us_dc = new US_DUNG_CHUNG();
                    US_GD_THU_NHAP_KHAC v_us_gd_thu_nhap_khac = new US_GD_THU_NHAP_KHAC();

                    var v_data_row = m_grv_quan_ly_thu_nhap_khac.GetDataRow(m_grv_quan_ly_thu_nhap_khac.GetSelectedRows()[i]);

                    try
                    {
                        get_id_nhan_vien_tu_data_row(v_us_dc, v_data_row, ref v_id_nv);
                    }
                    catch (Exception)
                    {
                        CHRM_BaseMessages.MsgBox_Error("Mã nhân viên " + v_data_row[1].ToString() + " không tồn tại trong hệ thống. Vui lòng kiểm tra lại thông tin!");
                        v_int_khong_nhap_duoc++;
                        continue;
                    }

                    form_2_us_gd_thu_nhap_khac(v_us_gd_thu_nhap_khac, v_id_nv, v_data_row);

                    try
                    {
                        delete_gd_da_co_trong_thang_cua_nhan_vien(v_us_dc, v_data_row, v_id_nv);
                        v_us_gd_thu_nhap_khac.BeginTransaction();
                        v_us_gd_thu_nhap_khac.Insert();
                        v_us_gd_thu_nhap_khac.CommitTransaction();
                        v_count++;
                    }
                    catch (Exception)
                    {
                        CHRM_BaseMessages.MsgBox_Error(CONST_ID_MSGBOX.ERROR_DA_CO_LOI_XAY_RA);
                        v_int_khong_nhap_duoc++;
                    }
                }
            }
        }
 //GD_THU_NHAP_KHAC
 private void luu_so_tien_vao_gd_thu_nhap_khac(DataSet ip_ds)
 {
     for (int i = 0; i < ip_ds.Tables[0].Rows.Count; i++)
     {
         US_GD_THU_NHAP_KHAC v_us_thu_khac = new US_GD_THU_NHAP_KHAC();
         v_us_thu_khac.dcID_NHAN_VIEN = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["ID_NHAN_VIEN"]);
         v_us_thu_khac.dcSO_TIEN = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["SO_TIEN"]);
         v_us_thu_khac.dcTHANG = CIPConvert.ToDecimal(DateTime.Now.Month.ToString());
         v_us_thu_khac.dcNAM = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["NAM"]);
         v_us_thu_khac.strLY_DO = ip_ds.Tables[0].Rows[i]["LY_DO"].ToString();
         if (int.Parse(ip_ds.Tables[0].Rows[i]["ID_TRANG_THAI_LAO_DONG"].ToString()) == CONST_ID_TRANG_THAI_LAO_DONG.NGHI_HUU)
         {
             v_us_thu_khac.dcID_CACH_TINH_THUE = CONST_ID_LOAI_CACH_TINH_THUE.THUE_10PT;
         }
         else
         {
             v_us_thu_khac.dcID_CACH_TINH_THUE = CONST_ID_LOAI_CACH_TINH_THUE.THUE_THANG;
         }
         v_us_thu_khac.dcID_LOAI_THU_NHAP_KHAC = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["ID_LOAI_THU_NHAP_KHAC"]);
         v_us_thu_khac.dcID_QUY_TIEN_THUONG = CONST_ID_TIEN_THUONG.THUONG_HS_BS;
         v_us_thu_khac.dcSO_TIEN_GIAM_TRU = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["SO_TIEN_GIAM_TRU"]);
         v_us_thu_khac.dcSO_TIEN_NOP_THE = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["SO_TIEN_NOP_THUE"]);
         v_us_thu_khac.dcSO_TIEN_THUC_LINH = CIPConvert.ToDecimal(ip_ds.Tables[0].Rows[i]["SO_TIEN_SAU_TINH_THUE"]);
         v_us_thu_khac.Insert();
     }
 }