예제 #1
0
        public ActionResult TimeLogReport(int weekNumber, int storesId, int years)
        {
            try
            {
                TimeLogReport report            = new TimeLogReport();
                var           employeesTimeLogs = new List <EmployeesTimeLogsViewModel>();
                var           placeHolder       = " ( " + GetDateFromWeekNumberAndDayOfWeek(weekNumber, years, 1).ToString("dd/MM") + " to " + GetDateFromWeekNumberAndDayOfWeek(weekNumber, years, 0).ToString("dd/MM") + " )";

                ViewData["weekNumber"] = weekNumber;
                ViewData["storesId"]   = storesId;
                ViewData["yearNumber"] = years;

                List <DateTime> weekDates = GetWeekDatesList(weekNumber, years);

                //get lists of employees by storesId
                var employeeLists = _employeeServices.GetAllEmployeesByLocation(CurrentTenantId, storesId).ToList();
                var locationName  = _tenantLocationsServices.GetTenantLocationById(storesId).WarehouseName;

                //CreateReportHeader(report, locationName);
                report.FindControl("xrLabel4", true).Text = $"{locationName}";
                report.FindControl("xrLabel1", true).Text = $"Week {weekNumber} {placeHolder}";
                report.FindControl("xrLabel3", true).Text = $"Time and Attendance @{DateTime.UtcNow.Year}";
                report.FindControl("xrLabel7", true).Text = $"{DateTime.UtcNow.Date.ToString("dd/MM/yyyy")}";


                if (employeeLists.Count() >= 1)
                {
                    //get by employeeId and weeknumber
                    foreach (var item in employeeLists)
                    {
                        employeesTimeLogs.Add(new EmployeesTimeLogsViewModel()
                        {
                            EmployeeId        = item.ResourceId,
                            PayrollEmployeeNo = item.PayrollEmployeeNo,
                            FirstName         = item.FirstName,
                            SurName           = item.SurName,
                            FullName          = item.Name,
                            WeekNumber        = weekNumber,
                            EmployeeRole      = item.EmployeeRoles.Count() <= 0 ? "" : item.EmployeeRoles.Where(x => x.IsDeleted != true).FirstOrDefault().Roles.RoleName,
                            TimeLogs          = TimeLogDataSource(item.ResourceId, weekNumber, storesId, years, weekDates)
                        });
                    }

                    CreateDetail(report, "FullName");       //Employees by Fullname
                    CreateDetailReport(report, "TimeLogs"); //Lists of Timelogs

                    report.DataSource = employeesTimeLogs;
                }

                return(View(report));
            }
            catch (Exception e)
            {
                //log exception
                var err = e.Message;

                return(View("_EmptyResult"));
            }
        }
예제 #2
0
        // GET: /Warehouse/Details/5
        public ActionResult Details(int?id)
        {
            /// Authorization Check
            if (!caSession.AuthoriseSession())
            {
                return(Redirect((string)Session["ErrorUrl"]));
            }

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            TenantLocations tenantwarehouse = _tenantLocationServices.GetTenantLocationById((int)id);

            if (tenantwarehouse == null)
            {
                return(HttpNotFound());
            }
            return(View(tenantwarehouse));
        }
예제 #3
0
        public PartialViewResult _AddPalletes()
        {
            int?receivedQty = 0;

            if (!string.IsNullOrEmpty(Request.Params["rec_qty"]))
            {
                receivedQty = int.Parse(Request.Params["rec_qty"]);
            }

            ViewBag.QuantityEnabled = true;
            int qty = int.Parse(Request.Params["qty"]);

            ViewBag.ProcessedQuantity = receivedQty;
            int prodId = int.Parse(Request.Params["pid"]);

            ViewBag.RequiredQuantity = qty - receivedQty;
            ViewBag.PalletPerCase    = _productServices.GetProductMasterById(prodId).ProductsPerCase ?? 1;
            decimal caseperpallet = ((decimal)ViewBag.RequiredQuantity / (decimal?)ViewBag.PalletPerCase ?? 1);

            if (ViewBag.RequiredQuantity < 0)
            {
                ViewBag.RequiredQuantity = 0;
            }
            if (caseperpallet < 0)
            {
                caseperpallet = 0;
            }
            ViewBag.cases = caseperpallet;
            if (Request.UrlReferrer.AbsolutePath.Contains("PurchaseOrders"))
            {
                ViewBag.Locations       = new SelectList(_productLookupService.GetAllValidProductLocations(CurrentTenantId, CurrentWarehouseId), "LocationId", "LocationCode");
                ViewBag.QuantityEnabled = false;
            }

            if (Request.UrlReferrer.AbsolutePath.Contains("SalesOrders") || Request.UrlReferrer.AbsolutePath.Contains("WorksOrders"))
            {
                ViewBag.QuantityEnabled = false;
                var palletTracking = _tenantLocationServices.GetTenantLocationById(CurrentWarehouseId);
                if (palletTracking != null)
                {
                    ViewBag.palletTracking   = palletTracking.PalletTrackingScheme;
                    ViewBag.palletTrackingId = (int)palletTracking.PalletTrackingScheme;
                    int palletTrackingIds = (int)palletTracking.PalletTrackingScheme;
                    if (palletTrackingIds == 3)
                    {
                        var date = _salesServices.GetSerialByPalletTrackingScheme(prodId, palletTrackingIds, CurrentTenantId, CurrentWarehouseId)?.ExpiryDate;
                        if (date != null)
                        {
                            ViewBag.MoYy    = date.Value.Day + "/" + date.Value.Month + "/" + date.Value.Year;
                            ViewBag.expDate = date;
                        }
                    }
                    if (palletTrackingIds == 4)
                    {
                        var date = _salesServices.GetSerialByPalletTrackingScheme(prodId, palletTrackingIds, CurrentTenantId, CurrentWarehouseId)?.ExpiryDate;
                        if (date != null)
                        {
                            ViewBag.MoYy    = date.Value.ToString("MMMM", CultureInfo.InvariantCulture) + "-" + date.Value.Year;
                            ViewBag.expDate = date;
                        }
                    }
                    else
                    {
                        ViewBag.Serial = _salesServices.GetSerialByPalletTrackingScheme(prodId, palletTrackingIds, CurrentTenantId, CurrentWarehouseId)?.PalletSerial;
                    }
                }
            }


            ViewBag.product = _productServices.GetProductMasterById(prodId);
            return(PartialView());
        }