public List <DonationRecNExpModel> GetExistList(string inst_code, string fund_code, string analytical_code, string section_code, int financial_year, int financial_year2, string value_date, int oid, string odon_inc_exp) { List <DonationRecNExpModel> result = new List <DonationRecNExpModel>(); var ds = DonationDetailRepository.GetExistList(inst_code, fund_code, analytical_code, section_code, financial_year, financial_year2, value_date, oid); if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0) { foreach (DataRow dr in ds.Tables[0].Rows) { DonationRecNExpModel model = new DonationRecNExpModel(); model.Id = Convert.ToInt32(dr["id"]); model.OId = oid; model.Hospital = dr["hospital"].ToString(); model.Fund = dr["fund"].ToString(); model.Section = dr["section"].ToString(); model.Analytical = dr["analytical"].ToString(); model.Don_kind_desc = dr["don_kind_desc"].ToString(); model.Donor_name = dr["donor_name"].ToString(); model.Don_type_desc = dr["don_type"].ToString(); model.Don_purpose_desc = dr["don_purpose"].ToString(); model.Don_cat_desc = dr["don_cat"].ToString(); model.Don_cur_mth = Convert.ToDecimal(dr["cm_amt"]); model.Don_YTD = Convert.ToDecimal(dr["ytd"]); model.Don_inc_exp = dr["don_inc_exp"].ToString(); model.ODon_inc_exp = odon_inc_exp; result.Add(model); } } return(result); }
public List <DonationRecNExpModel> GetExistList2(string don_inc_exp, string hospital, string fund_code, string analytical_code, string section_code, int financial_year, int curr_financial_year, DateTime current_date, int detail_id, string don_desc, string donor_name, short don_cat, out int record_cnt) { record_cnt = 0; List <DonationRecNExpModel> result = new List <DonationRecNExpModel>(); var ds = DonationDetailRepository.GetExistList2(hospital, fund_code, analytical_code, section_code, financial_year, curr_financial_year, current_date, detail_id, don_desc, donor_name, don_cat); if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0) { foreach (DataRow dr in ds.Tables[0].Rows) { DonationRecNExpModel model = new DonationRecNExpModel(); model.Id = Convert.ToInt32(dr["id"]); model.Hospital = dr["hospital"].ToString(); model.Fund = dr["fund"].ToString(); model.Section = dr["section"].ToString(); model.Analytical = dr["analytical"].ToString(); model.Don_kind_desc = dr["don_kind_desc"].ToString(); model.Donor_name = dr["donor_name"].ToString(); model.Don_type_desc = dr["don_type"].ToString(); model.Don_purpose_desc = dr["don_purpose"].ToString(); model.Don_cat_desc = dr["don_cat"].ToString(); model.Don_cur_mth = Convert.ToDecimal(dr["cm_amt"]); model.Don_YTD = Convert.ToDecimal(dr["ytd"]); model.Don_inc_exp = dr["don_inc_exp"].ToString(); if (model.Don_inc_exp == don_inc_exp) { result.Add(model); record_cnt = record_cnt + 1; } } } return(result); }
public void InsertDonationDetail(DonationRecNExpModel model, string login_id) { DataSet ds = new DataSet(); var sql = "insert into donation_detail "; sql = sql + " (hospital, trust, fund, section, analytical, donor_type, donor_name, donor_id, don_inc_exp, don_type, "; sql = sql + " don_purpose, don_supercat, don_cat, don_subcat, don_subsubcat, don_specific, maj_don1,maj_don2,maj_don3 , eqt_desc, recurrent_con, reimb, recurrent_cost, "; sql = sql + " don_kind_desc, input_by, input_at, "; sql = sql + " update_by, update_at) "; sql = sql + " values "; sql = sql + " ('" + model.Inst_code + "', " + model.Trust + ",'" + model.Fund + "', '" + model.Section + "','" + model.Analytical + "', '" + model.Donor_type + "', N'"; sql = sql + model.Donor_name + "', '" + model.Donor_name_exist + "', '" + model.Don_inc_exp + "', " + model.Don_type + ", "; sql = sql + model.Don_purpose + ", " + model.Don_supercat + ", " + model.Don_cat + ", " + model.Don_subcat + ", " + model.Don_subsubcat + ", N'"; sql = sql + model.Don_specific + "','" + model.Maj_don1 + "','" + model.Maj_don2 + "','" + model.Maj_don3 + "', '" + model.Eqt_desc + "', '"; sql = sql + model.Recurrent_con + "', '" + model.Reimb + "', " + model.Recurrent_cost + ", N'" + model.Don_kind_desc + "', '"; sql = sql + login_id + "', getdate(), '" + login_id + "', getdate()) "; using (SqlConnection sqlConn = new SqlConnection(Context.Database.GetDbConnection().ConnectionString)) { using (SqlCommand sqlCmd = new SqlCommand(sql, sqlConn)) { sqlCmd.Connection.Open(); sqlCmd.ExecuteNonQuery(); } } }
private void GetDonationRecNExpFormControl(DonationRecNExpModel model, int financial_year) { ViewBag.DonType = DonationRecNExpService.GetDonTypeList(false); ViewBag.DonDonor = DonationRecNExpService.GetDonDonorList(); ViewBag.DonDesc = DonationRecNExpService.GetDonDescList(model.Hospital, financial_year); ViewBag.DonPurpose = DonationRecNExpService.GetDonPurposeList(false); ViewBag.DonSuperCat = DonationRecNExpService.GetDonSuperCat(); ViewBag.DonCat = DonationRecNExpService.GetDonCatBySuperCatId(model.Don_supercat, false); ViewBag.DonSubCat = DonationRecNExpService.GetDonSubcatByCatId(model.Don_cat, false); ViewBag.DonSubsubCat = DonationRecNExpService.GetDonSubsubCatBySubCatId(model.Don_subcat, false); }
public IViewComponentResult Invoke(int record_cnt, DonationRecNExpModel model) { if (record_cnt == 0) { return(View("NoRecord")); } else { return(View(model)); } }
public List <DonationRecNExpModel> GetDonationList(string inst_code, int show_year, int financial_year, string value_date, int cur_year_only, string in_donor_name, string inc_exp, string designated, out int total_cnt, out Decimal total_don_cur_mth, out Decimal total_don_ytd) { total_cnt = 0; total_don_cur_mth = 0; total_don_ytd = 0; List <DonationRecNExpModel> result = new List <DonationRecNExpModel>(); var ds = DonationDetailRepository.GetDonationList(inst_code, show_year, financial_year, value_date, cur_year_only, in_donor_name, inc_exp, designated); if (ds != null && ds.Tables.Count != 0 && ds.Tables[0].Rows.Count != 0) { foreach (DataRow dr in ds.Tables[0].Rows) { DonationRecNExpModel model = new DonationRecNExpModel(); model.Id = Convert.ToInt32(dr["id"]); model.Hospital = dr["hospital"].ToString(); model.Trust = Convert.ToInt16((dr["trust"] is DBNull) ? 0 : dr["trust"]); model.Donor_type = dr["donor_type"].ToString(); model.Fund = dr["fund"].ToString(); model.Section = dr["section"].ToString(); model.Analytical = dr["analytical"].ToString(); model.Donor_name = dr["donor_name"].ToString(); model.Don_inc_exp = dr["don_inc_exp"].ToString(); model.Don_date = dr["don_date"].ToString(); model.Don_type = dr["don_type"].ToString(); model.Don_type_desc = dr["don_type_desc"].ToString(); model.Don_purpose = Convert.ToInt16((dr["don_purpose"] is DBNull) ? 0 : dr["don_purpose"]); model.Don_purpose_desc = dr["don_purpose_desc"].ToString(); model.Don_cat = Convert.ToInt32((dr["don_cat"] is DBNull) ? 0 : dr["don_cat"]); model.Don_cat_desc = dr["don_cat_desc"].ToString(); model.Don_subcat = Convert.ToInt32((dr["don_subcat"] is DBNull) ? 0 : dr["don_subcat"]); model.Eqt_desc = Convert.ToInt16((dr["eqt_desc"] is DBNull)?0: dr["eqt_desc"]); model.Recurrent_con = dr["recurrent_con"].ToString(); model.Recurrent_cost = Convert.ToDecimal((dr["recurrent_cost"] is DBNull) ? 0 : dr["recurrent_cost"]); model.Don_kind_desc = dr["don_kind_desc"].ToString(); model.Don_cur_mth = Convert.ToDecimal(dr["don_cur_mth"]); model.Don_YTD = Convert.ToDecimal((dr["don_ytd"] is DBNull) ? 0 : dr["don_ytd"]); model.Out_comm = Convert.ToDecimal((dr["out_comm"] is DBNull) ? 0 : dr["out_comm"]); model.General_donation = Convert.ToInt32((dr["general_donation"] is DBNull) ? 0 : dr["general_donation"]); if (model.Don_cur_mth != 0 || model.Don_YTD != 0 || in_donor_name != "") { result.Add(model); total_cnt = total_cnt + 1; total_don_cur_mth = total_don_cur_mth + model.Don_cur_mth; total_don_ytd = total_don_ytd + model.Don_YTD; } } } return(result); }
public IActionResult UpdateDonationRefund(DonationRecNExpModel model) { try { var financial_year = Convert.ToInt32(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Financial_Year")); var login_id = UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "LoginId"); DonationRecNExpService.UpdateDonationRefund(model.Id, financial_year, "", model.Refund.Refund_Detail_Cnt, login_id, model.Refund.Refund_Detail); TempData["SuccessMessage"] = "Update Donation Success"; return(RedirectToAction("Input", model)); } catch (Exception ex) { TempData["ErrorMessage"] = ex; return(RedirectToAction("Input", model)); } }
public IActionResult GetDonationReserveRecord(string inst_code, string fund_code, string analytical_code, string section_code, int financial_year, int curr_financial_year, DateTime current_date, int oid, string don_inc_exp, string don_desc, string donor_name, short don_cat) { int record_cnt = 0; var list = DonationReserveService.GetExistList2(don_inc_exp, inst_code, fund_code, analytical_code, section_code, financial_year, curr_financial_year, current_date, oid, don_desc, donor_name, don_cat, out record_cnt); DonationRecNExpModel model = new DonationRecNExpModel(); model.Link_rec = list; model.Inst_code = inst_code; model.Fund = fund_code; model.Analytical = analytical_code; model.Section = section_code; model.OId = oid; model.Don_inc_exp = don_inc_exp; model.Don_kind_desc = don_desc; model.Donor_name = donor_name; model.Don_supercat = don_cat; return(ViewComponent("DonationReserveSubList", new { record_cnt = record_cnt, model = model })); }
public void UpdateDonationDetail(DonationRecNExpModel model, string login_id) { var sql = "update donation_detail "; sql = sql + " set hospital = '" + model.Hospital + "',"; sql = sql + " trust = " + model.Trust + ", "; sql = sql + " donor_type = '" + model.Donor_type + "', "; sql = sql + " donor_name = N'" + model.Donor_name + "', "; sql = sql + " donor_id = '" + model.Donor_name_exist + "', "; sql = sql + " don_inc_exp = '" + model.Don_inc_exp + "', "; sql = sql + " don_purpose = " + model.Don_purpose + ", "; sql = sql + " don_supercat = " + model.Don_supercat + ", "; sql = sql + " don_cat = " + model.Don_cat + ", "; sql = sql + " don_subcat = " + model.Don_subcat + ", "; sql = sql + " don_subsubcat = " + model.Don_subsubcat + ", "; sql = sql + " don_specific = N'" + model.Don_specific + "', "; sql = sql + " eqt_desc = '" + model.Eqt_desc + "', "; sql = sql + " maj_don1 = '" + model.Maj_don1 + "', "; sql = sql + " maj_don2 = '" + model.Maj_don2 + "', "; sql = sql + " maj_don3 = '" + model.Maj_don3 + "', "; sql = sql + " recurrent_con = '" + model.Recurrent_con + "', "; sql = sql + " reimb = '" + model.Reimb + "', "; sql = sql + " recurrent_cost = " + model.Recurrent_cost + ", "; sql = sql + " don_kind_desc = N'" + model.Don_kind_desc + "', "; sql = sql + " update_by = '" + login_id + "', "; sql = sql + " update_at = getdate()"; sql = sql + " where id = " + model.Id; using (SqlConnection sqlConn = new SqlConnection(Context.Database.GetDbConnection().ConnectionString)) { using (SqlCommand sqlCmd = new SqlCommand(sql, sqlConn)) { sqlCmd.Connection.Open(); sqlCmd.ExecuteNonQuery(); } } }
public IActionResult Input(int id, int oid, string action, string type, string inst_code, string section, string fund, string analytical, string don_inc_exp, string odon_inc_exp) { Session.SetString("current_sys", "D"); ViewBag.IsHtmlMessage = true; ViewBag.SuccessMessage = TempData["SuccessMessage"] ?? ViewBag.SuccessMessage; ViewBag.ErrorMessage = TempData["ErrorMessage"] ?? ViewBag.ErrorMessage; ViewBag.HospClusterList = MenuService.GetHospitalClusterList(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "UserGroup_D")); ViewBag.HospClusterExAllList = MenuService.GetHospitalClusterList(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "UserGroup_D"), false); DonationRecNExpModel model = new DonationRecNExpModel(); var financial_year = Convert.ToInt32(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Financial_Year")); model.Id = id; model.Inst_code = inst_code; model.Hospital = inst_code; model.Fund = fund; model.Section = section; model.Analytical = analytical; model.Don_inc_exp = don_inc_exp; model.Link_diff_type = "N"; model.Trust = 0; model.Don_type = "2"; model.Don_YTD = 0; var value_date = UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Value_Date2"); //"20171101"; var cal_date = UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Cal_date"); //"20171101"; model.Action = string.IsNullOrEmpty(action)?"":action; if (model.Action == "link" && don_inc_exp != odon_inc_exp) { model.Link_diff_type = "Y"; model.Link_id = id; //model.Id = 0; } if (model.Action == "link" && oid != 0 && don_inc_exp == odon_inc_exp) { model.Link = "Y"; } if (model.Link == "Y") { DonationRecNExpService.DonationLinkRecord(id, oid); } if (model.Id != 0) { var detail = DonationRecNExpService.GetDonationDetailById(model.Id); if (detail != null) { model.Hospital = detail.Hospital; model.Inst_code = model.Hospital; model.Section = detail.Section; model.Donor_type = "D"; model.Donor_name = detail.DonorName.Replace("'", "''"); model.ODonor_id = detail.DonorId; model.Link_ind = detail.LinkId; if (action != "link") { model.Don_inc_exp = (detail.DonIncExp ?? "").Trim(); } model.Input_at_val = detail.InputAt; model.Don_type = detail.DonType; model.Don_purpose = detail.DonPurpose; model.Don_supercat = detail.DonSupercat; model.Don_cat = detail.DonCat; model.Don_subcat = detail.DonSubcat; model.Don_subsubcat = detail.DonSubsubcat; model.Don_specific = detail.DonSpecific; model.Eqt_desc = detail.EqtDesc; model.Recurrent_con = (detail.RecurrentCon ?? "").Trim(); model.Recurrent_cost = detail.RecurrentCost; model.Don_kind_desc = detail.DonKindDesc;//.Replace("'", "\'"); model.Maj_don1 = detail.MajDon1; model.Maj_don2 = detail.MajDon2; model.Maj_don3 = detail.MajDon3; model.Reimb = detail.Reimb; } else { model.Id = 0; } } if (model.Id != 0) { model.BalForward = DonationRecNExpService.GetBalForward(model.Id, financial_year); } else { model.Hospital = inst_code; model.Donor_type = "D"; model.Don_cat = 1; model.Don_subcat = 1; model.Don_subsubcat = 0; model.Recurrent_cost = 0; } model.Exist_record_cnt = DonationRecNExpService.GetExistListCount(model.Inst_code, model.Fund, model.Analytical, model.Section, financial_year, financial_year, value_date, model.Id); model.Link_rec = DonationRecNExpService.GetExistList(model.Inst_code, model.Fund, model.Analytical, model.Section, financial_year, financial_year, value_date, model.Id, model.Don_inc_exp); model.CM_per_GL = DonationRecNExpService.GetCMperGL(model.Hospital, model.Fund, model.Section, model.Analytical, value_date, model.Don_inc_exp); model.CM_Input = DonationRecNExpService.GetCMInput(model.Hospital, model.Fund, model.Section, model.Analytical, value_date, model.Don_inc_exp, model.Id); model.CM_record = DonationRecNExpService.GetPreviousRecord(model.Id, financial_year, true, value_date, cal_date); model.Previous_record = DonationRecNExpService.GetPreviousRecord(model.Id, financial_year, false, value_date, cal_date); model.CM_record_cnt = DonationRecNExpService.GetPreviousRecordCount(model.Id, financial_year, true, value_date, cal_date); model.Previous_record_cnt = DonationRecNExpService.GetPreviousRecordCount(model.Id, financial_year, false, value_date, cal_date); ViewBag.CM_record_cnt = model.CM_record_cnt; ViewBag.Previous_record_cnt = model.Previous_record_cnt; if (model.Action == "link" && don_inc_exp != odon_inc_exp) { ViewBag.CM_record_cnt = 0; ViewBag.Previous_record_cnt = 0; } //Refund ViewBag.Refund = DonationRecNExpService.GetRefund(model.Id, financial_year); model.Refund = DonationRecNExpService.GetRefund(model.Id, financial_year, ""); ViewBag.NotEditable = 0; ViewBag.Reserve_Bal_Alert = DonationRecNExpService.GetBalAlert(model.Hospital, model.Fund, model.Section, model.Analytical, value_date); GetDonationRecNExpFormControl(model, financial_year); if (model.Link_diff_type == "Y") { model.Id = 0; } return(View(model)); }
public IActionResult InsertUpdate(DonationRecNExpModel model) { try { var financial_year = Convert.ToInt32(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Financial_Year")); var login_id = UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "LoginId"); var value_date = DateTime.ParseExact(UserHelper.UserInfo(((ClaimsIdentity)User.Identity), "Value_Date2"), "yyyyMMdd", CultureInfo.GetCultureInfo("en-US")); model.New_program = model.New_program ?? ""; model.Exist_program = model.Exist_program ?? ""; model.Don_kind_desc = string.IsNullOrEmpty(model.New_program) ? HttpUtility.HtmlDecode(model.Exist_program).Replace("'", "\'") : model.New_program.Replace("'", "\'"); model.Don_case1 = string.IsNullOrEmpty(model.Don_case1) ? "N" : model.Don_case1; model.Don_case2 = string.IsNullOrEmpty(model.Don_case2) ? "N" : model.Don_case2; model.Don_case3 = string.IsNullOrEmpty(model.Don_case3) ? "N" : model.Don_case3; model.Reimb = string.IsNullOrEmpty(model.Reimb) ? "N" : model.Reimb; model.Trust = model.Fund == "52" ? (Int16)1 : (Int16)0; if (model.Don_cat != 3) { model.Eqt_desc = null; model.Recurrent_con = "N"; } model.Don_cat = model.Don_cat == 0 ? 12 : model.Don_cat; model.Recurrent_cost = model.Recurrent_con == "N" ? 0 : model.Recurrent_cost; model.Out_comm = model.Don_inc_exp == "E" ? 0 : model.Out_comm; if (model.Delete_function == 1 && model.Id != 0) { DonationRecNExpService.DeleteDonation(login_id, model.Id); } else { model.Input_month = Convert.ToInt32(20 + model.Don_date.Substring(7, 2) + model.Don_date.Substring(4, 2) + model.Don_date.Substring(1, 2) + ""); if (model.Id == 0 || model.Link_diff_type == "Y" && model.OId == 0) { DonationRecNExpService.InsertNewDonation(model, login_id); if (model.Link_diff_type != "Y") { DonationRecNExpService.UpdateDonationReserve(value_date, model.Inst_code, 0, login_id); } else { DonationRecNExpService.UpdateDonationReserve(value_date, model.Inst_code, model.Id, login_id); } } else { if (model.Link_diff_type != "Y") { DonationRecNExpService.DeleteDonationHistory(model.Id, financial_year); } if (model.Id != 0 && model.Link_diff_type == "Y" && model.OId != 0) { model.Id = model.OId; } DonationRecNExpService.UpdateDonationDetail(model, login_id); DonationRecNExpService.UpdateDonationReserve(value_date, model.Inst_code, model.Id, login_id); } } if (model.Link_id != null) { DonationRecNExpService.UpdateDonationLinkID(model.OId, model.Link_id ?? 0); } TempData["SuccessMessage"] = Resource.SaveSuccess; return(RedirectToAction("Index", new { inst_code = model.Inst_code })); } catch (Exception ex) { TempData["ErrorMessage"] = Resource.SaveFail + ex; return(RedirectToAction("Index", new { inst_code = model.Inst_code })); } }
public void InsertNewDonation(DonationRecNExpModel model, string login_id) { DonationDetailRepository.InsertDonationDetail(model, login_id); DonationHistoryRepository.InsertDonationHistoryForNewDonation(model.CM_record, model.Previous_record, login_id); }
public void UpdateDonationDetail(DonationRecNExpModel model, string login_id) { DonationDetailRepository.UpdateDonationDetail(model, login_id); DonationDetailRepository.UpdateDonationLinkDetail(model.Id); DonationHistoryRepository.InsertDonationHistory(model.Id, model.CM_record, model.Previous_record, login_id, model.Don_type); }