Exemple #1
0
        // GET: /MstFleet/
        public ActionResult Index()
        {
            //var data = _fleetBLL.GetFleet();
            var model = new FleetModel();

            model.SearchView = new FleetSearchView();
            //model.Details=Mapper.Map<List<FleetItem>>(data);
            //model.Details = new List<FleetItem>();

            var fleetList = _fleetBLL.GetFleet().ToList();

            model.SearchView.PoliceNumberList = new SelectList(fleetList.Select(x => new { x.PoliceNumber }).Distinct().ToList(), "PoliceNumber", "PoliceNumber");
            model.SearchView.EmployeeNameList = new SelectList(fleetList.Select(x => new { x.EmployeeName }).Distinct().ToList(), "EmployeeName", "EmployeeName");
            model.SearchView.ChasisNumberList = new SelectList(fleetList.Select(x => new { x.ChasisNumber }).Distinct().ToList(), "ChasisNumber", "ChasisNumber");
            model.SearchView.EmployeeIDList   = new SelectList(fleetList.Select(x => new { x.EmployeeID }).Distinct().ToList(), "EmployeeID", "EmployeeID");
            model.SearchView.EngineNumberList = new SelectList(fleetList.Select(x => new { x.EngineNumber }).Distinct().ToList(), "EngineNumber", "EngineNumber");
            model.SearchView.SupplyMethodList = new SelectList(fleetList.Select(x => new { x.SupplyMethod }).Distinct().ToList(), "SupplyMethod", "SupplyMethod");
            model.SearchView.BodyTypeList     = new SelectList(fleetList.Select(x => new { x.BodyType }).Distinct().ToList(), "BodyType", "BodyType");
            model.SearchView.VehicleTypeList  = new SelectList(fleetList.Select(x => new { x.VehicleType }).Distinct().ToList(), "VehicleType", "VehicleType");
            model.SearchView.VehicleUsageList = new SelectList(fleetList.Select(x => new { x.VehicleUsage }).Distinct().ToList(), "VehicleUsage", "VehicleUsage");
            model.SearchView.VendorList       = new SelectList(fleetList.Select(x => new { x.VendorName }).Distinct().ToList(), "VendorName", "VendorName");
            model.SearchView.FunctionList     = new SelectList(fleetList.Select(x => new { x.Function }).Distinct().ToList(), "Function", "Function");
            model.SearchView.RegionalList     = new SelectList(fleetList.Select(x => new { x.Regional }).Distinct().ToList(), "Regional", "Regional");
            model.SearchView.CityList         = new SelectList(fleetList.Select(x => new { x.City }).Distinct().ToList(), "City", "City");

            model.MainMenu          = _mainMenu;
            model.CurrentLogin      = CurrentUser;
            model.CurrentPageAccess = CurrentPageAccess;
            model.WriteAccess       = CurrentPageAccess.WriteAccess == true ? 1 : 0;
            model.ReadAccess        = CurrentPageAccess.ReadAccess == true ? 1 : 0;

            return(View("Index", model));
        }
Exemple #2
0
        public ActionResult Index()
        {
            var model = new RptPOModel();
            //model.SearchView.PeriodFrom = Convert.ToDateTime("2013-07-15");
            //model.SearchView.PeriodTo = Convert.ToDateTime("2018-07-14");
            //model.SearchView.MonthFrom = 11;
            //model.SearchView.MonthTo = 12;
            //model.SearchView.PoliceNumber = "L1976HS";
            var input = Mapper.Map <RptPoByParamInput>(model.SearchView);
            var data  = _rptPoBLL.GetRptPo(input);

            model.MainMenu     = _mainMenu;
            model.TitleForm    = "PO Report";
            model.TitleExport  = "ExportPO";
            model.CurrentLogin = CurrentUser;
            var settingData = _settingBLL.GetSetting();

            model.RptPOItem = Mapper.Map <List <RptPOItem> >(data);

            var listEmployee = _fleetBLL.GetFleet().Select(x => new { x.EmployeeName }).Distinct().OrderBy(x => x.EmployeeName).ToList();
            var listCost     = _fleetBLL.GetFleet().Select(x => new { x.CostCenter }).Distinct().OrderBy(x => x.CostCenter).ToList();
            var listSM       = _fleetBLL.GetFleet().Select(x => new { x.SupplyMethod }).Distinct().OrderBy(x => x.SupplyMethod).ToList();

            model.SearchView.EmployeeNameList = new SelectList(listEmployee, "EmployeeName", "EmployeeName");
            model.SearchView.CostCenterList   = new SelectList(listCost, "CostCenter", "CostCenter");
            model.SearchView.SupplyMethodList = new SelectList(listSM, "SupplyMethod", "SupplyMethod");

            return(View(model));
        }
        public ActionResult DetailsVehicle(string id, VehicleOverallSearchView filter)
        {
            var model = GetVehicleData(filter).Where(x => (x.ChasisNumber == null ? "" : x.ChasisNumber.ToUpper()) == (id == null ? "" : id.ToUpper())).FirstOrDefault();

            model.MainMenu     = _mainMenu;
            model.CurrentLogin = CurrentUser;

            model.MonthlyInstallmentStr = model.MonthlyInstallment == null ? "" : string.Format("{0:n0}", model.MonthlyInstallment);
            model.VatStr = model.Vat == null ? "" : string.Format("{0:n0}", model.Vat);
            model.TotalMonthlyInstallmentStr = model.TotalMonthlyInstallment == null ? "" : string.Format("{0:n0}", model.TotalMonthlyInstallment);


            var History = _fleetBLL.GetFleet().Where(x => (x.ChasisNumber == null ? "" : x.ChasisNumber.ToUpper()) == (model.ChasisNumber == null ? "" : model.ChasisNumber.ToUpper()) &&
                                                     (x.PoliceNumber == null ? "" : x.PoliceNumber.ToUpper()) == (model.PoliceNumber == null ? "" : model.PoliceNumber.ToUpper()) &&
                                                     x.StartContract == model.StartContract && x.EndContract == model.EndContract).GroupBy(x => x.CreatedDate)
                          .Select(x => new VehicleHistory {
                Employee = x.First().EmployeeName,
                Date     = x.First().CreatedDate
                           //Description = x.First().VehicleStatus
            }).OrderBy(x => x.Date).ToList();

            model.DetailsHistory = new List <VehicleHistory>();
            if (History != null && History.Count > 0)
            {
                model.DetailsHistory = History;
            }

            return(View(model));
        }
Exemple #4
0
        public GsItem InitialModel(GsItem model)
        {
            var policeList = _fleetBLL.GetFleet().Where(x => x.IsActive == true).ToList();

            model.PoliceNumberList = new SelectList(policeList, "PoliceNumber", "PoliceNumber");
            var RemarkList = _remarkBLL.GetRemark().Where(x => x.IsActive == true && x.DocumentType == (int)Enums.DocumentType.GS).ToList();

            model.RemarkList = new SelectList(RemarkList, "Remark", "Remark");
            var EmployeeList = _employeeBLL.GetEmployee().Where(x => x.IS_ACTIVE == true).Select(x => new { EmployeeName = x.FORMAL_NAME }).ToList();

            model.EmployeeList = new SelectList(EmployeeList, "EmployeeName", "EmployeeName");
            var LocationList = _locationMappingBLL.GetLocationMapping().Select(x => new { location = x.Location }).ToList();

            model.LocationList = new SelectList(LocationList, "location", "location");
            return(model);
        }
Exemple #5
0
        public JsonResult GetEmployeeList()
        {
            if (CurrentUser.UserRole == Enums.UserRole.Fleet)
            {
                var modelFleet  = _fleetBLL.GetFleet().Where(x => x.VehicleType == "WTC" && x.IsActive).ToList();
                var employeeWtc = modelFleet.GroupBy(x => x.EmployeeID).Select(x => x.Key).ToList();

                var modelWtc = _employeeBLL.GetEmployee().Where(x => x.IS_ACTIVE && employeeWtc.Contains(x.EMPLOYEE_ID)).Select(x => new { x.EMPLOYEE_ID, x.FORMAL_NAME }).ToList().OrderBy(x => x.FORMAL_NAME);

                return(Json(modelWtc, JsonRequestBehavior.AllowGet));
            }
            else
            {
                var model = _employeeBLL.GetEmployee().Where(x => x.IS_ACTIVE && x.GROUP_LEVEL > 0).Select(x => new { x.EMPLOYEE_ID, x.FORMAL_NAME }).ToList().OrderBy(x => x.FORMAL_NAME);
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
        }
        public CarComplaintFormItem listdata(CarComplaintFormItem model, string IdEmployee)
        {
            var listemployeefromdelegation = _delegationBLL.GetDelegation().Select(x => new { dataemployeefrom = x.EmployeeFrom + x.NameEmployeeFrom, x.EmployeeFrom, x.NameEmployeeFrom, x.EmployeeTo, x.NameEmployeeTo, x.DateTo }).ToList().Where(x => x.EmployeeTo == CurrentUser.EMPLOYEE_ID && x.DateTo >= DateTime.Today).OrderBy(x => x.EmployeeFrom);

            model.EmployeeFromDelegationList = new SelectList(listemployeefromdelegation, "EmployeeFrom", "dataemployeefrom");

            var listcomplaintcategory = _complaintcategoryBLL.GetComplaints().Select(x => new { x.MstComplaintCategoryId, x.CategoryName }).ToList().OrderBy(x => x.MstComplaintCategoryId);

            model.ComplaintCategoryList = new SelectList(listcomplaintcategory, "MstComplaintCategoryId", "CategoryName");

            var listsettingvtype = _settingBLL.GetSetting().Select(x => new { x.SettingGroup, x.SettingName, x.SettingValue }).ToList().Where(x => x.SettingGroup == "VEHICLE_TYPE").OrderBy(x => x.SettingValue);

            model.SettingListVType = new SelectList(listsettingvtype, "SettingValue", "SettingName");

            var listsettingvusage = _settingBLL.GetSetting().Select(x => new { x.SettingGroup, x.SettingName, x.SettingValue }).ToList().Where(x => x.SettingGroup == "VEHICLE_USAGE").OrderBy(x => x.SettingValue);

            model.SettingListVUsage = new SelectList(listsettingvusage, "SettingValue", "SettingName");

            var listsettingfleet = _fleetBLL.GetFleet().Select(x => new { x.MstFleetId, x.VehicleType, x.VehicleUsage, x.PoliceNumber, x.EmployeeID, x.EmployeeName, x.Manufacturer, x.Models, x.Series, x.VendorName, x.StartContract, x.EndContract }).ToList().Where(x => x.EmployeeID == IdEmployee).OrderBy(x => x.EmployeeName);

            model.SettingListFleet = new SelectList(listsettingfleet, "PoliceNumber", "PoliceNumber");

            return(model);
        }
Exemple #7
0
        //
        // GET: /MstFuelOdometer/

        public ActionResult Index()
        {
            var model = new FuelOdometerModel();

            //model.Details = Mapper.Map<List<FuelOdometerItem>>(data);
            model.SearchView = new FuelOdometerSearchView();
            var fleetList        = _fleetBLL.GetFleet().ToList();
            var costCenterList   = _groupCostCenterBLL.GetGroupCenter().ToList();
            var fuelOdometerList = _fuelodometerBLL.GetFuelOdometer().ToList();
            var listVehType      = _settingBLL.GetSetting().Where(x => x.SettingGroup == EnumHelper.GetDescription(Enums.SettingGroup.VehicleType) && x.IsActive).Select(x => new { x.MstSettingId, x.SettingValue }).ToList();

            model.SearchView.PoliceNumberList  = new SelectList(fleetList.Select(x => new { x.PoliceNumber }).Distinct().ToList(), "PoliceNumber", "PoliceNumber");
            model.SearchView.EmployeeNameList  = new SelectList(fleetList.Select(x => new { x.EmployeeName }).Distinct().ToList(), "EmployeeName", "EmployeeName");
            model.SearchView.EmployeeIDList    = new SelectList(fleetList.Select(x => new { x.EmployeeID }).Distinct().ToList(), "EmployeeID", "EmployeeID");
            model.SearchView.CostCenterList    = new SelectList(costCenterList.Select(x => new { x.CostCenter }).Distinct().ToList(), "CostCenter", "CostCenter");
            model.SearchView.EcsRmbTransIdList = new SelectList(fuelOdometerList.Select(x => new { x.EcsRmbTransId }).Distinct().ToList(), "EcsRmbTransId", "EcsRmbTransId");
            model.SearchView.ClaimTypeList     = new SelectList(fuelOdometerList.Select(x => new { x.ClaimType }).Distinct().ToList(), "ClaimType", "ClaimType");
            model.SearchView.VehicleTypeList   = new SelectList(listVehType.Select(x => new { x.SettingValue }).Distinct().ToList(), "SettingValue", "SettingValue");
            model.MainMenu          = _mainMenu;
            model.CurrentLogin      = CurrentUser;
            model.CurrentPageAccess = CurrentPageAccess;
            return(View(model));
        }
Exemple #8
0
        public ActionResult Index()
        {
            try
            {
                var model = new RptFuelModel();
                var input = Mapper.Map <RptFuelByParamInput>(model.SearchView);
                var data  = _rptFuelBLL.GetRptFuel(input);
                model.MainMenu     = _mainMenu;
                model.TitleForm    = "Fuel Report";
                model.TitleExport  = "ExportFuel";
                model.CurrentLogin = CurrentUser;
                var settingData     = _settingBLL.GetSetting();
                var listVehType     = settingData.Where(x => x.SettingGroup == EnumHelper.GetDescription(Enums.SettingGroup.VehicleType) && x.IsActive).Select(x => new { x.SettingValue }).ToList();
                var costCenter      = _fleetBLL.GetFleet().Select(x => new { x.CostCenter }).ToList().Distinct().OrderBy(x => x.CostCenter);
                var function        = _employeeBLL.GetEmployee().Select(x => new { x.DIRECTORATE }).ToList().Distinct().OrderBy(x => x.DIRECTORATE);
                var locationMapping = _locationMappingBLL.GetLocationMapping().Select(x => new { x.Region }).ToList().Distinct().OrderBy(x => x.Region);

                model.SearchView.VehicleTypeList = new SelectList(listVehType, "SettingValue", "SettingValue");
                model.SearchView.CostCenterList  = new SelectList(costCenter, "CostCenter", "CostCenter");
                model.SearchView.FunctionList    = new SelectList(function, "DIRECTORATE", "DIRECTORATE");
                model.SearchView.RegionalList    = new SelectList(locationMapping, "Region", "Region");
                model.RptFuelItem = Mapper.Map <List <RptFuelItem> >(data);

                var dataFuel = _rptFuelBLL.GetRptFuelData();

                foreach (var item in model.RptFuelItem)
                {
                    if (input.MonthFrom == 1)
                    {
                        input.MonthFrom = 12;
                        input.YearFrom  = input.YearFrom - 1;
                    }
                    else
                    {
                        input.MonthFrom = input.MonthFrom - 1;
                    }



                    if (item.Odometer != 0)
                    {
                        var data_temp = dataFuel.Where(x => x.PoliceNumber == item.PoliceNumber && x.ReportMonth == input.MonthFrom && x.ReportYear == input.YearFrom).Select(x => x.Odometer).FirstOrDefault();
                        if (data_temp == 0)
                        {
                            item.Usage = item.Odometer;
                            if (item.Liter != 0)
                            {
                                item.kmlt = Math.Round(item.Usage / item.Liter, 2);
                            }
                        }
                        else
                        {
                            item.Usage = item.Odometer - data_temp;
                            if (item.Liter != 0)
                            {
                                item.kmlt = Math.Round(item.Usage / item.Liter, 2);
                            }
                        }
                    }
                }

                return(View(model));
            }
            catch (Exception exception)
            {
                var model = new RptFuelModel();
                var input = Mapper.Map <RptFuelByParamInput>(model.SearchView);
                var data  = _rptFuelBLL.GetRptFuel(input);
                model.MainMenu     = _mainMenu;
                model.TitleForm    = "Fuel Report";
                model.TitleExport  = "ExportFuel";
                model.CurrentLogin = CurrentUser;
                var settingData     = _settingBLL.GetSetting();
                var listVehType     = settingData.Where(x => x.SettingGroup == EnumHelper.GetDescription(Enums.SettingGroup.VehicleType) && x.IsActive).Select(x => new { x.SettingValue }).ToList();
                var costCenter      = _fleetBLL.GetFleet().Select(x => new { x.CostCenter }).ToList().Distinct().OrderBy(x => x.CostCenter);
                var function        = _employeeBLL.GetEmployee().Select(x => new { x.DIRECTORATE }).ToList().Distinct().OrderBy(x => x.DIRECTORATE);
                var locationMapping = _locationMappingBLL.GetLocationMapping().Select(x => new { x.Region }).ToList().Distinct().OrderBy(x => x.Region);

                model.SearchView.VehicleTypeList = new SelectList(listVehType, "SettingValue", "SettingValue");
                model.SearchView.CostCenterList  = new SelectList(costCenter, "CostCenter", "CostCenter");
                model.SearchView.FunctionList    = new SelectList(function, "DIRECTORATE", "DIRECTORATE");
                model.SearchView.RegionalList    = new SelectList(locationMapping, "Region", "Region");
                model.RptFuelItem = Mapper.Map <List <RptFuelItem> >(data);

                model.ErrorMessage = exception.Message;
                return(View(model));
            }
        }