public ActionResult PayrollSetup(FormCollection collection) { SiteBlue.Areas.OwnerPortal.Models.PayrollSetup payrollSetupViewModel = GetViewModel(); ViewBag.PayrollSetupID = payrollSetupViewModel.PayrollSetupID; // TODO: Used to populate parts list. We want to populate with Jobs List. We'll worry about this later var Partslist = (from s in db.tbl_PB_Parts join t in db.tbl_PriceBook on s.PriceBookID equals t.PriceBookID join m in db.tbl_PB_MasterParts on s.MasterPartID equals m.MasterPartID where t.ActiveBookYN == true select new { s.PartID, m.PartCode, m.PartName, CodeDesc = m.PartCode + " -" + m.PartName }).Take(10).ToList(); ViewBag.ddlPartCode = Partslist; var PartsDesc = (from s in db.tbl_PB_Parts join t in db.tbl_PriceBook on s.PriceBookID equals t.PriceBookID join m in db.tbl_PB_MasterParts on s.MasterPartID equals m.MasterPartID where t.ActiveBookYN == true select new { s.PartID, m.PartCode, m.PartName }).FirstOrDefault(); if (PartsDesc != null) { ViewBag.txtPartDescriptionAdd = PartsDesc.PartName; } var ServiceProlist = (from p in db.tbl_Employee where p.ServiceProYN == true select p).ToList(); ViewBag.ddlServicePro = ServiceProlist; List <SelectListItem> itemsPaytype = new List <SelectListItem>(); itemsPaytype.Add(new SelectListItem { Text = "Flat Rate", Value = "0", Selected = true }); itemsPaytype.Add(new SelectListItem { Text = "Commission", Value = "1" }); ViewBag.ddlPayType = itemsPaytype; return(View(payrollSetupViewModel)); }
public ActionResult PayrollExceptionDataEdit(int partExceptionId) { SiteBlue.Areas.OwnerPortal.Models.PayrollSetup payrollSetupViewModel = GetViewModel(); SiteBlue.Areas.OwnerPortal.Models.PayrollSpiff payrollSpiff = (from ps in payrollSetupViewModel.PayrollSpiffs where ps.PayrollSpiffID == partExceptionId select ps).First <SiteBlue.Areas.OwnerPortal.Models.PayrollSpiff>(); return(Json(payrollSpiff)); }
public ActionResult PayrollPartExceptionData(bool checkStatus, string partsDesc, string partsCode, int FranchiseeId) { // Load spiffs from ViewModel instead of Parts List SiteBlue.Areas.OwnerPortal.Models.PayrollSetup payrollSetupViewModel = GetViewModel(); return(Json(payrollSetupViewModel.PayrollSpiffs_JSON)); ////Session["FranchiseId"] = franchiseId; //var PartList = (from e in db.tbl_HR_PartsExceptions // join e1 in db.tbl_PB_Parts on e.PartID equals e1.PartID // join e2 in db.tbl_PB_MasterParts on e1.MasterPartID equals e2.MasterPartID // join e3 in db.tbl_Employee on e.ServiceProID equals e3.EmployeeID into parts_emp // from e3 in parts_emp.DefaultIfEmpty() // where e.FranchiseID == FranchiseeId && e.ActiveYN == checkStatus // select new // { // e.PartExceptionID, // e.PartID, // e2.PartCode, // e2.PartName, // Employee = (e3.Employee == null ? "" : e3.Employee), // e.PayType, // e.Rate, // e.AddonYN, // e.DateExpires, // e.Comments, // e.ActiveYN, // e.ServiceProID // }).ToList(); //if (partsDesc != null && partsDesc.Trim() != "" && partsDesc != "null") //{ // PartList = PartList.Where(p => p.PartName.ToLower().Contains(partsDesc.ToLower())).ToList(); //} //if (partsCode != null && partsCode.Trim() != "" && partsCode != "null") //{ // PartList = PartList.Where(p => p.PartCode.ToLower().Contains(partsCode.ToLower())).ToList(); //} //return Json(PartList); }
/// <summary> /// This is my "Repository Loader". Not sure where in the solution to put this - BPanjavan /// </summary> /// <returns></returns> private SiteBlue.Areas.OwnerPortal.Models.PayrollSetup GetViewModel() { SiteBlue.Areas.OwnerPortal.Models.PayrollSetup payrollSetupViewModel = null; // Going to need this to set on our view-model ReportingService reportingService = ReportingService.Create <ReportingService>(UserInfo.UserKey); var arrOvertimeMethod = (from overtimeMethod in reportingService.GetOvertimeMethods() select new SiteBlue.Areas.OwnerPortal.Models.OvertimeMethod() { OvertimeMethodName = overtimeMethod.OvertimeMethodName, OvertimeMethodID = overtimeMethod.OvertimeMethodID } ).ToArray(); var arrJobCode = (from jobCode in reportingService.GetJobCodes(UserInfo.CurrentFranchise.FranchiseID) select new SiteBlue.Areas.OwnerPortal.Models.JobCode() { JobCodeID = jobCode.JobCodeID, JobCodeDescription = jobCode.JobCodeDescription, JobCodeName = jobCode.JobCodeName, ActiveYN = jobCode.ActiveYN, FranchiseID = jobCode.FranchiseID, PriceBookActiveYN = jobCode.PriceBookActiveYN, PriceBookID = jobCode.PriceBookID, PriceBookName = jobCode.PriceBookName } ).ToArray(); var arrEmployee = (from employee in reportingService.GetEmployees(UserInfo.CurrentFranchise.FranchiseID) select new SiteBlue.Areas.OwnerPortal.Models.Employees() { EmployeeID = employee.EmployeeID, Employee = employee.EmployeeName, ActiveYN = employee.ActiveYN, FranchiseID = employee.FranchiseID, ServiceProYN = employee.ServiceProYN } ).ToArray(); var arrSpiffPayType = ( from spiffPayType in reportingService.GetSpiffPayTypes() select new SiteBlue.Areas.OwnerPortal.Models.SpiffPayType() { SpiffPayTypeID = spiffPayType.SpiffPayTypeID, SpiffPayTypeName = spiffPayType.SpiffPayTypeName } ).ToArray(); SiteBlue.Business.Reporting.PayrollSetup[] arrPayrollSetup = reportingService.GetPayrollSetupData(UserInfo.CurrentFranchise.FranchiseID); // If there is NO existing PayrollSetup, load an empty one if (arrPayrollSetup.Length == 0) { payrollSetupViewModel = new SiteBlue.Areas.OwnerPortal.Models.PayrollSetup(UserInfo.CurrentFranchise.FranchiseID, 0, 0, 0M, null, arrOvertimeMethod, arrJobCode, arrEmployee, arrSpiffPayType); } else { // Otherwise, load our PayrollSetup Data SiteBlue.Business.Reporting.PayrollSetup payrollSetupExisting = arrPayrollSetup[0]; payrollSetupViewModel = new SiteBlue.Areas.OwnerPortal.Models.PayrollSetup( UserInfo.CurrentFranchise.FranchiseID, (decimal)payrollSetupExisting.OvertimeStarts, payrollSetupExisting.OvertimeMethodID, (decimal)payrollSetupExisting.OTMultiplier, (from reportingSpiff in payrollSetupExisting.PayrollSpiffs select new SiteBlue.Areas.OwnerPortal.Models.PayrollSpiff() { Active = reportingSpiff.Active, AddOn = reportingSpiff.AddOn, Comments = reportingSpiff.Comments, DateExpires = reportingSpiff.DateExpires, DateExpiresFormatted = reportingSpiff.DateExpires.Value.ToShortDateString(), JobCode = reportingSpiff.JobCode, JobCodeDescription = reportingSpiff.JobCodeDescription, JobCodeID = reportingSpiff.JobCodeID, PayrollSetupID = reportingSpiff.PayrollSetupID, PayrollSpiffID = reportingSpiff.PayrollSpiffID, PayType = reportingSpiff.PayType, PayTypeID = reportingSpiff.PayTypeID, Rate = reportingSpiff.Rate, ServiceProID = reportingSpiff.ServiceProID, Employee = reportingSpiff.Employee }), arrOvertimeMethod, arrJobCode, arrEmployee, arrSpiffPayType) { PayrollSetupID = arrPayrollSetup[0].PayrollSetupID }; } return(payrollSetupViewModel); }