public IActionResult UpdateDeliveryOrder(int poid)
        {
            PODOViewModel pdVModel = new PODOViewModel();

            emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee;
            pdVModel.Employee = emp;
            pdVModel.DO       = doService.FindDOByPOIdWithDOStatusCreated(poid);
            pdVModel.dosrList = dospService.FindBalanceValuestoInput(doService.FindDOByPOIdWithDOStatusCreated(poid).Id);

            return(View("DeliveryOrderFormUpdate", pdVModel));
        }
        public IActionResult ViewPurchaseOrder([FromRoute] int id)
        {
            emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee;
            PODOViewModel pdVModel = new PODOViewModel();

            pdVModel.Employee = emp;
            pdVModel.posrList = poService.FindPOSRByPOId(id);
            pdVModel.PO       = poService.FindPO(id);
            pdVModel.doList   = doService.FindDOListByPOID(id);
            pdVModel.dosrList = dospService.FindDOSRByPOId(id);

            return(View("PurchaseOrderFormView", pdVModel));
        }
        public IActionResult Save([FromBody] PODOViewModel pdVModel)
        {
            bool status = poService.CreatePurchaseOrder(pdVModel.Employee, pdVModel.comment, pdVModel.productList);

            if (status)
            {
                return(new JsonResult(new { success = "Success" }));
            }
            else
            {
                return(new JsonResult(new { success = "Failure" }));
            }
        }
        public IActionResult POSummary()
        {
            emp = JsonConvert.DeserializeObject <Employee>(HttpContext.Session.GetString("employee")) as Employee;
            PODOViewModel pdVModel = new PODOViewModel();

            pdVModel.poListIssued       = poService.FindAllIssuedPOs();
            pdVModel.poListCompleted    = poService.FindAllPOsCompleted();
            pdVModel.poListNotCompleted = poService.FindAllPOsNotCompleted();
            pdVModel.doListNotCompleted = doService.FindAllDOsCreated();
            pdVModel.doListCompleted    = doService.FindAllCompletedDOs();

            return(View("PODOSummary", pdVModel));
        }
        public IActionResult UpdateDOQuantityAssignment([FromBody] PODOViewModel pdVModel)
        {
            bool status = doService.UpdateDeliveryOrder(pdVModel.dosrList, pdVModel.Employee.Id, pdVModel.DO);

            if (status)
            {
                return(new JsonResult(new { success = "Success" }));
            }
            else
            {
                return(new JsonResult(new { success = "Failure" }));
            }
        }