/// <summary>
        /// This action is for retrieving CEO approval's details
        /// </summary>
        /// <param name="id">document id</param>
        /// <returns>finance approval details view</returns>
        // GET: CostSheet/CEOeApprovalDetails
        //[Authorize(Roles = "Finance Employee, CEO, ProductionEmployee")]
        public ActionResult CEOApprovalDetails(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            CostSheet costSheet = db.CostSheets.Find(id);

            if (costSheet == null)
            {
                return(HttpNotFound());
            }

            var model = new CostSheetViewModel
            {
                CostSheetId   = costSheet.CostSheetId,
                CostSheetName = costSheet.CostSheetName,
                Status        = costSheet.Status,
                EventProject  = costSheet.EventProject.Name,
                Employee      = costSheet.Employee.FullName,
                CEODecision   = costSheet.CEODecision,
                CEOFeedback   = costSheet.CEOFeedback,
            };

            ViewBag.CEOEmployeeId  = new SelectList(db.Employees, "Id", "FullName");
            ViewBag.EventProjectId = new SelectList(db.EventProjects, "EventProjectId", "FullName");

            return(View(model));
        }
        /// <summary>
        /// This action gets a page that includes a cost sheet's details
        /// </summary>
        /// <param name="id">cost sheet id</param>
        /// <returns>cost sheet items view</returns>
        public ActionResult CostSheetItems(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            CostSheet costSheet = db.CostSheets.Find(id);

            if (costSheet == null)
            {
                return(HttpNotFound());
            }

            var model = new CostSheetViewModel
            {
                EventProjectId     = costSheet.EventProjectId,
                CostSheetId        = costSheet.CostSheetId,
                CostSheetName      = costSheet.CostSheetName,
                Status             = costSheet.Status,
                ProductionEmployee = costSheet.ProductionEmployee.FullName,
            };

            ViewBag.ItemId = new SelectList(db.Items, "ItemId", "ItemPrice");

            return(View(model));
        }
        /// <summary>
        /// Thi action gets the CEO approval page
        /// </summary>
        /// <param name="id">cost sheet id</param>
        /// <returns>Add CEO Approval view</returns>
        // GET: CostSheet/AddCEOApproval
        //[Authorize(Roles = "CEO")]
        public ActionResult AddCEOApproval(int?id)
        {
            if (id == null)
            {
                return(View("Error"));
            }
            CostSheet costSheet = db.CostSheets.Find(id);

            if (costSheet == null)
            {
                return(View("Error"));
            }

            var model = new CostSheetViewModel
            {
                CostSheetId   = costSheet.CostSheetId,
                CostSheetName = costSheet.CostSheetName,
                Status        = costSheet.Status,
                Employee      = costSheet.Employee.FullName,
                CEODecision   = costSheet.CEODecision,
                CEOFeedback   = costSheet.CEOFeedback,
            };

            ViewBag.CEOEmployeeId = new SelectList(db.Employees, "Id", "FullName");

            return(View(model));
        }
        public ActionResult CostSheetPartial(CostSheetViewModel model)
        {
            if (ModelState.IsValid)
            {
                var project = db.EventProjects.Find(model.EventProjectId);

                if (project == null)
                {
                    return(HttpNotFound());
                }

                var costSheet = new CostSheet
                {
                    CostSheetName        = model.CostSheetName,
                    Status               = CostSheetStatus.Pending,
                    ProductionEmployeeId = User.Identity.GetUserId <int>(),
                    FinanceEmployeeId    = User.Identity.GetUserId <int>(),
                    CEOEmployeeId        = User.Identity.GetUserId <int>(),
                    EventProjectId       = model.EventProjectId,
                };

                ViewBag.ProductionEmployeeId = new SelectList(db.Employees, "ProductionEmployeeId", "FullName");
                //ViewBag.CEOEmployeeId = new SelectList(db.Employees, "Id", "FullName");
                //ViewBag.FinanceEmployeeId = new SelectList(db.Employees, "Id", "FullName");
                //ViewBag.EventProjectId = new SelectList(db.EventProjects, "EventProjectId", "Name");

                db.CostSheets.Add(costSheet);
                db.SaveChanges();
            }
            ViewBag.ProductionEmployeeId = new SelectList(db.Employees, "ProductionEmployeeId", "FullName");
            //ViewBag.CEOEmployeeId = new SelectList(db.Employees, "Id", "FullName");
            //ViewBag.FinanceEmployeeId = new SelectList(db.Employees, "Id", "FullName");
            //ViewBag.EventProjectId = new SelectList(db.EventProjects, "EventProjectId", "Name");
            return(PartialView(model));
        }
Example #5
0
        public void AddCostSheet(eCAR3Entities PpContext, int PnCARId, int PnCategory)
        {
            CostSheet pSheet = new CostSheet();

            pSheet.CARId      = PnCARId;
            pSheet.Category   = PnCategory.ToString();
            pSheet.Capital    = 0;
            pSheet.Expense    = 0;
            pSheet.OperLease  = 0;
            pSheet.Percentage = 0;
            pSheet.CreateTime = DateTime.Now;

            PpContext.CostSheets.Add(pSheet);
        }
Example #6
0
        public DataSet Get_load_cost_data()
        {
            CostSheet cost = new CostSheet();

            return(cost.LoadCostingDt());
        }
Example #7
0
 public DataTable Save_Costing(CostSheet cost)
 {
     return(cost.Save_Costing());
 }