Beispiel #1
0
        public ActionResult Delete(Guid id)
        {
            ExpanseRepportRepositery expRep    = new ExpanseRepportRepositery();
            ExpanseReports           expReport = expRep.GetById(id);

            expRep.Delete(expReport);
            expRep.Save();
            return(RedirectToAction("AllExpansesReports"));
        }
Beispiel #2
0
        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"));
        }
Beispiel #3
0
        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 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));
        }
        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 }));
        }
Beispiel #6
0
        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"));
        }
Beispiel #7
0
        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"));
        }