private void save_data_gd_chi_tiet_giai_ngan_in_grid(US_GD_CHI_TIET_GIAI_NGAN ip_us, FORM_MODE ip_form_mode) { ip_us.dcID_LOAI_NHIEM_VU = CIPConvert.ToDecimal(m_ddl_grid_edit_loai_nhiem_vu.SelectedValue); if (m_rdb_grid_edit_theo_chuong_loai_khoan_muc.Checked == true) { string v_str_mix = m_ddl_grid_edit_muc_tieu_muc.SelectedValue; string[] v_arr_id = v_str_mix.Split('|'); ip_us.dcID_CHUONG = CIPConvert.ToDecimal(v_arr_id[0]); //v_dc_id_loai = CIPConvert.ToDecimal(v_arr_id[1]); ip_us.dcID_KHOAN = CIPConvert.ToDecimal(v_arr_id[2]); ip_us.dcID_MUC = CIPConvert.ToDecimal(v_arr_id[3]); if (!v_arr_id[4].Trim().Equals("")) { ip_us.dcID_TIEU_MUC = CIPConvert.ToDecimal(v_arr_id[4]); } ip_us.SetID_CONG_TRINHNull(); ip_us.SetID_DU_ANNull(); } else { ip_us.dcID_CONG_TRINH = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an_quoc_lo.SelectedValue); ip_us.dcID_DU_AN = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an.SelectedValue); ip_us.SetID_CHUONGNull(); ip_us.SetID_KHOANNull(); ip_us.SetID_MUCNull(); ip_us.SetID_TIEU_MUCNull(); } ip_us.dcID_DON_VI = CIPConvert.ToDecimal(m_ddl_don_vi.SelectedValue); ip_us.dcID_GIAI_NGAN = CIPConvert.ToDecimal(m_hdf_id_dm_giai_ngan.Value); ip_us.dcSO_TIEN_NOP_THUE = CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_nop_thue.Text); ip_us.dcSO_TIEN_TT_CHO_DV_HUONG = CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_tt_cho_dv_huong.Text); ip_us.strNOI_DUNG_CHI = m_txt_grid_edit_ghi_chu.Text.Trim(); switch (ip_form_mode) { case FORM_MODE.THEM: ip_us.Insert(); WebformControls.ghiLogDuToan("Thêm bản ghi Giải ngân ở Uỷ nhiệm chi " + new US_DM_GIAI_NGAN(ip_us.dcID_GIAI_NGAN).strSO_UNC); break; case FORM_MODE.SUA: ip_us.Update(); WebformControls.ghiLogDuToan("Cập nhật bản ghi Giải ngân ở Uỷ nhiệm chi " + new US_DM_GIAI_NGAN(ip_us.dcID_GIAI_NGAN).strSO_UNC); break; case FORM_MODE.XOA: break; default: break; } }
protected void m_grv_unc_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Add") { RadioButton m_rdb_grid_edit_theo_quoc_lo_cong_trinh = (RadioButton)m_grv_unc.FooterRow.FindControl("m_rdb_grid_theo_quoc_lo_cong_trinh"); RadioButton m_rdb_grid_edit_theo_chuong_loai_khoan_muc = (RadioButton)m_grv_unc.FooterRow.FindControl("m_rdb_grid_theo_chuong_loai_khoan_muc"); DropDownList m_ddl_grid_edit_du_an_quoc_lo = (DropDownList)m_grv_unc.FooterRow.FindControl("m_ddl_grid_du_an_quoc_lo"); DropDownList m_ddl_grid_edit_loai_nhiem_vu = (DropDownList)m_grv_unc.FooterRow.FindControl("m_ddl_grid_loai_nhiem_vu"); DropDownList m_ddl_grid_edit_du_an = (DropDownList)m_grv_unc.FooterRow.FindControl("m_ddl_grid_du_an"); DropDownList m_ddl_grid_muc_tieu_muc = (DropDownList)m_grv_unc.FooterRow.FindControl("m_ddl_grid_muc_tieu_muc"); TextBox m_txt_grid_edit_so_tien_nop_thue = (TextBox)m_grv_unc.FooterRow.FindControl("m_txt_grid_so_tien_nop_thue"); TextBox m_txt_grid_edit_so_tien_tt_cho_dv_huong = (TextBox)m_grv_unc.FooterRow.FindControl("m_txt_grid_so_tien_thanh_toan_cho_don_vi_huong"); TextBox m_txt_grid_ghi_chu = (TextBox)m_grv_unc.FooterRow.FindControl("m_txt_grid_ghi_chu"); m_txt_grid_edit_so_tien_nop_thue.Text = m_txt_grid_edit_so_tien_nop_thue.Text.Trim().Replace(",", "").Replace(".", ""); m_txt_grid_edit_so_tien_tt_cho_dv_huong.Text = m_txt_grid_edit_so_tien_tt_cho_dv_huong.Text.Trim().Replace(",", "").Replace(".", ""); //1. Check validate data //1.1 Chi theo Cong trinh/Du an if (m_rdb_grid_edit_theo_quoc_lo_cong_trinh.Checked == true) { if (m_ddl_grid_edit_du_an_quoc_lo.SelectedValue.Equals("")) { m_lbl_mess_detail.Text = "Bạn chọn lại Loại nhiệm vụ! Trong mục này không có Quốc lộ/Dự án nào!"; m_ddl_grid_edit_loai_nhiem_vu.Focus(); return; } if (m_ddl_grid_edit_du_an.SelectedValue.Equals("")) { m_lbl_mess_detail.Text = "Bạn chọn lại Quốc lộ/Dự án! Trong mục này không mục chi nào!"; m_ddl_grid_edit_du_an_quoc_lo.Focus(); return; } } //1.2 Chi theo Loai khoan muc else if (m_rdb_grid_edit_theo_chuong_loai_khoan_muc.Checked == true) { if (m_ddl_grid_muc_tieu_muc.SelectedValue.Equals("")) { m_lbl_mess_detail.Text = "Bạn chọn lại Loại nhiệm vụ! Không có Mục/Tiểu mục nào trong Loại nhiệm vụ này!"; m_ddl_grid_edit_du_an_quoc_lo.Focus(); return; } } if (m_hdf_id_dm_giai_ngan.Value.Trim().Equals("") || m_hdf_id_dm_giai_ngan.Value.Trim().Equals("-1")) { m_lbl_mess_detail.Text = "Bạn phải chọn Uỷ nhiệm chi đã có hoặc Nhập mới một Uỷ nhiệm chi!"; m_txt_so_unc.Focus(); return; } if (!CValidateTextBox.IsValid(m_txt_grid_edit_so_tien_tt_cho_dv_huong, DataType.StringType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Nội dung thanh toán!"; m_txt_grid_edit_so_tien_tt_cho_dv_huong.Focus(); return; } if (!CValidateTextBox.IsValid(m_txt_grid_edit_so_tien_nop_thue, DataType.NumberType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền nộp thuế!"; m_txt_grid_edit_so_tien_nop_thue.Focus(); return; } if (CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_nop_thue.Text) < 0) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền nộp thuế!"; m_txt_grid_edit_so_tien_nop_thue.Focus(); return; } if (!CValidateTextBox.IsValid(m_txt_grid_edit_so_tien_tt_cho_dv_huong, DataType.NumberType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền thanh toán cho đơn vị hưởng!"; m_txt_grid_edit_so_tien_tt_cho_dv_huong.Focus(); return; } if (CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_tt_cho_dv_huong.Text) < 0) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền thanh toán cho đơn vị hưởng!"; m_txt_grid_edit_so_tien_tt_cho_dv_huong.Focus(); return; } //2. Insert data US_GD_CHI_TIET_GIAI_NGAN v_us_gd = new US_GD_CHI_TIET_GIAI_NGAN(); v_us_gd.dcID_LOAI_NHIEM_VU = CIPConvert.ToDecimal(m_ddl_grid_edit_loai_nhiem_vu.SelectedValue); if (m_rdb_grid_edit_theo_chuong_loai_khoan_muc.Checked == true) { string v_str_mix = m_ddl_grid_muc_tieu_muc.SelectedValue; string[] v_arr_id = v_str_mix.Split('|'); v_us_gd.dcID_CHUONG = CIPConvert.ToDecimal(v_arr_id[0]); //v_dc_id_loai = CIPConvert.ToDecimal(v_arr_id[1]); v_us_gd.dcID_KHOAN = CIPConvert.ToDecimal(v_arr_id[2]); v_us_gd.dcID_MUC = CIPConvert.ToDecimal(v_arr_id[3]); if (!v_arr_id[4].Trim().Equals("")) { v_us_gd.dcID_TIEU_MUC = CIPConvert.ToDecimal(v_arr_id[4]); } v_us_gd.SetID_CONG_TRINHNull(); v_us_gd.SetID_DU_ANNull(); } else { v_us_gd.dcID_CONG_TRINH = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an_quoc_lo.SelectedValue); v_us_gd.dcID_DU_AN = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an.SelectedValue); v_us_gd.SetID_CHUONGNull(); v_us_gd.SetID_KHOANNull(); v_us_gd.SetID_MUCNull(); v_us_gd.SetID_TIEU_MUCNull(); } v_us_gd.strNOI_DUNG_CHI = m_txt_grid_ghi_chu.Text.Trim(); v_us_gd.dcID_DON_VI = CIPConvert.ToDecimal(m_ddl_don_vi.SelectedValue); v_us_gd.dcID_GIAI_NGAN = CIPConvert.ToDecimal(m_hdf_id_dm_giai_ngan.Value); v_us_gd.dcSO_TIEN_NOP_THUE = CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_nop_thue.Text); v_us_gd.dcSO_TIEN_TT_CHO_DV_HUONG = CIPConvert.ToDecimal(m_txt_grid_edit_so_tien_tt_cho_dv_huong.Text); v_us_gd.strGHI_CHU = ""; WebformControls.ghiLogDuToan("Thêm bản ghi Giải ngân ở Uỷ nhiệm chi " + new US_DM_GIAI_NGAN(v_us_gd.dcID_GIAI_NGAN).strSO_UNC); v_us_gd.Insert(); load_data_to_grid_chi_tiet_uy_nhiem_chi(); m_lbl_mess_detail.Text = "Bạn đã thêm mới thành công!"; } } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(this, v_e); } }
protected void m_grv_unc_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { RadioButton m_rdb_grid_edit_theo_quoc_lo_cong_trinh = (RadioButton)m_grv_unc.Rows[e.RowIndex].FindControl("m_rdb_grid_edit_theo_quoc_lo_cong_trinh"); RadioButton m_rdb_grid_edit_theo_chuong_loai_khoan_muc = (RadioButton)m_grv_unc.Rows[e.RowIndex].FindControl("m_rdb_grid_edit_theo_chuong_loai_khoan_muc"); DropDownList m_ddl_grid_edit_du_an_quoc_lo = (DropDownList)m_grv_unc.Rows[e.RowIndex].FindControl("m_ddl_grid_edit_du_an_quoc_lo"); DropDownList m_ddl_grid_edit_loai_nhiem_vu = (DropDownList)m_grv_unc.Rows[e.RowIndex].FindControl("m_ddl_grid_edit_loai_nhiem_vu"); DropDownList m_ddl_grid_edit_du_an = (DropDownList)m_grv_unc.Rows[e.RowIndex].FindControl("m_ddl_grid_edit_du_an"); DropDownList m_ddl_grid_edit_muc_tieu_muc = (DropDownList)m_grv_unc.Rows[e.RowIndex].FindControl("m_ddl_grid_edit_muc_tieu_muc"); TextBox v_txt_grid_edit_so_tien_nop_thue = (TextBox)m_grv_unc.Rows[e.RowIndex].FindControl("m_txt_grid_edit_so_tien_nop_thue"); TextBox v_txt_grid_edit_so_tien_tt_cho_dv_huong = (TextBox)m_grv_unc.Rows[e.RowIndex].FindControl("m_txt_grid_edit_so_tien_tt_cho_dv_huong"); TextBox v_txt_grid_edit_ghi_chu = (TextBox)m_grv_unc.Rows[e.RowIndex].FindControl("m_txt_grid_edit_ghi_chu"); v_txt_grid_edit_so_tien_nop_thue.Text = v_txt_grid_edit_so_tien_nop_thue.Text.Trim().Replace(",", "").Replace(".", ""); v_txt_grid_edit_so_tien_tt_cho_dv_huong.Text = v_txt_grid_edit_so_tien_tt_cho_dv_huong.Text.Trim().Replace(",", "").Replace(".", ""); if (m_rdb_grid_edit_theo_quoc_lo_cong_trinh.Checked == true) { if (m_ddl_grid_edit_du_an_quoc_lo.SelectedValue == null | m_ddl_grid_edit_du_an_quoc_lo.SelectedValue == "-1") { m_lbl_mess_detail.Text = "Bạn chọn lại Loại nhiệm vụ! Trong mục này không có Quốc lộ/Dự án nào!"; m_ddl_grid_edit_loai_nhiem_vu.Focus(); return; } if (m_ddl_grid_edit_du_an.SelectedValue == "-1" | m_ddl_grid_edit_du_an.SelectedValue == null) { m_lbl_mess_detail.Text = "Bạn chọn lại Quốc lộ/Công trình! Trong mục này không mục chi nào!"; m_ddl_grid_edit_du_an_quoc_lo.Focus(); return; } } else { if (m_ddl_grid_edit_muc_tieu_muc.SelectedValue == "-1") { m_lbl_mess_detail.Text = "Bạn chọn lại Mục/Tiểu mục"; m_ddl_grid_edit_muc_tieu_muc.Focus(); return; } } if (!CValidateTextBox.IsValid(v_txt_grid_edit_ghi_chu, DataType.StringType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Nội dung thanh toán!"; v_txt_grid_edit_ghi_chu.Focus(); return; } if (!CValidateTextBox.IsValid(v_txt_grid_edit_so_tien_nop_thue, DataType.NumberType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền nộp thuế!"; v_txt_grid_edit_so_tien_nop_thue.Focus(); return; } if (CIPConvert.ToDecimal(v_txt_grid_edit_so_tien_nop_thue.Text) < 0) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền nộp thuế!"; v_txt_grid_edit_so_tien_nop_thue.Focus(); return; } if (!CValidateTextBox.IsValid(v_txt_grid_edit_so_tien_tt_cho_dv_huong, DataType.NumberType, allowNull.NO)) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền thanh toán cho đơn vị hưởng!"; v_txt_grid_edit_so_tien_tt_cho_dv_huong.Focus(); return; } if (CIPConvert.ToDecimal(v_txt_grid_edit_so_tien_tt_cho_dv_huong.Text) < 0) { m_lbl_mess_detail.Text = "Bạn phải nhập Số tiền thanh toán cho đơn vị hưởng!"; v_txt_grid_edit_so_tien_tt_cho_dv_huong.Focus(); return; } decimal v_dc_id_gd = CIPConvert.ToDecimal(m_grv_unc.DataKeys[e.RowIndex].Value); US_GD_CHI_TIET_GIAI_NGAN v_us_gd = new US_GD_CHI_TIET_GIAI_NGAN(v_dc_id_gd); v_us_gd.dcID_LOAI_NHIEM_VU = CIPConvert.ToDecimal(m_ddl_grid_edit_loai_nhiem_vu.SelectedValue); if (m_rdb_grid_edit_theo_chuong_loai_khoan_muc.Checked == true) { string v_str_mix = m_ddl_grid_edit_muc_tieu_muc.SelectedValue; string[] v_arr_id = v_str_mix.Split('|'); v_us_gd.dcID_CHUONG = CIPConvert.ToDecimal(v_arr_id[0]); //v_dc_id_loai = CIPConvert.ToDecimal(v_arr_id[1]); v_us_gd.dcID_KHOAN = CIPConvert.ToDecimal(v_arr_id[2]); v_us_gd.dcID_MUC = CIPConvert.ToDecimal(v_arr_id[3]); if (!v_arr_id[4].Trim().Equals("")) { v_us_gd.dcID_TIEU_MUC = CIPConvert.ToDecimal(v_arr_id[4]); } v_us_gd.SetID_CONG_TRINHNull(); v_us_gd.SetID_DU_ANNull(); } else { v_us_gd.dcID_CONG_TRINH = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an_quoc_lo.SelectedValue); v_us_gd.dcID_DU_AN = CIPConvert.ToDecimal(m_ddl_grid_edit_du_an.SelectedValue); v_us_gd.SetID_CHUONGNull(); v_us_gd.SetID_KHOANNull(); v_us_gd.SetID_MUCNull(); v_us_gd.SetID_TIEU_MUCNull(); } //v_us_gd.strTEN_DU_AN = m_ddl_grid_edit_du_an.SelectedValue; v_us_gd.dcID_DON_VI = CIPConvert.ToDecimal(m_ddl_don_vi.SelectedValue); v_us_gd.dcID_GIAI_NGAN = CIPConvert.ToDecimal(m_hdf_id_dm_uy_nhiem_chi.Value); v_us_gd.dcSO_TIEN_NOP_THUE = CIPConvert.ToDecimal(v_txt_grid_edit_so_tien_nop_thue.Text); v_us_gd.dcSO_TIEN_TT_CHO_DV_HUONG = CIPConvert.ToDecimal(v_txt_grid_edit_so_tien_tt_cho_dv_huong.Text); v_us_gd.strNOI_DUNG_CHI = v_txt_grid_edit_ghi_chu.Text.Trim(); v_us_gd.Update(); m_grv_unc.EditIndex = -1; data_to_grid_unc(); m_lbl_mess_detail.Text = "Bạn đã cập nhật thành công!"; } catch (Exception v_e) { CSystemLog_301.ExceptionHandle(this, v_e); } }