Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class Lists
- {
- public static List<Int32> ToIntegerList(string commavalues)
- {
- try
- {
- var _lst = commavalues.Split(',').ToList();
- List<Int32> arr = new List<int>();
- for (int i = 0; i < _lst.Count; i++)
- {
- arr.Add(int.Parse(_lst[i].ToString()));
- }
- return arr;
- }
- catch
- {
- return new List<int>() { 0 };
- }
- }
- /// <summary>
- /// Convert a list of items to a select list
- /// </summary>
- public static List<SelectListItem> ToSelectList<T>(
- this IEnumerable<T> enumerable,
- Func<T, string> text,
- Func<T, string> value,
- String defaultOption)
- {
- var items = enumerable.Select(f => new SelectListItem()
- {
- Text = text(f),
- Value = value(f)
- }).ToList();
- if (!(defaultOption == null))
- {
- items.Insert(0, new SelectListItem()
- {
- Text = defaultOption,
- Value = ""
- });
- }
- return items.ToList();
- }
- //From http://stackoverflow.com/questions/5663655/like-operator-in-linq-to-objects
- //For sql "Like" comparison in linq to objects
- public static bool Like(this string s, string pattern)
- {
- //Find the pattern anywhere in the string
- pattern = ".*" + pattern + ".*";
- return Regex.IsMatch(s, pattern, RegexOptions.IgnoreCase);
- }
- /// <summary>
- /// Convert the text into sentence cases.
- /// </summary>
- /// <param name="Input"></param>
- /// <returns></returns>
- public static string CapitalizeSentences(this string Input)
- {
- if (String.IsNullOrEmpty(Input))
- return Input;
- if (Input.Length == 1)
- return Input.ToUpper();
- Input = Regex.Replace(Input, @"\s+", " ");
- Input = Input.Trim().ToLower();
- Input = Char.ToUpper(Input[0]) + Input.Substring(1);
- var objDelimiters = new string[] { ". ", "! ", "? " };
- foreach (var objDelimiter in objDelimiters)
- {
- var varDelimiterLength = objDelimiter.Length;
- var varIndexStart = Input.IndexOf(objDelimiter, 0);
- while (varIndexStart > -1)
- {
- Input = Input.Substring(0, varIndexStart + varDelimiterLength) + (Input[varIndexStart + varDelimiterLength]).ToString().ToUpper() + Input.Substring((varIndexStart + varDelimiterLength) + 1);
- varIndexStart = Input.IndexOf(objDelimiter, varIndexStart + 1);
- }
- }
- return Input;
- }
- }
- namespace Occfinance.Extensibility
- {
- public class IsValidUser : ActionFilterAttribute
- {
- public override void OnActionExecuting(ActionExecutingContext filterContext)
- {
- HttpContext ctx = HttpContext.Current;
- string redirectTo = string.Empty;
- if (ctx.Session["IsValidUser"] != null)
- {
- bool check = Convert.ToBoolean(ctx.Session["IsValidUser"]);
- if (check == true)
- {
- //do nothing.
- }
- else if (check == false)
- {
- redirectTo = string.Format("~/Home/Index");
- filterContext.Result = new RedirectResult(redirectTo);
- }
- }
- else
- {
- Code.Q_Client Qclient = new Code.Q_Client();
- var client = Qclient.FindClientByLoggedUser(CookieWrapper.UserId);
- if (client != null)
- {
- ctx.Session["IsValidUser"] = true;
- ctx.Session["LoggedInUserId"] = CookieWrapper.UserId;
- ctx.Session["SiteLogo"] = "apptrack.jpg";
- ctx.Session["ContactName"] = client.username;
- ctx.Session["ContactEmail"] = client.email;
- ctx.Session["LoggedInUserAccountId"] = client.clientid;
- ctx.Session["telephone"] = client.telephone;
- }
- else
- {
- redirectTo = string.Format("~/Home/Index");
- filterContext.Result = new RedirectResult(redirectTo);
- }
- }
- base.OnActionExecuting(filterContext);
- }
- }
- public class AuthorizeUser : AuthorizeAttribute
- {
- protected override bool AuthorizeCore(HttpContextBase httpContext)
- {
- if (HttpContext.Current.Session["LoggedInUserAccountId"] != null)
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
- {
- try
- {
- filterContext.Result = new RedirectResult("~/Home/Index");
- }
- catch { throw; }
- }
- }
- }
- namespace Occfinance.FiltersException
- {
- public class MyErrorHandlerAttribute : HandleErrorAttribute
- {
- public override void OnException(ExceptionContext filterContext)
- {
- if (filterContext.ExceptionHandled || !filterContext.HttpContext.IsCustomErrorEnabled)
- {
- return;
- }
- if (new HttpException(null, filterContext.Exception).GetHttpCode() != 500)
- {
- return;
- }
- if (!ExceptionType.IsInstanceOfType(filterContext.Exception))
- {
- return;
- }
- // if the request is AJAX return JSON else view.
- if (filterContext.HttpContext.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
- {
- filterContext.Result = new JsonResult
- {
- JsonRequestBehavior = JsonRequestBehavior.AllowGet,
- Data = new
- {
- error = true,
- message = filterContext.Exception.Message
- }
- };
- }
- else
- {
- var controllerName = (string)filterContext.RouteData.Values["controller"];
- var actionName = (string)filterContext.RouteData.Values["action"];
- var model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);
- filterContext.Result = new ViewResult
- {
- ViewName = View,
- MasterName = Master,
- ViewData = new ViewDataDictionary(model),
- TempData = filterContext.Controller.TempData
- };
- }
- filterContext.ExceptionHandled = true;
- filterContext.HttpContext.Response.Clear();
- filterContext.HttpContext.Response.StatusCode = 500;
- filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
- }
- }
- }
- namespace Occfinance.Filters
- {
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
- public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
- {
- //private static SimpleMembershipInitializer _initializer;
- private static object _initializerLock = new object();
- private static bool _isInitialized;
- public override void OnActionExecuting(ActionExecutingContext filterContext)
- {
- // Ensure ASP.NET Simple Membership is initialized only once per app start
- LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
- }
- //private class SimpleMembershipInitializer
- //{
- // public SimpleMembershipInitializer()
- // {
- // Database.SetInitializer<UsersContext>(null);
- // try
- // {
- // using (var context = new UsersContext())
- // {
- // if (!context.Database.Exists())
- // {
- // // Create the SimpleMembership database without Entity Framework migration schema
- // ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
- // }
- // }
- // WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
- // }
- // catch (Exception ex)
- // {
- // throw new InvalidOperationException("The ASP.NET Simple Membership database could not be initialized. For more information, please see http://go.microsoft.com/fwlink/?LinkId=256588", ex);
- // }
- // }
- //}
- }
- }
- namespace Occfinance.Helpers
- {
- public static class Helper
- {
- private static List<Users> _allUserData;
- public static List<Users> AllUserData
- {
- get
- {
- return _allUserData ?? new List<Users>();
- }
- set
- {
- _allUserData = value;
- }
- }
- //date format like 10/23/2015 for 23 October 2015
- public static string DateFormat = "MM/dd/yyyy";
- public static string JavascriptDateFormat = "mm/dd/yyyy";
- //date format like 23/10/2015 for 23 October 2015
- public static string ddMMyyyy = "dd/MM/yyyy";
- //date format like 2015/10/23 for 23 October 2015
- public static string yyyyMMdd = "yyyy/MM/dd";
- //date format like 23/Oct/2015 for 23 October 2015
- public static string ddMMMyyyy = "dd/MMM/yyyy";
- //date format like 23 Oct 2015 for 23 October 2015
- public static string _ddMMMyyyy = "dd MMM yyyy";
- /// <summary>
- /// Convert list to datatable so that we could pass it to sql stored procedure - 20151021
- /// </summary>
- /// <param name="NegotiatorIds"></param>
- /// <param name="dataTable"></param>
- /// <returns></returns>
- public static DataTable FillDataTable(List<int> NegotiatorIds)
- {
- DataTable dataTable = new DataTable("IntArray");
- dataTable.Columns.Add("IntValue", typeof(Int32));
- foreach (var nid in NegotiatorIds)
- {
- dataTable.Rows.Add(nid);
- }
- return dataTable;
- }
- public static DateTime? GetDate(this string date)
- {
- try
- {
- var arrdate = date.Split('/');
- if (arrdate.Length == 3)
- {
- return new DateTime(int.Parse(arrdate[2]), int.Parse(arrdate[1]), int.Parse(arrdate[0]));
- }
- }
- catch
- {
- // ignored
- }
- return null;
- }
- public static DateTime? GetDateTime(this string date)
- {
- try
- {
- string[] arrdate = date.Split('/');
- if (arrdate.Length == 3)
- {
- return new DateTime(int.Parse(arrdate[2]), int.Parse(arrdate[1]), int.Parse(arrdate[0]), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
- }
- }
- catch
- {
- }
- return null;
- }
- public static string GetDateString(this DateTime? dt)
- {
- if (dt != null)
- return string.Format("{0}/{1}/{2}", dt.Value.Day.ToString().PadLeft(2, '0'), dt.Value.Month.ToString().PadLeft(2, '0'), dt.Value.Year.ToString());
- else
- return string.Empty;
- }
- public static DateTime? GetFollowUp(string date, string time)
- {
- DateTime dt1 = new DateTime();
- if (date != null && time != null)
- {
- string[] arrdate = date.Split('/');
- if (arrdate.Length == 3)
- {
- date = arrdate[1] + "/" + arrdate[0] + "/" + arrdate[2];
- }
- DateTime.TryParse(date, out dt1);
- string[] _time = time.Split(':');
- if (_time.Length >= 2)
- {
- dt1 = dt1.AddHours(Convert.ToInt32(_time[0])).AddMinutes(Convert.ToInt32(_time[1]));
- }
- return dt1;
- }
- else
- {
- return null;
- }
- }
- public static bool IsNumeric(this string value)
- {
- if (string.IsNullOrEmpty(value)) return false;
- try
- {
- int result;
- int.TryParse(value, out result);
- return true;
- }
- catch
- { }
- return false;
- }
- public static bool IsDateTime(this string value)
- {
- if (string.IsNullOrEmpty(value)) return false;
- try
- {
- DateTime result;
- DateTime.TryParse(value, out result);
- return true;
- }
- catch
- { }
- return false;
- }
- public static bool IsEmail(this string value)
- {
- bool isEmail = Regex.IsMatch(value, @"\A(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?)\Z", RegexOptions.IgnoreCase);
- return isEmail;
- }
- public static string ToGBPValue(this decimal? val)
- {
- if ((val ?? 0) > 0)
- {
- return string.Format("{0} {1}", SessionHelper.DefaultCurrency, val);
- }
- else
- {
- return string.Empty;
- }
- }
- public static string ToGBPValue(this string val)
- {
- if (!string.IsNullOrEmpty(val) && !string.IsNullOrWhiteSpace(val))
- {
- return string.Format("{0} {1}", SessionHelper.DefaultCurrency, val);
- }
- else
- {
- return string.Empty;
- }
- }
- /// <summary>
- /// Set length of a string
- /// </summary>
- /// <param name="str"></param>
- /// <param name="length"></param>
- /// <returns></returns>
- public static string StringToLength(this string str, int length)
- {
- int strlength = str.Length;
- string output = string.Empty;
- if (strlength < length)
- { return str; }
- else
- {
- return str.Substring(0, length);
- }
- }
- public static string GetStringForReferral(this string str)
- {
- if (string.IsNullOrEmpty(str))
- {
- return "N/A";
- }
- else if (string.IsNullOrWhiteSpace(str))
- {
- return "N/A";
- }
- else
- {
- return str;
- }
- }
- /// <summary>
- /// Enter errors in error log table.
- /// </summary>
- /// <param name="innerException"></param>
- /// <param name="className"></param>
- /// <param name="methodName"></param>
- /// <param name="exceptionMessage"></param>
- /// <param name="source"></param>
- /// <param name="trace"></param>
- /// <param name="helpLink"></param>
- public static void ErrorLog(Exception innerException = null, string className = "", string methodName = "", string exceptionMessage = "", string source = "", string trace = "", string helpLink = "")
- {
- try
- {
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- Occfinance_Data.tblErrorLog errlg = new Occfinance_Data.tblErrorLog();
- errlg.Controller = className;
- errlg.Action = methodName;
- errlg.Message = exceptionMessage;
- errlg.InnerMsg = Convert.ToString(innerException);
- errlg.HelpLink = helpLink;
- errlg.Source = source;
- errlg.Trace = trace;
- if (HttpContext.Current.Session != null)
- {
- errlg.Name = Convert.ToString(HttpContext.Current.Session["ContactName"] ?? "");
- errlg.AddBy = Convert.ToInt32(HttpContext.Current.Session["LoggedInUserId"] ?? "0");
- errlg.EmailId = Convert.ToString(HttpContext.Current.Session["ContactEmail"] ?? "");
- }
- errlg.AddDate = DateTime.Now;
- errlg.ErrorDate = DateTime.Now;
- errlg.IsActive = true;
- errlg.IsDeleted = false;
- errlg.IsResolved = false;
- errlg.URL = string.Empty;
- ctx.tblErrorLog.Add(errlg);
- ctx.SaveChanges();
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- //
- // Description : Html helper for razor generated field name and field id
- //
- // Created On : 01 June 2015
- //
- // Author :
- public static string FieldNameFor<T, TResult>(this HtmlHelper<T> html, Expression<Func<T, TResult>> expression)
- {
- return html.ViewData.TemplateInfo.GetFullHtmlFieldName(ExpressionHelper.GetExpressionText(expression));
- }
- public static string FieldIdFor<T, TResult>(this HtmlHelper<T> html, Expression<Func<T, TResult>> expression)
- {
- var id = html.ViewData.TemplateInfo.GetFullHtmlFieldId(ExpressionHelper.GetExpressionText(expression));
- // because "[" and "]" aren't replaced with "_" in GetFullHtmlFieldId
- return id.Replace('[', '_').Replace(']', '_');
- }
- /// <summary>
- /// Over load method to getting the date in string format
- /// </summary>
- /// <param name="value">date</param>
- /// <returns>Date in string</returns>
- public static string GetDateString(this string value, string dateFormat)
- {
- if (value != null)
- return value.GetDate().Value.ToString(dateFormat);
- else
- return string.Empty;
- }
- /// <summary>
- /// Method to getting the date in java string format yyyy/MM/dd
- /// </summary>
- /// <param name="value">string date</param>
- /// <returns>Java Script Date</returns>
- public static string GetJavaScriptDateString(this string value)
- {
- if (value != null)
- return value.GetDate().Value.ToString(Helper.yyyyMMdd);
- else
- return string.Empty;
- }
- /// <summary>
- /// Helper method for Souce list
- /// </summary>
- /// <returns>Source List</returns>
- public static List<SelectListItem> SourceList()
- {
- var sourceList = new List<SelectListItem>()
- {
- new SelectListItem(){Value = "all", Text="All"},
- new SelectListItem(){Value = "direct", Text="Direct"},
- new SelectListItem(){Value = "intellicalc", Text="Intellicalc"}
- };
- return sourceList;
- }
- /// <summary>
- /// Method for static date list
- /// </summary>
- /// <returns>Date List</returns>
- public static List<SelectListItem> DateList()
- {
- var CreatedItems = new List<SelectListItem>()
- {
- new SelectListItem(){Value = "0", Text="between"},
- new SelectListItem(){Value = "7", Text="last 7 days"},
- new SelectListItem(){Value = "14", Text="last 14 days"},
- new SelectListItem(){Value = "m", Text="this month"},
- new SelectListItem(){Value = "1m", Text="last month"},
- new SelectListItem(){Value = "2m", Text="last 2 months"},
- new SelectListItem(){Value = "y", Text="this year"},
- new SelectListItem(){Value = "1y", Text="last year"}
- };
- return CreatedItems;
- }
- /// <summary>
- /// Method for getting new lead staus of Product
- /// </summary>
- /// <param name="value"></param>
- /// <returns></returns>
- public static int GetNewLeadStatus(this int typeid)
- {
- if (typeid == (int)FinanceTypes.Mortgages)
- return (int)MortgageStatus.NewLead;
- else if (typeid == (int)FinanceTypes.Life)
- return (int)LifeStatus.NewLead;
- else if (typeid == (int)FinanceTypes.BuildingsOrContents)
- return (int)BuildingStatus.NewLead;
- else if (typeid == (int)FinanceTypes.Pensions)
- return (int)PensionsStatus.NewLead;
- else
- return (int)InvestmentStatus.NewLead;
- }
- /// <summary>
- /// Method is use to flush the memory of object
- /// </summary>
- /// <param name="obj"></param>
- public static void SafeDispose(this object obj)
- {
- if (obj != null)
- {
- ((IDisposable)obj).Dispose();
- }
- }
- /// <summary>
- /// Extension method for retrieving enum's description
- /// </summary>
- /// <param name="value"></param>
- /// <returns></returns>
- public static string GetEnumDescription(this Enum value)
- {
- FieldInfo fi = value.GetType().GetField(value.ToString());
- DescriptionAttribute[] attributes =
- (DescriptionAttribute[])fi.GetCustomAttributes(
- typeof(DescriptionAttribute),
- false);
- if (attributes != null &&
- attributes.Length > 0)
- return attributes[0].Description;
- else
- return value.ToString();
- }
- /// <summary>
- /// Helper method for referral Type List
- /// </summary>
- /// <returns>Referral Type List</returns>
- public static List<SelectListItem> ReferreTypeList()
- {
- var ReferreTypeList = new List<SelectListItem>()
- {
- new SelectListItem(){ Value="0", Text="All"},
- new SelectListItem(){ Value="1", Text="Primary Referral"},
- new SelectListItem(){ Value="2", Text="Secondary Referral"}
- };
- return ReferreTypeList;
- }
- public static int NoOFDayToCalculate(string TQuarter)
- {
- int NoOfDays = 0;
- string createdfrom = "";
- string createdto = "";
- if (TQuarter == "1" || TQuarter == "9")
- {
- createdfrom = "01/01/" + DateTime.Now.Year.ToString();
- createdto = "31/03/" + DateTime.Now.Year.ToString();
- DateTime now = DateTime.Now;
- TimeSpan elapsed = now.Subtract(Convert.ToDateTime(createdfrom));
- double daysAgo = elapsed.TotalDays;
- DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
- DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
- NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
- if (Convert.ToInt32(daysAgo) < NoOfDays)
- {
- NoOfDays = Convert.ToInt32(daysAgo);
- }
- }
- else if (TQuarter == "2")
- {
- createdfrom = "01/04/" + DateTime.Now.Year.ToString();
- createdto = "30/06/" + DateTime.Now.Year.ToString();
- DateTime now = DateTime.Now;
- TimeSpan elapsed = now.Subtract(Convert.ToDateTime(createdfrom));
- double daysAgo = elapsed.TotalDays;
- DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
- DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
- NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
- if (Convert.ToInt32(daysAgo) < NoOfDays)
- {
- NoOfDays = Convert.ToInt32(daysAgo);
- }
- }
- else if (TQuarter == "3")
- {
- createdfrom = "01/07/" + DateTime.Now.Year.ToString();
- createdto = "30/09/" + DateTime.Now.Year.ToString();
- DateTime now = DateTime.Now;
- DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
- DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
- int elapsed = Convert.ToInt32((now - d1).TotalDays);
- NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
- if (elapsed < NoOfDays)
- {
- NoOfDays = elapsed;
- }
- }
- else if (TQuarter == "4")
- {
- createdfrom = "01/10/" + DateTime.Now.Year.ToString();
- createdto = "31/12/" + DateTime.Now.Year.ToString();
- DateTime now = DateTime.Now;
- DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
- DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
- int elapsed = Convert.ToInt32((now - d1).TotalDays);
- NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
- if (elapsed < NoOfDays)
- {
- NoOfDays = elapsed;
- }
- }
- return NoOfDays;
- }
- public static string GetRandomString(int length,int type=0)
- {
- if (length > 0)
- {
- string allowedChars = string.Empty;
- if (type == 1)//Capital alphabets only
- {
- allowedChars = "ABCDEFGHJKLMNOPQRSTUVWXYZ";
- }
- else
- {
- allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789";
- }
- char[] chars = new char[length];
- Random rd = new Random();
- for (int i = 0; i < length; i++)
- {
- chars[i] = allowedChars[rd.Next(0, allowedChars.Length)];
- }
- return new string(chars);
- }
- else
- {
- return string.Empty;
- }
- }
- #region Encrypt/Decrypt string to Hex
- public static string ConvertStringToHex(String input, System.Text.Encoding encoding)
- {
- Byte[] stringBytes = encoding.GetBytes(input);
- StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2);
- foreach (byte b in stringBytes)
- {
- sbBytes.AppendFormat("{0:X2}", b);
- }
- return sbBytes.ToString();
- }
- public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding)
- {
- int numberChars = hexInput.Length;
- byte[] bytes = new byte[numberChars / 2];
- for (int i = 0; i < numberChars; i += 2)
- {
- bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16);
- }
- return encoding.GetString(bytes);
- }
- #endregion Encrypt/Decrypt string to Hex
- }
- #region[Getting value for session]
- /// <summary>
- /// Date: 21/Oct/2015
- /// To getting values from session
- /// </summary>
- public static class SessionHelper
- {
- /// <summary>
- /// To get User id from session
- /// </summary>
- public static int UserId
- {
- get
- {
- return HttpContext.Current.Session["LoggedInUserId"] != null ? Convert.ToInt32(HttpContext.Current.Session["LoggedInUserId"]) : 0;
- }
- }
- /// <summary>
- /// To get Account id from session
- /// </summary>
- public static int AccountId
- {
- get
- {
- return HttpContext.Current.Session["LoggedInUserAccountId"] != null ? Convert.ToInt32(HttpContext.Current.Session["LoggedInUserAccountId"]) : 0;
- }
- }
- /// <summary>
- /// To get default settings from session
- /// </summary>
- public static int DefaultsettingId
- {
- get
- {
- return HttpContext.Current.Session["DefaultsettingId"] != null ? Convert.ToInt32(HttpContext.Current.Session["DefaultsettingId"]) : 0;
- }
- }
- public static string DefaultCurrency
- {
- get
- {
- return (HttpContext.Current.Session["DefaultCurrency"] != null && !string.IsNullOrEmpty((HttpContext.Current.Session["DefaultCurrency"]).ToString())) ? (HttpContext.Current.Session["DefaultCurrency"]).ToString() : "£";
- }
- }
- }
- #endregion
- }
- namespace Select2Demo.Helpers
- {
- //I found this somewhere online...can't remember the source. Returns a jsonp instead of a standard json result.
- public class JsonpResult : JsonResult
- {
- public override void ExecuteResult(ControllerContext context)
- {
- if (context == null)
- {
- throw new ArgumentNullException("context");
- }
- var request = context.HttpContext.Request;
- var response = context.HttpContext.Response;
- string jsoncallback = (context.RouteData.Values["callback"] as string) ?? request["callback"];
- if (!string.IsNullOrEmpty(jsoncallback))
- {
- if (string.IsNullOrEmpty(base.ContentType))
- {
- base.ContentType = "application/x-javascript";
- }
- response.Write(string.Format("{0}(", jsoncallback));
- }
- base.ExecuteResult(context);
- if (!string.IsNullOrEmpty(jsoncallback))
- {
- response.Write(")");
- }
- }
- }
- }
- @{
- string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/AgentFeeSetting.js");
- }
- <input type="hidden" id="hdnUpdateUrl" value="@Url.Action("AgentFeeSettingAddUpdate", "agent_fee_setting")" />
- <input type="hidden" id="hdnlogoutUrl" value="@Url.Action("index", "home")" />
- <tbody>
- @{
- int c = 0;
- if (Model != null)
- {
- if (Model.Count() > 0)
- {
- foreach (var data in Model)
- {
- var trId = "trId" + data.AgentId;
- var hdnagentId = "hdnagentId" + data.AgentId;
- var hdnagentfee = "hdnagentfee" + data.AgentId;
- var hdnprocfee = "hdnprocfee" + data.AgentId;
- var spagentname = "spagentname" + data.AgentId;
- var spprocurationfee = "spprocurationfee" + data.AgentId;
- var spagentfee = "spagentfee" + data.AgentId;
- <tr id="@trId" @(c % 2 == 0 ? "" : "class=odd")>
- <td style="width: 70px;">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img onclick="return SetData('@data.AgentId');" title="@Occfinance.Resource.Edit" alt="Edit" id="imgeditbr" src="@Url.Content("~/Images/edit.png")" style="cursor: pointer; float:left; padding: 2px;">
- }
- </td>
- <td>
- <span id="@spagentname">@data.AgentName</span>
- <input type="hidden" id="@hdnagentId" value="@data.AgentId" />
- </td>
- <td>
- <span id="@spprocurationfee">@data.ProcFee %</span>
- <input type="hidden" id="@hdnprocfee" value="@data.ProcFee" />
- </td>
- <td>
- <span id="@spagentfee">@data.ClientFee</span>
- <input type="hidden" id="@hdnagentfee" value="@data.ClientFee" />
- </td>
- </tr>
- c++;
- }
- }
- }
- }
- </tbody>
- @model List<Occfinance.Models.AccountVisits>
- <div id="accountVisit_tab" class="dash-table re-mortgage divbordr">
- @if (Model != null && Model.Count > 0)
- {
- <table class="bordered-table" id="tblAccountVisit">
- <thead>
- <tr class="gray-row">
- <td><b>Introducer</b></td>
- <td><b>Branch</b></td>
- <td><b>Visit Frequency</b></td>
- <td><b>Note</b></td>
- <td><b>Action</b></td>
- </tr>
- </thead>
- <tbody>
- @{int i = 0;}
- @foreach (var item in Model)
- {
- <tr>
- <td>
- <input type="hidden" class="hdnId" value="@item.IntroducerVisitsId" />
- @item.Introducer
- </td>
- <td>@item.Branch</td>
- <td>@item.VisitFrequencyDay, @item.VisitFrequency </td>
- <td><input type="hidden" id="txtNote" class="txtNote" />@item.Note</td>
- <td>
- <div>
- @if (item.TransferedFromId > 0 && item.Status == 0)
- {
- <input type="button" class="btn btn-blue margin5 width99" value="Accept" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '2')" /><br />
- <input type="button" class="btn btn-blue margin5 width99" value="Reject" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '3')" />
- }
- else
- {
- <input type="button" class="btn btn-blue margin5 width99" value="Complete" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '1')"/><br />
- <input type="button" class="btn btn-blue margin5 width99" value="Transfer" onclick="GetSimilarBrokerList('@item.IntroducerVisitsId')" />
- }
- </div>
- </td>
- </tr>
- }
- </tbody>
- </table>
- }
- else
- {
- <div>
- <b class="nodata">No data</b>
- </div>
- }
- </div>
- @{
- List<Occfinance.Models.AdminTeam> teams = new List<Occfinance.Models.AdminTeam>();
- if (ViewBag.AdminTeamList != null)
- {
- teams = (List<Occfinance.Models.AdminTeam>)ViewBag.AdminTeamList;
- }
- int userid = Convert.ToInt32(Session["LoggedInUserAccountId"] ?? 0);
- string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/AdminTeamSettings.js");
- }
- <tbody>
- @{
- if (teams.Count() > 0)
- {
- for (int c = 0; c < teams.Count(); c++)
- {
- var trid = "trid" + teams[c].UserId;
- <tr id="@trid" @(c % 2 == 0 ? "" : "class=odd")>
- <td >
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img title="@Occfinance.Resource.Edit" alt="Edit" onclick="return showdetails(@teams[c].UserId);" id="imgedit" src="@Url.Content("~/Images/edit.png")" >
- }
- @if (userid != @teams[c].AccountId)
- {
- <img title="@Occfinance.Resource.Delete" onclick="return DeleteClient(@teams[c].UserId, '@trid')" alt="Delete" id="imgdelete" src="@Url.Content("~/Images/delete.gif")" >
- }
- </td>
- <td>
- @teams[c].AdminTeamName
- </td>
- <td>
- @teams[c].AdminName
- </td>
- <td >@teams[c].Brokers</td>
- </tr>
- }
- }
- }
- </tbody>
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <input type="hidden" value="@Url.Content("~/Images/edit.png")" id="editUrl" />
- <input title="@Occfinance.Resource.Refresh" onclick="return Reset()" id="btnrefreshteam" type="image" src="@Url.Content("~/Images/refreshsmall.png")" />
- @{
- ViewBag.Title = "_AdvisorReportPartial";
- Layout = null;
- Summary _summary = new Summary();
- var advisorData = new List<AdvisorReport>();
- if (ViewBag.advisorlist != null)
- {
- advisorData = (List<AdvisorReport>)ViewBag.advisorlist;
- }
- var PreOfferData = new List<AdvisorReport>();
- var PostOfferData = new List<AdvisorReport>();
- var CompleteData = new List<AdvisorReport>();
- var providers = new List<string>();
- var solicitor = new List<string>();
- if (ViewBag.PreOfferData != null)
- {
- PreOfferData = (List<AdvisorReport>)ViewBag.PreOfferData;
- providers = PreOfferData.Select(c => c.provider.ToLower().Trim()).Distinct().ToList();
- }
- if (ViewBag.PostOfferData != null)
- {
- PostOfferData = (List<AdvisorReport>)ViewBag.PostOfferData;
- solicitor = PostOfferData.Select(c => c.solicitor.ToLower().Trim()).Distinct().ToList();
- }
- if (ViewBag.CompleteData != null)
- {
- CompleteData = (List<AdvisorReport>)ViewBag.CompleteData;
- }
- if (ViewBag.Summary != null)
- {
- _summary = (Summary)ViewBag.Summary;
- }
- }
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsPrintAllData)
- {
- <a title="Generate Pdf" onclick="return PrePrint('divdocument');" href="javascript:void(0);" id="iconpdf">
- <img src="@Url.Content("~/Content/images/PDFicon.png")" class="adviserReport2" />
- </a>
- <a class="aback" title="Print Report Data" onclick="return PrintDocument('divdocumentForPrint');" href="javascript:void(0);" id="iconprint">
- <img src="@Url.Content("~/Content/images/print.png")" class="adviserReport2" />
- </a>
- }
- <a title="Send Mail" href="javascript:void(0);" id="iconmail">
- <img src="@Url.Content("~/Content/images/mail-icon.png")" class="adviserReport2" />
- </a>
- <td class="txtAlignRight">@Html.Raw(ViewBag.AdvisorName)</td>
- <td><b>Total Leads:</b></td>
- <td class="txtAlignRight">
- @_summary.NewLeads
- </td>
- @if (providers.Count > 0)
- {
- <table id="tblpre">
- <tr>
- <td>
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsPrintAllData)
- {
- <a class="aback" title="Print Report Data" onclick="return PrintDocument('divdocument1Print');" href="javascript:void(0);">
- <img src="@Url.Content("~/Content/images/print.png")" class="adviserReport2" id="preprint" />
- </a>
- }
- <table cellspacing="0" >
- <thead>
- <tr>
- <td ><b>Date Submitted</b></td>
- <td ><b>Client Name</b></td>
- <td ><b>Policy Reference #</b></td>
- <td ><b>Introducer </b></td>
- <td ><b>Negotiators Name</b></td>
- <td ><b>Mortgage Amount</b></td>
- <td ><b>Procuration Fee</b></td>
- </tr>
- </thead>
- <tbody>
- @foreach (var name in providers)
- {
- string _Pname = "N/A";
- if (PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()).Count() > 0)
- {
- <tr class="gray-row">
- <td colspan="8" >
- <b class="capitalize">
- Provider Name:
- @if (!string.IsNullOrEmpty(name))
- {
- _Pname = name;
- }
- @_Pname
- </b>
- </td>
- </tr>
- foreach (var item in PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()))
- {
- <tr>
- <td >@(item.SubmitDate.HasValue ? item.SubmitDate.Value.ToString("dd/MM/yyyy") : "")</td>
- <td >@item.ClinetName</td>
- <td >@item.policyreference</td>
- <td >@item.AgentName</td>
- <td >@item.NegRef</td>
- <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.MortgageAmount, 2))</td>
- <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.ProcurationFee, 2))</td>
- </tr>
- }
- }
- }
- </tbody>
- </table>
- <br />
- </td>
- </tr>
- </table>
- }
- else
- {
- <div></div>
- <div>
- <b class="nodata">No data</b>
- </div>
- }
- <table id="tblcomplete" >
- <thead>
- <tr>
- <td ><b>Date App Submitted</b></td>
- <td ><b>Date Offered</b></td>
- <td ><b>Date Completed</b></td>
- <td ><b>Client Name</b></td>
- <td ><b>Introducer</b></td>
- <td ><b>Negotiators Name</b></td>
- <td ><b>Mortgage Amount</b></td>
- </tr>
- </thead>
- <tbody>
- @foreach (var item in CompleteData)
- {
- <tr>
- <td >@(item.SubmitDate.HasValue ? item.SubmitDate.Value.ToString("dd/MM/yyyy") : "")</td>
- <td >@(item.OfferDate.HasValue ? item.OfferDate.Value.ToString("dd/MM/yyyy") : "")</td>
- <td >@(item.CompleteDate.HasValue ? item.CompleteDate.Value.ToString("dd/MM/yyyy") : "")</td>
- <td >@item.ClinetName</td>
- <td >@item.AgentName</td>
- <td >@item.NegRef</td>
- <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.MortgageAmount, 2))</td>
- </tr>
- }
- </tbody>
- </table>
- <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(_summary.TotalAppSubAmount, 2))</td>
- <img src="@Url.Content("~/Content/images/Collapse.png")" width="20" height="20" alt="Collapse" onclick="ExpandColapse(this);" style="float:right;" id="expcol" />
- @foreach (var name in providers)
- {
- string _Pname = "N/A";
- if (PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()).Count() > 0)
- {
- <tr>
- <td colspan="8" style="border: 1px solid #808080; padding: 10px; background-color:#DDDDDD;">
- <b style="text-transform: capitalize;">
- Provider Name:
- @if (!string.IsNullOrEmpty(name))
- {
- _Pname = name;
- }
- @_Pname
- </b>
- </td>
- </tr>
- <h3 class="header nodatah" onclick="ExpandColapse('expcol1');" style="cursor: pointer;">
- <table id="tblpost" cellspacing="0" class="content" style="width: 100%; display: table !important;">
- <script type="text/javascript">
- function PrintDocument(tagid) {
- $("#preprint").hide();
- $("#postofferprint").hide();
- $("#expcol").hide();
- $("#expcol1").hide();
- $("#expcol2").hide();
- $("#expcol3").hide();
- $("#expcol4").hide();
- $("#expcol5").hide();
- $("#expcol6").hide();
- $("#tblpre").show();
- $("#tblcomplete").show();
- $("#tblpost").show();
- $("#tblSummary").show();
- $("#tblToatl").show();
- $("#tblToatlproc").show();
- $("#tblpost").show();
- var oIframe = document.getElementById('ifrmPrint');
- var oContent = $('#' + tagid).html();
- var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
- if (oDoc.document) oDoc = oDoc.document;
- oDoc.write("<head><title></title>" + "</head><body style='height:297mm; width:210mm;' onload='this.focus(); this.print();'> <div> <img alt='main image' class='clientlogo' oncontextmenu='return false;' src='@Url.Content("~/Content/images/" + Convert.ToString(Session["SiteLogo"] ?? ""))'> </div> <div style='width:100%; text-align:right;'>Print Time: @System.DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss tt")</div>"
- + oContent + "<table style='background-color: #D9D9D9; clear: both; margin: 20px 0 16px;padding: 16px 16px 0;'><td>" +
- "<div style = 'float: left;'> © " + '@System.DateTime.Now.Year' +
- " OCC Finance Technology Ltd. Registered trademarks IntelliCalc®, AppTrack®. All rights reserved </div>" +
- "<td/> </table></body>");
- oDoc.close();
- $("#expcol").show();
- $("#expcol1").show();
- $("#expcol2").show();
- $("#expcol3").show();
- $("#expcol4").show();
- $("#expcol5").show();
- $("#expcol6").show();
- $("#preprint").show();
- $("#postofferprint").show();
- }
- function PrePrint(tagid) {
- var _isReportAv = '@ViewBag.advcreatedfrom';
- var url = '@Url.Action("SaveAdvisorPDF", "Apptrack")';
- window.location.href = url;
- }
- function ExpandColapse(objid) {
- var imgfile = $("#" + objid).attr("src").toString();
- if (imgfile.toString().indexOf("expand.png") != -1) {
- $("#" + objid).attr("src", '@Url.Content("~/Content/images/Collapse.png")');
- }
- else {
- $("#" + objid).attr("src", '@Url.Content("~/Content/images/expand.png")');
- }
- $("#" + objid).parent().next().slideToggle(50, function () { });
- }
- </script>
- <script type="text/javascript">
- $(function () {
- $('#iconmail').click(function () {
- $('#lblerrorSentEmail').html('');
- $('#txtToEmail').val('');
- $('#pdfDownload').html('Adviser.pdf');
- $('#hdnSendPdf').val('@Url.Action("SaveAdvisorPDF", "Apptrack")');
- $('#PdfReportDialog').modal('show');
- });
- $('#pdfDownload').click(function () {
- return PrePrint('divdocument');
- });
- });
- </script>
- @{
- int brkSiglnt = 0;
- var brkname = "";
- var brkcontact = "";
- try
- {
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- int brId = Model != null ? Model.Broker : 0;
- var brkobj = ctx.tblusers.Where(c => c.userid == brId).FirstOrDefault();
- var signature = "";
- if (brkobj != null)
- {
- brkname = brkobj.brokername;
- brkcontact = (string.IsNullOrWhiteSpace(brkobj.SecondaryContact) ? brkobj.PrimaryContact : brkobj.SecondaryContact);
- }
- brkSiglnt = signature.Length;
- }
- catch { }
- Layout = null;
- ViewBag.ContactId = Model.contactid;
- ViewBag.Email = Model.Email;
- var _maxLength = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MaxTextMsgLength"] ?? "160");
- }
- @Html.HiddenFor(model => model.AppicationType, new { @id = "applicationid" })
- @Html.TextBoxFor(model => model.Email, new { @name = "_DSemailaddress", @id = "txtemail", @class = "idleField txtField txt_field" })
- @Html.DropDownListFor(x => x.Method, (IEnumerable<SelectListItem>)ViewBag.methods, new { id = "_DSmethod", @class = "searchselect" })
- @Html.Hidden("OtherApplicantId", Convert.ToString(Model.OtherApplicant != null ? Model.OtherApplicant.OtherApplicantId : 0))
- <input type="text" value="@(Model.OtherApplicant != null ? Model.OtherApplicant.SurName : "")" id="osname" maxlength="300" class="idleField txtField capitalField txt_field">
- <img src="@Url.Content("~/Content/Layout/images/mortgagetab1.png")">
- @functions{
- public string TrimAddress(string address)
- {
- return address.Length > 30 ? address.Substring(0, 30) : address;
- }
- public string GetAddressAndLender(int financeId)
- {
- try
- {
- string result = string.Empty;
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- var product = (from con in ctx.tblcontacts
- join fin in ctx.tblfinances on con.contactid equals fin.contact
- where fin.financeid == financeId
- select new
- {
- results = fin.Address1 + ", " + fin.provider
- }).FirstOrDefault();
- return product.results;
- }
- catch
- {
- return string.Empty;
- }
- }
- public bool IsDeleted(int financeId)
- {
- bool result = false;
- try
- {
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- result = ctx.tblfinances.Where(res => res.financeid == financeId && (res.status == 34 || res.status == 35 || res.status == 36 || res.status == 37 || res.status == 38)).Count() > 0 ? true : false;
- return result;
- }
- catch
- {
- return result;
- }
- }
- }
- @helper MortgageProductDetails(int j, List<clsCaseDetails> lstCaseDetails)
- {
- <a class="csshref" onclick="GetMortgageDetails(@j, @lstCaseDetails[j].FinanceId, @lstCaseDetails[j].ContactId)">
- <div class="divMortgageLogo">
- <p>
- @TrimAddress(lstCaseDetails[j].Address) <br />
- @lstCaseDetails[j].PostCode <br />
- £@Math.Round(Convert.ToDecimal(lstCaseDetails[j].Value), 2)<span>, </span>
- @lstCaseDetails[j].Type
- </p>
- </div>
- </a>
- }
- @helper LifeProductDetails(int j, List<clsCaseDetails> lstCaseDetails)
- {
- <a class="csshref" onclick="GetLifeDetails(@j, @lstCaseDetails[j].FinanceId, @lstCaseDetails[j].ContactId)">
- <div class="divLifeLogo">
- <p>
- @TrimAddress(lstCaseDetails[j].Address) <br />
- @lstCaseDetails[j].PostCode <br />
- £@Math.Round(Convert.ToDecimal(lstCaseDetails[j].Value), 2)<br />
- @lstCaseDetails[j].Type
- </p>
- </div>
- </a>
- }
- <div id="divMortgagePropertyLogos">
- @if (Model.addproducts != null)
- {
- List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var mortgagePRDS = Model.addproducts.MortgageProduct.OrderBy(c => c.financeid).ToList();
- var lstFinanceIds = mortgagePRDS.Select(res => res.financeid).ToList();
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- lstCaseDetails = (from fin in ctx.tblfinances
- where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
- join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
- select new clsCaseDetails()
- {
- FinanceId = fin.financeid,
- ContactId = fin.contact,
- Address = ((string.IsNullOrEmpty(fin.Address1) ? string.Empty : fin.Address1) + " " + (string.IsNullOrEmpty(fin.Address2) ? string.Empty : fin.Address2) + " " + (string.IsNullOrEmpty(fin.Town) ? string.Empty : fin.Town) + " " + (string.IsNullOrEmpty(fin.County) ? string.Empty : fin.County)),
- PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
- Value = (fin.amount == null) ? 0.0M : fin.amount,
- Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
- }).ToList();
- var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
- <div class="col-md-12 mobilepaddNone">
- @for (var i = 0; i < lstCaseDetails.Count; i++)
- {
- <div class="col-md-3 col-sm-6 mobilepaddNone">
- @MortgageProductDetails(i, lstCaseDetails)
- </div>
- }
- </div>
- }
- }
- </div>
- <div class="tabs_paddedcontent select_custome">
- <div class="col-md-3 col-sm-3 dletbtn">
- @*<button class="delete button btn-blue" id="deleteMortgagebutton" onclick="DeleteLeadsMortgage();"><i class="fa fa-trash-o" aria-hidden="true"></i>Delete</button>*@
- <img onclick="DeleteLeadsMortgage();" id="deleteMortgagebutton" src="/Images/delete.png" class="delete button">
- </div>
- <div class="col-md-3 col-sm-3 viewbtnwidth">
- <div class="view_btn">
- @*<button class="back button btn-blue" id="imgbtnBackToMortgageLogos" onclick="BackToMortgageLogos();"><i class="fa fa-caret-left" aria-hidden="true"></i>View Client Portfolio</button>*@
- <img onclick="BackToMortgageLogos();" id="imgbtnBackToMortgageLogos" src="/Images/viewclientportfolio.png" class="back button">
- <a id="ToMortgageiconpdf" href="javascript:void(0);" onclick="return PDFPrint('Mortgage');" title="Generate Pdf">
- <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
- </a>
- </div>
- </div>
- <div class="col-md-5 col-sm-5">
- <select id="financemortageproductselect" data-pastvalue="" data-type="Mortgage" class="financeproductselect searchselect">
- @if (Model.addproducts != null)
- {
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var mortgagePRDS = Model.addproducts.MortgageProduct.OrderBy(c => c.financeid).ToList();
- foreach (financeID f in mortgagePRDS)
- {
- //Start:- Updated On 2-4-2014 regarding tab and product selection
- int financeId = Model.FinanceId;
- if (!IsDeleted(f.financeid))
- {
- if (financeId == f.financeid)
- {
- <option class="clsOption" value="@f.financeid" selected="selected">@f.name</option>
- }
- else
- {
- <option class="clsOption" value="@f.financeid">@f.name</option>
- }
- }
- }
- }
- }
- </select>
- </div>
- <div class="col-md-1 col-sm-1">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <input class="addmortageproduct pull-right btn-blue icon-plus" id="addmortgagebutton" value="Add" type="button">
- }
- </div>
- <div id="financeproduct0" data_objid="{656F999E-E838-4CF8-BAA5-8464B8044BA9}" class="financeproduct financeid43047">
- @Html.HiddenFor(model => model.Mortgage.mortage_financeid, new { @name = "finance-0-financeid" })
- @Html.HiddenFor(model => model.Mortgage.mortage_financetype, new { @name = "finance-0-type", @id = "mortage_status" })
- @Html.HiddenFor(model => model.Mortgage.mortage_contactid, new { @id = "mortage_contactid" })
- @Html.HiddenFor(model => model.Mortgage.mortage_AppicationType, new { @id = "mortage_applicationtype" })
- @Html.HiddenFor(model => model.Mortgage.newremortgagedate, new { @id = "newremortgagedate" })
- @Html.HiddenFor(model => model.Mortgage.remortgagecontact, new { @id = "remortgagecontact" })
- <table class="formtable">
- <tbody>
- <tr class="row">
- <td class="col-md-3 col-md-3 label test"><label>Status:</label></td>
- <td class="col-md-3 value">
- @Html.DropDownListFor(model => model.Mortgage.mortage_mortgagesubtype, (IEnumerable<SelectListItem>)ViewBag.MortgageStatusList, new { id = "mortagestatus", @name = "_DSaid", @class = "searchselect" })
- </td>
- <td class="col-md-3 label colFinanceSubstatus mort_sub_s_tatus1"><label>Sub-Status:</label></td>
- <td class="col-md-3 value colFinanceSubstatus mort_sub_s_tatus1">
- <select id="mortgage_substatus" name="mortgage_substatus">
- <option selected="selected" value="0">None</option>
- </select>
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"> <label>Lender:</label></td>
- <td class="value col-md-3">
- @Html.HiddenFor(model => model.Mortgage.mortage_lender, new { @name = "finance-0-provider", @id = "mortgage_lender", @tooltip = Model.Mortgage.mortage_lender })
- </td>
- <td class="col-md-3 label test"><label>Mortgage Acc. No:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_mortageaccountno, new { @name = "finance-0-policyreference", @class = "idleField txtField capitalField txt_field", @id = "mortgage_accno" })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Mortgage Amount: £</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_amount, new { @name = "finance-0-amount", @class = "moneyfield idleField txtField txt_field", @id = "mortgage_amount", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_commission, new { @name = "finance-0-commission", @class = "moneyfield idleField txtField txt_field proc_fee", @id = "mortgage_commission", onkeypress = "return validateDecimalOnly(event);" })
- <input id="Mortgage_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionMortgageList();" class="btn-blue">
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Rate: %</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_rate, new { @name = "finance-0-rate", @class = "moneyfield idleField txtField txt_field", @id = "mortgage_rate", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Rate Type:</label></td>
- <td class="value col-md-3">
- @Html.HiddenFor(model => model.Mortgage.RateType, new { @id = "TypeRate" })
- @{
- var fixedRates = false;
- var trackerRates = false;
- if (Model.Mortgage.RateType == 1)
- {
- fixedRates = true;
- }
- if (Model.Mortgage.RateType == 2)
- {
- trackerRates = true;
- }
- }
- <input type="radio" name="_Rate" id="RateFix" value="RateFix" onclick="ClickFix();" checked="@fixedRates"> Fixed
- <input type="radio" name="_Rate" id="RateTracker" value="RateTracker" onclick="ClickTracker();" checked="@trackerRates">
- Tracker
- </td>
- </tr>
- <!-- MORTGAGE -->
- <tr class="row">
- <td class="label col-md-3"><label>Client Fee: £</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_Clientfee, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);", @id = "mortgage_Clientfee" })
- </td>
- <td class="col-md-3 label test"><label>Monthly Payment: £</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_premium, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", @id = "mortgage_premium", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr class="row">
- <td class="label col-md-3"><label>Deposit: £</label></td>
- <td class="value col-md-3 fontsize12">
- @Html.TextBoxFor(model => model.Mortgage.mortage_deposit, new { @name = "finance-0-mor_deposit", @class = "moneyfield idleField txtField txt_field width80px deposite_e", @id = "mortgage_deposit", onkeypress = "return validateDecimalOnly(event);" })
- Income £
- @Html.TextBoxFor(model => model.Mortgage.mortage_income, new { @name = "finance-0-mor_income", @class = "idleField txtField txt_field width60px income_e", @id = "mortgage_income", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="label col-md-3"><label>Property Value: £</label></td>
- <td class="value col-md-3 fontsize12">
- @Html.TextBoxFor(model => model.Mortgage.mortage_propertyvalue, new { @name = "finance-0-mor_purchase", @class = "moneyfield idleField txtField txt_field width80px", @id = "mortgage_propertyvalue", onkeypress = "return validateDecimalOnly(event);" })
- Term
- <img src="~/Images/info-icon.png" title="Repayment term for mortgage in years">
- @Html.TextBoxFor(model => model.Mortgage.mortage_rterm, new { @name = "finance-0-mor_rterm", @class = "idleField txtField txt_field width60px", @id = "mortgage_term" })
- years
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Mortgage Type</label>:</td>
- <td class="col-md-3">
- @Html.DropDownListFor(model => model.Mortgage.mortage_reason, (IEnumerable<SelectListItem>)ViewBag.MortgageReasonList, new { @name = "finance-0-mor_mortgagesubtype", @id = "mortgage_reason", @class = "searchselect" })
- </td>
- <td class="col-md-3 label test"><label>Remortgage Date:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_remortgagedate, new { @name = "finance-0-mor_remortgagedate", @class = "jq_remortgagedate datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_remortagedate" })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Remortgage Contact:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_remortgagecontact, new { @namespace = "finance-0-mor_remortgagecontact", @class = "jq_remortgagedate datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_remortgagecontact" })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Exchange Date:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(mdoel => mdoel.Mortgage.mortage_exchanged, new { @name = "finance-0-mor_exchanged", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_exchangedate" })
- </td>
- <td class="col-md-3 label test"><label>Completion Date:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_completed, new { @name = "finance-0-mor_completed", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_completiondate" })
- </td>
- </tr>
- <tr class="row">
- <td class="label col-md-3"><label>Solicitor:</label></td>
- <td colspan="3" class="value col-md-3">
- @Html.HiddenFor(model => model.Mortgage.mortage_solicitor, new { @name = "finance-0-mor_solicitor", @id = "mortgage_solicitor", @tooltip = Model.Mortgage.mortage_solicitor })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Live:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_datelive, new { @name = "finance-0-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_datelive" })
- </td>
- <td class="col-md-3 label test"><label>Expires:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_expires, new { @name = "finance-0-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_expires" })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"><label>Follow up:</label></td>
- <td class="value col-md-3">
- @Html.DropDownListFor(model => model.Mortgage.mortage_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup", @class = "searchselect" })
- </td>
- <td colspan="2" class="col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortage_date, new { @name = "finance-0-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid mort_time", @id = "mortgage_date" })
- Time
- @Html.TextBoxFor(model => model.Mortgage.mortage_time, new { @name = "finance-0-followuptime", @class = "jq_followuptime idleField txtField txt_field width60px mortg_time2", @id = "mortgage_time" })
- </td>
- </tr>
- <tr class="row">
- <td class="col-md-3 label test"></td>
- <td class="value col-md-3"></td>
- <td colspan="2" class="col-md-3">
- <input type="button" value="Sync this action to your Outlook" id="exportall" name="exportall" class="btn-blue" />
- </td>
- </tr>
- <tr></tr>
- </tbody>
- </table>
- </div>
- </div>
- <!-- Property Address -->
- <div class="fieldset oddfieldset">
- <div class="h2head"><h2>Property Address</h2></div>
- <table class="formtable">
- <tbody>
- <tr class="row">
- <td class="label col-md-3"><label>Address 1:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_address1, new { onkeypress = "return validatePotentialError(event);", @maxlength = "25", @name = "finance-0-address1", @class = "idleField txtField capitalField txt_field", @id = "mortgage_address1" })
- </td>
- <td class="label col-md-3"><label>Address 2:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_address2, new { onkeypress = "return validatePotentialError(event);", @maxlength = "25", @name = "finance-0-address2", @class = "idleField txtField capitalField txt_field", @id = "mortgage_address2" })
- </td>
- </tr>
- <tr class="row">
- <td class="label col-md-3"><label>Town:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_town, new { onkeypress = "return validatePotentialError(event);", @maxlength = "25", @name = "finance-0-town", @class = "idleField txtField capitalField txt_field", @id = "mortgage_town" })
- </td>
- <td class="label col-md-3"><label>County:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_county, new { onkeypress = "return validatePotentialError(event);", @maxlength = "25", @name = "finance-0-county", @class = "idleField txtField capitalField txt_field", @id = "mortgage_county" })
- </td>
- </tr>
- <tr class="row">
- <td class="label col-md-3"><label>Postcode:</label></td>
- <td class="value col-md-3">
- @Html.TextBoxFor(model => model.Mortgage.mortgage_postcode, new { onkeypress = "return validatePotentialError(event);", @maxlength = "10", @name = "finance-0-postcode", @class = "idleField txtField capitalField txt_field", @id = "mortgage_postcode" })
- </td>
- <td colspan="2" class="col-md-3"> </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- Notes -->
- <div class="tabs_paddedcontent">
- <table class="formtable">
- <tbody>
- <tr class="row">
- <td class="label col-md-3"><label>Note:</label></td>
- <td class="col-md-9">
- <div class="pull-left fontsize_12">
- Send last note as:
- <input type="radio" checked="checked" name="lastnotetype" id="lastnotetypeMsg" value="1" onclick="return ValidateSMSOrMSG(1);">
- <span class="radiotxt"> Email</span>
- <input type="radio" name="lastnotetype" id="lastnotetypeSMS" value="2" onclick="return ValidateSMSOrMSG(2);"><span class="radiotxt">SMS</span>
- <input id="hdnsmsemail" type="hidden" value="1" />
- </div>
- @Html.TextAreaFor(model => model.Mortgage.mortage_notes, new { @name = "finance-0-note", @id = "mortgage_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this, event)" })
- <div class="pull-left fontsize_12">
- Allow in report
- <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
- </div>
- </td>
- </tr>
- <tr class="row">
- <td colspan="2">
- <span id="tdMSG" class="pull-right">
- [ Characters Count :
- <span class="application_9 txtcolorred" id="totalCharacters">0 </span>
- ]
- </span>
- <span id="tdSMS" class="pull-right displayNone">
- [ Characters Left :
- <span class="application_9 txtcolorred" id="totalCharactersLeft">200</span>
- ]
- </span>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- <!-- Life tab -->
- <div class="jq_tabssection" id="life_tab">
- <div id="divLifeLogos" class="divMainContainer displayNone">
- <div id="divLifePropertyLogos">
- @if (Model.addproducts != null)
- {
- List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var lifePRDS = Model.addproducts.LifeProduct.OrderBy(c => c.financeid).ToList();
- var lstFinanceIds = lifePRDS.Select(res => res.financeid).ToList();
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- lstCaseDetails = (from fin in ctx.tblfinances
- where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
- join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
- select new clsCaseDetails()
- {
- FinanceId = fin.financeid,
- ContactId = fin.contact,
- Address = ((string.IsNullOrEmpty(fin.Address1) ? string.Empty : fin.Address1) + " " + (string.IsNullOrEmpty(fin.Address2) ? string.Empty : fin.Address2) + " " + (string.IsNullOrEmpty(fin.Town) ? string.Empty : fin.Town) + " " + (string.IsNullOrEmpty(fin.County) ? string.Empty : fin.County)),
- PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
- Value = (fin.amount == null) ? 0.0M : fin.amount,
- Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
- }).ToList();
- var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
- <div class="col-md-12 mobilepaddNone">
- @for (var i = 0; i < lstCaseDetails.Count; i++)
- {
- <div class="col-md-3 col-sm-6 mobilepaddNone">
- @LifeProductDetails(i, lstCaseDetails)
- </div>
- }
- </div>
- }
- }
- </div>
- </div>
- <!-- Life Content Added on 2015-03-13-->
- <div id="divLifeContent">
- <div class="tabs_paddedcontent select_custome">
- <div class="col-md-3 col-sm-3">
- <img class="delete button" src="~/Images/delete.png" id="deleteLifebutton" onclick="DeleteLeadsLife();">
- </div>
- <div class="col-md-3 col-sm-3">
- <div class="view_btn">
- <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToLifeLogos" onclick="BackToLifeLogos();">
- <a id="lifeiconpdf" href="javascript:void(0);" onclick="return PDFPrint('portfolio');" title="Generate Pdf">
- <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
- </a>
- </div>
- </div>
- <div class="col-md-5 col-sm-5">
- <select id="LifeProductAdd" data-pastvalue="" data-type="Life" class="financeproductselect searchselect">
- @if (Model.addproducts != null)
- {
- if (Model.addproducts.LifeProduct.Count > 0)
- {
- var lifePRDS = Model.addproducts.LifeProduct.OrderBy(c => c.financeid).ToList();
- foreach (financeID f in lifePRDS)
- {
- //Start:- Updated On 2-4-2014 regarding tab and product selection
- int financeId = Model.FinanceId;
- if (financeId == f.financeid)
- {
- <option value="@f.financeid" selected="selected">@f.name</option>
- }
- else
- {
- <option value="@f.financeid">@f.name</option>
- }
- }
- }
- }
- </select>
- </div>
- <div class="col-md-1 col-sm-1">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img id="btnAddLifeProduct" class="addlifeproduct pull-right" src="~/Images/addbtn.png" cursor pointer;">
- }
- </div>
- <div id="financeproduct1" class="financeproduct financeid">
- @Html.HiddenFor(model => model.Life.life_financeid, new { @name = "finance-1-financeid", @id = "life_financeid" })
- @Html.HiddenFor(model => model.Life.life_financetype, new { @name = "finance-1-type", @id = "life_statusid" })
- @Html.HiddenFor(model => model.Life.life_contactid, new { @id = "Life_contactid" })
- @Html.HiddenFor(model => model.Life.life_AppicationType, new { @id = "Life_applicationtype" })
- <table class="formtable">
- <tbody>
- <tr>
- <td class="col-md-3 label test"><label>Status:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Life.life_status, (IEnumerable<SelectListItem>)ViewBag.LifeStatusList, new { id = "life_status" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Provider:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_provider, new { @name = "finance-1-provider", @class = "idleField txtField capitalField txt_field", @id = "life_provider" })
- </td>
- <td class="col-md-3 label test"><label>Policy Ref:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_policyref, new { @name = "finance-1-policyreference", @class = "idleField txtField capitalField txt_field", @id = "life_policyreference" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Amount: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_amount, new { @id = "life_amount", @name = "finance-1-amount", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Proc Fee:£</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_commission, new { @id = "life_commission", @name = "finance-1-commission", @class = "moneyfield idleField txtField txt_field proc_fee", onkeypress = "return validateDecimalOnly(event);" })
- <input id="life_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionLifeList();" class="btn-blue">
- </td>
- </tr>
- <!-- LIFE -->
- <tr>
- <td class="col-md-3 label test"><label>Policy Type:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Life.life_policytype, (IEnumerable<SelectListItem>)ViewBag.LifePolicyTypes, new { @name = "finance-1-subtype", @id = "life_type" })
- </td>
- <td class="col-md-3 label test"><label>Premium:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_premium, new { @id = "life_premium", @name = "finance-1-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="label col-md-3 test"><label>Height:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_height, new { @id = "life_height", @name = "finance-1-ins_height", @class = "idleField txtField txt_field" })
- </td>
- <td class="col-md-3 label test"><label>Weight:</label></td>
- <td>
- @Html.TextBoxFor(model => model.Life.life_weight, new { @id = "life_weight", @name = "finance-1-ins_weight", @class = "idleField txtField txt_field" })
- Smoker
- @Html.CheckBoxFor(model => model.Life.life_issmoker, new { @id = "life_issmoker" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Doctor:</label></td>
- <td colspan="3" class="value">
- @Html.TextBoxFor(model => model.Life.life_doctor, new { @id = "life_doctor", @name = "finance-1-ins_doctor", @class = "idleField txtField capitalField txt_field" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Medical:</label></td>
- <td colspan="3" class="block_td">
- @Html.TextAreaFor(model => model.Life.life_medical, new { @id = "life_medical", @name = "finance-1-details", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Date Live:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_datelive, new { @name = "finance-1-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "life_datelive" })
- </td>
- <td class="col-md-3 label test"><label>Expires:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Life.life_expires, new { @name = "finance-1-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "life_dateexpires" })
- </td>
- </tr>
- <tr>
- <tr>
- <td class="col-md-3 label test"><label>Follow up:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Life.life_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
- </td>
- <td colspan="2">
- @Html.TextBoxFor(model => model.Life.life_date, new { @name = "finance-1-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field mortga_time", @id = "life_followupdate" })
- Time
- @Html.TextBoxFor(model => model.Life.life_time, new { @name = "finance-1-followuptime", @class = "jq_followuptime idleField txtField txt_field width60px mortg_time2", @id = "life_followuptime" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"></td>
- <td class="value"></td>
- <td colspan="2">
- <input type="button" value="Sync this action to your Outlook" id="exportallLife" name="exportallLife" class="btn-blue" />
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Client Fee: £</label></td>
- <td colspan="1" class="block_td">
- @Html.TextBoxFor(model => model.Life.life_Clientfee, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);", @id = "life_Clientfee" })
- </td>
- <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Life.life_isPolicyForOtherApplicant, new { @id = "life_isPolicyForOtherApplicant" })</td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Note:</label></td>
- <td colspan="3" class="block_td">
- @Html.TextAreaFor(model => model.Life.life_notes, new { @name = "finance-1-note", @id = "life_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- <div class="pull-left fontsize_12">
- Allow in report
- <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <!-- Building/Contents Tab -->
- <div class="jq_tabssection" id="insurance_tab">
- <div id="divBuildingLogos" class="divMainContainer displayNone">
- <div id="divBuildingPropertyLogos">
- @if (Model.addproducts != null)
- {
- List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var buildingPRDS = Model.addproducts.BuildingContentProduct.OrderBy(c => c.financeid).ToList();
- var lstFinanceIds = buildingPRDS.Select(res => res.financeid).ToList();
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- lstCaseDetails = (from fin in ctx.tblfinances
- where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
- join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
- select new clsCaseDetails()
- {
- FinanceId = fin.financeid,
- ContactId = fin.contact,
- Address = ((string.IsNullOrEmpty(fin.Address1) ? string.Empty : fin.Address1) + " " + (string.IsNullOrEmpty(fin.Address2) ? string.Empty : fin.Address2) + " " + (string.IsNullOrEmpty(fin.Town) ? string.Empty : fin.Town) + " " + (string.IsNullOrEmpty(fin.County) ? string.Empty : fin.County)),
- PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
- Value = (fin.amount == null) ? 0.0M : fin.amount,
- Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
- }).ToList();
- var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
- <div class="col-md-12 mobilepaddNone">
- @for (var i = 0; i < lstCaseDetails.Count; i++)
- {
- <div class="col-md-3 col-sm-6 mobilepaddNone">
- @BuildingProductDetails(i, lstCaseDetails)
- </div>
- }
- </div>
- }
- }
- </div>
- </div>
- <!-- Building Content Added on 2015-03-13-->
- <div id="divBuildingContent">
- <div class="tabs_paddedcontent select_custome">
- <div class="col-md-3 col-sm-3">
- <img class="delete button" src="~/Images/delete.png" id="deleteBuildingbutton" onclick="DeleteLeadsBuilding();">
- </div>
- <div class="col-md-3 col-sm-3">
- <div class="view_btn">
- <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToBuildingLogos" onclick="BackToBuildingLogos();">
- <a id="bildingiconpdf" href="javascript:void(0);" onclick="return PDFPrint('Building');" title="Generate Pdf">
- <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
- </a>
- </div>
- </div>
- <div class="col-md-5 col-sm-5">
- <select id="BuildingContentProductAdd" data-pastvalue="" data-type="Buildings / Contents" class="financeproductselect searchselect">
- @if (Model.addproducts != null)
- {
- if (Model.addproducts.BuildingContentProduct.Count > 0)
- {
- var buildprds = Model.addproducts.BuildingContentProduct.OrderBy(c => c.financeid).ToList();
- foreach (financeID f in buildprds)
- {
- //Start:- Updated On 2-4-2014 regarding tab and product selection
- int financeId = Model.FinanceId;
- if (financeId == f.financeid)
- {
- <option value="@f.financeid" selected="selected">@f.name</option>
- }
- else
- {
- <option value="@f.financeid">@f.name</option>
- }
- }
- }
- }
- </select>
- </div>
- <div class="col-md-1 col-sm-1">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img id="btnBuildingContentAdd" class="addbuildingproduct pull-right" src="~/Images/addbtn.png" cursor pointer;">
- }
- </div>
- <div id="financeproduct2" data_objid="" class="financeproduct financeid">
- @Html.HiddenFor(model => model.BuildingContent.buildingcontent_financeid, new { @name = "finance-2-financeid", @id = "buildingcontent_financeid" })
- @Html.HiddenFor(model => model.BuildingContent.buildingcontent_financetype, new { @name = "finance-2-type", @id = "building_status" })
- @Html.HiddenFor(model => model.BuildingContent.buildingContent_contactid, new { @id = "BuildingContent_contactid" })
- @Html.HiddenFor(model => model.BuildingContent.buildingContent_AppicationType, new { @id = "BuildingContent_applicationtype" })
- <table class="formtable">
- <tbody>
- <tr>
- <td class="col-md-3 label test"><label>Status:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.BuildingContent.buildingcontent_status, (IEnumerable<SelectListItem>)ViewBag.BuildingOrContentList, new { id = "_DSBuildingOrContentStaus" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Provider:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_provider, new { @id = "buildingcontent_provider", @name = "finance-2-provider", @class = "idleField txtField capitalField txt_field" })
- </td>
- <td class="col-md-3 label test"><label>Policy Ref:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_policyref, new { @id = "buildingcontent_policyref", @name = "finance-2-policyreference", @class = "idleField txtField capitalField txt_field" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Amount: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_amount, new { @id = "buildingcontent_amount", @name = "finance-2-amount", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_commission, new { @id = "buildingcontent_commission", @name = "finance-2-commission", @class = "moneyfield idleField txtField txt_field proc_fee", onkeypress = "return validateDecimalOnly(event);" })
- <input id="BuildingContent_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionBuildingList();" class="btn-blue">
- </td>
- </tr>
- <!-- BUILD/CON -->
- <tr>
- <td class="col-md-3 label test"><label>Type:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.BuildingContent.buildingcontent_type, (IEnumerable<SelectListItem>)ViewBag.FinanceSubtypeList, new { @id = "buildingcontent_type", @name = "finance-2-subtype" })
- </td>
- <td class="col-md-3 label test"><label>Premium:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_premium, new { @id = "buildingcontent_premium", @name = "finance-2-premium", @class = "moneyfield idleField txtField", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Rebuild Value:</label></td>
- <td colspan="3" class="value" class="block_td">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_rebuildvalue, new { @id = "buildingcontent_rebuildvalue", @name = "finance-2-bui_rebuild", @class = "moneyfield idleField txtField", onkeypress = "return validateDecimalOnly(event);" })
- Alarmed
- @Html.CheckBoxFor(model => model.BuildingContent.buildingcontent_isalarmed, new { @id = "buildingcontent_isalarmed", @name = "finance-2-bui_alarm" })
- </td>
- </tr>
- <tr>
- <td style="vertical-align: top" class="col-md-3 label test"><label>Add.Cover:</label></td>
- <td colspan="3">
- @Html.TextAreaFor(model => model.BuildingContent.buildingcontent_addcover, new { @id = "buildingcontent_addcover", @name = "finance-2-details", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Date Live:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_datelive, new { @id = "buildingcontent_datelive", @name = "finance-2-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field" })
- </td>
- <td class="col-md-3 label test"><label>Expires:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_expires, new { @name = "finance-2-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "buildingcontent_expires" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Follow up:</label></td>
- <td class="value">
- @Html.DropDownListFor(mortage => mortage.BuildingContent.buildingcontent_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-2-addfollowup" })
- </td>
- <td colspan="2">
- @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_date, new { @name = "finance-2-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "buildingcontent_date" })
- Time
- @Html.TextBoxFor(mdoel => Model.BuildingContent.buildingcontent_time, new { @id = "buildingcontent_time", @name = "finance-2-followuptime", @class = "jq_followuptime idleField txtField txt_field width60px mortg_time2" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"></td>
- <td class="value"></td>
- <td colspan="2">
- <input type="button" value="Sync this action to your Outlook" id="exportallBuilding" name="exportallBuilding" class="btn-blue" />
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Client Fee: £</label></td>
- <td colspan="1" class="block_td">
- @Html.TextBoxFor(model => model.BuildingContent.building_Clientfee, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);", @id = "building_Clientfee" })
- </td>
- <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.BuildingContent.buildingcontent_isPolicyForOtherApplicant, new { @id = "buildingcontent_isPolicyForOtherApplicant" })</td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Note:</label></td>
- <td colspan="3" class="block_td">
- @Html.TextAreaFor(model => model.BuildingContent.buildingcontent_notes, new { @name = "finance-2-note", @id = "building_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- <div class="pull-left fontsize_12">
- Allow in report
- <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <!-- Pension tab -->
- <div class="jq_tabssection" id="pensions_tab">
- <!-- Pension Logo Added on 2015-03-13 -->
- <div id="divPensionLogos" class="divMainContainer displayNone">
- <div id="divPensionPropertyLogos">
- @if (Model.addproducts != null)
- {
- List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var pensionPRDS = Model.addproducts.PensionProduct.OrderBy(c => c.financeid).ToList();
- var lstFinanceIds = pensionPRDS.Select(res => res.financeid).ToList();
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- lstCaseDetails = (from fin in ctx.tblfinances
- where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
- join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
- select new clsCaseDetails()
- {
- FinanceId = fin.financeid,
- ContactId = fin.contact,
- Address = ((string.IsNullOrEmpty(fin.Address1) ? string.Empty : fin.Address1) + " " + (string.IsNullOrEmpty(fin.Address2) ? string.Empty : fin.Address2) + " " + (string.IsNullOrEmpty(fin.Town) ? string.Empty : fin.Town) + " " + (string.IsNullOrEmpty(fin.County) ? string.Empty : fin.County)),
- PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
- Value = (fin.amount == null) ? 0.0M : fin.amount,
- Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
- }).ToList();
- var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
- <div class="col-md-12 mobilepaddNone">
- @for (var i = 0; i < lstCaseDetails.Count; i++)
- {
- <div class="col-md-3 col-sm-6 mobilepaddNone">
- @PensionProductDetails(i, lstCaseDetails)
- </div>
- }
- </div>
- }
- }
- </div>
- </div>
- <div id="divPensionContent">
- <div class="tabs_paddedcontent select_custome">
- <div class="col-md-3 col-sm-3">
- <img class="delete button" src="~/Images/delete.png" id="deletePensionbutton" onclick="DeleteLeadsPension();">
- </div>
- <div class="col-md-3 col-sm-3">
- <div class="view_btn">
- <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToPensionLogos" onclick="BackToPensionLogos();">
- <a id="pensioniconpdf" href="javascript:void(0);" onclick="return PDFPrint('Pension');" title="Generate Pdf">
- <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
- </a>
- </div>
- </div>
- <div class="col-md-5 col-sm-5">
- <select id="PensionProductAdd" data-pastvalue="" data-type="Pension" class="financeproductselect searchselect">
- @if (Model.addproducts != null)
- {
- if (Model.addproducts.PensionProduct.Count > 0)
- {
- var oenprds = Model.addproducts.PensionProduct.OrderBy(c => c.financeid).ToList();
- foreach (financeID f in oenprds)
- {
- //Start:- Updated On 2-4-2014 regarding tab and product selection
- int financeId = Model.FinanceId;
- if (financeId == f.financeid)
- {
- <option value="@f.financeid" selected="selected">@f.name</option>
- }
- else
- {
- <option value="@f.financeid">@f.name</option>
- }
- }
- }
- }
- </select>
- </div>
- <div class="col-md-1 col-sm-1">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img id="btnPensionProductAdd" class="addpensionproduct pull-right" src="~/Images/addbtn.png">
- }
- </div>
- <div id="financeproduct3" data_objid="" class="financeproduct financeid">
- @Html.HiddenFor(model => model.Pension.pension_financeid, new { @id = "pensoion_financeid", name = "finance-3-financeid" })
- @Html.HiddenFor(model => model.Pension.pension_financetype, new { @name = "finance-3-type", @id = "pension_status" })
- @Html.HiddenFor(model => model.Pension.pension_contactid, new { @id = "pension_contactid" })
- @Html.HiddenFor(model => model.Pension.pension_AppicationType, new { @id = "pension_AppicationType" })
- <table class="formtable">
- <tbody>
- <tr>
- <td class="col-md-3 label test"><label>Status:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Pension.pension_status, (IEnumerable<SelectListItem>)ViewBag.PensionStatusList, new { id = "_DSPensionStatus" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Provider:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_provider, new { @id = "pension_provider", @name = "finance-3-provider", @class = "idleField txtField capitalField txt_field" })
- </td>
- <td class="col-md-3 label test"><label>Policy Ref:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_policyref, new { @id = "pension_policyref", @name = "finance-3-policyreference", @class = "idleField txtField capitalField txt_field" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Amount: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_amount, new { @id = "pension_amount", @name = "finance-3-amount", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_commission, new { @id = "pension_commission", @name = "finance-3-commission", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- <input id="Pension_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionPensionList();" class="btn-blue">
- </td>
- </tr>
- <!-- Pension -->
- <tr>
- <td class="col-md-3 label test"><label>Risk Profile of Applicant:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Pension.pension_riskprofile, (IEnumerable<SelectListItem>)ViewBag.PensionRiskProfileList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "pension_riskprofile" })
- </td>
- <td class="col-md-3 label test"><label>Contributions:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_contributors, new { @id = "pension_contributors", @name = "finance-3-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Fund Value:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_fundvalue, new { @id = "pension_fundvalue", @name = "finance-3-fundvalue", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Income Req. on Retirement:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_incomereq, new { @id = "pension_incomereq", @name = "finance-3-pen_incomereq", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Date Live:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_datelive, new { @name = "finance-3-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "pension_datelive" })
- </td>
- <td class="col-md-3 label test"><label>Expires:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Pension.pension_expires, new { @name = "finance-3-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "pension_expires" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Follow up:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Pension.pension_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
- </td>
- <td colspan="2">
- @Html.TextBoxFor(model => model.Pension.pension_date, new { @name = "finance-3-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "pension_date" })
- Time
- @Html.TextBoxFor(model => model.Pension.pension_time, new { @id = "pension_time", @name = "finance-3-followuptime", @class = "jq_followuptime idleField txtField txt_field full-width" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"></td>
- <td class="value"></td>
- <td colspan="2">
- <input type="button" value="Sync this action to your Outlook" id="exportallPension" name="exportallPension" class="btn-blue" />
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Client Fee: £</label></td>
- <td colspan="1" class="block_td">
- @Html.TextBoxFor(model => model.Pension.pension_Clientfee, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);", @id = "pension_Clientfee" })
- </td>
- <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Pension.pension_isPolicyForOtherApplicant, new { @id = "pension_isPolicyForOtherApplicant" })</td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Note:</label></td>
- <td colspan="3" class="block_td">
- @Html.TextAreaFor(model => model.Pension.pension_notes, new { @name = "finance-3-note", @id = "pension_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- <div class="pull-left fontsize_12">
- Allow in report
- <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <!-- Investment tab -->
- <div class="jq_tabssection" id="investments_tab">
- <div id="divInvestmentLogos" class="divMainContainer displayNone">
- <div id="divInvestmentPropertyLogos">
- @if (Model.addproducts != null)
- {
- List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
- if (Model.addproducts.MortgageProduct.Count > 0)
- {
- var investmentPRDS = Model.addproducts.InvestmentProduct.OrderBy(c => c.financeid).ToList();
- var lstFinanceIds = investmentPRDS.Select(res => res.financeid).ToList();
- Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
- lstCaseDetails = (from fin in ctx.tblfinances
- where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
- join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
- select new clsCaseDetails()
- {
- FinanceId = fin.financeid,
- ContactId = fin.contact,
- Address = ((string.IsNullOrEmpty(fin.Address1) ? string.Empty : fin.Address1) + " " + (string.IsNullOrEmpty(fin.Address2) ? string.Empty : fin.Address2) + " " + (string.IsNullOrEmpty(fin.Town) ? string.Empty : fin.Town) + " " + (string.IsNullOrEmpty(fin.County) ? string.Empty : fin.County)),
- PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
- Value = (fin.amount == null) ? 0.0M : fin.amount,
- Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
- }).ToList();
- var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
- <div class="col-md-12 mobilepaddNone">
- @for (var i = 0; i < lstCaseDetails.Count; i++)
- {
- <div class="col-md-3 col-sm-6 mobilepaddNone">
- @LifeProductDetails(i, lstCaseDetails)
- </div>
- }
- </div>
- }
- }
- </div>
- </div>
- <div id="divInvestmentContent">
- <div class="tabs_paddedcontent select_custome">
- <div class="col-md-3 col-sm-3">
- <img class="delete button" src="~/Images/delete.png" id="deleteInvestmentbutton" onclick="DeleteLeadsInvestment();">
- </div>
- <div class="col-md-3 col-sm-3">
- <div class="view_btn">
- <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToInvestmentLogos" onclick="BackToInvestmentLogos();">
- <a id="Investmenticonpdf" href="javascript:void(0);" onclick="return PDFPrint('Investment');" title="Generate Pdf">
- <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
- </a>
- </div>
- </div>
- <div class="col-md-5 col-sm-5">
- <select id="InvestmentProductAdd" data-pastvalue="" data-type="Investment" class="financeproductselect searchselect">
- @if (Model.addproducts != null)
- {
- if (Model.addproducts.InvestmentProduct.Count > 0)
- {
- var invds = Model.addproducts.InvestmentProduct.OrderBy(c => c.financeid).ToList();
- foreach (financeID f in invds)
- {
- //Start:- Updated On 2-4-2014 regarding tab and product selection
- int financeId = Model.FinanceId;
- if (financeId == f.financeid)
- {
- <option value="@f.financeid" selected="selected">@f.name</option>
- }
- else
- {
- <option value="@f.financeid">@f.name</option>
- }
- }
- }
- }
- </select>
- </div>
- <div class="col-md-1 col-sm-1">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img id="btnInvestmentProductAdd" class="addinvestmentproduct pull-right" src="~/Images/addbtn.png">
- }
- </div>
- <div id="financeproduct4" data_objid="" class="financeproduct financeid">
- @Html.HiddenFor(model => model.Investment.investment_financeid, new { @id = "investment_financeid", name = "finance-4-financeid" })
- @Html.HiddenFor(model => model.Investment.investment_financetype, new { @name = "finance-4-type", @id = "investment_status" })
- @Html.HiddenFor(model => model.Investment.investment_contactid, new { @id = "investment_contactid" })
- @Html.HiddenFor(model => model.Investment.investment_AppicationType, new { @id = "investment_AppicationType" })
- <table class="formtable">
- <tbody>
- <tr>
- <td class="col-md-3 label test"><label>Status:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Investment.investment_status, (IEnumerable<SelectListItem>)ViewBag.InvestmentStatusList, new { id = "_DSInvestmentStatus" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Provider:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_provider, new { @id = "investment_provider", @name = "finance-4-provider", @class = "idleField txtField capitalField txt_field" })
- </td>
- <td class="col-md-3 label test"><label>Policy Ref:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_policyref, new { @id = "investment_policyref", @name = "finance-4-policyreference", @class = "idleField txtField capitalField txt_field" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Amount: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_amount, new { @id = "investment_amount", @name = "finance-4-amount", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_commission, new { @id = "investment_commission", @name = "finance-4-commission", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- <input id="Investment_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionInvestmentsList();" class="btn-blue">
- </td>
- </tr>
- <!-- Investments -->
- <tr>
- <td class="col-md-3 label test"><label>Risk Profile of Applicant:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Investment.investment_riskprofiles, (IEnumerable<SelectListItem>)ViewBag.PensionRiskProfileList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "investment_riskprofiles" })
- </td>
- <td class="col-md-3 label test"><label>Contributions:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_contributors, new { @id = "investment_contributors", @name = "finance-4-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Fund Value:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_fundvalue, new { @id = "investment_fundvalue", @name = "finance-4-fundvalue", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Date Live:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_datelive, new { @name = "finance-4-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "investment_datelive" })
- </td>
- <td class="col-md-3 label test"><label>Expires:</label></td>
- <td class="value">
- @Html.TextBoxFor(model => model.Investment.investment_expires, new { @name = "finance-4-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid", @id = "investment_expires" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Follow up:</label></td>
- <td class="value">
- @Html.DropDownListFor(model => model.Investment.investment_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
- </td>
- <td colspan="2">
- @Html.TextBoxFor(model => model.Investment.investment_date, new { @name = "finance-4-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "investment_date" })
- Time
- @Html.TextBoxFor(model => model.Investment.investment_time, new { @id = "investment_time", @name = "finance-4-followuptime", @class = "jq_followuptime idleField txtField txt_field width60px" })
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"></td>
- <td class="value"></td>
- <td colspan="2">
- <input type="button" value="Sync this action to your Outlook" id="exportallInvestment" name="exportallInvestment" class="btn-blue" />
- </td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Client Fee: £</label></td>
- <td colspan="1" class="block_td">
- @Html.TextBoxFor(model => model.Investment.investment_Clientfee, new { @name = "finance-0-premium", @class = "moneyfield idleField txtField txt_field", onkeypress = "return validateDecimalOnly(event);", @id = "investment_Clientfee" })
- </td>
- <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Investment.investment_isPolicyForOtherApplicant, new { @id = "investment_isPolicyForOtherApplicant" })</td>
- </tr>
- <tr>
- <td class="col-md-3 label test"><label>Note:</label></td>
- <td colspan="3" class="block_td">
- @Html.TextAreaFor(model => model.Investment.investment_notes, new { @name = "finance-4-note", @id = "investment_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
- <div class="pull-left fontsize_12">
- Allow in report
- <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
- </div>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
- </div>
- </div>
- <input type="hidden" id="hdnbrkname" value="@brkname" />
- <script type="text/javascript">
- function ShowPAssword() {
- $("#btnPassword").hide();
- $("#input_password").val($("#hdnFactFindPassword").val());
- $("#input_password").show();
- };
- function CountCharactersForNote(maxLength, obj) {
- var signature = "";
- signature = "Hi " + $("#txtfirstname").val() + "," + '\r\n\r\n' + $("#hdnbrkname").val() + '\r\n' + "Please reply to " + $("#hdnbrkcontact").val();
- lengthVar = signature.length;
- var _maxLength = maxLength - lengthVar;
- var _usedChars = $("#mortgage_note").val().length;
- if (parseInt(_usedChars) >= parseInt(_maxLength)) {
- $("#totalCharactersLeft").text('0');
- $("#mortgage_note").val($("#mortgage_note").val().substring(0, parseInt(_maxLength) - 1));
- return false;
- }
- else {
- $("#totalCharactersLeft").text(parseInt(_maxLength) - parseInt(_usedChars));
- }
- }
- function ValidateSMSOrMSG(typeval) {
- var signature = "";
- signature = "Hi " + $("#txtfirstname").val() + "," + '\r\n\r\n' + $("#hdnbrkname").val() + '\r\n' + "Please reply to " + $("#hdnbrkcontact").val();
- lengthVar = signature.length;
- var _maxLength = 0;
- _maxLength = parseInt('@_maxLength') - lengthVar;
- $("#hdnsmsemail").val(typeval);
- if (typeval == 2) {
- if ($("#mortgage_note").val().length >= _maxLength) {
- $("#mortgage_note").val($("#mortgage_note").val().substring(0, _maxLength - 1));
- }
- var _totalleft = _maxLength - $("#mortgage_note").val().length;
- if (_totalleft < 0)
- _totalleft = 0;
- $("#totalCharactersLeft").text(_totalleft);
- $("#tdSMS").show();
- $("#tdMSG").hide();
- $("#mortgage_note").attr("oninput", 'return CountCharactersForNote(' + @_maxLength + ', this);');
- }
- else {
- var _totalleft = _maxLength - $("#mortgage_note").val().length;
- if (_totalleft < 0)
- _totalleft = 0;
- $("#tdSMS").hide();
- $("#tdMSG").show();
- $("#totalCharactersLeft").text(_totalleft);
- $("#mortgage_note").removeAttr("oninput");
- }
- $("#totalCharacters").text($("#mortgage_note").val().length);
- }
- //////// auto emails
- function ResetFormAutoEmails() {
- $("#drpAutoEmailtemplate").html("<option value='0'></option>");
- $("#lblalertAutoEmail").text('');
- $('#txtAutoEmailSubject').val('');
- var editor = CKEDITOR.instances.txtAutoEmailBody;
- editor.setData('');
- }
- function PrevAutoEmailTemp() {
- var w = window.open("", "popup", "width=900,height=750,scrollbars=yes,resizable=yes," + "toolbar=no,directories=no,location=no,menubar=no,status=no,left=170,top=100");
- if (!w || w.closed || typeof w.closed == 'undefined') {
- $("#overlaycontainer").hide();
- alert('The pop up is blocked in your browser, please allow pop up to view the preview.');
- }
- var editor = CKEDITOR.instances.txtAutoEmailBody;
- $(w.document.body).html(editor.getData());
- $("#overlaycontainer").hide();
- }
- function PostAjaxTemplateCall(selStatusId, level) {
- ResetFormAutoEmails();
- $("#divAutoEmails").modal('show');
- var adviser = $("#_DSbrokerrefAccountForm option:selected").text().substring(0, $("#_DSbrokerrefAccountForm option:selected").text().indexOf("("));
- var adviserId = $("#_DSbrokerrefAccountForm").val();
- var email = $('#txtemail').val();
- var address = ($('#mortgage_address1').val() != "") ? $('#mortgage_address1').val() + ", " : "";
- address += ($('#mortgage_address2').val() != "") ? $('#mortgage_address2').val() + ", " : "";
- address += ($('#mortgage_town').val() != "") ? $('#mortgage_town').val() + ", " : "";
- address += ($('#mortgage_county').val() != "") ? $('#mortgage_county').val() + ", " : "";
- address += ($('#mortgage_postcode').val() != "") ? $('#mortgage_postcode').val() + "," : "";
- $.ajax({
- url: "../AppTrack/GetAutoEmailTemplate",
- cache: false,
- type: "POST",
- data: "{'statusId':" + selStatusId + ",'level':" + level + ",'fname':'" + $("#txtfirstname").val() +
- "','mortgage_amount':'" + $('#mortgage_amount').val() + "','mortgage_propertyvalue':'"
- + $('#mortgage_propertyvalue').val() + "','mortgage_propertyaddress':"
- + JSON.stringify(address)
- + ",'adviser':'" + adviser + "','email':'" + email + "','adviserId':" + adviserId + "}",
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- beforeSend: function () {
- $("#overlaycontainer").show();
- },
- success: function (result) {
- setAutoEmailContent(result, selStatusId, level);
- }
- });
- }
- //////// auto emails
- function setAutoEmailContent(result, selStatusId, level) {
- var opts = '<OPTION VALUE="' + result.tempId + '">' + result.tempName + '</OPTION>';
- $("#drpAutoEmailtemplate").html(opts);
- // Get the editor instance that we want to interact with.
- var editor = CKEDITOR.instances.txtAutoEmailBody;
- editor.setData(result.data);
- var subject = '';
- if (level == 0 && selStatusId == 6) {
- subject = 'Application Submitted';
- }
- else if (level == 0 && selStatusId == 7) {
- subject = 'Offer Issued';
- }
- else if (level == 0 && selStatusId == 8) {
- subject = 'Application Completed';
- }
- else if (level == 0 && selStatusId == 2) {
- subject = 'Time To Remortgage';
- }
- else if (level == 1 && selStatusId == 1) {
- subject = 'Valuation Instructed';
- }
- else if (level == 1 && selStatusId == 2) {
- subject = 'Valuation Received';
- }
- else if (level == 1 && selStatusId == 3) {
- subject = 'Exchange of Contracts';
- }
- else if (level == 0 && selStatusId == 13) {
- subject = 'Application Submitted';
- }
- else if (level == 0 && selStatusId == 14) {
- subject = 'Application Completed';
- }
- $('#txtAutoEmailSubject').val(subject);
- $("#overlaycontainer").hide();
- }
- function RedirectToFactFind(contactId) {
- var _Url = '@Url.Action("RedirectToFactfindPage", "Apptrack")';
- $.ajax({
- type: "Get",
- url: _Url,
- data: { contactid: contactId },
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false,
- error: function (error) {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- },
- success: function (data) {
- if (data.length > 0 && data != '0' && data != null) {
- // window.location.href = data;
- window.open(data, '_blank');
- }
- else {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- }
- }
- });
- }
- function SendFactFind(contactId) {
- var _Url = '@Url.Action("SendFactfindLink", "Apptrack")';
- $.ajax({
- type: "Get",
- url: _Url,
- data: { contactid: contactId },
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false,
- error: function (error) {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- },
- success: function (data) {
- if (parseInt(data) == 1) {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Green").html('Requested token has been sent successfully.');
- $("#Message_Box_Dialog").modal('show');
- }
- else {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- }
- }
- });
- }
- function GenerateFactfind(contactId) {
- var _Url = '@Url.Action("GenerateFactfind", "Apptrack")';
- $.ajax({
- type: "Get",
- url: _Url,
- data: { contactid: contactId },
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- async: false,
- error: function (error) {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- },
- success: function (username) {
- if (username.username != null) {
- var target = $("#divFactFindArea");
- target.empty();
- var detail = "";
- var path = '#';
- var user = username.username;
- var password = username.password;
- detail += "<div>"
- detail += "<div class='col-md-6 heading pull-left'>"
- detail += "<label>"
- detail += "<a id='linkfactfind' href='" + path + "' target='_blank'>Goto FactFind</a>"
- detail += "</label>"
- detail += "</div>"
- detail += "<div class='col-md-6 heading pull-left'>"
- detail += "<label>"
- detail += "<a id='linksendfactfind' href='javascript:void(null)' onclick='SendFactFind(@Model.contactid)'>Request Token</a>"
- detail += "</label>"
- detail += "</div>"
- detail += "</div><div class='col-md-6'><div class='row'><div class='col-md-4'><label>User Name</label></div>"
- detail += "<div class='col-md-8'>"
- detail += "<input type='text' readonly value='" + user + "' maxlength='300' class='idleField txtField capitalField txt_field'>"
- detail += "</div></div></div><div class='col-md-6'><div class='row'>"
- detail += "<div class='col-md-4'><label>Password</label></div>"
- detail += "<div class='col-md-8'>"
- detail += "<input type='button' id='btnPassword' onclick='ShowPAssword()' value='Show Password' class='btn-blue' />"
- detail += "<input id='input_password' type='text' readonly style='display:none' maxlength='300' class='idleField txtField capitalField txt_field'>"
- detail += "<input type='hidden' id='hdnFactFindPassword' value='" + password + "' />"
- detail += "</div></div></div>"
- $("#divFactFindArea").append(detail).show('slow');
- $('a#linkfactfind').mousedown(function (event) {
- var cId = $("#hdn_Contt_id_f").val();
- RedirectToFactFind(cId);
- });
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Green").html('Token has been generated successfully.');
- $("#Message_Box_Dialog").modal('show');
- }
- else {
- $("#Message_Box_Dialog #lbl_message_Green").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('');
- $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
- $("#Message_Box_Dialog").modal('show');
- }
- }
- });
- }
- $(document).ready(function () {
- $(".mort_sub_s_tatus1").hide();
- //$("#mortgage_substatus").val();
- $("#life_status").change(function () {
- selStatusId = $("#life_status option:selected").val();
- if (selStatusId == 13 || selStatusId == 14) {
- PostAjaxTemplateCall(selStatusId, 0);
- }
- });
- $("#mortgage_substatus").change(function () {
- selStatusId = $("#mortgage_substatus option:selected").val();
- if (selStatusId == 1 || selStatusId == 2 || selStatusId == 3) {
- PostAjaxTemplateCall(selStatusId, 1);
- }
- });
- $("#mortagestatus").change(function () {
- selStatusId = $("#mortagestatus option:selected").val();
- if (selStatusId == 6 || selStatusId == 7 || selStatusId == 8 || selStatusId == 2) {
- PostAjaxTemplateCall(selStatusId, 0);
- }
- BindFinanceSubstatus($("#mortagestatus option:selected").val());
- });
- //$('#_DSleadRef').chosen();
- $('#expand').hide();
- $('#directLead').click(function () {
- $('#expand').toggle();
- });
- //
- var SinglValueURL = '@Url.Action("GetContactsValue", "Reports")';
- var attendeeUrl = '@Url.Action("GetSelect2Contact", "Reports")';
- var pageSize = 20;
- var lastResults = [];
- $('#_DSleadRef').select2({
- placeholder: 'Any',
- //Does the user have to enter any data before sending the ajax request
- minimumInputLength: 0,
- allowClear: true,
- ajax: {
- multiple: true,
- quietMillis: 150,
- url: attendeeUrl,
- dataType: 'jsonp',
- //Our search term and what page we are on
- data: function (term, page) {
- return {
- datatype: (term = '' || term.length <= 0) ? parseInt(10) : parseInt(1),
- pageSize: pageSize,
- pageNum: page,
- allowClear: true,
- searchTerm: $('.select2-drop').find('input.select2-active').val()
- };
- },
- results: function (data, page) {
- lastResults = data.Results;
- var more = (page * pageSize) < data.Total;
- return { results: data.Results, more: more };
- }
- }, createSearchChoice: function (term) {
- var text = $('.select2-drop').find('input.select2-active').val();
- return { id: term, text: text };
- }, initSelection: function (element, callback) {
- var elementText = $(element).attr('tooltip');
- $.ajax(SinglValueURL, {
- data: {
- searchTerm: elementText
- },
- dataType: "json"
- }).done(function (data) {
- callback(data.Results[0])
- });
- }
- });
- //
- var SinglValueURL = '@Url.Action("GetProviderSolicitorValue", "AppTrack")';
- var attendeeUrl = '@Url.Action("GetProviderOrSoliciterDemo", "AppTrack")';
- var pageSize = 20;
- var financetype = $("#financetype option:selected").val();
- var lastResults = [];
- $('#mortgage_lender').select2({
- placeholder: 'Any',
- //Does the user have to enter any data before sending the ajax request
- minimumInputLength: 0,
- allowClear: true,
- ajax: {
- multiple: true,
- quietMillis: 150,
- url: attendeeUrl,
- dataType: 'jsonp',
- //Our search term and what page we are on
- data: function (term, page) {
- return {
- pageSize: pageSize,
- pageNum: page,
- allowClear: true,
- searchTerm: $('.select2-drop').find('input.select2-active').val()
- };
- },
- results: function (data, page) {
- lastResults = data.Results;
- var more = (page * pageSize) < data.Total;
- return { results: data.Results, more: more };
- }
- }, createSearchChoice: function (term) {
- var text = $('.select2-drop').find('input.select2-active').val();
- return { id: term, text: text };
- }, initSelection: function (element, callback) {
- var elementText = $(element).attr('tooltip');
- $.ajax(SinglValueURL, {
- data: {
- searchTerm: elementText
- },
- dataType: "json"
- }).done(function (data) {
- callback(data.Results[0])
- });
- }
- });
- var SinglValueURL = $("#SinglValueURL").val();
- $('#mortgage_solicitor').select2({
- placeholder: 'Any',
- //Does the user have to enter any data before sending the ajax request
- minimumInputLength: 0,
- allowClear: true,
- ajax: {
- multiple: true,
- quietMillis: 150,
- url: attendeeUrl,
- dataType: 'jsonp',
- //Our search term and what page we are on
- data: function (term, page) {
- return {
- datatype: (term = '' || term.length <= 0) ? parseInt(20) : parseInt(2),
- financetype: financetype,
- pageSize: pageSize,
- pageNum: page,
- allowClear: true,
- searchTerm: $('.select2-drop').find('input.select2-active').val()
- };
- },
- results: function (data, page) {
- lastResults = data.Results;
- var more = (page * pageSize) < data.Total;
- return { results: data.Results, more: more };
- }
- }, createSearchChoice: function (term) {
- var text = $('.select2-drop').find('input.select2-active').val();
- return { id: term, text: text };
- }, initSelection: function (element, callback) {
- var elementText = $(element).attr('tooltip');
- $.ajax(SinglValueURL, {
- data: {
- searchTerm: elementText
- },
- dataType: "json"
- }).done(function (data) {
- callback(data.Results[0])
- });
- }
- });
- });
- function validateNumbersOnly(e) {
- var unicode = e.charCode ? e.charCode : e.keyCode;
- if ((unicode == 8) || (unicode == 9) || (unicode > 47 && unicode < 58) || unicode == 37 || unicode == 32 || unicode == 39) {
- return true;
- }
- else {
- return false;
- }
- }
- /* charecter count */
- $('#mortgage_note').on('input', function (event) {
- //alert($(this).val().length);
- $('#totalCharacters').text($(this).val().length);
- });
- function toUpperFirstLetter(obj) {
- var mystring = obj.value;
- var f, r;
- f = mystring.substring(0, 1).toUpperCase();
- r = mystring.substring(1).toLowerCase();
- obj.value = f + r;
- return true;
- }
- /* charecter count */
- $('#_DSaid1').unbind('change').change(function () {
- $("#hideRow").hide();
- var hold = $(this);
- var _spn = hold.next('.customStyleSelectBox').find('.customStyleSelectBoxInner');
- _spn.html(hold.find(':selected').text());
- var maintbl = $('#basetable1');
- $('#loaddiv1').remove();
- // var newobj = '<div style="height:40px;" id="loaddiv1"><div><table id="Dtltbl" class="formtable"><tbody><tr><td class="label">Branch</td><td class="value"><div class="dropdown"><input type="text" value="" name="_DSbranch" id="branch" onkeydown="dropdownkeydown(this,event);" oninput="toUpper(this);" class="idleField txtField capitalField"><ul id="ddbranch"><li>Balham</li></ul></div></td><td class="label">Negotiator</td><td class="value"><div class="dropdown"><input type="text" value="" onkeydown="dropdownkeydown(this,event);" oninput="toUpper(this);" name="_DSnegref" id="neg" class="idleField txtField capitalField"><ul id="ddneg"><li>Matt Jordan</li></ul></div></td></tr></tbody></table></div></div>';
- var newobj = '<div id="loaddiv1"><div><table id="Dtltbl" class="formtable"><tbody><tr class="row"><td class="col-md-2">Branch</td><td class="col-md-4"><div class="dropdown divrelative"><input type="text" value="" name="_DSbranch" id="branch" onkeydown="dropdownkeydown(this,event);" oninput="toUpper(this);" class="idleField txtField capitalField"><ul id="ddbranch" class="app_ul_branch"><li>Balham</li></ul></div></td><td class="col-md-2">Negotiator</td><td class="col-md-4"><div class="dropdown divrelative"><input type="text" value="" onkeydown="dropdownkeydown(this,event);" oninput="toUpper(this);" name="_DSnegref" id="neg" class="idleField txtField capitalField"><ul id="ddneg" class="app_ul_neg"><li>Matt Jordan</li></ul></div></td></tr></tbody></table></div></div>';
- maintbl.after(newobj);
- FindContactsForAccount();
- // ddoperation();
- });
- function FindContactsForAccount() {
- var url = $('#hdfindcontacts').val();
- var accountId = $('#_DSaid1 option:selected').val();
- var Criteria = JSON.stringify({ accountId: accountId });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: url,
- data: Criteria,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- error: function (error) {
- // alert('Error:' + error.responseText);
- },
- success: function (data) {
- var bmap = [];
- var nmap = [];
- if (data.contactlists.length > 0) {
- $('#ddbranch').html('');
- $('#ddneg').html('');
- if (data.contactlists[0].length > 0) {
- for (j = 0; j < data.contactlists[0].length; j++) {
- if (data.contactlists[0][j] != '') {
- if (bmap.indexOf(data.contactlists[0][j]) == -1) {
- bmap.push(data.contactlists[0][j]);
- }
- }
- }
- }
- //for neg
- if (data.contactlists[1].length > 0) {
- for (k = 0; k < data.contactlists[1].length; k++) {
- if (data.contactlists[1][k] != '') {
- if (nmap.indexOf(data.contactlists[1][k]) == -1) {
- nmap.push(data.contactlists[1][k]);
- }
- }
- }
- }
- bmap.sort(function (a, b) {
- if (a.toLowerCase() < b.toLowerCase()) return -1;
- if (a.toLowerCase() > b.toLowerCase()) return 1;
- return 0;
- });
- nmap.sort(function (a, b) {
- if (a.toLowerCase() < b.toLowerCase()) return -1;
- if (a.toLowerCase() > b.toLowerCase()) return 1;
- return 0;
- });
- var laststring = '';
- for (j = 0; j < bmap.length; j++) {
- if (laststring != bmap[j].toLowerCase()) {
- $('#ddbranch').append('<li onclick="ddoperationBranch(this)">' + bmap[j] + '</li>');
- laststring = bmap[j].toLowerCase();
- }
- }
- for (j = 0; j < nmap.length; j++) {
- if (laststring != nmap[j].toLowerCase()) {
- $('#ddneg').append('<li onclick="ddoperationneg(this)">' + nmap[j] + '</li>');
- laststring = nmap[j].toLowerCase();
- }
- }
- }
- else if (data.contactlists.length == 0) {
- $('#branch').val('');
- $('#neg').val('');
- $('#ddbranch').hide();
- $('#ddneg').hide();
- }
- }
- });
- }
- function ddoperationBranch(hold) {
- $('input#branch').val(hold.textContent);
- $('ul#ddbranch').hide();
- }
- function ddoperationneg(hold) {
- $('input#neg').val(hold.textContent);
- $('ul#ddneg').hide();
- }
- $('#exportall').click(function () {
- var financeId = $('#financemortageproductselect').val();
- var mortgage_date = $("#mortgage_date").val();
- var mortgage_time = $("#mortgage_time").val();
- var d = { financeid: financeId, followUpDate: mortgage_date, followUpTime: mortgage_time };
- var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
- var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
- data: JSON.stringify(d),
- contentType: "application/json; charset=utf-8",
- dataType: "json", beforeSend: function () {
- $('#overlaycontainer').show();
- },
- success: function (data) {
- $('#overlaycontainer').hide();
- if (data.filename != "") {
- window.location = getUrl + "?filename=" + data.filename;
- }
- }, error: function (xhr, ajaxOptions, thrownError) {
- $('#overlaycontainer').hide();
- alert("No File Created!");
- }
- });
- });
- $('#exportallLife').click(function () {
- var financeId = $('#LifeProductAdd').val();
- var life_date = $("#life_followupdate").val();
- var life_time = $("#life_followuptime").val();
- var d = { financeid: financeId, followUpDate: life_date, followUpTime: life_time };
- var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
- var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
- data: JSON.stringify(d),
- contentType: "application/json; charset=utf-8",
- dataType: "json", beforeSend: function () {
- $('#overlaycontainer').show();
- },
- success: function (data) {
- $('#overlaycontainer').hide();
- if (data.filename != "") {
- window.location = getUrl + "?filename=" + data.filename;
- }
- }, error: function (xhr, ajaxOptions, thrownError) {
- $('#overlaycontainer').hide();
- alert("No File Created!");
- }
- });
- });
- $('#exportallBuilding').click(function () {
- var financeId = $('#BuildingContentProductAdd').val();
- var Building_date = $("#buildingcontent_date").val();
- var Building_time = $("#buildingcontent_time").val();
- var d = { financeid: financeId, followUpDate: Building_date, followUpTime: Building_time };
- var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
- var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
- data: JSON.stringify(d),
- contentType: "application/json; charset=utf-8",
- dataType: "json", beforeSend: function () {
- $('#overlaycontainer').show();
- },
- success: function (data) {
- $('#overlaycontainer').hide();
- if (data.filename != "") {
- window.location = getUrl + "?filename=" + data.filename;
- }
- }, error: function (xhr, ajaxOptions, thrownError) {
- $('#overlaycontainer').hide();
- alert("No File Created!");
- }
- });
- });
- $('#exportallPension').click(function () {
- var financeId = $('#PensionProductAdd').val();
- var Pension_date = $("#pension_date").val();
- var Pension_time = $("#pension_time").val();
- var d = { financeid: financeId, followUpDate: Pension_date, followUpTime: Pension_time };
- var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
- var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
- data: JSON.stringify(d),
- contentType: "application/json; charset=utf-8",
- dataType: "json", beforeSend: function () {
- $('#overlaycontainer').show();
- },
- success: function (data) {
- $('#overlaycontainer').hide();
- if (data.filename != "") {
- window.location = getUrl + "?filename=" + data.filename;
- }
- }, error: function (xhr, ajaxOptions, thrownError) {
- $('#overlaycontainer').hide();
- alert("No File Created!");
- }
- });
- });
- $('#exportallInvestment').click(function () {
- var financeId = $('#InvestmentProductAdd').val();
- var Investment_date = $("#investment_date").val();
- var Investment_time = $("#investment_time").val();
- var d = { financeid: financeId, followUpDate: Investment_date, followUpTime: Investment_time };
- var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
- var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
- data: JSON.stringify(d),
- contentType: "application/json; charset=utf-8",
- dataType: "json", beforeSend: function () {
- $('#overlaycontainer').show();
- },
- success: function (data) {
- $('#overlaycontainer').hide();
- if (data.filename != "") {
- window.location = getUrl + "?filename=" + data.filename;
- }
- }, error: function (xhr, ajaxOptions, thrownError) {
- $('#overlaycontainer').hide();
- alert("No File Created!");
- }
- });
- });
- function BindFinanceSubstatus(StatusId) {
- //var StatusId = $("#mortagestatus option:selected").val();
- if (StatusId == '6' || StatusId == '7') {
- var Criteria = JSON.stringify({ StatusId: StatusId });
- var url = '@Url.Action("BindSubFinanceStatus","Apptrack")';
- $.ajaxSetup({ cache: false });
- $.ajax({
- type: "POST",
- url: url,
- data: Criteria,
- contentType: "application/json; charset=utf-8",
- dataType: "json",
- //async: false,
- error: function (error) {
- // alert('Error:' + error.responseText);
- },
- success: function (data) {
- if (data.substatusList.length > 0) {
- $('#mortgage_substatus').empty();
- for (var i = 0; i < data.substatusList.length; i++) {
- $('#mortgage_substatus').append('<option value="' + data.substatusList[i].Value + '">' + data.substatusList[i].Text + '</option>');
- }
- var hold = $('.colFinanceSubstatus');
- hold.css('display', '');
- }
- else {
- $('#mortgage_substatus').empty();
- $('#mortgage_substatus').append('<option value="0">None</option>');
- var hold = $('.colFinanceSubstatus');
- hold.css('display', 'none');
- }
- return true;
- }
- });
- }
- else {
- $('#mortgage_substatus').empty();
- $('#mortgage_substatus').append('<option value="0">None</option>');
- var hold = $('.colFinanceSubstatus');
- hold.css('display', 'none');
- }
- }
- function SelectTextFromDDL(id) {
- var x = document.getElementById(id);
- for (var i = 0; i < x.options.length; i++) {
- if (x.options[i].selected == true) {
- return x.options[i].text;
- }
- }
- }
- function PDFPrint(tagid) {
- var MethodName = $("select#_DSmethod option:selected").text();
- var AdviserName = $("select#_DSbrokerrefAccountForm option:selected").text().substring(0, $("select#_DSbrokerrefAccountForm option:selected").text().indexOf("("));
- var ContactWithinTwoHr = $("select#_Contact_within_2hrs option:selected").text();
- var ApplicationDownloadURl = '@Url.Action("DownloadAttachment", "Apptrack")';
- if (tagid.toLowerCase() == "mortgage") {
- var mortgagename = $("#financemortageproductselect option:selected").text();
- var Status = $("select#mortagestatus option:selected").text();
- var SubStatus = $("select#mortgage_substatus option:selected").text();
- var lendername = $("#s2id_mortgage_lender").text();
- var mortgagetype = $("select#mortgage_reason option:selected").text();
- var ratetype = ($("#RateFix").prop("checked") == true ? $("#RateFix").val() : ($("#RateTracker").prop("checked") == true ? $("#RateTracker").val() : ""));
- var solicitor = $("#s2id_mortgage_solicitor").text();
- var MortgagePDFFileURl = '@Url.Action("SaveMortgagePDF", "Apptrack")';
- $.ajax({
- url: MortgagePDFFileURl,
- cache: false,
- data: { strmortgagename: mortgagename, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strSubStatus: SubStatus, strLender: lendername, strMortgageType: mortgagetype, strRateType: ratetype, strsolicitor: solicitor },
- type: "POST",
- success: function (result) {
- window.location = ApplicationDownloadURl;
- }
- });
- }
- else if (tagid.toLowerCase() == "portfolio") {
- var lifename = $("#LifeProductAdd option:selected").text();
- var Status = $("select#life_status option:selected").text();
- var PolicyType = $("select#life_type option:selected").text();
- var LifePDFFileURl = '@Url.Action("SaveLifePDF", "Apptrack")';
- $.ajax({
- url: LifePDFFileURl,
- cache: false,
- data: { strlifename: lifename, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strPolicyType: PolicyType },
- type: "POST",
- success: function (result) {
- window.location = ApplicationDownloadURl;
- }
- });
- }
- else if (tagid.toLowerCase() == "building") {
- var BuildingContentname = $("select#BuildingContentProductAdd option:selected ").text();
- var Status = $("select#_DSBuildingOrContentStaus option:selected").text();
- var Type = $("select#buildingcontent_type option:selected").text();
- var BuildingsPDFFileURl = '@Url.Action("SaveBuildingsPDF", "Apptrack")';
- $.ajax({
- url: BuildingsPDFFileURl,
- cache: false,
- type: "POST",
- data: { strBuildingContentname: BuildingContentname, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strType: Type },
- success: function (result) {
- window.location = ApplicationDownloadURl;
- }
- });
- }
- else if (tagid.toLowerCase() == "pension") {
- var Pensionname = $("select#PensionProductAdd option:selected ").text();
- var Status = $("select#_DSPensionStatus option:selected").text();
- var pension_riskprofiles = $("select#pension_riskprofile option:selected").text();
- var PensionPDFFileURl = '@Url.Action("SavePensionPDF", "Apptrack")';
- $.ajax({
- url: PensionPDFFileURl,
- cache: false,
- type: "POST",
- data: { strPensionname: Pensionname, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strpension_riskprofiles: pension_riskprofiles },
- success: function (result) {
- window.location = ApplicationDownloadURl;
- }
- });
- }
- else if (tagid.toLowerCase() == "investment") {
- var Investment = $("select#InvestmentProductAdd option:selected ").text();
- var Status = $("select#_DSInvestmentStatus option:selected").text();
- var investment_riskprofiles = $("select#investment_riskprofiles option:selected").text();
- var followUp = $("select#mortgage_Followup option:selected").text()
- var InvestmentsPDFFileURl = '@Url.Action("SaveInvestmentsPDF", "Apptrack")';
- $.ajax({
- url: InvestmentsPDFFileURl,
- cache: false,
- type: "POST",
- data: { strInvestment: Investment, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strinvestment_riskprofiles: investment_riskprofiles },
- success: function (result) {
- window.location = ApplicationDownloadURl;
- }
- });
- }
- }
- </script>
- <script type='text/javascript'>
- jQuery(function($){
- $('a#linkfactfind').mousedown(function (event) {
- //For all click of mouse like left,middle,right
- var cId = $("#hdn_Contt_id_f").val();
- RedirectToFactFind(cId);
- });
- });
- $('#mortage_notes_allow').val('true')
- $('#mortage_notes_allow').on('change', function () { // on change of state
- if (this.checked) // if changed state is "CHECKED"
- {
- $('#mortage_notes_allow').val('true')
- // alert($('#mortage_notes_allow').val());
- }
- else {
- $('#mortage_notes_allow').val('false')
- //alert($('#mortage_notes_allow').val());
- }
- })
- </script>
- ==========================================================
- @{ string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/Attendance.js"); }
- <script>
- function SerachData() {
- Reset();
- var Year = $("#yearsearch").val();
- var Name = $("#brokernamesearch").val();
- var TeamId = $("#TeamId").val();
- if (Year.length < 4 && Year.length > 0) {
- alert('Invalid year.');
- $("#yearsearch").focus();
- return false;
- }
- var Criteria = { Year: Year, Name: Name, TeamId: TeamId };
- $.ajax({
- url: '@Url.Action("BrokerAttendanceListTab", "apptrack")',
- type: 'POST',
- cache: false,
- async:false,
- data: Criteria,
- success: function (result) {
- $('#divbrkyearlist').html(result);
- }
- });
- }
- $(document).ready(function () {
- var Year = $("#yearsearch").val();
- if (Year.length == 0) {
- var cDate = new Date();
- var year = "";
- year = cDate.getFullYear();
- $("#yearsearch").val(year);
- }
- });
- </script>
- <tbody>
- @{
- List<Occfinance.Models.AttendanceClients> clients = (List<Occfinance.Models.AttendanceClients>)Model;
- if (clients.Count() > 0)
- {
- var _rowId = "";
- for (int c = 0; c < clients.Count(); c++)
- {
- _rowId = "rowId" + c;
- <tr @(c % 2 == 0 ? "" : "class=odd") id="@_rowId">
- <td style="width: 60px;">
- @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
- {
- <img title="@Occfinance.Resource.Edit" alt="Edit" onclick="return showdetailsDay(@clients[c].userid,'@clients[c].contactname',@clients[c].AbsentHrsAllowed,@clients[c].AbsentHrsUsed);" id="imgeditbr" src="@Url.Content("~/Images/edit.png")" style="cursor: pointer; float:left; padding: 2px;" />
- if (clients[c].AbsentHrsAllowed != 0)
- {
- <img id="imgdeletebr" onclick="return DeleteAttendanceDay(@clients[c].userid);" style="cursor: pointer; float:left; padding: 2px;" src="@Url.Content("~/Images/delete.gif")" alt="Delete" title="Delete">
- }
- else
- {
- <img id="imgdeletebr" style="cursor: default; float:left; padding: 2px;" src="@Url.Content("~/Images/delete.gif")" alt="Delete" title="No hours assigned to delete!">
- }
- }
- <img id="imgcaldrbr" onclick="GoToSchedule('@clients[c].userid');" style="cursor: pointer; float:left; padding: 2px;" src="@Url.Content("~/Images/calendar.png")" alt="Attendance Setting" title="Attendance Setting">
- </td>
- <td>
- <span id="spbrokername">@clients[c].contactname</span>
- <input type="hidden" value="@clients[c].contactname" />
- </td>
- <td>@clients[c].email</td>
- <td style="width: 10%;">
- @clients[c].AbsentHrsAllowed
- </td>
- <td style="width: 10%;">
- @clients[c].AbsentHrsUsed
- </td>
- <td style="width: 15%;">
- @(clients[c].ActivityDate.HasValue ? clients[c].ActivityDate.Value.ToString("dd-MM-yyyy") : "")
- </td>
- </tr>
- }
- }
- }
- </tbody>
- <script>
- function SerachDayData() {
- ResetDay();
- var Name = $("#brokernamesearchday").val();
- var TeamId = $("#TeamIdDay").val();
- var cdate = $("#txtsearchdate").val();
- if (cdate.length < 10 && cdate.length > 0) {
- alert('Invalid date.');
- $("#txtsearchdate").focus();
- return false;
- }
- var Criteria = { DayVal: cdate, Name: Name, TeamId: TeamId };
- $.ajax({
- url: '@Url.Action("BrokerDayWiseAttendanceListTab", "apptrack")',
- type: 'POST',
- cache: false,
- async: false,
- data: Criteria,
- success: function (result) {
- $('#divbrkmonthlist').html(result);
- }
- });
- }
- function GoToSchedule(userid) {
- if (userid > 0) {
- var Criteria = { uid: userid };
- $.ajax({
- url: '@Url.Action("Attendance_Read", "Attendance")',
- type: 'GET',
- cache: false,
- async: false,
- data: Criteria,
- dataType: "jsonp", contentType: "application/json",
- success: function (result) {
- $("#tab3").click();
- }
- });
- }
- }
- @{
- var today = DateTime.Today.ToString("yyyy/MM/dd");
- }
- <script>
- var _data = [];
- function StartTimeAppointments() {
- now = new Date();
- year = "" + now.getFullYear() - 3;
- month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
- day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
- var hour = now.getHours();
- var minute = now.getMinutes();
- var second = now.getSeconds();
- var ap = "AM";
- if (hour > 11) { ap = "PM"; }
- if (hour > 12) { hour = hour - 12; }
- if (hour == 0) { hour = 12; }
- if (hour < 10) { hour = "0" + hour; }
- if (minute < 10) { minute = "0" + minute; }
- if (second < 10) { second = "0" + second; }
- var timeString = hour +
- ':' +
- minute +
- " " +
- ap;
- return day + "/" + month + "/" + year + " " + "08:00 AM";
- }
- function EndTimeAppointments() {
- now = new Date();
- year = "" + now.getFullYear();
- month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
- day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
- var hour = now.getHours();
- var minute = now.getMinutes();
- var second = now.getSeconds();
- var ap = "AM";
- if (hour > 11) { ap = "PM"; }
- if (hour > 12) { hour = hour - 12; }
- if (hour == 0) { hour = 12; }
- if (hour < 10) { hour = "0" + hour; }
- if (minute < 10) { minute = "0" + minute; }
- if (second < 10) { second = "0" + second; }
- var timeString = hour +
- ':' +
- minute +
- " " +
- ap;
- return day + "/" + month + "/" + year + " " + "07:30 PM";
- }
- function js_yyyy_mm_dd() {
- now = new Date();
- year = "" + now.getFullYear();
- month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
- day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
- return day + "/" + month + "/" + year;
- }
- function scheduler_navigate(e) {
- //makeHoliday(dno, title)
- var action = e.action;
- var view = e.view;
- var showdate = dateFormat(new Date(e.date), 'dd/mm/yyyy')
- var date = kendo.format("{0:d}", e.date);
- var brokername = $('#brokernamesearchattendance').val();
- var teammanager = $('#TeamIdAttendace').val();
- $('#overlaycontainer').show();
- $.ajax({
- type: "POST",
- url: '@Url.Action("SetValuestoSession", "Attendance")',
- data: { Broker: brokername, ActivityDate: showdate, Team: teammanager, View: view },
- success: function (result) {
- $("#scheduler").data("kendoScheduler").refresh();
- $("#scheduler").data("kendoScheduler").dataSource.read();
- $("#scheduler").data("kendoScheduler").refresh();
- if ((action == "next" || action == "previous") && view == "day") {
- $('#txtsearchdateattendance').val(showdate);
- }
- else {
- $('#txtsearchdateattendance').val('');
- }
- $('#overlaycontainer').hide();
- }, error: function (result) {
- $('#overlaycontainer').hide();
- }
- });
- $('#overlaycontainer').hide();
- }
- function scheduler_edit(e) {
- @* $('#DaysOffAbsentType').val('@((int)Occfinance.Helpers.eAttendenceType.FullDayPresent)');*@
- $("#TotalDaysHoursUsed").kendoNumericTextBox();
- $("#ActivityDate").kendoDatePicker(
- {
- format: "dd/MM/yyyy"
- });
- $("#ActivityStartTime").kendoTimePicker(
- {
- min: new Date(2014, 6, 10, 09, 0, 0),
- max: new Date(2014, 6, 10, 18, 00, 0)
- }
- );
- $("#ActivityEndTime").kendoTimePicker({
- min: new Date(2014, 6, 10, 09, 0, 0),
- max: new Date(2014, 6, 10, 18, 00, 0)
- }
- );
- }
- $("#scheduler").kendoScheduler({
- //date: new Date(js_yyyy_mm_dd()),
- date: new Date('@today'),
- startTime: new Date(StartTimeAppointments()),
- endTime: new Date(EndTimeAppointments()),
- showWorkHours: true,
- majorTick: 30,
- workDayStart: new Date(StartTimeAppointments()),
- workDayEnd: new Date(EndTimeAppointments()),
- // navigate: scheduler_navigate,
- edit: scheduler_edit,
- height: 1000,
- footer: "",
- //selectable: true,
- timezone: "Europe/London", // Use the London timezone
- currentTimeMarker: {
- useLocalTimezone: false
- }, editable: {
- confirmation: "Are you sure you want to delete this attendence?",
- template: kendo.template($("#edit-Template").html())
- },
- views: [
- {
- type: "month", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
- },
- {
- type: "week", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
- },
- {
- type: "day", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
- },
- //,
- //{
- // type: "agenda", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}",
- // editable: { create: false, destroy: true }
- //}
- ],
- allDaySlot: true,
- autoBind: true,
- messages: {
- deleteWindowTitle: "Remove attendence",
- save: "Update",
- editor: {
- editorTitle: "Edit attendence"
- }
- },
- dataSource: {
- sync: function () {
- this.read();
- },
- batch: true,
- transport: {
- read: {
- url: "@Url.Action("Attendance_Read", "Attendance")",
- dataType: "jsonp", contentType: "application/json"
- },
- update: {
- url: "@Url.Action("Attendence_Update", "Attendance")",
- dataType: "jsonp", contentType: "application/json"
- },
- destroy: {
- url: "@Url.Action("Attendence_Destroy", "Attendance")",
- dataType: "jsonp"
- },
- parameterMap: function (options, operation) {
- if (operation == "update" && options.models) {
- var starttime = kendo.parseDate(options.models[0].ActivityStartTime);
- var endtime = kendo.parseDate(options.models[0].ActivityEndTime);
- ShowActivateDivs($.parseJSON(JSON.stringify(options.models[0].DaysOffAbsentType)));
- return {
- Title: $.parseJSON(JSON.stringify(options.models[0].Title)),
- TotalDaysHoursUsed: $.parseJSON(JSON.stringify(options.models[0].TotalDaysHoursUsed)),
- ActivityDate: $.parseJSON(JSON.stringify(options.models[0].ActivityDate)),
- ActivityStartTime: $.parseJSON(JSON.stringify(starttime)),
- ActivityEndTime: $.parseJSON(JSON.stringify(endtime)),
- DaysOffAbsentType: $.parseJSON(JSON.stringify(options.models[0].DaysOffAbsentType)),
- userid: $.parseJSON(JSON.stringify(options.models[0].userid)),
- };
- }
- if (operation == "destroy" && options.models) {
- return {
- userid: $.parseJSON(JSON.stringify(options.models[0].userid)),
- ActivityDate: $.parseJSON(JSON.stringify(options.models[0].ActivityDate)),
- };
- }
- }
- },
- schema: {
- timezone: "Europe/London", // Use the London timezone
- model: {
- id: "DayWiseAtendanceId",
- fields: {
- title: { from: "Title", defaultValue: "No title" },
- start: { type: "date", from: "Start" },
- end: { type: "date", from: "End" },
- startTimezone: { from: "StartTimezone" },
- endTimezone: { from: "EndTimezone" },
- description: { from: "Description" },
- isAllDay: { type: "boolean", from: "IsAllDay" },
- clientid: { from: "clientid" },
- //parent: { from: "parent" },
- companyname: { from: "companyname" },
- TeamName: { from: "TeamName" },
- TeamId: { from: "TeamId" },
- affiliateid: { from: "affiliateid" },
- contactname: { from: "contactname" },
- address: { from: "address" },
- userid: { from: "userid" },
- AdminId: { from: "AdminId" },
- TotalDaysHoursUsed: { from: "TotalDaysHoursUsed" },
- ActivityDate: { type: "date", from: "ActivityDate" },
- ActivityStartTime: { from: "ActivityStartTime" },
- ActivityEndTime: { from: "ActivityEndTime" },
- DaysOffAbsentType: { from: "DaysOffAbsentType" },
- DayWiseAtendanceId: { from: "DayWiseAtendanceId" },
- IsHoliday: { from: "IsHoliday" },
- Holiday: { type: "date", from: "Holiday" },
- HolidayTitle: { from: "HolidayTitle" },
- HolidayDescription: { from: "HolidayDescription" }
- }
- }
- }
- },
- edit: function (e) {
- if (e.event.IsHoliday == 1 || e.event.IsHoliday == 2) {
- e.preventDefault();
- return false;
- }
- },
- moveStart: function (e) {
- if (e.event.IsHoliday == 1 || e.event.IsHoliday == 2) {
- e.preventDefault();
- return false;
- }
- },
- dataBound: function (e) {
- if (e.sender.view().name.toLowerCase() == "day") {
- $('.k-scheduler-times').hide();
- $('.k-scheduler-dayview .k-scheduler-content .k-scheduler-table').hide();
- }
- },
- resources: [
- {
- field: "IsHoliday",
- dataSource: [
- { text: "", value: 1, color: "#9ACD32" },
- ],
- title: "",
- multiple: false,
- editable: false,
- moveStart: false
- },
- {
- field: "IsHoliday",
- dataSource: [
- { text: "Weekend", value: 2, color: "#556B2F" },
- ],
- title: "Weekend",
- multiple: false,
- editable: false,
- moveStart: false
- },
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 1, color: "#66CCFF" },
- ],
- title: "Present"
- },
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 2, color: "#FF7F50" },
- ],
- title: "Half Day(Sickness)"
- }
- ,
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 3, color: "#CF98A8" },
- ],
- title: "Half Day(Holiday)"
- }
- ,
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 4, color: "#FFE4C4" },
- ],
- title: "Half Day(Others)"
- }
- ,
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 5, color: "#FFFF00" },
- ],
- title: "Absent(Sickness)"
- }
- ,
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 6, color: "#C0FF3E" },
- ],
- title: "Absent(Holiday)"
- }
- ,
- {
- field: "DaysOffAbsentType",
- dataSource: [
- { text: "", value: 7, color: "#FFD700" },
- ],
- title: "Absent(Others)"
- }
- ]
- });
- function ShowActivateDivs(typeid) {
- if (typeid == 1) {
- $("#aDivP").show();
- $("#divPresent").addClass("divActiveCss");
- }
- else if (typeid == 2) {
- $("#aDivH").show();
- $("#divHalfDay").addClass("divActiveCss");
- }
- else if (typeid == 3) {
- $("#aDivHH").show();
- $("#divAbsentHoliday").addClass("divActiveCss");
- }
- else if (typeid == 4) {
- $("#aDivHO").show();
- $("#divHalfDayOther").addClass("divActiveCss");
- }
- else if (typeid == 5) {
- $("#aDivA").show();
- $("#divAbsent").addClass("divActiveCss");
- }
- else if (typeid == 6) {
- $("#aDivAHO").show();
- $("#divAbsentholiday").addClass("divActiveCss");
- }
- else if (typeid == 7) {
- $("#aDivAO").show();
- $("#divAbsentOther").addClass("divActiveCss");
- }
- }
- //var scheduler = $("#scheduler").data("kendoScheduler");
- //scheduler.refresh();
- var eList = [];
- var _eSender;
- var _data = [];
- function kando_dataBound(e) {
- $('#overlaycontainer').show();
- _eSender = e.sender;
- var eventCount = e.sender._data.length;
- var icount = 0;
- if (eventCount > 0) {
- var scheduler = this,
- view = this.view(),
- slots = view.table.find("[role='gridcell']");
- slots.each(function () {
- var slot = scheduler.slotByElement(this);
- var date = dateFormat(new Date(slot.startDate), 'dd/mm/yyyy');
- for (var x = 0; x < eventCount; x++) {
- var holidayDate = dateFormat(new Date(e.sender._data[x].Holiday), 'dd/mm/yyyy');
- if (date == holidayDate) {
- $(this).css("background-color", "#9ACD32");
- // $(this).css("width", "0px");
- if (icount == 0) {
- $(this).css("color", "white");
- }
- $(this).html('');
- $('#overlaycontainer').hide();
- e.disable = true;
- }
- //else {
- // if (e.sender._data[x].DaysOffAbsentType == 1)
- // $(this).css("background-color", "#6B8E23");
- // else if (e.sender._data[x].DaysOffAbsentType == 2)
- // $(this).css("background-color", "#FFB6C1");
- // else if (e.sender._data[x].DaysOffAbsentType == 3)
- // $(this).css("background-color", "#CD5C5C");
- //}
- icount = icount + 1;
- }
- });
- $('#overlaycontainer').hide();
- }
- }
- function makeHoliday(dno, title) {
- var tbl = $('table.k-scheduler-table').find('td').length;
- $('table.k-scheduler-table').find('td').each(function (i, tag) {
- var dayNo = $(tag).find('span').html();
- if (!$(tag).hasClass('k-other-month')) {
- if (parseInt(dayNo) == parseInt(dno)) {
- $(this).addClass('holiday');
- }
- }
- });
- $('table.k-scheduler-table').find('th').each(function (i, tag) {
- var dSpan = $(tag).find('span');
- if (dSpan != null || dSpan != undefined) {
- var dayNo = $(tag).find('span').html();
- if (!$(tag).hasClass('k-other-month')) {
- if (parseInt(dayNo) == parseInt(dno)) {
- $(this).addClass('holiday');
- }
- }
- }
- });
- }
- </script>
- <div id="scheduler"></div>
- <div id="overlaycontainer" style="display: none;">
- <div class="overlay-container"></div>
- <img src="@Url.Content("~/images/loading.gif")" width="31" height="31" />
- </div>
- <div id="popup_box" style="display:none">
- </div>
- @Html.Partial("AttendanceEditTemplate")
Add Comment
Please, Sign In to add comment