public ActionResult createExpanseReportsDateDay(String userName) { ViewData["userName"] = userName; ViewData["month"] = Convert.ToInt32(Request.Form["Month"]); ViewData["year"] = Convert.ToInt32(Request.Form["Year"]); int mois = Convert.ToInt32(Request.Form["Month"]); var userId = User.Identity.GetUserId(); ExpanseRepportRepositery expRepRepo = new ExpanseRepportRepositery(); EmployesRepositery empRepository = new EmployesRepositery(); ExpanseReports exp = new ExpanseReports(); var idEmployer = empRepository.GetByIdUser(userId).Employee_ID; var actor_id = idEmployer; exp.ExpanseReport_ID = Guid.NewGuid(); exp.CreationDate = DateTime.Now; exp.Year = Convert.ToInt32(Request.Form["Year"]); exp.Month = mois; exp.StatusCode = Convert.ToInt32(00); exp.ManagerValidationDate = Convert.ToDateTime(Request.Form["CreationDate"]); exp.ManagerComment = Convert.ToString(" no comment"); exp.AccountingValidatationDate = Convert.ToDateTime(Request.Form["CreationDate"]); exp.AccountingComment = Convert.ToString(" no comment"); exp.Total_HT = Convert.ToDouble(0); exp.Total_TTC = Convert.ToDouble(0); exp.Total_TVA = Convert.ToDouble(0); exp.Employee_ID = idEmployer; exp.Author_ID = actor_id; expRepRepo.AddExpansesReports(exp); return(RedirectToAction("AllExpanses", "Expanses", new { idExpanseReport = exp.ExpanseReport_ID })); }
public void updateExpanseReports(ExpanseReports expRep, double ttc, double ht, double tva) { expRep.Total_TTC = ttc; expRep.Total_HT = ht; expRep.Total_TVA = tva; Save(); }
public void AddExpansesReports(ExpanseReports exp) { using (new NotesDeFraisEntities()) { e.ExpanseReports.Add(exp); e.SaveChanges(); } }
public ExpanseReports GetById(Guid id) { using (new NotesDeFraisEntities()) { ExpanseReports expanseRepport = (from ex in e.ExpanseReports where ex.ExpanseReport_ID == id select ex).FirstOrDefault(); return(expanseRepport); } }
public ActionResult DeleteConfirmed(Guid id) { ExpanseReports expanseReports = db.ExpanseReports.Find(id); db.ExpanseReports.Remove(expanseReports); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Delete(Guid id) { ExpanseRepportRepositery expRep = new ExpanseRepportRepositery(); ExpanseReports expReport = expRep.GetById(id); expRep.Delete(expReport); expRep.Save(); return(RedirectToAction("AllExpansesReports")); }
public void updateStatus(ExpanseReports expRep, int statut, String managerComment, String comptableComment) { using (new NotesDeFraisEntities()) { expRep.StatusCode = statut; expRep.ManagerComment = managerComment; expRep.AccountingComment = comptableComment; e.SaveChanges(); } }
public ActionResult annulExpanseReports(Guid idExpanseReport) { ExpanseRepportRepositery expRepRep = new ExpanseRepportRepositery(); ExpanseReports expRep = expRepRep.GetById(idExpanseReport); String managerComment = "no comment"; String comtableComment = "no comment"; int StatusCode = 35; expRepRep.updateStatus(expRep, StatusCode, managerComment, comtableComment); return(RedirectToAction("AllExpansesReports")); }
public ActionResult modifExpanseReports(Guid idExpanseReport) { ExpanseRepportRepositery expRepRep = new ExpanseRepportRepositery(); ExpanseReports expRep = expRepRep.GetById(idExpanseReport); ExpanseReportsModel expRepModel = new ExpanseReportsModel(); expRepModel.ExpanseReport_ID = expRep.ExpanseReport_ID; expRepModel.Author_ID = expRep.Author_ID; expRepModel.ManagerComment = expRep.ManagerComment; return(PartialView("_modifExpanseReports", expRepModel)); }
public ActionResult Edit([Bind(Include = "ExpanseReport_ID,Employee_ID,Author_ID,CreationDate,Year,Month,StatusCode,ManagerValidationDate,AccountingValidatationDate,Total_HT,Total_TVA,Total_TTC,ManagerComment,AccountingComment")] ExpanseReports expanseReports) { if (ModelState.IsValid) { db.Entry(expanseReports).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Employee_ID = new SelectList(db.Employees, "Employee_ID", "User_ID", expanseReports.Employee_ID); ViewBag.Author_ID = new SelectList(db.Employees, "Employee_ID", "User_ID", expanseReports.Author_ID); return(View(expanseReports)); }
public void Delete(ExpanseReports expRep) { using (new NotesDeFraisEntities()) { var expanse = (from exp in e.Expanses where (exp.ExpanseReport_ID == expRep.ExpanseReport_ID) select exp); foreach (var exp in expanse.ToList()) { e.Expanses.Remove(exp); } e.ExpanseReports.Remove(expRep); } }
public ActionResult AllExpanses(int?pageIndex, Guid idExpanseReport) { ExpanseRepositery expRepo = new ExpanseRepositery(); double ttc = 0; double tva = 0; double ht = 0; var countElementPage = 10; var expanses = expRepo.GetAllByIdExpansesRepport(idExpanseReport); ViewData["idExpanseReport"] = idExpanseReport; List <ExpansesModel> expanseModel = new List <ExpansesModel>(); foreach (var exp in expanses) { tva = tva + exp.Amount_TVA; ht = ht + exp.Amount_HT; ttc = ttc + exp.Amount_TTC; ExpansesModel expanse = new ExpansesModel(); CustomersModel customer = new CustomersModel(); ExpanseTypesModel expType = new ExpanseTypesModel(); ExpanseReportsModel expanseRapport = new ExpanseReportsModel(); ProjectsModel projet = new ProjectsModel(); expanseRapport.ExpanseReport_ID = idExpanseReport; expanse.ExpanseReport_ID = exp.Expanse_ID; expanse.Expanse_ID = exp.Expanse_ID; expanse.Amount_HT = exp.Amount_HT; expanse.Amount_TTC = exp.Amount_TTC; expanse.Amount_TVA = exp.Amount_TVA; expanse.Day = exp.Day; customer.Name = expRepo.GetByIdCutomer(exp.Customer_ID).Name; projet.Name = expRepo.GetByIdProjects(exp.Project_ID).Name; expType.Name = expRepo.GetByIdExpanseTypes(exp.ExpanseType_ID).Name; expanseRapport.Year = expRepo.GetByIdExpansesRepport(exp.ExpanseReport_ID).Year; expanse.Customers = customer; expanse.Projects = projet; expanse.ExpanseReports = expanseRapport; expanse.ExpanseTypes = expType; expanseModel.Add(expanse); } ExpanseRepportRepositery expRapRep = new ExpanseRepportRepositery(); ExpanseReports expRap = expRapRep.GetById(idExpanseReport); expRapRep.updateExpanseReports(expRap, ttc, ht, tva); ViewData["idExpanseReport"] = idExpanseReport; IQueryable <ExpansesModel> listExpanse = expanseModel.AsQueryable(); PaginatedList <ExpansesModel> lst = new PaginatedList <ExpansesModel>(listExpanse, pageIndex, countElementPage); return(View("AllExpanses", lst)); }
// GET: ExpanseReports/Details/5 public ActionResult Details(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExpanseReports expanseReports = db.ExpanseReports.Find(id); if (expanseReports == null) { return(HttpNotFound()); } return(View(expanseReports)); }
public ActionResult Delete(Guid id) { ExpanseRepositery expRepo = new ExpanseRepositery(); ExpanseRepportRepositery expRapRep = new ExpanseRepportRepositery(); Expanses exp = expRepo.GetById(id); Guid idExpRapo = exp.ExpanseReport_ID; ExpanseReports expReport = expRapRep.GetById(idExpRapo); double ttc = expReport.Total_TTC - exp.Amount_TTC; double ht = expReport.Total_HT - exp.Amount_HT; double tva = expReport.Total_TVA - exp.Amount_TVA; expRapRep.updateExpanseReports(expReport, ttc, ht, tva); expRepo.Delete(exp); expRepo.Save(); return(RedirectToAction("AllExpanses", new { idExpanseReport = idExpRapo })); }
// GET: ExpanseReports/Edit/5 public ActionResult Edit(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ExpanseReports expanseReports = db.ExpanseReports.Find(id); if (expanseReports == null) { return(HttpNotFound()); } ViewBag.Employee_ID = new SelectList(db.Employees, "Employee_ID", "User_ID", expanseReports.Employee_ID); ViewBag.Author_ID = new SelectList(db.Employees, "Employee_ID", "User_ID", expanseReports.Author_ID); return(View(expanseReports)); }
public ActionResult modifCommentExpanseReports(Guid idExpanseReport) { ExpanseRepportRepositery expRepRep = new ExpanseRepportRepositery(); ExpanseReports expRep = expRepRep.GetById(idExpanseReport); String managerComment = "no comment"; String comtableComment = "no comment"; int StatusCode = 15; managerComment = Convert.ToString(Request.Form["ManagerComment"]); if (User.IsInRole("Comptable")) { StatusCode = 25; comtableComment = Convert.ToString(Request.Form["ManagerComment"]); managerComment = "no comment"; } expRepRep.updateStatus(expRep, StatusCode, managerComment, comtableComment); return(RedirectToAction("AllExpansesReportsToValid")); }
public ActionResult validateExpanseReportByAdminOrManager(Guid id) { ExpanseRepportRepositery expRep = new ExpanseRepportRepositery(); String managerComment = "no comment"; String comtableComment = "no comment"; int StatusCode = 10; ExpanseReports expReport = expRep.GetById(id); if (User.IsInRole("Manager")) { StatusCode = 20; expRep.updateStatus(expReport, StatusCode, managerComment, comtableComment); return(RedirectToAction("AllExpansesReportsToValid")); } else if (User.IsInRole("Comptable")) { StatusCode = 30; expRep.updateStatus(expReport, StatusCode, managerComment, comtableComment); return(RedirectToAction("AllExpansesReportsToValid")); } expRep.updateStatus(expReport, StatusCode, managerComment, comtableComment); return(RedirectToAction("AllExpansesReportsToValid")); }
public ActionResult createExpanseReports(ExpanseReports exp, Guid?auther_id) { return(null); }