protected void Page_Load(object sender, EventArgs e) { if (!base.IsPostBack && !string.IsNullOrEmpty(base.Request.QueryString["type"])) { if (base.Request.QueryString["type"] == "add") { this.lblTitle.Text = "新增司机报销单"; this.txtcode.Text = DateTime.Now.ToString("yyyyMMddHHmmss"); this.txtDate.Text = DateTime.Now.ToString("yyyy-MM-dd"); this.hdnGuid.Value = Guid.NewGuid().ToString(); return; } if (base.Request.QueryString["type"] == "edit") { this.lblTitle.Text = "修改司机报销单"; this.rei = this.reiBll.GetModel(new Guid(base.Request.QueryString["id"])); this.txtcode.Text = this.rei.ReimbursementCode; this.txtDate.Text = Convert.ToDateTime(this.rei.Date).ToString("yyyy-MM-dd"); this.txtVehicleCode.Value = this.mainBll.GetCodeByguid(this.rei.VehicleGuid); this.txtDestination.Text = this.rei.Destination; this.txtPeople.Value = this.rei.UserName; this.txtFuelcosts.Text = this.rei.FuelCosts.ToString(); this.txtMaintenancecosts.Text = this.rei.MaintenanceCosts.ToString(); this.txtTolls.Text = this.rei.Tolls.ToString(); this.txtRemark.Text = this.rei.Remark; this.txtRepairs.Text = this.rei.Repairs.ToString(); this.hdnGuid.Value = this.rei.Guid.ToString(); this.hdnVehicleGuid.Value = this.rei.VehicleGuid.ToString(); return; } if (base.Request.QueryString["type"] == "view") { this.lblTitle.Text = "查看司机报销单"; this.rei = this.reiBll.GetModel(new Guid(base.Request.QueryString["id"])); this.txtcode.Text = this.rei.ReimbursementCode; this.txtDate.Text = Convert.ToDateTime(this.rei.Date).ToString("yyyy-MM-dd"); this.txtVehicleCode.Value = this.mainBll.GetCodeByguid(this.rei.VehicleGuid); this.txtDestination.Text = this.rei.Destination; this.txtPeople.Value = this.rei.UserName; this.txtFuelcosts.Text = this.rei.FuelCosts.ToString(); this.txtMaintenancecosts.Text = this.rei.MaintenanceCosts.ToString(); this.txtTolls.Text = this.rei.Tolls.ToString(); this.txtRemark.Text = this.rei.Remark; this.txtRepairs.Text = this.rei.Repairs.ToString(); this.txtcode.Enabled = false; this.txtDate.Enabled = false; this.txtDestination.Enabled = false; this.txtFuelcosts.Enabled = false; this.txtMaintenancecosts.Enabled = false; this.txtPeople.Disabled = true; this.txtRemark.Enabled = false; this.txtRepairs.Enabled = false; this.txtTolls.Enabled = false; this.txtVehicleCode.Disabled = true; this.btnSave.Enabled = false; this.Img1.Visible = false; this.imgPrj.Visible = false; } } }
/// <summary> /// 根据记录编号,获取费用报销记录 /// </summary> /// <param name="id"></param> /// <returns></returns> public static Reimbursement GetReimbursementByID(int id) { SqlConnection conn = new SqlConnection(connString); SqlCommand cmd = new SqlCommand("SELECT * FROM [Reimbursements] WHERE [ReimbursementID] = @ReimbursementID", conn); cmd.Parameters.Add("@ReimbursementID", SqlDbType.Int).Value = id; conn.Open(); SqlDataReader sdr = cmd.ExecuteReader(); Reimbursement ri = null; if (sdr.Read()) { ri = new Reimbursement(); ri.staffName = (string)sdr["StaffName"]; ri.department = (string)sdr["Department"]; ri.manager = (string)sdr["Manager"]; ri.projectCode = (string)sdr["ProjectCode"]; ri.projectAccount = (string)sdr["ProjectAccount"]; ri.happenDate = Convert.ToDateTime(sdr["HappenDate"]); ri.reimburseDate = Convert.ToDateTime(sdr["ReimburseDate"]); ri.payeeDate = Convert.ToDateTime(sdr["PayeeDate"]); ri.bill = (int)sdr["Bill"]; ri.expense = Convert.ToDouble(sdr["Expense"]); ri.allExpense = Convert.ToDouble(sdr["AllExpense"]); ri.remark = (string)sdr["Remark"]; ri.ApproveProcess = sdr["ApproveProcess"] == DBNull.Value ? "" : (string)sdr["ApproveProcess"]; } sdr.Close(); conn.Close(); return(ri); }
public ActionResult Create(ReimbursementVo entity) { try { var obj = new Reimbursement { Contract = db.Contracts.Find(entity.ContractId), ReimbursementType = 1, ReimbursementPerson = entity.ReimbursementPerson, ReimbursementTime = entity.ReimbursementTime, StartingTime = entity.StartingTime, ReturnTime = entity.ReturnTime, Participant = entity.Participant, Fare = entity.Fare, FoodAllowance = entity.FoodAllowance, AccommodationAllowance = entity.AccommodationAllowance, OtherExpenses = entity.OtherExpenses, Subtotal = (entity.Fare + entity.FoodAllowance + entity.AccommodationAllowance + entity.OtherExpenses) * (1 + ManageHelper.Rate), Memo = entity.Memo, }; db.Reimbursements.Add(obj); db.SaveChanges(); } catch (Exception ex) { return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet)); } return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); }
// // GET: /Reimbursement/Edit/5 public ActionResult Approve(int id, Reimbursement collection, Budget budget) { var ApplicantId = db.Applicants.Single(a => a.Reimbursements.Where(b => b.Id == id).Any()).Id; collection = db.Reimbursements.Single(a => a.Id == id); var BudgetId = db.Reimbursements.Single(a => a.Id == id).BudgetId; budget = db.Budgets.Single(a => a.Id == BudgetId); var ReimbursementAmount = collection.Amount; var BudgetAmount = budget.Amount; var NewBudgetAmount = BudgetAmount - ReimbursementAmount; collection.ActiveNow = false; collection.DateApproved = DateTime.Now; budget.Amount = NewBudgetAmount; if (ModelState.IsValid) { UpdateModel(collection); db.SaveChanges(); return(RedirectToAction("Index", new { id = ApplicantId })); } else { return(View(collection)); } }
public bool Update(Reimbursement model) { StringBuilder builder = new StringBuilder(); builder.Append("update OA_Vehicle_Reimbursement set "); builder.Append("UserName=@UserName,"); builder.Append("VehicleGuid=@VehicleGuid,"); builder.Append("Date=@Date,"); builder.Append("Destination=@Destination,"); builder.Append("Tolls=@Tolls,"); builder.Append("Repairs=@Repairs,"); builder.Append("FuelCosts=@FuelCosts,"); builder.Append("MaintenanceCosts=@MaintenanceCosts,"); builder.Append("Remark=@Remark,"); builder.Append("ReimbursementCode=@ReimbursementCode"); builder.Append(" where Guid=@Guid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@VehicleGuid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@Date", SqlDbType.DateTime), new SqlParameter("@Destination", SqlDbType.NVarChar), new SqlParameter("@Tolls", SqlDbType.Decimal, 9), new SqlParameter("@Repairs", SqlDbType.Decimal, 9), new SqlParameter("@FuelCosts", SqlDbType.Decimal, 9), new SqlParameter("@MaintenanceCosts", SqlDbType.Decimal, 9), new SqlParameter("@Remark", SqlDbType.NVarChar), new SqlParameter("@ReimbursementCode", SqlDbType.NVarChar, 100) }; commandParameters[0].Value = model.Guid; commandParameters[1].Value = model.UserName; commandParameters[2].Value = model.VehicleGuid; commandParameters[3].Value = model.Date; commandParameters[4].Value = model.Destination; commandParameters[5].Value = model.Tolls; commandParameters[6].Value = model.Repairs; commandParameters[7].Value = model.FuelCosts; commandParameters[8].Value = model.MaintenanceCosts; commandParameters[9].Value = model.Remark; commandParameters[10].Value = model.ReimbursementCode; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public JsonResult DeleteContent(int id) { BaseJsonData json = new BaseJsonData(); if (!User.Identity.IsAuthenticated) { json.msg_code = "nologin"; goto next; } Reimbursement_Content content = db.Reimbursement_Content.Find(id); if (content == null) { json.msg_code = "nodate"; json.msg_text = "报销内容不存在或被删除。"; goto next; } Reimbursement bill = db.Reimbursement.Find(content.c_reimbursement_code); if (bill != null) { int user = Common.PageValidate.FilterParam(User.Identity.Name); if (user != bill.r_add_user_id) { json.msg_code = "forbidden"; json.msg_text = "没有权限操作他人申请的报销单。"; goto next; } if (bill.r_bill_state == 1) { json.msg_code = "forbidden"; json.msg_text = "已批复同意的报销单不允许删除。"; goto next; } } var details = db.Reimbursement_Detail.Where(x => x.detail_content_id == content.content_id); foreach (var detail in details) { db.Reimbursement_Detail.Remove(detail); } db.Reimbursement_Content.Remove(content); try { db.SaveChanges(); } catch (Exception e) { ErrorUnit.WriteErrorLog(e.ToString(), this.GetType().Name); json.msg_code = "error"; json.msg_text = "报销单删除失败。"; goto next; } json.state = 1; json.msg_code = "success"; next: return(Json(json, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { Reimbursement reimbursement = db.Reimbursements.Single(a => a.Id == id); ViewBag.TypeId = new SelectList(db.Types, "Id", "Name"); ViewBag.BudgetId = new SelectList(db.Budgets, "Id", "Number"); return(View(reimbursement)); }
public ActionResult Delete(IList <int> idList) { foreach (var id in idList) { Reimbursement obj = db.Reimbursements.Find(id); db.Reimbursements.Remove(obj); db.SaveChanges(); } return(Json(new { IsSuccess = true, Message = "保存成功" })); }
public List <Reimbursement> DataTableToList(DataTable dt) { List <Reimbursement> list = new List <Reimbursement>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Reimbursement item = new Reimbursement(); if ((dt.Rows[i]["Guid"] != null) && (dt.Rows[i]["Guid"].ToString() != "")) { item.Guid = new Guid(dt.Rows[i]["Guid"].ToString()); } if ((dt.Rows[i]["UserName"] != null) && (dt.Rows[i]["UserName"].ToString() != "")) { item.UserName = dt.Rows[i]["UserName"].ToString(); } if ((dt.Rows[i]["VehicleGuid"] != null) && (dt.Rows[i]["VehicleGuid"].ToString() != "")) { item.VehicleGuid = new Guid(dt.Rows[i]["VehicleGuid"].ToString()); } if ((dt.Rows[i]["Date"] != null) && (dt.Rows[i]["Date"].ToString() != "")) { item.Date = new DateTime?(DateTime.Parse(dt.Rows[i]["Date"].ToString())); } if ((dt.Rows[i]["Destination"] != null) && (dt.Rows[i]["Destination"].ToString() != "")) { item.Destination = dt.Rows[i]["Destination"].ToString(); } if ((dt.Rows[i]["Tolls"] != null) && (dt.Rows[i]["Tolls"].ToString() != "")) { item.Tolls = new decimal?(decimal.Parse(dt.Rows[i]["Tolls"].ToString())); } if ((dt.Rows[i]["Repairs"] != null) && (dt.Rows[i]["Repairs"].ToString() != "")) { item.Repairs = new decimal?(decimal.Parse(dt.Rows[i]["Repairs"].ToString())); } if ((dt.Rows[i]["FuelCosts"] != null) && (dt.Rows[i]["FuelCosts"].ToString() != "")) { item.FuelCosts = new decimal?(decimal.Parse(dt.Rows[i]["FuelCosts"].ToString())); } if ((dt.Rows[i]["MaintenanceCosts"] != null) && (dt.Rows[i]["MaintenanceCosts"].ToString() != "")) { item.MaintenanceCosts = new decimal?(decimal.Parse(dt.Rows[i]["MaintenanceCosts"].ToString())); } if ((dt.Rows[i]["Remark"] != null) && (dt.Rows[i]["Remark"].ToString() != "")) { item.Remark = dt.Rows[i]["Remark"].ToString(); } list.Add(item); } } return(list); }
private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back) { int recordID = Convert.ToInt32(Request["RecordID"]); Reimbursement ri = Reimbursement.GetReimbursementByID(recordID); ri.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ","; Reimbursement.SetReimbursement(recordID, ri); string nextApprover = next; Apply.UpdateNextApprover(recordID, nextApprover, if_back); }
private void SetObjectInfo(Reimbursement _objReimbursement) { _objReimbursement.EmployeeId = txtEmployeeId.Text; _objReimbursement.EmployeeName = txtEmployeeName.Text; _objReimbursement.ManagerName = txtManagerName.Text; _objReimbursement.Department = txtDepartment.Text; _objReimbursement.FromDate = txtFromDate.Text; _objReimbursement.ToDate = txtToDate.Text; _objReimbursement.BusinessPurpose = txtBusinessPurpose.Text; _objReimbursement.CreatedBy = Session["LoginId"].ToString(); _objReimbursement.ModifiedBy = Session["LoginId"].ToString(); }
// // GET: /Reimbursement/Create public ActionResult Create(int id) { ViewBag.ApplicantId = db.Applicants.Single(a => a.Id == id).Id; Reimbursement reimbursement = new Reimbursement(); reimbursement.ApplicantId = id; ViewBag.TypeId = new SelectList(db.Types, "Id", "Name"); ViewBag.BudgetId = new SelectList(db.Budgets, "Id", "Number"); return(View(reimbursement)); }
public JsonResult DeleteAttachment(int id) { BaseJsonData json = new BaseJsonData(); if (!User.Identity.IsAuthenticated) { json.msg_code = "nologin"; goto next; } Reimbursement_Attachment atta = db.Reimbursement_Attachment.Find(id); if (atta == null) { json.msg_code = "nodate"; json.msg_text = "附件不存在或被删除。"; goto next; } Reimbursement bill = db.Reimbursement.Find(atta.atta_reimbursement_code); if (bill != null) { int user = Common.PageValidate.FilterParam(User.Identity.Name); if (user != bill.r_add_user_id && !RoleCheck.CheckHasAuthority(user, db, "系统管理")) { json.msg_code = "forbidden"; json.msg_text = "没有权限操作他人申请的报销单。"; goto next; } if (bill.r_bill_state == 1) { json.msg_code = "forbidden"; json.msg_text = "已批复同意的报销单不允许删除任何信息。"; goto next; } } db.Reimbursement_Attachment.Remove(atta); try { db.SaveChanges(); } catch (Exception e) { ErrorUnit.WriteErrorLog(e.ToString(), this.GetType().Name); json.msg_code = "error"; json.msg_text = "附件删除失败。"; goto next; } json.state = 1; json.msg_code = "success"; next: return(Json(json, JsonRequestBehavior.AllowGet)); }
public StripeTransfer CreateTransfer(Reimbursement reimbursement) { StripeConfiguration.SetApiKey(_stripe_key); var options = new StripeTransferCreateOptions { // TODO }; var service = new StripeTransferService(); StripeTransfer transfer = service.Create(options); return(transfer); }
/// <summary> /// 新增或更新费用报销记录 /// </summary> /// <param name="id"></param> /// <param name="ri"></param> public static void SetReimbursement(int id, Reimbursement ri) { SqlConnection conn = new SqlConnection(connString); SqlCommand cmd; bool isExist = HasReimbursement(id); if (!isExist) { cmd = new SqlCommand("INSERT INTO [Reimbursements] ([StaffName], [Department], [Manager], [ProjectCode],[ProjectAccount], [HappenDate], [ReimburseDate], [PayeeDate], [Bill], [Expense], [AllExpense], [Remark]) VALUES (@StaffName, @Department, @Manager, @ProjectCode,@ProjectAccount, @HappenDate, @ReimburseDate, @PayeeDate, @Bill, @Expense, @AllExpense, @Remark) Select @@Identity as 'Identity'", conn); } else { cmd = new SqlCommand("UPDATE [Reimbursements] SET [ApproveProcess]=@ApproveProcess,[ProjectAccount]=@ProjectAccount WHERE [ReimbursementID] = @ReimbursementID", conn); } cmd.Parameters.Add("@StaffName", SqlDbType.VarChar).Value = ri.staffName; cmd.Parameters.Add("@Department", SqlDbType.VarChar).Value = ri.department; cmd.Parameters.Add("@Manager", SqlDbType.VarChar).Value = ri.manager; cmd.Parameters.Add("@ProjectCode", SqlDbType.VarChar).Value = ri.projectCode; cmd.Parameters.Add("@ProjectAccount", SqlDbType.VarChar).Value = ri.projectAccount; cmd.Parameters.Add("@Bill", SqlDbType.Int).Value = ri.bill; cmd.Parameters.Add("@Expense", SqlDbType.Float).Value = ri.expense; cmd.Parameters.Add("@AllExpense", SqlDbType.Float).Value = ri.allExpense; cmd.Parameters.Add("@HappenDate", SqlDbType.DateTime).Value = ri.happenDate; cmd.Parameters.Add("@ReimburseDate", SqlDbType.DateTime).Value = ri.reimburseDate; cmd.Parameters.Add("@PayeeDate", SqlDbType.DateTime).Value = ri.payeeDate; cmd.Parameters.Add("@Remark", SqlDbType.VarChar).Value = ri.remark; cmd.Parameters.Add("@ReimbursementID", SqlDbType.Int).Value = id; cmd.Parameters.Add("@ApproveProcess", SqlDbType.VarChar).Value = ri.approveProcess; conn.Open(); //cmd.ExecuteNonQuery(); //同时在标准化申请表中插入一条记录 int recordId = Convert.ToInt32(cmd.ExecuteScalar()); if (!isExist) { SqlCommand cmd2 = new SqlCommand("INSERT INTO [AllApplies] ( [ApplyStaff], [ApplyDate], [ApplyType], [NextApprover], [RecordID], [Result]) VALUES (@ApplyStaff, @ApplyDate, @ApplyType, @NextApprover, @RecordID, @Result)", conn); cmd2.Parameters.Add("@ApplyStaff", SqlDbType.VarChar).Value = ri.staffName; cmd2.Parameters.Add("@ApplyDate", SqlDbType.DateTime).Value = DateTime.Now; cmd2.Parameters.Add("@ApplyType", SqlDbType.VarChar).Value = "费用报销"; cmd2.Parameters.Add("@RecordID", SqlDbType.Int).Value = recordId; cmd2.Parameters.Add("@NextApprover", SqlDbType.VarChar).Value = ProjectInfo.getProjectInfoByCode(ri.projectCode).Manager; cmd2.Parameters.Add("@Result", SqlDbType.Bit).Value = false; cmd2.ExecuteNonQuery(); } conn.Close(); }
public Reimbursement GetModel(Guid Guid) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 Guid,UserName,VehicleGuid,Date,Destination,Tolls,Repairs,FuelCosts,MaintenanceCosts,Remark,ReimbursementCode from OA_Vehicle_Reimbursement "); builder.Append(" where Guid=@Guid "); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier) }; commandParameters[0].Value = Guid; Reimbursement reimbursement = new Reimbursement(); DataTable table = SqlHelper.ExecuteQuery(CommandType.Text, builder.ToString(), commandParameters); if (table.Rows.Count <= 0) { return(null); } if (table.Rows[0]["Guid"].ToString() != "") { reimbursement.Guid = new Guid(table.Rows[0]["Guid"].ToString()); } reimbursement.UserName = table.Rows[0]["UserName"].ToString(); if (table.Rows[0]["VehicleGuid"].ToString() != "") { reimbursement.VehicleGuid = new Guid(table.Rows[0]["VehicleGuid"].ToString()); } if (table.Rows[0]["Date"].ToString() != "") { reimbursement.Date = new DateTime?(DateTime.Parse(table.Rows[0]["Date"].ToString())); } reimbursement.Destination = table.Rows[0]["Destination"].ToString(); if (table.Rows[0]["Tolls"].ToString() != "") { reimbursement.Tolls = new decimal?(decimal.Parse(table.Rows[0]["Tolls"].ToString())); } if (table.Rows[0]["Repairs"].ToString() != "") { reimbursement.Repairs = new decimal?(decimal.Parse(table.Rows[0]["Repairs"].ToString())); } if (table.Rows[0]["FuelCosts"].ToString() != "") { reimbursement.FuelCosts = new decimal?(decimal.Parse(table.Rows[0]["FuelCosts"].ToString())); } if (table.Rows[0]["MaintenanceCosts"].ToString() != "") { reimbursement.MaintenanceCosts = new decimal?(decimal.Parse(table.Rows[0]["MaintenanceCosts"].ToString())); } reimbursement.Remark = table.Rows[0]["Remark"].ToString(); reimbursement.ReimbursementCode = table.Rows[0]["ReimbursementCode"].ToString(); return(reimbursement); }
private void updateApprove(string if_agree, string next, BasicInfo info, bool if_back) { //更新审批流程 int recordID = Convert.ToInt32(Request["RecordID"]); Reimbursement ri = Reimbursement.GetReimbursementByID(recordID); ri.ApproveProcess += info.StaffName.Trim() + "-" + if_agree + ","; ri.ProjectAccount = accountList.SelectedValue; Reimbursement.SetReimbursement(recordID, ri); //更新下一审批人 int applyID = Convert.ToInt32(Request["ApplyID"]); string nextApprover = next; Apply.UpdateNextApprover(applyID, nextApprover, if_back); }
public ActionResult Audit(Reimbursement model) { try { var entity = db.Reimbursements.Find(model.Id); entity.AuditAmount = model.AuditAmount; db.Entry(entity).State = EntityState.Modified; db.SaveChanges(); return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet)); } }
public ActionResult Delete(int id, Reimbursement collection) { var ApplicantId = db.Applicants.Single(a => a.Reimbursements.Where(b => b.Id == id).Any()).Id; collection = db.Reimbursements.Single(a => a.Id == id); if (ModelState.IsValid) { db.DeleteObject(collection); db.SaveChanges(); return(RedirectToAction("Index", new { id = ApplicantId })); } else { return(View()); } }
public ActionResult Edit(Reimbursement model, int ContractId) { try { model.Contract = db.Contracts.Find(ContractId); model.Subtotal = (model.Fare + model.FoodAllowance + model.AccommodationAllowance + model.OtherExpenses) * (1 + ManageHelper.Rate); model.AuditAmount = model.Subtotal; db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(Json(new { IsSuccess = true, Message = "保存成功" }, "text/html", JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { IsSuccess = false, Message = ex.Message }, "text/html", JsonRequestBehavior.AllowGet)); } }
public ActionResult Create(Reimbursement model, List <ReimbursementDetail> details) { try { // TODO: Add insert logic here var result = new ResultModel(); //var model = new Reimbursement(); if (model != null) { model.CreatedAt = DateTime.Now; model.CreatedBy = SessionItems.CurrentUser.UserID; result = model.Insert(); } if (result.BooleanResult) { foreach (var obj in details) { obj.Insert(); } } else { //Bad result result.StringResult += "Save Error"; return(new JsonResult() { Data = result }); } return(new JsonResult() { Data = result }); } catch { return(new JsonResult() { Data = ResultModel.FailResult() }); } }
public ActionResult Edit(int id, Reimbursement collection) { collection = db.Reimbursements.Single(a => a.Id == id); ViewBag.TypeId = new SelectList(db.Types, "Id", "Name"); ViewBag.BudgetId = new SelectList(db.Budgets, "Id", "Number"); if (ModelState.IsValid) { // TODO: Add insert logic here UpdateModel(collection); db.SaveChanges(); return(RedirectToAction("Details", new { id = id })); } else { return(View(collection)); } }
/// <summary> /// 保存操作 /// </summary> private void DoSave() { Reimbursement ent = null; id = FormData.Get <String>("Id"); if (String.IsNullOrEmpty(id)) { ent = this.GetPostedData <Reimbursement>(); ent.DoCreate(); } else { ent = this.GetMergedData <Reimbursement>(); ent.DoUpdate(); } this.SetFormData(ent); }
public ActionResult Create(int id, Reimbursement collection) { ViewBag.TypeId = new SelectList(db.Types, "Id", "Name"); ViewBag.BudgetId = new SelectList(db.Budgets, "Id", "Number"); if (ModelState.IsValid) { collection.ActiveNow = true; collection.ApprovedBy = "Alex Riabov"; collection.DateAdded = DateTime.Now; db.Reimbursements.AddObject(collection); db.SaveChanges(); return(RedirectToAction("Index", new { id = id })); } else { return(View(collection)); } }
public bool Add(Reimbursement model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into OA_Vehicle_Reimbursement("); builder.Append("Guid,UserName,VehicleGuid,Date,Destination,Tolls,Repairs,FuelCosts,MaintenanceCosts,Remark,ReimbursementCode)"); builder.Append(" values ("); builder.Append("@Guid,@UserName,@VehicleGuid,@Date,@Destination,@Tolls,@Repairs,@FuelCosts,@MaintenanceCosts,@Remark,@ReimbursementCode)"); SqlParameter[] commandParameters = new SqlParameter[] { new SqlParameter("@Guid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@UserName", SqlDbType.NVarChar, 50), new SqlParameter("@VehicleGuid", SqlDbType.UniqueIdentifier, 0x10), new SqlParameter("@Date", SqlDbType.DateTime), new SqlParameter("@Destination", SqlDbType.NVarChar), new SqlParameter("@Tolls", SqlDbType.Decimal, 9), new SqlParameter("@Repairs", SqlDbType.Decimal, 9), new SqlParameter("@FuelCosts", SqlDbType.Decimal, 9), new SqlParameter("@MaintenanceCosts", SqlDbType.Decimal, 9), new SqlParameter("@Remark", SqlDbType.NVarChar), new SqlParameter("@ReimbursementCode", SqlDbType.NVarChar, 100) }; commandParameters[0].Value = model.Guid; commandParameters[1].Value = model.UserName; commandParameters[2].Value = model.VehicleGuid; commandParameters[3].Value = model.Date; commandParameters[4].Value = model.Destination; commandParameters[5].Value = model.Tolls; commandParameters[6].Value = model.Repairs; commandParameters[7].Value = model.FuelCosts; commandParameters[8].Value = model.MaintenanceCosts; commandParameters[9].Value = model.Remark; commandParameters[10].Value = model.ReimbursementCode; return(SqlHelper.ExecuteNonQuery(CommandType.Text, builder.ToString(), commandParameters) > 0); }
public ActionResult Edit(Reimbursement model, List <ReimbursementDetail> details) { try { // TODO: Add update logic here var result = new ResultModel(); if (model.id > 0) { result = model.SaveOrUpDate(); } if (result.BooleanResult) { foreach (var obj in details) { if (obj.id > 0) { obj.SaveOrUpDate(); } else { obj.Insert(); } } } return(new JsonResult() { Data = result }); } catch { return(new JsonResult() { Data = ResultModel.FailResult() }); } }
protected void redictor_Click(object sender, EventArgs e) { Reimbursement ri = new Reimbursement(); ri.StaffName = staffName.Text; ri.Department = department.Text; ri.Manager = manager.Text; ri.Payee = Request["payee"]; ri.ProjectCode = projectCodeList.SelectedValue; ri.ProjectAccount = ProjectInfo.getProjectInfoByCode(ri.ProjectCode).ProjectAccount; ri.HappenDate = Convert.ToDateTime(happenDate.Value); ri.ReimburestDate = Convert.ToDateTime(applyDate.Text); ri.Bill = Convert.ToInt32(bill.Value); ri.Expense = Convert.ToDouble(expense.Text); ri.AllExpense = Convert.ToDouble(allExpense.Text); ri.Remark = remarkBox.Text; ri.Note = Request["note"]; ri.ApproveProcess = ""; Reimbursement.SetReimbursement(-1, ri); Response.Redirect("~/Account/ApplyListPage.aspx"); }
//"StarSI" type="bh:AdmissionStarSIDef" minOccurs="0"/> //"FamilyReunification" type="bh:AdmissionFamilyReunificationDef" minOccurs="0"/> //"WomensProgram" type="bh:AdmissionWomensProgramDef" minOccurs="0"/> //"PayingBoard" type="bh:BoardNumberDef" minOccurs="1" maxOccurs="unbounded"/> //"GAF" type="integer" minOccurs="0" maxOccurs="1"/> //"MHSecondary" type="bh:AddMHSecondaryDef" minOccurs="0" maxOccurs="1"/> public void Initialize() { DateOfFirstContact = DateTime.Now.Date.AddMonths(-5); AdmissionDate = DateOfFirstContact.AddDays(1); CompletelyPaidByMedicaid = false; LevelOfCare = new LevelOfCare(); //"NotConsistentWithAssessment" type="bh:NotConsistentWithAssessmentDef" minOccurs="0"/> //"GamblingDisorderScreen" type="boolean" minOccurs="0"/> //"GamblingDisorderAssessment" type="boolean" minOccurs="0"/> //"ProviderEpisodeNumber" type="bh:ProviderEpisodeNumberDef" minOccurs="0"/> ReferredBy = new ReferredBy(); MaritalStatus = new MaritalStatus(); EducationLevel = new EducationLevel(); EducationEnrollment = new EducationEnrollment(); EmploymentStatus = new EmploymentStatus(); SourceOfIncomeSupport = new SourceOfIncomeSupport(); LivingArrangement = new LivingArrangement(); PriorAODTxtEpisodes = new PriorAODTxtEpisodes(); MentalHealthHistory = true; Diagnoses = new Diagnoses(); OpioidReplacementTherapy = new OpioidReplacementTherapy(); NumberOfChildrenUnder18 = 2; SpecialPopulation = new SpecialPopulation(); ChildBirthWithinLast5Years = true; NumberOfBirths = 0; ClientPregnant = false; StageOfPregnancy = new StageOfPregnancy(); MilitaryStatus = new MilitaryStatus(); ServedInIraq = false; ServedInAfghanistan = false; AlcoholAgeOfFirstIntox = 15; DrugUse = new DrugUse(); NumberOfArrestsPast30Days = 0; Reimbursement = new Reimbursement(); SelfHelp = new SelfHelp(); }
protected void Page_Load(object sender, EventArgs e) { int recordID = Convert.ToInt32(Request["RecordID"]); int applyID = Convert.ToInt32(Request["ApplyID"]); bool rejected = Convert.ToBoolean(Request["rejected"]); Apply ap = Apply.GetApplyByID(applyID); Reimbursement ri = Reimbursement.GetReimbursementByID(recordID); if (!IsPostBack) { DataSet allPro = ProjectInfo.GetAllProjects(); accountList.DataSource = allPro.Tables[0].DefaultView; accountList.DataTextField = "ProjectAccount"; accountList.DataValueField = "ProjectAccount"; accountList.DataBind(); staffName.Text = ri.StaffName; department.Text = ri.Department; manager.Text = ri.Manager; payee.Text = ri.Payee; projectCode.Text = ri.ProjectCode; accountList.SelectedValue = ri.ProjectAccount; happenDate.Text = ri.HappenDate.ToShortDateString(); reimburseDate.Text = ri.ReimburestDate.ToShortDateString(); payeeDate.Text = ri.PayeeDate.ToShortDateString(); bill.Text = ri.Bill.ToString(); allExpense.Text = ri.AllExpense.ToString(); expense.Text = ri.Expense.ToString(); capital.Text = MoneyConvert.convertToCapital(ri.AllExpense.ToString()); remark.Text = ri.Remark; note.Text = ri.Note; processShow.Text = ri.ApproveProcess; } // //用户权限相关显示功能 Users usr = (Users)Session["Identify"]; BasicInfo info = BasicInfo.GetBasicInfoByID(usr.UserID); if (!rejected && ap.NextApprover == ri.StaffName) { agreeButton.Visible = false; disagreeButton.Visible = false; cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; accountList.Enabled = false; //可打印状态 proManager.Text = "已签字"; depManager.Text = "已签字"; financial.Text = "已签字"; company.Text = "已签字"; } else if (info.StaffName.Trim() == ri.StaffName.Trim() || info.Position.Trim() == "出纳") { agreeButton.Visible = false; disagreeButton.Visible = false; accountList.Enabled = false; if (info.Position.Trim() != "出纳") { cashierButton.Visible = false; rejectButton.Visible = false; whyDisagree.Visible = false; } } else if (info.Position.Trim() == "会计") { accountList.Enabled = true; cashierButton.Visible = false; rejectButton.Visible = false; } else { accountList.Enabled = false; cashierButton.Visible = false; rejectButton.Visible = false; } //测试阶段保持处理流程可见,运行阶段记得去掉 processShow.Visible = true; }
public void beforeTest() { r = new Reimbursement(); }