Guest User

Untitled

a guest
Nov 14th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 232.58 KB | None | 0 0
  1. public static class Lists
  2. {
  3.  
  4. public static List<Int32> ToIntegerList(string commavalues)
  5. {
  6.  
  7. try
  8. {
  9. var _lst = commavalues.Split(',').ToList();
  10. List<Int32> arr = new List<int>();
  11. for (int i = 0; i < _lst.Count; i++)
  12. {
  13. arr.Add(int.Parse(_lst[i].ToString()));
  14. }
  15. return arr;
  16. }
  17. catch
  18. {
  19. return new List<int>() { 0 };
  20. }
  21.  
  22. }
  23.  
  24. /// <summary>
  25. /// Convert a list of items to a select list
  26. /// </summary>
  27. public static List<SelectListItem> ToSelectList<T>(
  28. this IEnumerable<T> enumerable,
  29. Func<T, string> text,
  30. Func<T, string> value,
  31. String defaultOption)
  32. {
  33. var items = enumerable.Select(f => new SelectListItem()
  34. {
  35. Text = text(f),
  36. Value = value(f)
  37. }).ToList();
  38.  
  39. if (!(defaultOption == null))
  40. {
  41. items.Insert(0, new SelectListItem()
  42. {
  43. Text = defaultOption,
  44. Value = ""
  45. });
  46. }
  47.  
  48. return items.ToList();
  49. }
  50.  
  51.  
  52. //From http://stackoverflow.com/questions/5663655/like-operator-in-linq-to-objects
  53. //For sql "Like" comparison in linq to objects
  54. public static bool Like(this string s, string pattern)
  55. {
  56. //Find the pattern anywhere in the string
  57. pattern = ".*" + pattern + ".*";
  58.  
  59. return Regex.IsMatch(s, pattern, RegexOptions.IgnoreCase);
  60. }
  61.  
  62. /// <summary>
  63. /// Convert the text into sentence cases.
  64. /// </summary>
  65. /// <param name="Input"></param>
  66. /// <returns></returns>
  67. public static string CapitalizeSentences(this string Input)
  68. {
  69. if (String.IsNullOrEmpty(Input))
  70. return Input;
  71.  
  72. if (Input.Length == 1)
  73. return Input.ToUpper();
  74.  
  75.  
  76. Input = Regex.Replace(Input, @"\s+", " ");
  77.  
  78. Input = Input.Trim().ToLower();
  79. Input = Char.ToUpper(Input[0]) + Input.Substring(1);
  80.  
  81.  
  82. var objDelimiters = new string[] { ". ", "! ", "? " };
  83. foreach (var objDelimiter in objDelimiters)
  84. {
  85. var varDelimiterLength = objDelimiter.Length;
  86.  
  87. var varIndexStart = Input.IndexOf(objDelimiter, 0);
  88. while (varIndexStart > -1)
  89. {
  90. Input = Input.Substring(0, varIndexStart + varDelimiterLength) + (Input[varIndexStart + varDelimiterLength]).ToString().ToUpper() + Input.Substring((varIndexStart + varDelimiterLength) + 1);
  91.  
  92. varIndexStart = Input.IndexOf(objDelimiter, varIndexStart + 1);
  93. }
  94. }
  95.  
  96.  
  97. return Input;
  98. }
  99. }
  100.  
  101. namespace Occfinance.Extensibility
  102. {
  103. public class IsValidUser : ActionFilterAttribute
  104. {
  105. public override void OnActionExecuting(ActionExecutingContext filterContext)
  106. {
  107. HttpContext ctx = HttpContext.Current;
  108. string redirectTo = string.Empty;
  109. if (ctx.Session["IsValidUser"] != null)
  110. {
  111. bool check = Convert.ToBoolean(ctx.Session["IsValidUser"]);
  112. if (check == true)
  113. {
  114. //do nothing.
  115. }
  116. else if (check == false)
  117. {
  118. redirectTo = string.Format("~/Home/Index");
  119. filterContext.Result = new RedirectResult(redirectTo);
  120. }
  121. }
  122. else
  123. {
  124. Code.Q_Client Qclient = new Code.Q_Client();
  125. var client = Qclient.FindClientByLoggedUser(CookieWrapper.UserId);
  126. if (client != null)
  127. {
  128. ctx.Session["IsValidUser"] = true;
  129. ctx.Session["LoggedInUserId"] = CookieWrapper.UserId;
  130. ctx.Session["SiteLogo"] = "apptrack.jpg";
  131. ctx.Session["ContactName"] = client.username;
  132. ctx.Session["ContactEmail"] = client.email;
  133. ctx.Session["LoggedInUserAccountId"] = client.clientid;
  134. ctx.Session["telephone"] = client.telephone;
  135. }
  136. else
  137. {
  138. redirectTo = string.Format("~/Home/Index");
  139. filterContext.Result = new RedirectResult(redirectTo);
  140. }
  141. }
  142.  
  143. base.OnActionExecuting(filterContext);
  144. }
  145. }
  146.  
  147. public class AuthorizeUser : AuthorizeAttribute
  148. {
  149. protected override bool AuthorizeCore(HttpContextBase httpContext)
  150. {
  151. if (HttpContext.Current.Session["LoggedInUserAccountId"] != null)
  152. {
  153. return true;
  154. }
  155. else
  156. {
  157. return false;
  158. }
  159. }
  160.  
  161. protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext)
  162. {
  163. try
  164. {
  165. filterContext.Result = new RedirectResult("~/Home/Index");
  166. }
  167. catch { throw; }
  168. }
  169. }
  170. }
  171.  
  172. namespace Occfinance.FiltersException
  173. {
  174.  
  175. public class MyErrorHandlerAttribute : HandleErrorAttribute
  176. {
  177. public override void OnException(ExceptionContext filterContext)
  178. {
  179. if (filterContext.ExceptionHandled || !filterContext.HttpContext.IsCustomErrorEnabled)
  180. {
  181. return;
  182. }
  183.  
  184. if (new HttpException(null, filterContext.Exception).GetHttpCode() != 500)
  185. {
  186. return;
  187. }
  188.  
  189. if (!ExceptionType.IsInstanceOfType(filterContext.Exception))
  190. {
  191. return;
  192. }
  193.  
  194. // if the request is AJAX return JSON else view.
  195. if (filterContext.HttpContext.Request.Headers["X-Requested-With"] == "XMLHttpRequest")
  196. {
  197. filterContext.Result = new JsonResult
  198. {
  199. JsonRequestBehavior = JsonRequestBehavior.AllowGet,
  200. Data = new
  201. {
  202. error = true,
  203. message = filterContext.Exception.Message
  204. }
  205. };
  206. }
  207. else
  208. {
  209. var controllerName = (string)filterContext.RouteData.Values["controller"];
  210. var actionName = (string)filterContext.RouteData.Values["action"];
  211. var model = new HandleErrorInfo(filterContext.Exception, controllerName, actionName);
  212.  
  213. filterContext.Result = new ViewResult
  214. {
  215. ViewName = View,
  216. MasterName = Master,
  217. ViewData = new ViewDataDictionary(model),
  218. TempData = filterContext.Controller.TempData
  219. };
  220. }
  221.  
  222. filterContext.ExceptionHandled = true;
  223. filterContext.HttpContext.Response.Clear();
  224. filterContext.HttpContext.Response.StatusCode = 500;
  225.  
  226. filterContext.HttpContext.Response.TrySkipIisCustomErrors = true;
  227. }
  228. }
  229. }
  230.  
  231. namespace Occfinance.Filters
  232. {
  233. [AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, AllowMultiple = false, Inherited = true)]
  234. public sealed class InitializeSimpleMembershipAttribute : ActionFilterAttribute
  235. {
  236. //private static SimpleMembershipInitializer _initializer;
  237. private static object _initializerLock = new object();
  238. private static bool _isInitialized;
  239.  
  240. public override void OnActionExecuting(ActionExecutingContext filterContext)
  241. {
  242. // Ensure ASP.NET Simple Membership is initialized only once per app start
  243. LazyInitializer.EnsureInitialized(ref _initializer, ref _isInitialized, ref _initializerLock);
  244. }
  245.  
  246. //private class SimpleMembershipInitializer
  247. //{
  248. // public SimpleMembershipInitializer()
  249. // {
  250. // Database.SetInitializer<UsersContext>(null);
  251.  
  252. // try
  253. // {
  254. // using (var context = new UsersContext())
  255. // {
  256. // if (!context.Database.Exists())
  257. // {
  258. // // Create the SimpleMembership database without Entity Framework migration schema
  259. // ((IObjectContextAdapter)context).ObjectContext.CreateDatabase();
  260. // }
  261. // }
  262.  
  263. // WebSecurity.InitializeDatabaseConnection("DefaultConnection", "UserProfile", "UserId", "UserName", autoCreateTables: true);
  264. // }
  265. // catch (Exception ex)
  266. // {
  267. // 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);
  268. // }
  269. // }
  270. //}
  271. }
  272. }
  273.  
  274.  
  275. namespace Occfinance.Helpers
  276. {
  277. public static class Helper
  278. {
  279. private static List<Users> _allUserData;
  280.  
  281. public static List<Users> AllUserData
  282. {
  283. get
  284. {
  285. return _allUserData ?? new List<Users>();
  286. }
  287. set
  288. {
  289. _allUserData = value;
  290. }
  291.  
  292. }
  293.  
  294.  
  295. //date format like 10/23/2015 for 23 October 2015
  296. public static string DateFormat = "MM/dd/yyyy";
  297.  
  298. public static string JavascriptDateFormat = "mm/dd/yyyy";
  299.  
  300. //date format like 23/10/2015 for 23 October 2015
  301. public static string ddMMyyyy = "dd/MM/yyyy";
  302.  
  303. //date format like 2015/10/23 for 23 October 2015
  304. public static string yyyyMMdd = "yyyy/MM/dd";
  305.  
  306. //date format like 23/Oct/2015 for 23 October 2015
  307. public static string ddMMMyyyy = "dd/MMM/yyyy";
  308.  
  309. //date format like 23 Oct 2015 for 23 October 2015
  310. public static string _ddMMMyyyy = "dd MMM yyyy";
  311.  
  312. /// <summary>
  313. /// Convert list to datatable so that we could pass it to sql stored procedure - 20151021
  314. /// </summary>
  315. /// <param name="NegotiatorIds"></param>
  316. /// <param name="dataTable"></param>
  317. /// <returns></returns>
  318. public static DataTable FillDataTable(List<int> NegotiatorIds)
  319. {
  320. DataTable dataTable = new DataTable("IntArray");
  321. dataTable.Columns.Add("IntValue", typeof(Int32));
  322.  
  323. foreach (var nid in NegotiatorIds)
  324. {
  325. dataTable.Rows.Add(nid);
  326. }
  327. return dataTable;
  328. }
  329.  
  330. public static DateTime? GetDate(this string date)
  331. {
  332. try
  333. {
  334. var arrdate = date.Split('/');
  335. if (arrdate.Length == 3)
  336. {
  337. return new DateTime(int.Parse(arrdate[2]), int.Parse(arrdate[1]), int.Parse(arrdate[0]));
  338. }
  339. }
  340. catch
  341. {
  342. // ignored
  343. }
  344. return null;
  345. }
  346.  
  347. public static DateTime? GetDateTime(this string date)
  348. {
  349. try
  350. {
  351. string[] arrdate = date.Split('/');
  352. if (arrdate.Length == 3)
  353. {
  354. return new DateTime(int.Parse(arrdate[2]), int.Parse(arrdate[1]), int.Parse(arrdate[0]), DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);
  355. }
  356. }
  357. catch
  358. {
  359. }
  360. return null;
  361. }
  362.  
  363. public static string GetDateString(this DateTime? dt)
  364. {
  365. if (dt != null)
  366. return string.Format("{0}/{1}/{2}", dt.Value.Day.ToString().PadLeft(2, '0'), dt.Value.Month.ToString().PadLeft(2, '0'), dt.Value.Year.ToString());
  367. else
  368. return string.Empty;
  369. }
  370.  
  371.  
  372. public static DateTime? GetFollowUp(string date, string time)
  373. {
  374. DateTime dt1 = new DateTime();
  375. if (date != null && time != null)
  376. {
  377. string[] arrdate = date.Split('/');
  378. if (arrdate.Length == 3)
  379. {
  380. date = arrdate[1] + "/" + arrdate[0] + "/" + arrdate[2];
  381. }
  382.  
  383. DateTime.TryParse(date, out dt1);
  384. string[] _time = time.Split(':');
  385. if (_time.Length >= 2)
  386. {
  387. dt1 = dt1.AddHours(Convert.ToInt32(_time[0])).AddMinutes(Convert.ToInt32(_time[1]));
  388. }
  389. return dt1;
  390. }
  391. else
  392. {
  393. return null;
  394. }
  395. }
  396.  
  397. public static bool IsNumeric(this string value)
  398. {
  399. if (string.IsNullOrEmpty(value)) return false;
  400. try
  401. {
  402.  
  403. int result;
  404. int.TryParse(value, out result);
  405. return true;
  406. }
  407. catch
  408. { }
  409. return false;
  410. }
  411. public static bool IsDateTime(this string value)
  412. {
  413. if (string.IsNullOrEmpty(value)) return false;
  414. try
  415. {
  416. DateTime result;
  417. DateTime.TryParse(value, out result);
  418. return true;
  419. }
  420. catch
  421. { }
  422. return false;
  423. }
  424.  
  425. public static bool IsEmail(this string value)
  426. {
  427. 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);
  428. return isEmail;
  429. }
  430.  
  431. public static string ToGBPValue(this decimal? val)
  432. {
  433. if ((val ?? 0) > 0)
  434. {
  435. return string.Format("{0} {1}", SessionHelper.DefaultCurrency, val);
  436. }
  437. else
  438. {
  439. return string.Empty;
  440. }
  441. }
  442.  
  443. public static string ToGBPValue(this string val)
  444. {
  445. if (!string.IsNullOrEmpty(val) && !string.IsNullOrWhiteSpace(val))
  446. {
  447. return string.Format("{0} {1}", SessionHelper.DefaultCurrency, val);
  448. }
  449. else
  450. {
  451. return string.Empty;
  452. }
  453. }
  454.  
  455.  
  456.  
  457. /// <summary>
  458. /// Set length of a string
  459. /// </summary>
  460. /// <param name="str"></param>
  461. /// <param name="length"></param>
  462. /// <returns></returns>
  463. public static string StringToLength(this string str, int length)
  464. {
  465. int strlength = str.Length;
  466.  
  467. string output = string.Empty;
  468.  
  469. if (strlength < length)
  470. { return str; }
  471. else
  472. {
  473. return str.Substring(0, length);
  474. }
  475. }
  476. public static string GetStringForReferral(this string str)
  477. {
  478. if (string.IsNullOrEmpty(str))
  479. {
  480. return "N/A";
  481. }
  482. else if (string.IsNullOrWhiteSpace(str))
  483. {
  484. return "N/A";
  485. }
  486. else
  487. {
  488. return str;
  489. }
  490. }
  491. /// <summary>
  492. /// Enter errors in error log table.
  493. /// </summary>
  494. /// <param name="innerException"></param>
  495. /// <param name="className"></param>
  496. /// <param name="methodName"></param>
  497. /// <param name="exceptionMessage"></param>
  498. /// <param name="source"></param>
  499. /// <param name="trace"></param>
  500. /// <param name="helpLink"></param>
  501. public static void ErrorLog(Exception innerException = null, string className = "", string methodName = "", string exceptionMessage = "", string source = "", string trace = "", string helpLink = "")
  502. {
  503. try
  504. {
  505. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  506. Occfinance_Data.tblErrorLog errlg = new Occfinance_Data.tblErrorLog();
  507. errlg.Controller = className;
  508. errlg.Action = methodName;
  509. errlg.Message = exceptionMessage;
  510. errlg.InnerMsg = Convert.ToString(innerException);
  511. errlg.HelpLink = helpLink;
  512. errlg.Source = source;
  513. errlg.Trace = trace;
  514. if (HttpContext.Current.Session != null)
  515. {
  516. errlg.Name = Convert.ToString(HttpContext.Current.Session["ContactName"] ?? "");
  517. errlg.AddBy = Convert.ToInt32(HttpContext.Current.Session["LoggedInUserId"] ?? "0");
  518. errlg.EmailId = Convert.ToString(HttpContext.Current.Session["ContactEmail"] ?? "");
  519. }
  520. errlg.AddDate = DateTime.Now;
  521. errlg.ErrorDate = DateTime.Now;
  522. errlg.IsActive = true;
  523. errlg.IsDeleted = false;
  524. errlg.IsResolved = false;
  525. errlg.URL = string.Empty;
  526. ctx.tblErrorLog.Add(errlg);
  527. ctx.SaveChanges();
  528. }
  529. catch (Exception ex)
  530. {
  531. throw ex;
  532. }
  533. }
  534.  
  535. //
  536. // Description : Html helper for razor generated field name and field id
  537. //
  538. // Created On : 01 June 2015
  539. //
  540. // Author :
  541.  
  542. public static string FieldNameFor<T, TResult>(this HtmlHelper<T> html, Expression<Func<T, TResult>> expression)
  543. {
  544. return html.ViewData.TemplateInfo.GetFullHtmlFieldName(ExpressionHelper.GetExpressionText(expression));
  545. }
  546. public static string FieldIdFor<T, TResult>(this HtmlHelper<T> html, Expression<Func<T, TResult>> expression)
  547. {
  548. var id = html.ViewData.TemplateInfo.GetFullHtmlFieldId(ExpressionHelper.GetExpressionText(expression));
  549. // because "[" and "]" aren't replaced with "_" in GetFullHtmlFieldId
  550. return id.Replace('[', '_').Replace(']', '_');
  551. }
  552.  
  553. /// <summary>
  554. /// Over load method to getting the date in string format
  555. /// </summary>
  556. /// <param name="value">date</param>
  557. /// <returns>Date in string</returns>
  558. public static string GetDateString(this string value, string dateFormat)
  559. {
  560. if (value != null)
  561. return value.GetDate().Value.ToString(dateFormat);
  562. else
  563. return string.Empty;
  564. }
  565.  
  566. /// <summary>
  567. /// Method to getting the date in java string format yyyy/MM/dd
  568. /// </summary>
  569. /// <param name="value">string date</param>
  570. /// <returns>Java Script Date</returns>
  571. public static string GetJavaScriptDateString(this string value)
  572. {
  573. if (value != null)
  574. return value.GetDate().Value.ToString(Helper.yyyyMMdd);
  575. else
  576. return string.Empty;
  577. }
  578.  
  579. /// <summary>
  580. /// Helper method for Souce list
  581. /// </summary>
  582. /// <returns>Source List</returns>
  583. public static List<SelectListItem> SourceList()
  584. {
  585. var sourceList = new List<SelectListItem>()
  586. {
  587. new SelectListItem(){Value = "all", Text="All"},
  588. new SelectListItem(){Value = "direct", Text="Direct"},
  589. new SelectListItem(){Value = "intellicalc", Text="Intellicalc"}
  590. };
  591.  
  592. return sourceList;
  593. }
  594. /// <summary>
  595. /// Method for static date list
  596. /// </summary>
  597. /// <returns>Date List</returns>
  598. public static List<SelectListItem> DateList()
  599. {
  600. var CreatedItems = new List<SelectListItem>()
  601. {
  602. new SelectListItem(){Value = "0", Text="between"},
  603. new SelectListItem(){Value = "7", Text="last 7 days"},
  604. new SelectListItem(){Value = "14", Text="last 14 days"},
  605. new SelectListItem(){Value = "m", Text="this month"},
  606. new SelectListItem(){Value = "1m", Text="last month"},
  607. new SelectListItem(){Value = "2m", Text="last 2 months"},
  608. new SelectListItem(){Value = "y", Text="this year"},
  609. new SelectListItem(){Value = "1y", Text="last year"}
  610. };
  611.  
  612. return CreatedItems;
  613. }
  614.  
  615. /// <summary>
  616. /// Method for getting new lead staus of Product
  617. /// </summary>
  618. /// <param name="value"></param>
  619. /// <returns></returns>
  620. public static int GetNewLeadStatus(this int typeid)
  621. {
  622. if (typeid == (int)FinanceTypes.Mortgages)
  623. return (int)MortgageStatus.NewLead;
  624. else if (typeid == (int)FinanceTypes.Life)
  625. return (int)LifeStatus.NewLead;
  626. else if (typeid == (int)FinanceTypes.BuildingsOrContents)
  627. return (int)BuildingStatus.NewLead;
  628. else if (typeid == (int)FinanceTypes.Pensions)
  629. return (int)PensionsStatus.NewLead;
  630. else
  631. return (int)InvestmentStatus.NewLead;
  632. }
  633. /// <summary>
  634. /// Method is use to flush the memory of object
  635. /// </summary>
  636. /// <param name="obj"></param>
  637. public static void SafeDispose(this object obj)
  638. {
  639. if (obj != null)
  640. {
  641. ((IDisposable)obj).Dispose();
  642. }
  643. }
  644. /// <summary>
  645. /// Extension method for retrieving enum's description
  646. /// </summary>
  647. /// <param name="value"></param>
  648. /// <returns></returns>
  649. public static string GetEnumDescription(this Enum value)
  650. {
  651. FieldInfo fi = value.GetType().GetField(value.ToString());
  652.  
  653. DescriptionAttribute[] attributes =
  654. (DescriptionAttribute[])fi.GetCustomAttributes(
  655. typeof(DescriptionAttribute),
  656. false);
  657.  
  658. if (attributes != null &&
  659. attributes.Length > 0)
  660. return attributes[0].Description;
  661. else
  662. return value.ToString();
  663. }
  664. /// <summary>
  665. /// Helper method for referral Type List
  666. /// </summary>
  667. /// <returns>Referral Type List</returns>
  668. public static List<SelectListItem> ReferreTypeList()
  669. {
  670. var ReferreTypeList = new List<SelectListItem>()
  671. {
  672. new SelectListItem(){ Value="0", Text="All"},
  673. new SelectListItem(){ Value="1", Text="Primary Referral"},
  674. new SelectListItem(){ Value="2", Text="Secondary Referral"}
  675. };
  676.  
  677. return ReferreTypeList;
  678. }
  679.  
  680.  
  681.  
  682. public static int NoOFDayToCalculate(string TQuarter)
  683. {
  684. int NoOfDays = 0;
  685. string createdfrom = "";
  686. string createdto = "";
  687.  
  688. if (TQuarter == "1" || TQuarter == "9")
  689. {
  690. createdfrom = "01/01/" + DateTime.Now.Year.ToString();
  691. createdto = "31/03/" + DateTime.Now.Year.ToString();
  692. DateTime now = DateTime.Now;
  693. TimeSpan elapsed = now.Subtract(Convert.ToDateTime(createdfrom));
  694. double daysAgo = elapsed.TotalDays;
  695. DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
  696. DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
  697. NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
  698. if (Convert.ToInt32(daysAgo) < NoOfDays)
  699. {
  700. NoOfDays = Convert.ToInt32(daysAgo);
  701. }
  702.  
  703. }
  704. else if (TQuarter == "2")
  705. {
  706. createdfrom = "01/04/" + DateTime.Now.Year.ToString();
  707. createdto = "30/06/" + DateTime.Now.Year.ToString();
  708. DateTime now = DateTime.Now;
  709. TimeSpan elapsed = now.Subtract(Convert.ToDateTime(createdfrom));
  710. double daysAgo = elapsed.TotalDays;
  711. DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
  712. DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
  713. NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
  714. if (Convert.ToInt32(daysAgo) < NoOfDays)
  715. {
  716. NoOfDays = Convert.ToInt32(daysAgo);
  717. }
  718.  
  719. }
  720. else if (TQuarter == "3")
  721. {
  722. createdfrom = "01/07/" + DateTime.Now.Year.ToString();
  723. createdto = "30/09/" + DateTime.Now.Year.ToString();
  724. DateTime now = DateTime.Now;
  725. DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
  726. DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
  727. int elapsed = Convert.ToInt32((now - d1).TotalDays);
  728. NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
  729. if (elapsed < NoOfDays)
  730. {
  731. NoOfDays = elapsed;
  732. }
  733.  
  734. }
  735. else if (TQuarter == "4")
  736. {
  737. createdfrom = "01/10/" + DateTime.Now.Year.ToString();
  738. createdto = "31/12/" + DateTime.Now.Year.ToString();
  739. DateTime now = DateTime.Now;
  740. DateTime d1 = DateTime.ParseExact(createdfrom, "dd/MM/yyyy", null);
  741. DateTime d2 = DateTime.ParseExact(createdto, "dd/MM/yyyy", null);
  742. int elapsed = Convert.ToInt32((now - d1).TotalDays);
  743. NoOfDays = Convert.ToInt32((d2 - d1).TotalDays);
  744. if (elapsed < NoOfDays)
  745. {
  746. NoOfDays = elapsed;
  747. }
  748. }
  749. return NoOfDays;
  750. }
  751. public static string GetRandomString(int length,int type=0)
  752. {
  753. if (length > 0)
  754. {
  755. string allowedChars = string.Empty;
  756. if (type == 1)//Capital alphabets only
  757. {
  758. allowedChars = "ABCDEFGHJKLMNOPQRSTUVWXYZ";
  759. }
  760. else
  761. {
  762. allowedChars = "abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ0123456789";
  763. }
  764. char[] chars = new char[length];
  765. Random rd = new Random();
  766. for (int i = 0; i < length; i++)
  767. {
  768. chars[i] = allowedChars[rd.Next(0, allowedChars.Length)];
  769. }
  770. return new string(chars);
  771. }
  772. else
  773. {
  774. return string.Empty;
  775. }
  776. }
  777.  
  778. #region Encrypt/Decrypt string to Hex
  779. public static string ConvertStringToHex(String input, System.Text.Encoding encoding)
  780. {
  781. Byte[] stringBytes = encoding.GetBytes(input);
  782. StringBuilder sbBytes = new StringBuilder(stringBytes.Length * 2);
  783. foreach (byte b in stringBytes)
  784. {
  785. sbBytes.AppendFormat("{0:X2}", b);
  786. }
  787. return sbBytes.ToString();
  788. }
  789. public static string ConvertHexToString(String hexInput, System.Text.Encoding encoding)
  790. {
  791. int numberChars = hexInput.Length;
  792. byte[] bytes = new byte[numberChars / 2];
  793. for (int i = 0; i < numberChars; i += 2)
  794. {
  795. bytes[i / 2] = Convert.ToByte(hexInput.Substring(i, 2), 16);
  796. }
  797. return encoding.GetString(bytes);
  798. }
  799. #endregion Encrypt/Decrypt string to Hex
  800. }
  801.  
  802. #region[Getting value for session]
  803. /// <summary>
  804. /// Date: 21/Oct/2015
  805. /// To getting values from session
  806. /// </summary>
  807. public static class SessionHelper
  808. {
  809. /// <summary>
  810. /// To get User id from session
  811. /// </summary>
  812. public static int UserId
  813. {
  814. get
  815. {
  816. return HttpContext.Current.Session["LoggedInUserId"] != null ? Convert.ToInt32(HttpContext.Current.Session["LoggedInUserId"]) : 0;
  817. }
  818. }
  819.  
  820. /// <summary>
  821. /// To get Account id from session
  822. /// </summary>
  823. public static int AccountId
  824. {
  825. get
  826. {
  827. return HttpContext.Current.Session["LoggedInUserAccountId"] != null ? Convert.ToInt32(HttpContext.Current.Session["LoggedInUserAccountId"]) : 0;
  828. }
  829.  
  830. }
  831.  
  832. /// <summary>
  833. /// To get default settings from session
  834. /// </summary>
  835. public static int DefaultsettingId
  836. {
  837. get
  838. {
  839. return HttpContext.Current.Session["DefaultsettingId"] != null ? Convert.ToInt32(HttpContext.Current.Session["DefaultsettingId"]) : 0;
  840. }
  841.  
  842. }
  843.  
  844. public static string DefaultCurrency
  845. {
  846. get
  847. {
  848. return (HttpContext.Current.Session["DefaultCurrency"] != null && !string.IsNullOrEmpty((HttpContext.Current.Session["DefaultCurrency"]).ToString())) ? (HttpContext.Current.Session["DefaultCurrency"]).ToString() : "£";
  849. }
  850. }
  851.  
  852.  
  853. }
  854. #endregion
  855.  
  856.  
  857. }
  858.  
  859. namespace Select2Demo.Helpers
  860. {
  861. //I found this somewhere online...can't remember the source. Returns a jsonp instead of a standard json result.
  862. public class JsonpResult : JsonResult
  863. {
  864. public override void ExecuteResult(ControllerContext context)
  865. {
  866. if (context == null)
  867. {
  868. throw new ArgumentNullException("context");
  869. }
  870. var request = context.HttpContext.Request;
  871. var response = context.HttpContext.Response;
  872. string jsoncallback = (context.RouteData.Values["callback"] as string) ?? request["callback"];
  873. if (!string.IsNullOrEmpty(jsoncallback))
  874. {
  875. if (string.IsNullOrEmpty(base.ContentType))
  876. {
  877. base.ContentType = "application/x-javascript";
  878. }
  879. response.Write(string.Format("{0}(", jsoncallback));
  880. }
  881. base.ExecuteResult(context);
  882. if (!string.IsNullOrEmpty(jsoncallback))
  883. {
  884. response.Write(")");
  885. }
  886. }
  887. }
  888. }
  889.  
  890. @{
  891. string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/AgentFeeSetting.js");
  892.  
  893. }
  894.  
  895. <input type="hidden" id="hdnUpdateUrl" value="@Url.Action("AgentFeeSettingAddUpdate", "agent_fee_setting")" />
  896. <input type="hidden" id="hdnlogoutUrl" value="@Url.Action("index", "home")" />
  897.  
  898. <tbody>
  899. @{
  900. int c = 0;
  901. if (Model != null)
  902. {
  903. if (Model.Count() > 0)
  904. {
  905. foreach (var data in Model)
  906. {
  907. var trId = "trId" + data.AgentId;
  908. var hdnagentId = "hdnagentId" + data.AgentId;
  909. var hdnagentfee = "hdnagentfee" + data.AgentId;
  910. var hdnprocfee = "hdnprocfee" + data.AgentId;
  911. var spagentname = "spagentname" + data.AgentId;
  912. var spprocurationfee = "spprocurationfee" + data.AgentId;
  913. var spagentfee = "spagentfee" + data.AgentId;
  914.  
  915. <tr id="@trId" @(c % 2 == 0 ? "" : "class=odd")>
  916. <td style="width: 70px;">
  917. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  918. {
  919. <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;">
  920. }
  921. </td>
  922. <td>
  923. <span id="@spagentname">@data.AgentName</span>
  924. <input type="hidden" id="@hdnagentId" value="@data.AgentId" />
  925. </td>
  926. <td>
  927. <span id="@spprocurationfee">@data.ProcFee %</span>
  928. <input type="hidden" id="@hdnprocfee" value="@data.ProcFee" />
  929. </td>
  930. <td>
  931. <span id="@spagentfee">@data.ClientFee</span>
  932. <input type="hidden" id="@hdnagentfee" value="@data.ClientFee" />
  933. </td>
  934. </tr>
  935. c++;
  936. }
  937. }
  938. }
  939. }
  940.  
  941.  
  942.  
  943. </tbody>
  944.  
  945. @model List<Occfinance.Models.AccountVisits>
  946.  
  947. <div id="accountVisit_tab" class="dash-table re-mortgage divbordr">
  948. @if (Model != null && Model.Count > 0)
  949. {
  950. <table class="bordered-table" id="tblAccountVisit">
  951. <thead>
  952. <tr class="gray-row">
  953. <td><b>Introducer</b></td>
  954. <td><b>Branch</b></td>
  955. <td><b>Visit Frequency</b></td>
  956. <td><b>Note</b></td>
  957. <td><b>Action</b></td>
  958. </tr>
  959. </thead>
  960. <tbody>
  961. @{int i = 0;}
  962. @foreach (var item in Model)
  963. {
  964. <tr>
  965. <td>
  966. <input type="hidden" class="hdnId" value="@item.IntroducerVisitsId" />
  967. @item.Introducer
  968. </td>
  969. <td>@item.Branch</td>
  970. <td>@item.VisitFrequencyDay, @item.VisitFrequency </td>
  971. <td><input type="hidden" id="txtNote" class="txtNote" />@item.Note</td>
  972. <td>
  973. <div>
  974. @if (item.TransferedFromId > 0 && item.Status == 0)
  975. {
  976. <input type="button" class="btn btn-blue margin5 width99" value="Accept" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '2')" /><br />
  977. <input type="button" class="btn btn-blue margin5 width99" value="Reject" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '3')" />
  978. }
  979. else
  980. {
  981. <input type="button" class="btn btn-blue margin5 width99" value="Complete" onclick="UpdateAVStatus('@item.IntroducerVisitsId', '1')"/><br />
  982. <input type="button" class="btn btn-blue margin5 width99" value="Transfer" onclick="GetSimilarBrokerList('@item.IntroducerVisitsId')" />
  983. }
  984. </div>
  985. </td>
  986. </tr>
  987. }
  988.  
  989.  
  990. </tbody>
  991. </table>
  992. }
  993. else
  994. {
  995. <div>
  996. <b class="nodata">No data</b>
  997. </div>
  998. }
  999.  
  1000. </div>
  1001.  
  1002. @{
  1003. List<Occfinance.Models.AdminTeam> teams = new List<Occfinance.Models.AdminTeam>();
  1004. if (ViewBag.AdminTeamList != null)
  1005. {
  1006. teams = (List<Occfinance.Models.AdminTeam>)ViewBag.AdminTeamList;
  1007. }
  1008. int userid = Convert.ToInt32(Session["LoggedInUserAccountId"] ?? 0);
  1009. string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/AdminTeamSettings.js");
  1010. }
  1011.  
  1012. <tbody>
  1013. @{
  1014. if (teams.Count() > 0)
  1015. {
  1016.  
  1017. for (int c = 0; c < teams.Count(); c++)
  1018. {
  1019. var trid = "trid" + teams[c].UserId;
  1020. <tr id="@trid" @(c % 2 == 0 ? "" : "class=odd")>
  1021. <td >
  1022. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  1023. {
  1024. <img title="@Occfinance.Resource.Edit" alt="Edit" onclick="return showdetails(@teams[c].UserId);" id="imgedit" src="@Url.Content("~/Images/edit.png")" >
  1025. }
  1026. @if (userid != @teams[c].AccountId)
  1027. {
  1028. <img title="@Occfinance.Resource.Delete" onclick="return DeleteClient(@teams[c].UserId, '@trid')" alt="Delete" id="imgdelete" src="@Url.Content("~/Images/delete.gif")" >
  1029. }
  1030.  
  1031. </td>
  1032. <td>
  1033. @teams[c].AdminTeamName
  1034. </td>
  1035. <td>
  1036. @teams[c].AdminName
  1037. </td>
  1038. <td >@teams[c].Brokers</td>
  1039. </tr>
  1040. }
  1041. }
  1042. }
  1043.  
  1044. </tbody>
  1045.  
  1046. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  1047. {
  1048. <input type="hidden" value="@Url.Content("~/Images/edit.png")" id="editUrl" />
  1049.  
  1050. <input title="@Occfinance.Resource.Refresh" onclick="return Reset()" id="btnrefreshteam" type="image" src="@Url.Content("~/Images/refreshsmall.png")" />
  1051.  
  1052. @{
  1053. ViewBag.Title = "_AdvisorReportPartial";
  1054. Layout = null;
  1055. Summary _summary = new Summary();
  1056. var advisorData = new List<AdvisorReport>();
  1057. if (ViewBag.advisorlist != null)
  1058. {
  1059. advisorData = (List<AdvisorReport>)ViewBag.advisorlist;
  1060. }
  1061. var PreOfferData = new List<AdvisorReport>();
  1062. var PostOfferData = new List<AdvisorReport>();
  1063. var CompleteData = new List<AdvisorReport>();
  1064. var providers = new List<string>();
  1065. var solicitor = new List<string>();
  1066. if (ViewBag.PreOfferData != null)
  1067. {
  1068. PreOfferData = (List<AdvisorReport>)ViewBag.PreOfferData;
  1069. providers = PreOfferData.Select(c => c.provider.ToLower().Trim()).Distinct().ToList();
  1070. }
  1071. if (ViewBag.PostOfferData != null)
  1072. {
  1073. PostOfferData = (List<AdvisorReport>)ViewBag.PostOfferData;
  1074. solicitor = PostOfferData.Select(c => c.solicitor.ToLower().Trim()).Distinct().ToList();
  1075. }
  1076. if (ViewBag.CompleteData != null)
  1077. {
  1078. CompleteData = (List<AdvisorReport>)ViewBag.CompleteData;
  1079. }
  1080. if (ViewBag.Summary != null)
  1081. {
  1082. _summary = (Summary)ViewBag.Summary;
  1083. }
  1084. }
  1085.  
  1086.  
  1087. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsPrintAllData)
  1088. {
  1089. <a title="Generate Pdf" onclick="return PrePrint('divdocument');" href="javascript:void(0);" id="iconpdf">
  1090. <img src="@Url.Content("~/Content/images/PDFicon.png")" class="adviserReport2" />
  1091. </a>
  1092. <a class="aback" title="Print Report Data" onclick="return PrintDocument('divdocumentForPrint');" href="javascript:void(0);" id="iconprint">
  1093. <img src="@Url.Content("~/Content/images/print.png")" class="adviserReport2" />
  1094. </a>
  1095. }
  1096. <a title="Send Mail" href="javascript:void(0);" id="iconmail">
  1097. <img src="@Url.Content("~/Content/images/mail-icon.png")" class="adviserReport2" />
  1098. </a>
  1099.  
  1100. <td class="txtAlignRight">@Html.Raw(ViewBag.AdvisorName)</td>
  1101.  
  1102. <td><b>Total Leads:</b></td>
  1103. <td class="txtAlignRight">
  1104. @_summary.NewLeads
  1105. </td>
  1106.  
  1107. @if (providers.Count > 0)
  1108. {
  1109. <table id="tblpre">
  1110. <tr>
  1111. <td>
  1112. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsPrintAllData)
  1113. {
  1114. <a class="aback" title="Print Report Data" onclick="return PrintDocument('divdocument1Print');" href="javascript:void(0);">
  1115. <img src="@Url.Content("~/Content/images/print.png")" class="adviserReport2" id="preprint" />
  1116. </a>
  1117. }
  1118. <table cellspacing="0" >
  1119. <thead>
  1120. <tr>
  1121. <td ><b>Date Submitted</b></td>
  1122. <td ><b>Client Name</b></td>
  1123. <td ><b>Policy Reference #</b></td>
  1124. <td ><b>Introducer </b></td>
  1125. <td ><b>Negotiators Name</b></td>
  1126. <td ><b>Mortgage Amount</b></td>
  1127. <td ><b>Procuration Fee</b></td>
  1128. </tr>
  1129. </thead>
  1130. <tbody>
  1131. @foreach (var name in providers)
  1132. {
  1133. string _Pname = "N/A";
  1134. if (PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()).Count() > 0)
  1135. {
  1136. <tr class="gray-row">
  1137. <td colspan="8" >
  1138. <b class="capitalize">
  1139. Provider Name:
  1140. @if (!string.IsNullOrEmpty(name))
  1141. {
  1142. _Pname = name;
  1143. }
  1144. @_Pname
  1145. </b>
  1146. </td>
  1147. </tr>
  1148. foreach (var item in PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()))
  1149. {
  1150. <tr>
  1151. <td >@(item.SubmitDate.HasValue ? item.SubmitDate.Value.ToString("dd/MM/yyyy") : "")</td>
  1152. <td >@item.ClinetName</td>
  1153. <td >@item.policyreference</td>
  1154. <td >@item.AgentName</td>
  1155. <td >@item.NegRef</td>
  1156. <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.MortgageAmount, 2))</td>
  1157. <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.ProcurationFee, 2))</td>
  1158. </tr>
  1159. }
  1160. }
  1161. }
  1162. </tbody>
  1163. </table>
  1164. <br />
  1165. </td>
  1166. </tr>
  1167. </table>
  1168. }
  1169. else
  1170. {
  1171. <div></div>
  1172. <div>
  1173. <b class="nodata">No data</b>
  1174. </div>
  1175. }
  1176.  
  1177. <table id="tblcomplete" >
  1178. <thead>
  1179. <tr>
  1180. <td ><b>Date App Submitted</b></td>
  1181. <td ><b>Date Offered</b></td>
  1182. <td ><b>Date Completed</b></td>
  1183. <td ><b>Client Name</b></td>
  1184. <td ><b>Introducer</b></td>
  1185. <td ><b>Negotiators Name</b></td>
  1186. <td ><b>Mortgage Amount</b></td>
  1187. </tr>
  1188. </thead>
  1189. <tbody>
  1190. @foreach (var item in CompleteData)
  1191. {
  1192. <tr>
  1193. <td >@(item.SubmitDate.HasValue ? item.SubmitDate.Value.ToString("dd/MM/yyyy") : "")</td>
  1194. <td >@(item.OfferDate.HasValue ? item.OfferDate.Value.ToString("dd/MM/yyyy") : "")</td>
  1195. <td >@(item.CompleteDate.HasValue ? item.CompleteDate.Value.ToString("dd/MM/yyyy") : "")</td>
  1196. <td >@item.ClinetName</td>
  1197. <td >@item.AgentName</td>
  1198. <td >@item.NegRef</td>
  1199. <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(item.MortgageAmount, 2))</td>
  1200. </tr>
  1201. }
  1202. </tbody>
  1203. </table>
  1204.  
  1205. <td class="txtAlignRight">£ @string.Format("{0:#,###0.00}", Math.Round(_summary.TotalAppSubAmount, 2))</td>
  1206.  
  1207. <img src="@Url.Content("~/Content/images/Collapse.png")" width="20" height="20" alt="Collapse" onclick="ExpandColapse(this);" style="float:right;" id="expcol" />
  1208.  
  1209. @foreach (var name in providers)
  1210. {
  1211. string _Pname = "N/A";
  1212. if (PreOfferData.Where(c => c.provider.ToLower().Trim() == name.ToLower().Trim()).Count() > 0)
  1213. {
  1214. <tr>
  1215. <td colspan="8" style="border: 1px solid #808080; padding: 10px; background-color:#DDDDDD;">
  1216. <b style="text-transform: capitalize;">
  1217. Provider Name:
  1218. @if (!string.IsNullOrEmpty(name))
  1219. {
  1220. _Pname = name;
  1221. }
  1222. @_Pname
  1223. </b>
  1224. </td>
  1225. </tr>
  1226.  
  1227. <h3 class="header nodatah" onclick="ExpandColapse('expcol1');" style="cursor: pointer;">
  1228.  
  1229. <table id="tblpost" cellspacing="0" class="content" style="width: 100%; display: table !important;">
  1230.  
  1231.  
  1232. <script type="text/javascript">
  1233. function PrintDocument(tagid) {
  1234. $("#preprint").hide();
  1235. $("#postofferprint").hide();
  1236. $("#expcol").hide();
  1237. $("#expcol1").hide();
  1238. $("#expcol2").hide();
  1239. $("#expcol3").hide();
  1240. $("#expcol4").hide();
  1241. $("#expcol5").hide();
  1242. $("#expcol6").hide();
  1243. $("#tblpre").show();
  1244. $("#tblcomplete").show();
  1245. $("#tblpost").show();
  1246. $("#tblSummary").show();
  1247. $("#tblToatl").show();
  1248. $("#tblToatlproc").show();
  1249. $("#tblpost").show();
  1250. var oIframe = document.getElementById('ifrmPrint');
  1251. var oContent = $('#' + tagid).html();
  1252. var oDoc = (oIframe.contentWindow || oIframe.contentDocument);
  1253. if (oDoc.document) oDoc = oDoc.document;
  1254. 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>"
  1255. + oContent + "<table style='background-color: #D9D9D9; clear: both; margin: 20px 0 16px;padding: 16px 16px 0;'><td>" +
  1256. "<div style = 'float: left;'> &copy; " + '@System.DateTime.Now.Year' +
  1257. " OCC Finance Technology Ltd. Registered trademarks IntelliCalc&reg;, AppTrack&reg;. All rights reserved </div>" +
  1258. "<td/> </table></body>");
  1259. oDoc.close();
  1260. $("#expcol").show();
  1261. $("#expcol1").show();
  1262. $("#expcol2").show();
  1263. $("#expcol3").show();
  1264. $("#expcol4").show();
  1265. $("#expcol5").show();
  1266. $("#expcol6").show();
  1267. $("#preprint").show();
  1268. $("#postofferprint").show();
  1269. }
  1270. function PrePrint(tagid) {
  1271. var _isReportAv = '@ViewBag.advcreatedfrom';
  1272. var url = '@Url.Action("SaveAdvisorPDF", "Apptrack")';
  1273. window.location.href = url;
  1274. }
  1275. function ExpandColapse(objid) {
  1276. var imgfile = $("#" + objid).attr("src").toString();
  1277. if (imgfile.toString().indexOf("expand.png") != -1) {
  1278. $("#" + objid).attr("src", '@Url.Content("~/Content/images/Collapse.png")');
  1279. }
  1280. else {
  1281. $("#" + objid).attr("src", '@Url.Content("~/Content/images/expand.png")');
  1282. }
  1283. $("#" + objid).parent().next().slideToggle(50, function () { });
  1284. }
  1285. </script>
  1286. <script type="text/javascript">
  1287. $(function () {
  1288.  
  1289. $('#iconmail').click(function () {
  1290. $('#lblerrorSentEmail').html('');
  1291. $('#txtToEmail').val('');
  1292. $('#pdfDownload').html('Adviser.pdf');
  1293. $('#hdnSendPdf').val('@Url.Action("SaveAdvisorPDF", "Apptrack")');
  1294. $('#PdfReportDialog').modal('show');
  1295. });
  1296.  
  1297. $('#pdfDownload').click(function () {
  1298. return PrePrint('divdocument');
  1299. });
  1300.  
  1301.  
  1302.  
  1303. });
  1304.  
  1305.  
  1306. </script>
  1307.  
  1308. @{
  1309. int brkSiglnt = 0;
  1310. var brkname = "";
  1311. var brkcontact = "";
  1312. try
  1313. {
  1314. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  1315. int brId = Model != null ? Model.Broker : 0;
  1316. var brkobj = ctx.tblusers.Where(c => c.userid == brId).FirstOrDefault();
  1317.  
  1318. var signature = "";
  1319. if (brkobj != null)
  1320. {
  1321.  
  1322. brkname = brkobj.brokername;
  1323. brkcontact = (string.IsNullOrWhiteSpace(brkobj.SecondaryContact) ? brkobj.PrimaryContact : brkobj.SecondaryContact);
  1324. }
  1325. brkSiglnt = signature.Length;
  1326. }
  1327. catch { }
  1328. Layout = null;
  1329. ViewBag.ContactId = Model.contactid;
  1330. ViewBag.Email = Model.Email;
  1331. var _maxLength = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["MaxTextMsgLength"] ?? "160");
  1332. }
  1333.  
  1334. @Html.HiddenFor(model => model.AppicationType, new { @id = "applicationid" })
  1335.  
  1336. @Html.TextBoxFor(model => model.Email, new { @name = "_DSemailaddress", @id = "txtemail", @class = "idleField txtField txt_field" })
  1337.  
  1338. @Html.DropDownListFor(x => x.Method, (IEnumerable<SelectListItem>)ViewBag.methods, new { id = "_DSmethod", @class = "searchselect" })
  1339.  
  1340. @Html.Hidden("OtherApplicantId", Convert.ToString(Model.OtherApplicant != null ? Model.OtherApplicant.OtherApplicantId : 0))
  1341.  
  1342. <input type="text" value="@(Model.OtherApplicant != null ? Model.OtherApplicant.SurName : "")" id="osname" maxlength="300" class="idleField txtField capitalField txt_field">
  1343. <img src="@Url.Content("~/Content/Layout/images/mortgagetab1.png")">
  1344.  
  1345. @functions{
  1346. public string TrimAddress(string address)
  1347. {
  1348. return address.Length > 30 ? address.Substring(0, 30) : address;
  1349. }
  1350. public string GetAddressAndLender(int financeId)
  1351. {
  1352. try
  1353. {
  1354. string result = string.Empty;
  1355. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  1356. var product = (from con in ctx.tblcontacts
  1357. join fin in ctx.tblfinances on con.contactid equals fin.contact
  1358. where fin.financeid == financeId
  1359. select new
  1360. {
  1361. results = fin.Address1 + ", " + fin.provider
  1362.  
  1363. }).FirstOrDefault();
  1364. return product.results;
  1365. }
  1366. catch
  1367. {
  1368. return string.Empty;
  1369. }
  1370. }
  1371. public bool IsDeleted(int financeId)
  1372. {
  1373. bool result = false;
  1374. try
  1375. {
  1376.  
  1377. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  1378. 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;
  1379. return result;
  1380. }
  1381. catch
  1382. {
  1383. return result;
  1384. }
  1385. }
  1386. }
  1387.  
  1388. @helper MortgageProductDetails(int j, List<clsCaseDetails> lstCaseDetails)
  1389. {
  1390. <a class="csshref" onclick="GetMortgageDetails(@j, @lstCaseDetails[j].FinanceId, @lstCaseDetails[j].ContactId)">
  1391. <div class="divMortgageLogo">
  1392. <p>
  1393. @TrimAddress(lstCaseDetails[j].Address) <br />
  1394. @lstCaseDetails[j].PostCode <br />
  1395. £@Math.Round(Convert.ToDecimal(lstCaseDetails[j].Value), 2)<span>, </span>
  1396. @lstCaseDetails[j].Type
  1397. </p>
  1398. </div>
  1399. </a>
  1400. }
  1401. @helper LifeProductDetails(int j, List<clsCaseDetails> lstCaseDetails)
  1402. {
  1403. <a class="csshref" onclick="GetLifeDetails(@j, @lstCaseDetails[j].FinanceId, @lstCaseDetails[j].ContactId)">
  1404. <div class="divLifeLogo">
  1405. <p>
  1406. @TrimAddress(lstCaseDetails[j].Address) <br />
  1407. @lstCaseDetails[j].PostCode <br />
  1408. £@Math.Round(Convert.ToDecimal(lstCaseDetails[j].Value), 2)<br />
  1409. @lstCaseDetails[j].Type
  1410. </p>
  1411. </div>
  1412. </a>
  1413. }
  1414.  
  1415. <div id="divMortgagePropertyLogos">
  1416.  
  1417. @if (Model.addproducts != null)
  1418. {
  1419. List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
  1420. if (Model.addproducts.MortgageProduct.Count > 0)
  1421. {
  1422. var mortgagePRDS = Model.addproducts.MortgageProduct.OrderBy(c => c.financeid).ToList();
  1423. var lstFinanceIds = mortgagePRDS.Select(res => res.financeid).ToList();
  1424.  
  1425.  
  1426.  
  1427. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  1428. lstCaseDetails = (from fin in ctx.tblfinances
  1429. where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
  1430. join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
  1431. select new clsCaseDetails()
  1432. {
  1433. FinanceId = fin.financeid,
  1434. ContactId = fin.contact,
  1435. 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)),
  1436. PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
  1437. Value = (fin.amount == null) ? 0.0M : fin.amount,
  1438. Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
  1439. }).ToList();
  1440. var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
  1441. <div class="col-md-12 mobilepaddNone">
  1442.  
  1443. @for (var i = 0; i < lstCaseDetails.Count; i++)
  1444. {
  1445. <div class="col-md-3 col-sm-6 mobilepaddNone">
  1446. @MortgageProductDetails(i, lstCaseDetails)
  1447. </div>
  1448. }
  1449. </div>
  1450. }
  1451. }
  1452. </div>
  1453. <div class="tabs_paddedcontent select_custome">
  1454. <div class="col-md-3 col-sm-3 dletbtn">
  1455. @*<button class="delete button btn-blue" id="deleteMortgagebutton" onclick="DeleteLeadsMortgage();"><i class="fa fa-trash-o" aria-hidden="true"></i>Delete</button>*@
  1456. <img onclick="DeleteLeadsMortgage();" id="deleteMortgagebutton" src="/Images/delete.png" class="delete button">
  1457. </div>
  1458. <div class="col-md-3 col-sm-3 viewbtnwidth">
  1459. <div class="view_btn">
  1460. @*<button class="back button btn-blue" id="imgbtnBackToMortgageLogos" onclick="BackToMortgageLogos();"><i class="fa fa-caret-left" aria-hidden="true"></i>View Client Portfolio</button>*@
  1461. <img onclick="BackToMortgageLogos();" id="imgbtnBackToMortgageLogos" src="/Images/viewclientportfolio.png" class="back button">
  1462. <a id="ToMortgageiconpdf" href="javascript:void(0);" onclick="return PDFPrint('Mortgage');" title="Generate Pdf">
  1463. <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
  1464. </a>
  1465. </div>
  1466. </div>
  1467. <div class="col-md-5 col-sm-5">
  1468. <select id="financemortageproductselect" data-pastvalue="" data-type="Mortgage" class="financeproductselect searchselect">
  1469. @if (Model.addproducts != null)
  1470. {
  1471. if (Model.addproducts.MortgageProduct.Count > 0)
  1472. {
  1473. var mortgagePRDS = Model.addproducts.MortgageProduct.OrderBy(c => c.financeid).ToList();
  1474. foreach (financeID f in mortgagePRDS)
  1475. {
  1476.  
  1477. //Start:- Updated On 2-4-2014 regarding tab and product selection
  1478. int financeId = Model.FinanceId;
  1479. if (!IsDeleted(f.financeid))
  1480. {
  1481. if (financeId == f.financeid)
  1482. {
  1483. <option class="clsOption" value="@f.financeid" selected="selected">@f.name</option>
  1484. }
  1485. else
  1486. {
  1487. <option class="clsOption" value="@f.financeid">@f.name</option>
  1488. }
  1489. }
  1490. }
  1491. }
  1492. }
  1493. </select>
  1494. </div>
  1495. <div class="col-md-1 col-sm-1">
  1496. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  1497. {
  1498. <input class="addmortageproduct pull-right btn-blue icon-plus" id="addmortgagebutton" value="Add" type="button">
  1499. }
  1500. </div>
  1501. <div id="financeproduct0" data_objid="{656F999E-E838-4CF8-BAA5-8464B8044BA9}" class="financeproduct financeid43047">
  1502. @Html.HiddenFor(model => model.Mortgage.mortage_financeid, new { @name = "finance-0-financeid" })
  1503. @Html.HiddenFor(model => model.Mortgage.mortage_financetype, new { @name = "finance-0-type", @id = "mortage_status" })
  1504. @Html.HiddenFor(model => model.Mortgage.mortage_contactid, new { @id = "mortage_contactid" })
  1505. @Html.HiddenFor(model => model.Mortgage.mortage_AppicationType, new { @id = "mortage_applicationtype" })
  1506. @Html.HiddenFor(model => model.Mortgage.newremortgagedate, new { @id = "newremortgagedate" })
  1507. @Html.HiddenFor(model => model.Mortgage.remortgagecontact, new { @id = "remortgagecontact" })
  1508. <table class="formtable">
  1509. <tbody>
  1510. <tr class="row">
  1511. <td class="col-md-3 col-md-3 label test"><label>Status:</label></td>
  1512. <td class="col-md-3 value">
  1513. @Html.DropDownListFor(model => model.Mortgage.mortage_mortgagesubtype, (IEnumerable<SelectListItem>)ViewBag.MortgageStatusList, new { id = "mortagestatus", @name = "_DSaid", @class = "searchselect" })
  1514. </td>
  1515. <td class="col-md-3 label colFinanceSubstatus mort_sub_s_tatus1"><label>Sub-Status:</label></td>
  1516. <td class="col-md-3 value colFinanceSubstatus mort_sub_s_tatus1">
  1517. <select id="mortgage_substatus" name="mortgage_substatus">
  1518. <option selected="selected" value="0">None</option>
  1519. </select>
  1520. </td>
  1521. </tr>
  1522. <tr class="row">
  1523. <td class="col-md-3 label test"> <label>Lender:</label></td>
  1524. <td class="value col-md-3">
  1525. @Html.HiddenFor(model => model.Mortgage.mortage_lender, new { @name = "finance-0-provider", @id = "mortgage_lender", @tooltip = Model.Mortgage.mortage_lender })
  1526.  
  1527. </td>
  1528. <td class="col-md-3 label test"><label>Mortgage Acc. No:</label></td>
  1529. <td class="value col-md-3">
  1530. @Html.TextBoxFor(model => model.Mortgage.mortage_mortageaccountno, new { @name = "finance-0-policyreference", @class = "idleField txtField capitalField txt_field", @id = "mortgage_accno" })
  1531. </td>
  1532. </tr>
  1533. <tr class="row">
  1534. <td class="col-md-3 label test"><label>Mortgage Amount: £</label></td>
  1535. <td class="value col-md-3">
  1536. @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);" })
  1537. </td>
  1538.  
  1539. <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
  1540. <td class="value col-md-3">
  1541. @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);" })
  1542. <input id="Mortgage_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionMortgageList();" class="btn-blue">
  1543. </td>
  1544. </tr>
  1545. <tr class="row">
  1546. <td class="col-md-3 label test"><label>Rate: %</label></td>
  1547. <td class="value col-md-3">
  1548. @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);" })
  1549. </td>
  1550. <td class="col-md-3 label test"><label>Rate Type:</label></td>
  1551. <td class="value col-md-3">
  1552. @Html.HiddenFor(model => model.Mortgage.RateType, new { @id = "TypeRate" })
  1553. @{
  1554. var fixedRates = false;
  1555. var trackerRates = false;
  1556. if (Model.Mortgage.RateType == 1)
  1557. {
  1558. fixedRates = true;
  1559. }
  1560. if (Model.Mortgage.RateType == 2)
  1561. {
  1562. trackerRates = true;
  1563. }
  1564. }
  1565. <input type="radio" name="_Rate" id="RateFix" value="RateFix" onclick="ClickFix();" checked="@fixedRates">&nbsp;Fixed &nbsp;&nbsp;
  1566. <input type="radio" name="_Rate" id="RateTracker" value="RateTracker" onclick="ClickTracker();" checked="@trackerRates">
  1567. Tracker
  1568. </td>
  1569. </tr>
  1570. <!-- MORTGAGE -->
  1571. <tr class="row">
  1572. <td class="label col-md-3"><label>Client Fee: £</label></td>
  1573. <td class="value col-md-3">
  1574. @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" })
  1575. </td>
  1576. <td class="col-md-3 label test"><label>Monthly Payment: £</label></td>
  1577. <td class="value col-md-3">
  1578. @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);" })
  1579. </td>
  1580. </tr>
  1581. <tr class="row">
  1582. <td class="label col-md-3"><label>Deposit: £</label></td>
  1583. <td class="value col-md-3 fontsize12">
  1584. @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);" })
  1585. Income £
  1586. @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);" })
  1587. </td>
  1588. <td class="label col-md-3"><label>Property Value: £</label></td>
  1589. <td class="value col-md-3 fontsize12">
  1590. @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);" })
  1591. &nbsp;&nbsp;Term
  1592. <img src="~/Images/info-icon.png" title="Repayment term for mortgage in years">
  1593. @Html.TextBoxFor(model => model.Mortgage.mortage_rterm, new { @name = "finance-0-mor_rterm", @class = "idleField txtField txt_field width60px", @id = "mortgage_term" })
  1594. years
  1595. </td>
  1596. </tr>
  1597. <tr class="row">
  1598. <td class="col-md-3 label test"><label>Mortgage Type</label>:</td>
  1599. <td class="col-md-3">
  1600. @Html.DropDownListFor(model => model.Mortgage.mortage_reason, (IEnumerable<SelectListItem>)ViewBag.MortgageReasonList, new { @name = "finance-0-mor_mortgagesubtype", @id = "mortgage_reason", @class = "searchselect" })
  1601.  
  1602. </td>
  1603. <td class="col-md-3 label test"><label>Remortgage Date:</label></td>
  1604. <td class="value col-md-3">
  1605. @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" })
  1606. </td>
  1607. </tr>
  1608. <tr class="row">
  1609. <td class="col-md-3 label test"><label>Remortgage Contact:</label></td>
  1610. <td class="value col-md-3">
  1611. @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" })
  1612. </td>
  1613. </tr>
  1614. <tr class="row">
  1615. <td class="col-md-3 label test"><label>Exchange Date:</label></td>
  1616. <td class="value col-md-3">
  1617. @Html.TextBoxFor(mdoel => mdoel.Mortgage.mortage_exchanged, new { @name = "finance-0-mor_exchanged", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_exchangedate" })
  1618. </td>
  1619. <td class="col-md-3 label test"><label>Completion Date:</label></td>
  1620. <td class="value col-md-3">
  1621. @Html.TextBoxFor(model => model.Mortgage.mortage_completed, new { @name = "finance-0-mor_completed", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_completiondate" })
  1622. </td>
  1623. </tr>
  1624. <tr class="row">
  1625. <td class="label col-md-3"><label>Solicitor:</label></td>
  1626. <td colspan="3" class="value col-md-3">
  1627.  
  1628. @Html.HiddenFor(model => model.Mortgage.mortage_solicitor, new { @name = "finance-0-mor_solicitor", @id = "mortgage_solicitor", @tooltip = Model.Mortgage.mortage_solicitor })
  1629.  
  1630. </td>
  1631. </tr>
  1632. <tr class="row">
  1633. <td class="col-md-3 label test"><label>Live:</label></td>
  1634. <td class="value col-md-3">
  1635. @Html.TextBoxFor(model => model.Mortgage.mortage_datelive, new { @name = "finance-0-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_datelive" })
  1636. </td>
  1637. <td class="col-md-3 label test"><label>Expires:</label></td>
  1638. <td class="value col-md-3">
  1639. @Html.TextBoxFor(model => model.Mortgage.mortage_expires, new { @name = "finance-0-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "mortgage_expires" })
  1640. </td>
  1641. </tr>
  1642. <tr class="row">
  1643. <td class="col-md-3 label test"><label>Follow up:</label></td>
  1644. <td class="value col-md-3">
  1645. @Html.DropDownListFor(model => model.Mortgage.mortage_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup", @class = "searchselect" })
  1646.  
  1647. </td>
  1648. <td colspan="2" class="col-md-3">
  1649. @Html.TextBoxFor(model => model.Mortgage.mortage_date, new { @name = "finance-0-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid mort_time", @id = "mortgage_date" })
  1650. Time
  1651. @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" })
  1652. </td>
  1653. </tr>
  1654. <tr class="row">
  1655. <td class="col-md-3 label test"></td>
  1656.  
  1657. <td class="value col-md-3"></td>
  1658. <td colspan="2" class="col-md-3">
  1659. <input type="button" value="Sync this action to your Outlook" id="exportall" name="exportall" class="btn-blue" />
  1660. </td>
  1661. </tr>
  1662. <tr></tr>
  1663.  
  1664. </tbody>
  1665. </table>
  1666.  
  1667. </div>
  1668.  
  1669. </div>
  1670. <!-- Property Address -->
  1671. <div class="fieldset oddfieldset">
  1672. <div class="h2head"><h2>Property Address</h2></div>
  1673. <table class="formtable">
  1674. <tbody>
  1675. <tr class="row">
  1676. <td class="label col-md-3"><label>Address 1:</label></td>
  1677. <td class="value col-md-3">
  1678. @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" })
  1679. </td>
  1680. <td class="label col-md-3"><label>Address 2:</label></td>
  1681. <td class="value col-md-3">
  1682. @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" })
  1683. </td>
  1684. </tr>
  1685. <tr class="row">
  1686. <td class="label col-md-3"><label>Town:</label></td>
  1687. <td class="value col-md-3">
  1688. @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" })
  1689. </td>
  1690.  
  1691. <td class="label col-md-3"><label>County:</label></td>
  1692. <td class="value col-md-3">
  1693. @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" })
  1694. </td>
  1695. </tr>
  1696. <tr class="row">
  1697. <td class="label col-md-3"><label>Postcode:</label></td>
  1698. <td class="value col-md-3">
  1699. @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" })
  1700. </td>
  1701. <td colspan="2" class="col-md-3">&nbsp;</td>
  1702. </tr>
  1703. </tbody>
  1704. </table>
  1705. </div>
  1706.  
  1707. <!-- Notes -->
  1708. <div class="tabs_paddedcontent">
  1709. <table class="formtable">
  1710. <tbody>
  1711. <tr class="row">
  1712. <td class="label col-md-3"><label>Note:</label></td>
  1713. <td class="col-md-9">
  1714. <div class="pull-left fontsize_12">
  1715. Send last note as:
  1716. <input type="radio" checked="checked" name="lastnotetype" id="lastnotetypeMsg" value="1" onclick="return ValidateSMSOrMSG(1);">
  1717. <span class="radiotxt"> Email</span>
  1718. <input type="radio" name="lastnotetype" id="lastnotetypeSMS" value="2" onclick="return ValidateSMSOrMSG(2);"><span class="radiotxt">SMS</span>
  1719. <input id="hdnsmsemail" type="hidden" value="1" />
  1720. </div>
  1721. @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)" })
  1722.  
  1723. <div class="pull-left fontsize_12">
  1724. Allow in report
  1725. <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
  1726.  
  1727. </div>
  1728.  
  1729. </td>
  1730. </tr>
  1731.  
  1732. <tr class="row">
  1733.  
  1734. <td colspan="2">
  1735. <span id="tdMSG" class="pull-right">
  1736. [ Characters Count :
  1737. <span class="application_9 txtcolorred" id="totalCharacters">0 </span>
  1738. ]
  1739. </span>
  1740. <span id="tdSMS" class="pull-right displayNone">
  1741. [ Characters Left :
  1742. <span class="application_9 txtcolorred" id="totalCharactersLeft">200</span>
  1743. ]
  1744. </span>
  1745. </td>
  1746.  
  1747. </tr>
  1748. </tbody>
  1749. </table>
  1750. </div>
  1751. <!-- Life tab -->
  1752.  
  1753. <div class="jq_tabssection" id="life_tab">
  1754.  
  1755. <div id="divLifeLogos" class="divMainContainer displayNone">
  1756. <div id="divLifePropertyLogos">
  1757.  
  1758. @if (Model.addproducts != null)
  1759. {
  1760. List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
  1761. if (Model.addproducts.MortgageProduct.Count > 0)
  1762. {
  1763. var lifePRDS = Model.addproducts.LifeProduct.OrderBy(c => c.financeid).ToList();
  1764. var lstFinanceIds = lifePRDS.Select(res => res.financeid).ToList();
  1765.  
  1766. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  1767. lstCaseDetails = (from fin in ctx.tblfinances
  1768. where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
  1769. join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
  1770. select new clsCaseDetails()
  1771. {
  1772. FinanceId = fin.financeid,
  1773. ContactId = fin.contact,
  1774. 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)),
  1775. PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
  1776. Value = (fin.amount == null) ? 0.0M : fin.amount,
  1777. Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
  1778. }).ToList();
  1779. var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
  1780.  
  1781. <div class="col-md-12 mobilepaddNone">
  1782.  
  1783. @for (var i = 0; i < lstCaseDetails.Count; i++)
  1784. {
  1785. <div class="col-md-3 col-sm-6 mobilepaddNone">
  1786. @LifeProductDetails(i, lstCaseDetails)
  1787. </div>
  1788. }
  1789. </div>
  1790.  
  1791.  
  1792. }
  1793. }
  1794.  
  1795. </div>
  1796. </div>
  1797. <!-- Life Content Added on 2015-03-13-->
  1798. <div id="divLifeContent">
  1799. <div class="tabs_paddedcontent select_custome">
  1800.  
  1801.  
  1802.  
  1803. <div class="col-md-3 col-sm-3">
  1804. <img class="delete button" src="~/Images/delete.png" id="deleteLifebutton" onclick="DeleteLeadsLife();">
  1805.  
  1806. </div>
  1807.  
  1808. <div class="col-md-3 col-sm-3">
  1809. <div class="view_btn">
  1810. <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToLifeLogos" onclick="BackToLifeLogos();">
  1811. <a id="lifeiconpdf" href="javascript:void(0);" onclick="return PDFPrint('portfolio');" title="Generate Pdf">
  1812. <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
  1813. </a>
  1814. </div>
  1815.  
  1816. </div>
  1817.  
  1818. <div class="col-md-5 col-sm-5">
  1819. <select id="LifeProductAdd" data-pastvalue="" data-type="Life" class="financeproductselect searchselect">
  1820. @if (Model.addproducts != null)
  1821. {
  1822. if (Model.addproducts.LifeProduct.Count > 0)
  1823. {
  1824. var lifePRDS = Model.addproducts.LifeProduct.OrderBy(c => c.financeid).ToList();
  1825. foreach (financeID f in lifePRDS)
  1826. {
  1827. //Start:- Updated On 2-4-2014 regarding tab and product selection
  1828. int financeId = Model.FinanceId;
  1829. if (financeId == f.financeid)
  1830. {
  1831. <option value="@f.financeid" selected="selected">@f.name</option>
  1832. }
  1833. else
  1834. {
  1835. <option value="@f.financeid">@f.name</option>
  1836. }
  1837. }
  1838. }
  1839. }
  1840. </select>
  1841.  
  1842.  
  1843.  
  1844. </div>
  1845.  
  1846. <div class="col-md-1 col-sm-1">
  1847.  
  1848. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  1849. {
  1850. <img id="btnAddLifeProduct" class="addlifeproduct pull-right" src="~/Images/addbtn.png" cursor pointer;">
  1851.  
  1852. }
  1853.  
  1854. </div>
  1855.  
  1856.  
  1857. <div id="financeproduct1" class="financeproduct financeid">
  1858. @Html.HiddenFor(model => model.Life.life_financeid, new { @name = "finance-1-financeid", @id = "life_financeid" })
  1859. @Html.HiddenFor(model => model.Life.life_financetype, new { @name = "finance-1-type", @id = "life_statusid" })
  1860. @Html.HiddenFor(model => model.Life.life_contactid, new { @id = "Life_contactid" })
  1861. @Html.HiddenFor(model => model.Life.life_AppicationType, new { @id = "Life_applicationtype" })
  1862. <table class="formtable">
  1863. <tbody>
  1864. <tr>
  1865. <td class="col-md-3 label test"><label>Status:</label></td>
  1866. <td class="value">
  1867. @Html.DropDownListFor(model => model.Life.life_status, (IEnumerable<SelectListItem>)ViewBag.LifeStatusList, new { id = "life_status" })
  1868.  
  1869. </td>
  1870.  
  1871. </tr>
  1872. <tr>
  1873. <td class="col-md-3 label test"><label>Provider:</label></td>
  1874. <td class="value">
  1875. @Html.TextBoxFor(model => model.Life.life_provider, new { @name = "finance-1-provider", @class = "idleField txtField capitalField txt_field", @id = "life_provider" })
  1876. </td>
  1877. <td class="col-md-3 label test"><label>Policy Ref:</label></td>
  1878. <td class="value">
  1879. @Html.TextBoxFor(model => model.Life.life_policyref, new { @name = "finance-1-policyreference", @class = "idleField txtField capitalField txt_field", @id = "life_policyreference" })
  1880. </td>
  1881. </tr>
  1882. <tr>
  1883. <td class="col-md-3 label test"><label>Amount: £</label></td>
  1884. <td class="value">
  1885. @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);" })
  1886. </td>
  1887. <td class="col-md-3 label test"><label>Proc Fee:£</label></td>
  1888. <td class="value">
  1889. @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);" })
  1890.  
  1891. <input id="life_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionLifeList();" class="btn-blue">
  1892.  
  1893. </td>
  1894. </tr>
  1895.  
  1896. <!-- LIFE -->
  1897. <tr>
  1898. <td class="col-md-3 label test"><label>Policy Type:</label></td>
  1899. <td class="value">
  1900. @Html.DropDownListFor(model => model.Life.life_policytype, (IEnumerable<SelectListItem>)ViewBag.LifePolicyTypes, new { @name = "finance-1-subtype", @id = "life_type" })
  1901.  
  1902. </td>
  1903. <td class="col-md-3 label test"><label>Premium:</label></td>
  1904. <td class="value">
  1905. @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);" })
  1906. </td>
  1907. </tr>
  1908.  
  1909. <tr>
  1910. <td class="label col-md-3 test"><label>Height:</label></td>
  1911. <td class="value">
  1912. @Html.TextBoxFor(model => model.Life.life_height, new { @id = "life_height", @name = "finance-1-ins_height", @class = "idleField txtField txt_field" })
  1913. </td>
  1914. <td class="col-md-3 label test"><label>Weight:</label></td>
  1915. <td>
  1916. @Html.TextBoxFor(model => model.Life.life_weight, new { @id = "life_weight", @name = "finance-1-ins_weight", @class = "idleField txtField txt_field" })
  1917. &nbsp;&nbsp;Smoker
  1918.  
  1919. @Html.CheckBoxFor(model => model.Life.life_issmoker, new { @id = "life_issmoker" })
  1920. </td>
  1921. </tr>
  1922. <tr>
  1923. <td class="col-md-3 label test"><label>Doctor:</label></td>
  1924. <td colspan="3" class="value">
  1925. @Html.TextBoxFor(model => model.Life.life_doctor, new { @id = "life_doctor", @name = "finance-1-ins_doctor", @class = "idleField txtField capitalField txt_field" })
  1926. </td>
  1927. </tr>
  1928. <tr>
  1929. <td class="col-md-3 label test"><label>Medical:</label></td>
  1930. <td colspan="3" class="block_td">
  1931. @Html.TextAreaFor(model => model.Life.life_medical, new { @id = "life_medical", @name = "finance-1-details", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  1932. </td>
  1933. </tr>
  1934. <tr>
  1935. <td class="col-md-3 label test"><label>Date Live:</label></td>
  1936. <td class="value">
  1937. @Html.TextBoxFor(model => model.Life.life_datelive, new { @name = "finance-1-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "life_datelive" })
  1938. </td>
  1939. <td class="col-md-3 label test"><label>Expires:</label></td>
  1940. <td class="value">
  1941. @Html.TextBoxFor(model => model.Life.life_expires, new { @name = "finance-1-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "life_dateexpires" })
  1942. </td>
  1943. </tr>
  1944. <tr>
  1945. <tr>
  1946. <td class="col-md-3 label test"><label>Follow up:</label></td>
  1947. <td class="value">
  1948. @Html.DropDownListFor(model => model.Life.life_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
  1949.  
  1950. </td>
  1951. <td colspan="2">
  1952. @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" })
  1953. Time
  1954. @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" })
  1955. </td>
  1956. </tr>
  1957. <tr>
  1958. <td class="col-md-3 label test"></td>
  1959.  
  1960. <td class="value"></td>
  1961. <td colspan="2">
  1962. <input type="button" value="Sync this action to your Outlook" id="exportallLife" name="exportallLife" class="btn-blue" />
  1963. </td>
  1964. </tr>
  1965. <tr>
  1966. <td class="col-md-3 label test"><label>Client Fee: £</label></td>
  1967. <td colspan="1" class="block_td">
  1968.  
  1969. @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" })
  1970.  
  1971. </td>
  1972. <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Life.life_isPolicyForOtherApplicant, new { @id = "life_isPolicyForOtherApplicant" })</td>
  1973.  
  1974. </tr>
  1975. <tr>
  1976. <td class="col-md-3 label test"><label>Note:</label></td>
  1977. <td colspan="3" class="block_td">
  1978. @Html.TextAreaFor(model => model.Life.life_notes, new { @name = "finance-1-note", @id = "life_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  1979.  
  1980. <div class="pull-left fontsize_12">
  1981. Allow in report
  1982. <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
  1983. </div>
  1984. </td>
  1985. </tr>
  1986. </tbody>
  1987. </table>
  1988. </div>
  1989. </div>
  1990. </div>
  1991. </div>
  1992.  
  1993. <!-- Building/Contents Tab -->
  1994. <div class="jq_tabssection" id="insurance_tab">
  1995.  
  1996. <div id="divBuildingLogos" class="divMainContainer displayNone">
  1997. <div id="divBuildingPropertyLogos">
  1998.  
  1999. @if (Model.addproducts != null)
  2000. {
  2001. List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
  2002. if (Model.addproducts.MortgageProduct.Count > 0)
  2003. {
  2004. var buildingPRDS = Model.addproducts.BuildingContentProduct.OrderBy(c => c.financeid).ToList();
  2005. var lstFinanceIds = buildingPRDS.Select(res => res.financeid).ToList();
  2006.  
  2007.  
  2008.  
  2009. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  2010. lstCaseDetails = (from fin in ctx.tblfinances
  2011. where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
  2012. join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
  2013. select new clsCaseDetails()
  2014. {
  2015. FinanceId = fin.financeid,
  2016. ContactId = fin.contact,
  2017. 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)),
  2018. PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
  2019. Value = (fin.amount == null) ? 0.0M : fin.amount,
  2020. Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
  2021. }).ToList();
  2022.  
  2023. var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
  2024.  
  2025. <div class="col-md-12 mobilepaddNone">
  2026.  
  2027. @for (var i = 0; i < lstCaseDetails.Count; i++)
  2028. {
  2029. <div class="col-md-3 col-sm-6 mobilepaddNone">
  2030. @BuildingProductDetails(i, lstCaseDetails)
  2031. </div>
  2032. }
  2033. </div>
  2034.  
  2035. }
  2036. }
  2037.  
  2038. </div>
  2039. </div>
  2040. <!-- Building Content Added on 2015-03-13-->
  2041. <div id="divBuildingContent">
  2042. <div class="tabs_paddedcontent select_custome">
  2043.  
  2044.  
  2045.  
  2046. <div class="col-md-3 col-sm-3">
  2047. <img class="delete button" src="~/Images/delete.png" id="deleteBuildingbutton" onclick="DeleteLeadsBuilding();">
  2048. </div>
  2049.  
  2050. <div class="col-md-3 col-sm-3">
  2051. <div class="view_btn">
  2052. <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToBuildingLogos" onclick="BackToBuildingLogos();">
  2053. <a id="bildingiconpdf" href="javascript:void(0);" onclick="return PDFPrint('Building');" title="Generate Pdf">
  2054. <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
  2055. </a>
  2056. </div>
  2057. </div>
  2058.  
  2059. <div class="col-md-5 col-sm-5">
  2060. <select id="BuildingContentProductAdd" data-pastvalue="" data-type="Buildings / Contents" class="financeproductselect searchselect">
  2061. @if (Model.addproducts != null)
  2062. {
  2063. if (Model.addproducts.BuildingContentProduct.Count > 0)
  2064. {
  2065. var buildprds = Model.addproducts.BuildingContentProduct.OrderBy(c => c.financeid).ToList();
  2066. foreach (financeID f in buildprds)
  2067. {
  2068. //Start:- Updated On 2-4-2014 regarding tab and product selection
  2069. int financeId = Model.FinanceId;
  2070. if (financeId == f.financeid)
  2071. {
  2072. <option value="@f.financeid" selected="selected">@f.name</option>
  2073. }
  2074. else
  2075. {
  2076. <option value="@f.financeid">@f.name</option>
  2077. }
  2078. }
  2079. }
  2080. }
  2081. </select>
  2082. </div>
  2083.  
  2084. <div class="col-md-1 col-sm-1">
  2085. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  2086. {
  2087. <img id="btnBuildingContentAdd" class="addbuildingproduct pull-right" src="~/Images/addbtn.png" cursor pointer;">
  2088.  
  2089. }
  2090. </div>
  2091.  
  2092.  
  2093. <div id="financeproduct2" data_objid="" class="financeproduct financeid">
  2094.  
  2095. @Html.HiddenFor(model => model.BuildingContent.buildingcontent_financeid, new { @name = "finance-2-financeid", @id = "buildingcontent_financeid" })
  2096. @Html.HiddenFor(model => model.BuildingContent.buildingcontent_financetype, new { @name = "finance-2-type", @id = "building_status" })
  2097. @Html.HiddenFor(model => model.BuildingContent.buildingContent_contactid, new { @id = "BuildingContent_contactid" })
  2098. @Html.HiddenFor(model => model.BuildingContent.buildingContent_AppicationType, new { @id = "BuildingContent_applicationtype" })
  2099. <table class="formtable">
  2100. <tbody>
  2101. <tr>
  2102. <td class="col-md-3 label test"><label>Status:</label></td>
  2103. <td class="value">
  2104. @Html.DropDownListFor(model => model.BuildingContent.buildingcontent_status, (IEnumerable<SelectListItem>)ViewBag.BuildingOrContentList, new { id = "_DSBuildingOrContentStaus" })
  2105.  
  2106. </td>
  2107.  
  2108. </tr>
  2109. <tr>
  2110. <td class="col-md-3 label test"><label>Provider:</label></td>
  2111. <td class="value">
  2112. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_provider, new { @id = "buildingcontent_provider", @name = "finance-2-provider", @class = "idleField txtField capitalField txt_field" })
  2113. </td>
  2114. <td class="col-md-3 label test"><label>Policy Ref:</label></td>
  2115. <td class="value">
  2116. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_policyref, new { @id = "buildingcontent_policyref", @name = "finance-2-policyreference", @class = "idleField txtField capitalField txt_field" })
  2117. </td>
  2118. </tr>
  2119. <tr>
  2120. <td class="col-md-3 label test"><label>Amount: £</label></td>
  2121. <td class="value">
  2122. @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);" })
  2123. </td>
  2124. <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
  2125. <td class="value">
  2126. @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);" })
  2127. <input id="BuildingContent_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionBuildingList();" class="btn-blue">
  2128. </td>
  2129. </tr>
  2130.  
  2131. <!-- BUILD/CON -->
  2132. <tr>
  2133. <td class="col-md-3 label test"><label>Type:</label></td>
  2134. <td class="value">
  2135. @Html.DropDownListFor(model => model.BuildingContent.buildingcontent_type, (IEnumerable<SelectListItem>)ViewBag.FinanceSubtypeList, new { @id = "buildingcontent_type", @name = "finance-2-subtype" })
  2136.  
  2137. </td>
  2138. <td class="col-md-3 label test"><label>Premium:</label></td>
  2139. <td class="value">
  2140. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_premium, new { @id = "buildingcontent_premium", @name = "finance-2-premium", @class = "moneyfield idleField txtField", onkeypress = "return validateDecimalOnly(event);" })
  2141. </td>
  2142. </tr>
  2143. <tr>
  2144. <td class="col-md-3 label test"><label>Rebuild Value:</label></td>
  2145. <td colspan="3" class="value" class="block_td">
  2146. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_rebuildvalue, new { @id = "buildingcontent_rebuildvalue", @name = "finance-2-bui_rebuild", @class = "moneyfield idleField txtField", onkeypress = "return validateDecimalOnly(event);" })
  2147. &nbsp;&nbsp;Alarmed
  2148. @Html.CheckBoxFor(model => model.BuildingContent.buildingcontent_isalarmed, new { @id = "buildingcontent_isalarmed", @name = "finance-2-bui_alarm" })
  2149. </td>
  2150. </tr>
  2151. <tr>
  2152. <td style="vertical-align: top" class="col-md-3 label test"><label>Add.Cover:</label></td>
  2153. <td colspan="3">
  2154. @Html.TextAreaFor(model => model.BuildingContent.buildingcontent_addcover, new { @id = "buildingcontent_addcover", @name = "finance-2-details", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  2155. </td>
  2156. </tr>
  2157. <tr>
  2158. <td class="col-md-3 label test"><label>Date Live:</label></td>
  2159. <td class="value">
  2160. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_datelive, new { @id = "buildingcontent_datelive", @name = "finance-2-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field" })
  2161. </td>
  2162. <td class="col-md-3 label test"><label>Expires:</label></td>
  2163. <td class="value">
  2164. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_expires, new { @name = "finance-2-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "buildingcontent_expires" })
  2165. </td>
  2166. </tr>
  2167. <tr>
  2168. <td class="col-md-3 label test"><label>Follow up:</label></td>
  2169. <td class="value">
  2170. @Html.DropDownListFor(mortage => mortage.BuildingContent.buildingcontent_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-2-addfollowup" })
  2171.  
  2172. </td>
  2173. <td colspan="2">
  2174. @Html.TextBoxFor(model => model.BuildingContent.buildingcontent_date, new { @name = "finance-2-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "buildingcontent_date" })
  2175. Time
  2176. @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" })
  2177. </td>
  2178. </tr>
  2179. <tr>
  2180. <td class="col-md-3 label test"></td>
  2181.  
  2182. <td class="value"></td>
  2183. <td colspan="2">
  2184. <input type="button" value="Sync this action to your Outlook" id="exportallBuilding" name="exportallBuilding" class="btn-blue" />
  2185. </td>
  2186. </tr>
  2187. <tr>
  2188. <td class="col-md-3 label test"><label>Client Fee: £</label></td>
  2189. <td colspan="1" class="block_td">
  2190.  
  2191. @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" })
  2192.  
  2193. </td>
  2194. <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.BuildingContent.buildingcontent_isPolicyForOtherApplicant, new { @id = "buildingcontent_isPolicyForOtherApplicant" })</td>
  2195.  
  2196. </tr>
  2197. <tr>
  2198. <td class="col-md-3 label test"><label>Note:</label></td>
  2199. <td colspan="3" class="block_td">
  2200. @Html.TextAreaFor(model => model.BuildingContent.buildingcontent_notes, new { @name = "finance-2-note", @id = "building_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  2201.  
  2202. <div class="pull-left fontsize_12">
  2203. Allow in report
  2204. <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
  2205. </div>
  2206.  
  2207. </td>
  2208. </tr>
  2209. </tbody>
  2210. </table>
  2211.  
  2212. </div>
  2213.  
  2214. </div>
  2215. </div>
  2216. </div>
  2217.  
  2218. <!-- Pension tab -->
  2219. <div class="jq_tabssection" id="pensions_tab">
  2220. <!-- Pension Logo Added on 2015-03-13 -->
  2221. <div id="divPensionLogos" class="divMainContainer displayNone">
  2222. <div id="divPensionPropertyLogos">
  2223.  
  2224. @if (Model.addproducts != null)
  2225. {
  2226. List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
  2227. if (Model.addproducts.MortgageProduct.Count > 0)
  2228. {
  2229. var pensionPRDS = Model.addproducts.PensionProduct.OrderBy(c => c.financeid).ToList();
  2230. var lstFinanceIds = pensionPRDS.Select(res => res.financeid).ToList();
  2231.  
  2232.  
  2233.  
  2234. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  2235. lstCaseDetails = (from fin in ctx.tblfinances
  2236. where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
  2237. join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
  2238. select new clsCaseDetails()
  2239. {
  2240. FinanceId = fin.financeid,
  2241. ContactId = fin.contact,
  2242. 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)),
  2243. PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
  2244. Value = (fin.amount == null) ? 0.0M : fin.amount,
  2245. Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
  2246. }).ToList();
  2247. var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
  2248. <div class="col-md-12 mobilepaddNone">
  2249.  
  2250. @for (var i = 0; i < lstCaseDetails.Count; i++)
  2251. {
  2252. <div class="col-md-3 col-sm-6 mobilepaddNone">
  2253. @PensionProductDetails(i, lstCaseDetails)
  2254. </div>
  2255. }
  2256. </div>
  2257.  
  2258. }
  2259. }
  2260.  
  2261. </div>
  2262. </div>
  2263.  
  2264. <div id="divPensionContent">
  2265. <div class="tabs_paddedcontent select_custome">
  2266.  
  2267.  
  2268.  
  2269. <div class="col-md-3 col-sm-3">
  2270. <img class="delete button" src="~/Images/delete.png" id="deletePensionbutton" onclick="DeleteLeadsPension();">
  2271. </div>
  2272.  
  2273. <div class="col-md-3 col-sm-3">
  2274. <div class="view_btn">
  2275. <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToPensionLogos" onclick="BackToPensionLogos();">
  2276. <a id="pensioniconpdf" href="javascript:void(0);" onclick="return PDFPrint('Pension');" title="Generate Pdf">
  2277. <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
  2278. </a>
  2279. </div>
  2280. </div>
  2281.  
  2282. <div class="col-md-5 col-sm-5">
  2283. <select id="PensionProductAdd" data-pastvalue="" data-type="Pension" class="financeproductselect searchselect">
  2284. @if (Model.addproducts != null)
  2285. {
  2286. if (Model.addproducts.PensionProduct.Count > 0)
  2287. {
  2288. var oenprds = Model.addproducts.PensionProduct.OrderBy(c => c.financeid).ToList();
  2289. foreach (financeID f in oenprds)
  2290. {
  2291. //Start:- Updated On 2-4-2014 regarding tab and product selection
  2292. int financeId = Model.FinanceId;
  2293. if (financeId == f.financeid)
  2294. {
  2295. <option value="@f.financeid" selected="selected">@f.name</option>
  2296. }
  2297. else
  2298. {
  2299. <option value="@f.financeid">@f.name</option>
  2300. }
  2301. }
  2302. }
  2303. }
  2304. </select>
  2305. </div>
  2306.  
  2307. <div class="col-md-1 col-sm-1">
  2308. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  2309. {
  2310. <img id="btnPensionProductAdd" class="addpensionproduct pull-right" src="~/Images/addbtn.png">
  2311. }
  2312. </div>
  2313.  
  2314.  
  2315.  
  2316. <div id="financeproduct3" data_objid="" class="financeproduct financeid">
  2317.  
  2318. @Html.HiddenFor(model => model.Pension.pension_financeid, new { @id = "pensoion_financeid", name = "finance-3-financeid" })
  2319. @Html.HiddenFor(model => model.Pension.pension_financetype, new { @name = "finance-3-type", @id = "pension_status" })
  2320. @Html.HiddenFor(model => model.Pension.pension_contactid, new { @id = "pension_contactid" })
  2321. @Html.HiddenFor(model => model.Pension.pension_AppicationType, new { @id = "pension_AppicationType" })
  2322. <table class="formtable">
  2323. <tbody>
  2324. <tr>
  2325. <td class="col-md-3 label test"><label>Status:</label></td>
  2326. <td class="value">
  2327. @Html.DropDownListFor(model => model.Pension.pension_status, (IEnumerable<SelectListItem>)ViewBag.PensionStatusList, new { id = "_DSPensionStatus" })
  2328.  
  2329.  
  2330. </td>
  2331.  
  2332. </tr>
  2333. <tr>
  2334. <td class="col-md-3 label test"><label>Provider:</label></td>
  2335. <td class="value">
  2336.  
  2337. @Html.TextBoxFor(model => model.Pension.pension_provider, new { @id = "pension_provider", @name = "finance-3-provider", @class = "idleField txtField capitalField txt_field" })
  2338. </td>
  2339. <td class="col-md-3 label test"><label>Policy Ref:</label></td>
  2340. <td class="value">
  2341.  
  2342. @Html.TextBoxFor(model => model.Pension.pension_policyref, new { @id = "pension_policyref", @name = "finance-3-policyreference", @class = "idleField txtField capitalField txt_field" })
  2343. </td>
  2344. </tr>
  2345. <tr>
  2346. <td class="col-md-3 label test"><label>Amount: £</label></td>
  2347. <td class="value">
  2348.  
  2349. @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);" })
  2350. </td>
  2351. <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
  2352. <td class="value">
  2353.  
  2354. @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);" })
  2355. <input id="Pension_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionPensionList();" class="btn-blue">
  2356. </td>
  2357. </tr>
  2358. <!-- Pension -->
  2359. <tr>
  2360. <td class="col-md-3 label test"><label>Risk Profile of Applicant:</label></td>
  2361. <td class="value">
  2362. @Html.DropDownListFor(model => model.Pension.pension_riskprofile, (IEnumerable<SelectListItem>)ViewBag.PensionRiskProfileList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "pension_riskprofile" })
  2363.  
  2364. </td>
  2365. <td class="col-md-3 label test"><label>Contributions:</label></td>
  2366. <td class="value">
  2367.  
  2368. @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);" })
  2369. </td>
  2370. </tr>
  2371. <tr>
  2372. <td class="col-md-3 label test"><label>Fund Value:</label></td>
  2373. <td class="value">
  2374. @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);" })
  2375. </td>
  2376. <td class="col-md-3 label test"><label>Income Req. on Retirement:</label></td>
  2377. <td class="value">
  2378.  
  2379. @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);" })
  2380. </td>
  2381. </tr>
  2382. <tr>
  2383. <td class="col-md-3 label test"><label>Date Live:</label></td>
  2384. <td class="value">
  2385.  
  2386. @Html.TextBoxFor(model => model.Pension.pension_datelive, new { @name = "finance-3-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "pension_datelive" })
  2387. </td>
  2388. <td class="col-md-3 label test"><label>Expires:</label></td>
  2389. <td class="value">
  2390. @Html.TextBoxFor(model => model.Pension.pension_expires, new { @name = "finance-3-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "pension_expires" })
  2391. </td>
  2392. </tr>
  2393. <tr>
  2394. <td class="col-md-3 label test"><label>Follow up:</label></td>
  2395. <td class="value">
  2396. @Html.DropDownListFor(model => model.Pension.pension_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
  2397. </td>
  2398. <td colspan="2">
  2399. @Html.TextBoxFor(model => model.Pension.pension_date, new { @name = "finance-3-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "pension_date" })
  2400. Time
  2401.  
  2402. @Html.TextBoxFor(model => model.Pension.pension_time, new { @id = "pension_time", @name = "finance-3-followuptime", @class = "jq_followuptime idleField txtField txt_field full-width" })
  2403. </td>
  2404. </tr>
  2405. <tr>
  2406. <td class="col-md-3 label test"></td>
  2407.  
  2408. <td class="value"></td>
  2409. <td colspan="2">
  2410. <input type="button" value="Sync this action to your Outlook" id="exportallPension" name="exportallPension" class="btn-blue" />
  2411. </td>
  2412. </tr>
  2413. <tr>
  2414. <td class="col-md-3 label test"><label>Client Fee: £</label></td>
  2415. <td colspan="1" class="block_td">
  2416. @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" })
  2417.  
  2418. </td>
  2419. <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Pension.pension_isPolicyForOtherApplicant, new { @id = "pension_isPolicyForOtherApplicant" })</td>
  2420. </tr>
  2421. <tr>
  2422. <td class="col-md-3 label test"><label>Note:</label></td>
  2423. <td colspan="3" class="block_td">
  2424. @Html.TextAreaFor(model => model.Pension.pension_notes, new { @name = "finance-3-note", @id = "pension_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  2425.  
  2426. <div class="pull-left fontsize_12">
  2427. Allow in report
  2428. <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
  2429. </div>
  2430. </td>
  2431. </tr>
  2432. </tbody>
  2433. </table>
  2434.  
  2435. </div>
  2436.  
  2437. </div>
  2438. </div>
  2439. </div>
  2440.  
  2441. <!-- Investment tab -->
  2442. <div class="jq_tabssection" id="investments_tab">
  2443.  
  2444. <div id="divInvestmentLogos" class="divMainContainer displayNone">
  2445. <div id="divInvestmentPropertyLogos">
  2446.  
  2447. @if (Model.addproducts != null)
  2448. {
  2449. List<clsCaseDetails> lstCaseDetails = new List<clsCaseDetails>();
  2450. if (Model.addproducts.MortgageProduct.Count > 0)
  2451. {
  2452. var investmentPRDS = Model.addproducts.InvestmentProduct.OrderBy(c => c.financeid).ToList();
  2453. var lstFinanceIds = investmentPRDS.Select(res => res.financeid).ToList();
  2454.  
  2455.  
  2456.  
  2457. Occfinance_Data.db_occfinance_5572Entities ctx = new Occfinance_Data.db_occfinance_5572Entities();
  2458. lstCaseDetails = (from fin in ctx.tblfinances
  2459. where lstFinanceIds.Contains(fin.financeid) && fin.status != 34 && fin.status != 35 && fin.status != 36 && fin.status != 37 && fin.status != 38
  2460. join fsd in ctx.tblfinancestatus on fin.status equals fsd.statusid
  2461. select new clsCaseDetails()
  2462. {
  2463. FinanceId = fin.financeid,
  2464. ContactId = fin.contact,
  2465. 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)),
  2466. PostCode = string.IsNullOrEmpty(fin.Postcode) ? string.Empty : fin.Postcode,
  2467. Value = (fin.amount == null) ? 0.0M : fin.amount,
  2468. Type = string.IsNullOrEmpty(fsd.name) ? string.Empty : fsd.name
  2469. }).ToList();
  2470. var rowCount = (lstCaseDetails.Count % 2 == 0) ? (lstCaseDetails.Count / 2) : (lstCaseDetails.Count + 1) / 2;
  2471. <div class="col-md-12 mobilepaddNone">
  2472.  
  2473. @for (var i = 0; i < lstCaseDetails.Count; i++)
  2474. {
  2475. <div class="col-md-3 col-sm-6 mobilepaddNone">
  2476. @LifeProductDetails(i, lstCaseDetails)
  2477. </div>
  2478. }
  2479. </div>
  2480.  
  2481. }
  2482. }
  2483.  
  2484. </div>
  2485. </div>
  2486.  
  2487. <div id="divInvestmentContent">
  2488. <div class="tabs_paddedcontent select_custome">
  2489.  
  2490.  
  2491.  
  2492.  
  2493. <div class="col-md-3 col-sm-3">
  2494. <img class="delete button" src="~/Images/delete.png" id="deleteInvestmentbutton" onclick="DeleteLeadsInvestment();">
  2495.  
  2496. </div>
  2497.  
  2498. <div class="col-md-3 col-sm-3">
  2499. <div class="view_btn">
  2500. <img class="back button" src="~/Images/viewclientportfolio.png" id="imgbtnBackToInvestmentLogos" onclick="BackToInvestmentLogos();">
  2501. <a id="Investmenticonpdf" href="javascript:void(0);" onclick="return PDFPrint('Investment');" title="Generate Pdf">
  2502. <img class="mortgagecaseWrittenReport2" src="@Url.Content("~/Content/images/PDFicon.png")">
  2503. </a>
  2504. </div>
  2505. </div>
  2506.  
  2507. <div class="col-md-5 col-sm-5">
  2508. <select id="InvestmentProductAdd" data-pastvalue="" data-type="Investment" class="financeproductselect searchselect">
  2509. @if (Model.addproducts != null)
  2510. {
  2511. if (Model.addproducts.InvestmentProduct.Count > 0)
  2512. {
  2513. var invds = Model.addproducts.InvestmentProduct.OrderBy(c => c.financeid).ToList();
  2514. foreach (financeID f in invds)
  2515. {
  2516. //Start:- Updated On 2-4-2014 regarding tab and product selection
  2517. int financeId = Model.FinanceId;
  2518. if (financeId == f.financeid)
  2519. {
  2520. <option value="@f.financeid" selected="selected">@f.name</option>
  2521. }
  2522. else
  2523. {
  2524. <option value="@f.financeid">@f.name</option>
  2525. }
  2526. }
  2527. }
  2528. }
  2529. </select>
  2530. </div>
  2531.  
  2532. <div class="col-md-1 col-sm-1">
  2533. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  2534. {
  2535. <img id="btnInvestmentProductAdd" class="addinvestmentproduct pull-right" src="~/Images/addbtn.png">
  2536.  
  2537. }
  2538. </div>
  2539.  
  2540.  
  2541. <div id="financeproduct4" data_objid="" class="financeproduct financeid">
  2542. @Html.HiddenFor(model => model.Investment.investment_financeid, new { @id = "investment_financeid", name = "finance-4-financeid" })
  2543. @Html.HiddenFor(model => model.Investment.investment_financetype, new { @name = "finance-4-type", @id = "investment_status" })
  2544. @Html.HiddenFor(model => model.Investment.investment_contactid, new { @id = "investment_contactid" })
  2545. @Html.HiddenFor(model => model.Investment.investment_AppicationType, new { @id = "investment_AppicationType" })
  2546. <table class="formtable">
  2547. <tbody>
  2548. <tr>
  2549. <td class="col-md-3 label test"><label>Status:</label></td>
  2550. <td class="value">
  2551. @Html.DropDownListFor(model => model.Investment.investment_status, (IEnumerable<SelectListItem>)ViewBag.InvestmentStatusList, new { id = "_DSInvestmentStatus" })
  2552.  
  2553. </td>
  2554.  
  2555. </tr>
  2556. <tr>
  2557. <td class="col-md-3 label test"><label>Provider:</label></td>
  2558. <td class="value">
  2559.  
  2560. @Html.TextBoxFor(model => model.Investment.investment_provider, new { @id = "investment_provider", @name = "finance-4-provider", @class = "idleField txtField capitalField txt_field" })
  2561. </td>
  2562. <td class="col-md-3 label test"><label>Policy Ref:</label></td>
  2563. <td class="value">
  2564.  
  2565. @Html.TextBoxFor(model => model.Investment.investment_policyref, new { @id = "investment_policyref", @name = "finance-4-policyreference", @class = "idleField txtField capitalField txt_field" })
  2566. </td>
  2567. </tr>
  2568. <tr>
  2569. <td class="col-md-3 label test"><label>Amount: £</label></td>
  2570. <td class="value">
  2571.  
  2572. @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);" })
  2573. </td>
  2574. <td class="col-md-3 label test"><label>Proc Fee: £</label></td>
  2575. <td class="value">
  2576.  
  2577. @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);" })
  2578. <input id="Investment_SplitCommission" type="button" name="SplitCommission" value="Split Commission" onclick="return ShowSplitCommissionInvestmentsList();" class="btn-blue">
  2579. </td>
  2580. </tr>
  2581.  
  2582.  
  2583.  
  2584. <!-- Investments -->
  2585. <tr>
  2586. <td class="col-md-3 label test"><label>Risk Profile of Applicant:</label></td>
  2587. <td class="value">
  2588.  
  2589. @Html.DropDownListFor(model => model.Investment.investment_riskprofiles, (IEnumerable<SelectListItem>)ViewBag.PensionRiskProfileList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "investment_riskprofiles" })
  2590. </td>
  2591. <td class="col-md-3 label test"><label>Contributions:</label></td>
  2592. <td class="value">
  2593.  
  2594. @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);" })
  2595. </td>
  2596. </tr>
  2597. <tr>
  2598. <td class="col-md-3 label test"><label>Fund Value:</label></td>
  2599. <td class="value">
  2600.  
  2601. @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);" })
  2602. </td>
  2603. </tr>
  2604.  
  2605. <tr>
  2606. <td class="col-md-3 label test"><label>Date Live:</label></td>
  2607. <td class="value">
  2608.  
  2609. @Html.TextBoxFor(model => model.Investment.investment_datelive, new { @name = "finance-4-datelive", @class = "datepick idleField txtField cutomedatetimevalid txt_field", @id = "investment_datelive" })
  2610. </td>
  2611. <td class="col-md-3 label test"><label>Expires:</label></td>
  2612. <td class="value">
  2613.  
  2614. @Html.TextBoxFor(model => model.Investment.investment_expires, new { @name = "finance-4-dateexpire", @class = "datepick idleField txtField cutomedatetimevalid", @id = "investment_expires" })
  2615. </td>
  2616. </tr>
  2617. <tr>
  2618. <td class="col-md-3 label test"><label>Follow up:</label></td>
  2619. <td class="value">
  2620. @Html.DropDownListFor(model => model.Investment.investment_followup, (IEnumerable<SelectListItem>)ViewBag.MortgageFollowupList, new { @onchange = "updatefollowup(this);", @name = "finance-0-addfollowup", @id = "mortgage_Followup" })
  2621.  
  2622. </td>
  2623. <td colspan="2">
  2624.  
  2625. @Html.TextBoxFor(model => model.Investment.investment_date, new { @name = "finance-4-followup", @class = "datepick jq_followupdate idleField txtField cutomedatetimevalid txt_field", @id = "investment_date" })
  2626.  
  2627. Time
  2628.  
  2629. @Html.TextBoxFor(model => model.Investment.investment_time, new { @id = "investment_time", @name = "finance-4-followuptime", @class = "jq_followuptime idleField txtField txt_field width60px" })
  2630. </td>
  2631. </tr>
  2632. <tr>
  2633. <td class="col-md-3 label test"></td>
  2634.  
  2635. <td class="value"></td>
  2636. <td colspan="2">
  2637. <input type="button" value="Sync this action to your Outlook" id="exportallInvestment" name="exportallInvestment" class="btn-blue" />
  2638. </td>
  2639. </tr>
  2640. <tr>
  2641. <td class="col-md-3 label test"><label>Client Fee: £</label></td>
  2642. <td colspan="1" class="block_td">
  2643.  
  2644. @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" })
  2645.  
  2646. </td>
  2647. <td colspan="2">Policy Holder is Other Applicant @Html.CheckBoxFor(model => model.Investment.investment_isPolicyForOtherApplicant, new { @id = "investment_isPolicyForOtherApplicant" })</td>
  2648. </tr>
  2649. <tr>
  2650. <td class="col-md-3 label test"><label>Note:</label></td>
  2651. <td colspan="3" class="block_td">
  2652.  
  2653. @Html.TextAreaFor(model => model.Investment.investment_notes, new { @name = "finance-4-note", @id = "investment_note", @class = "idleField textareaField full-width", onkeydown = "return CapitalizeSentences(this)" })
  2654.  
  2655. <div class="pull-left fontsize_12">
  2656. Allow in report
  2657. <input name="mortage_notes_allow" id="mortage_notes_allow" checked="checked" type="checkbox">
  2658. </div>
  2659. </td>
  2660. </tr>
  2661. </tbody>
  2662. </table>
  2663. </div>
  2664. </div>
  2665. </div>
  2666. </div>
  2667.  
  2668. <input type="hidden" id="hdnbrkname" value="@brkname" />
  2669. <script type="text/javascript">
  2670.  
  2671. function ShowPAssword() {
  2672. $("#btnPassword").hide();
  2673. $("#input_password").val($("#hdnFactFindPassword").val());
  2674. $("#input_password").show();
  2675. };
  2676.  
  2677. function CountCharactersForNote(maxLength, obj) {
  2678. var signature = "";
  2679. signature = "Hi " + $("#txtfirstname").val() + "," + '\r\n\r\n' + $("#hdnbrkname").val() + '\r\n' + "Please reply to " + $("#hdnbrkcontact").val();
  2680. lengthVar = signature.length;
  2681.  
  2682. var _maxLength = maxLength - lengthVar;
  2683. var _usedChars = $("#mortgage_note").val().length;
  2684. if (parseInt(_usedChars) >= parseInt(_maxLength)) {
  2685. $("#totalCharactersLeft").text('0');
  2686. $("#mortgage_note").val($("#mortgage_note").val().substring(0, parseInt(_maxLength) - 1));
  2687. return false;
  2688. }
  2689. else {
  2690.  
  2691. $("#totalCharactersLeft").text(parseInt(_maxLength) - parseInt(_usedChars));
  2692. }
  2693. }
  2694.  
  2695. function ValidateSMSOrMSG(typeval) {
  2696.  
  2697. var signature = "";
  2698. signature = "Hi " + $("#txtfirstname").val() + "," + '\r\n\r\n' + $("#hdnbrkname").val() + '\r\n' + "Please reply to " + $("#hdnbrkcontact").val();
  2699.  
  2700. lengthVar = signature.length;
  2701. var _maxLength = 0;
  2702. _maxLength = parseInt('@_maxLength') - lengthVar;
  2703.  
  2704. $("#hdnsmsemail").val(typeval);
  2705.  
  2706. if (typeval == 2) {
  2707.  
  2708. if ($("#mortgage_note").val().length >= _maxLength) {
  2709. $("#mortgage_note").val($("#mortgage_note").val().substring(0, _maxLength - 1));
  2710.  
  2711.  
  2712. }
  2713.  
  2714. var _totalleft = _maxLength - $("#mortgage_note").val().length;
  2715.  
  2716. if (_totalleft < 0)
  2717. _totalleft = 0;
  2718.  
  2719. $("#totalCharactersLeft").text(_totalleft);
  2720.  
  2721. $("#tdSMS").show();
  2722. $("#tdMSG").hide();
  2723. $("#mortgage_note").attr("oninput", 'return CountCharactersForNote(' + @_maxLength + ', this);');
  2724. }
  2725. else {
  2726. var _totalleft = _maxLength - $("#mortgage_note").val().length;
  2727.  
  2728. if (_totalleft < 0)
  2729. _totalleft = 0;
  2730.  
  2731. $("#tdSMS").hide();
  2732. $("#tdMSG").show();
  2733. $("#totalCharactersLeft").text(_totalleft);
  2734. $("#mortgage_note").removeAttr("oninput");
  2735. }
  2736.  
  2737. $("#totalCharacters").text($("#mortgage_note").val().length);
  2738. }
  2739.  
  2740. //////// auto emails
  2741.  
  2742. function ResetFormAutoEmails() {
  2743.  
  2744. $("#drpAutoEmailtemplate").html("<option value='0'></option>");
  2745. $("#lblalertAutoEmail").text('');
  2746. $('#txtAutoEmailSubject').val('');
  2747. var editor = CKEDITOR.instances.txtAutoEmailBody;
  2748. editor.setData('');
  2749. }
  2750.  
  2751. function PrevAutoEmailTemp() {
  2752.  
  2753.  
  2754. 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");
  2755. if (!w || w.closed || typeof w.closed == 'undefined') {
  2756. $("#overlaycontainer").hide();
  2757. alert('The pop up is blocked in your browser, please allow pop up to view the preview.');
  2758. }
  2759. var editor = CKEDITOR.instances.txtAutoEmailBody;
  2760. $(w.document.body).html(editor.getData());
  2761.  
  2762. $("#overlaycontainer").hide();
  2763. }
  2764. function PostAjaxTemplateCall(selStatusId, level) {
  2765. ResetFormAutoEmails();
  2766. $("#divAutoEmails").modal('show');
  2767.  
  2768. var adviser = $("#_DSbrokerrefAccountForm option:selected").text().substring(0, $("#_DSbrokerrefAccountForm option:selected").text().indexOf("("));
  2769.  
  2770. var adviserId = $("#_DSbrokerrefAccountForm").val();
  2771.  
  2772. var email = $('#txtemail').val();
  2773.  
  2774. var address = ($('#mortgage_address1').val() != "") ? $('#mortgage_address1').val() + ", " : "";
  2775. address += ($('#mortgage_address2').val() != "") ? $('#mortgage_address2').val() + ", " : "";
  2776. address += ($('#mortgage_town').val() != "") ? $('#mortgage_town').val() + ", " : "";
  2777. address += ($('#mortgage_county').val() != "") ? $('#mortgage_county').val() + ", " : "";
  2778. address += ($('#mortgage_postcode').val() != "") ? $('#mortgage_postcode').val() + "," : "";
  2779.  
  2780.  
  2781. $.ajax({
  2782. url: "../AppTrack/GetAutoEmailTemplate",
  2783. cache: false,
  2784. type: "POST",
  2785. data: "{'statusId':" + selStatusId + ",'level':" + level + ",'fname':'" + $("#txtfirstname").val() +
  2786. "','mortgage_amount':'" + $('#mortgage_amount').val() + "','mortgage_propertyvalue':'"
  2787. + $('#mortgage_propertyvalue').val() + "','mortgage_propertyaddress':"
  2788. + JSON.stringify(address)
  2789. + ",'adviser':'" + adviser + "','email':'" + email + "','adviserId':" + adviserId + "}",
  2790.  
  2791. contentType: "application/json; charset=utf-8",
  2792. dataType: "json",
  2793. beforeSend: function () {
  2794. $("#overlaycontainer").show();
  2795. },
  2796. success: function (result) {
  2797. setAutoEmailContent(result, selStatusId, level);
  2798. }
  2799. });
  2800.  
  2801.  
  2802. }
  2803.  
  2804.  
  2805.  
  2806. //////// auto emails
  2807.  
  2808. function setAutoEmailContent(result, selStatusId, level) {
  2809. var opts = '<OPTION VALUE="' + result.tempId + '">' + result.tempName + '</OPTION>';
  2810. $("#drpAutoEmailtemplate").html(opts);
  2811.  
  2812. // Get the editor instance that we want to interact with.
  2813. var editor = CKEDITOR.instances.txtAutoEmailBody;
  2814. editor.setData(result.data);
  2815.  
  2816. var subject = '';
  2817.  
  2818. if (level == 0 && selStatusId == 6) {
  2819. subject = 'Application Submitted';
  2820. }
  2821. else if (level == 0 && selStatusId == 7) {
  2822. subject = 'Offer Issued';
  2823. }
  2824. else if (level == 0 && selStatusId == 8) {
  2825. subject = 'Application Completed';
  2826. }
  2827. else if (level == 0 && selStatusId == 2) {
  2828. subject = 'Time To Remortgage';
  2829. }
  2830. else if (level == 1 && selStatusId == 1) {
  2831. subject = 'Valuation Instructed';
  2832. }
  2833. else if (level == 1 && selStatusId == 2) {
  2834. subject = 'Valuation Received';
  2835. }
  2836. else if (level == 1 && selStatusId == 3) {
  2837. subject = 'Exchange of Contracts';
  2838. }
  2839.  
  2840. else if (level == 0 && selStatusId == 13) {
  2841. subject = 'Application Submitted';
  2842. }
  2843.  
  2844. else if (level == 0 && selStatusId == 14) {
  2845. subject = 'Application Completed';
  2846. }
  2847. $('#txtAutoEmailSubject').val(subject);
  2848.  
  2849. $("#overlaycontainer").hide();
  2850.  
  2851. }
  2852.  
  2853. function RedirectToFactFind(contactId) {
  2854.  
  2855. var _Url = '@Url.Action("RedirectToFactfindPage", "Apptrack")';
  2856.  
  2857. $.ajax({
  2858. type: "Get",
  2859. url: _Url,
  2860. data: { contactid: contactId },
  2861. contentType: "application/json; charset=utf-8",
  2862. dataType: "json",
  2863. async: false,
  2864. error: function (error) {
  2865.  
  2866. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2867. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2868. $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
  2869. $("#Message_Box_Dialog").modal('show');
  2870. },
  2871. success: function (data) {
  2872. if (data.length > 0 && data != '0' && data != null) {
  2873. // window.location.href = data;
  2874. window.open(data, '_blank');
  2875.  
  2876. }
  2877. else {
  2878.  
  2879. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2880. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2881. $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
  2882. $("#Message_Box_Dialog").modal('show');
  2883. }
  2884. }
  2885. });
  2886.  
  2887. }
  2888.  
  2889.  
  2890. function SendFactFind(contactId) {
  2891. var _Url = '@Url.Action("SendFactfindLink", "Apptrack")';
  2892. $.ajax({
  2893. type: "Get",
  2894. url: _Url,
  2895. data: { contactid: contactId },
  2896. contentType: "application/json; charset=utf-8",
  2897. dataType: "json",
  2898. async: false,
  2899. error: function (error) {
  2900.  
  2901. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2902. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2903. $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
  2904. $("#Message_Box_Dialog").modal('show');
  2905. },
  2906. success: function (data) {
  2907. if (parseInt(data) == 1) {
  2908.  
  2909. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2910. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2911. $("#Message_Box_Dialog #lbl_message_Green").html('Requested token has been sent successfully.');
  2912. $("#Message_Box_Dialog").modal('show');
  2913.  
  2914. }
  2915. else {
  2916.  
  2917. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2918. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2919. $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
  2920. $("#Message_Box_Dialog").modal('show');
  2921. }
  2922. }
  2923. });
  2924. }
  2925.  
  2926. function GenerateFactfind(contactId) {
  2927. var _Url = '@Url.Action("GenerateFactfind", "Apptrack")';
  2928. $.ajax({
  2929. type: "Get",
  2930. url: _Url,
  2931. data: { contactid: contactId },
  2932. contentType: "application/json; charset=utf-8",
  2933. dataType: "json",
  2934. async: false,
  2935. error: function (error) {
  2936.  
  2937. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2938. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2939. $("#Message_Box_Dialog #lbl_message_Red").html('Internal error occured, Please try again later');
  2940. $("#Message_Box_Dialog").modal('show');
  2941. },
  2942. success: function (username) {
  2943. if (username.username != null) {
  2944. var target = $("#divFactFindArea");
  2945. target.empty();
  2946. var detail = "";
  2947. var path = '#';
  2948. var user = username.username;
  2949. var password = username.password;
  2950. detail += "<div>"
  2951. detail += "<div class='col-md-6 heading pull-left'>"
  2952. detail += "<label>"
  2953. detail += "<a id='linkfactfind' href='" + path + "' target='_blank'>Goto FactFind</a>"
  2954. detail += "</label>"
  2955. detail += "</div>"
  2956. detail += "<div class='col-md-6 heading pull-left'>"
  2957. detail += "<label>"
  2958. detail += "<a id='linksendfactfind' href='javascript:void(null)' onclick='SendFactFind(@Model.contactid)'>Request Token</a>"
  2959. detail += "</label>"
  2960. detail += "</div>"
  2961. detail += "</div><div class='col-md-6'><div class='row'><div class='col-md-4'><label>User Name</label></div>"
  2962. detail += "<div class='col-md-8'>"
  2963. detail += "<input type='text' readonly value='" + user + "' maxlength='300' class='idleField txtField capitalField txt_field'>"
  2964. detail += "</div></div></div><div class='col-md-6'><div class='row'>"
  2965. detail += "<div class='col-md-4'><label>Password</label></div>"
  2966. detail += "<div class='col-md-8'>"
  2967. detail += "<input type='button' id='btnPassword' onclick='ShowPAssword()' value='Show Password' class='btn-blue' />"
  2968. detail += "<input id='input_password' type='text' readonly style='display:none' maxlength='300' class='idleField txtField capitalField txt_field'>"
  2969. detail += "<input type='hidden' id='hdnFactFindPassword' value='" + password + "' />"
  2970. detail += "</div></div></div>"
  2971. $("#divFactFindArea").append(detail).show('slow');
  2972. $('a#linkfactfind').mousedown(function (event) {
  2973. var cId = $("#hdn_Contt_id_f").val();
  2974. RedirectToFactFind(cId);
  2975. });
  2976.  
  2977. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2978. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2979. $("#Message_Box_Dialog #lbl_message_Green").html('Token has been generated successfully.');
  2980. $("#Message_Box_Dialog").modal('show');
  2981.  
  2982. }
  2983. else {
  2984. $("#Message_Box_Dialog #lbl_message_Green").html('');
  2985. $("#Message_Box_Dialog #lbl_message_Red").html('');
  2986. $("#Message_Box_Dialog #lbl_message_Red").html('Unable to process your request, Please try again later');
  2987. $("#Message_Box_Dialog").modal('show');
  2988. }
  2989. }
  2990. });
  2991.  
  2992. }
  2993.  
  2994.  
  2995. $(document).ready(function () {
  2996. $(".mort_sub_s_tatus1").hide();
  2997.  
  2998. //$("#mortgage_substatus").val();
  2999.  
  3000.  
  3001. $("#life_status").change(function () {
  3002. selStatusId = $("#life_status option:selected").val();
  3003. if (selStatusId == 13 || selStatusId == 14) {
  3004. PostAjaxTemplateCall(selStatusId, 0);
  3005. }
  3006. });
  3007.  
  3008. $("#mortgage_substatus").change(function () {
  3009. selStatusId = $("#mortgage_substatus option:selected").val();
  3010. if (selStatusId == 1 || selStatusId == 2 || selStatusId == 3) {
  3011. PostAjaxTemplateCall(selStatusId, 1);
  3012. }
  3013. });
  3014.  
  3015. $("#mortagestatus").change(function () {
  3016. selStatusId = $("#mortagestatus option:selected").val();
  3017. if (selStatusId == 6 || selStatusId == 7 || selStatusId == 8 || selStatusId == 2) {
  3018. PostAjaxTemplateCall(selStatusId, 0);
  3019. }
  3020. BindFinanceSubstatus($("#mortagestatus option:selected").val());
  3021. });
  3022.  
  3023.  
  3024. //$('#_DSleadRef').chosen();
  3025. $('#expand').hide();
  3026. $('#directLead').click(function () {
  3027. $('#expand').toggle();
  3028. });
  3029. //
  3030. var SinglValueURL = '@Url.Action("GetContactsValue", "Reports")';
  3031. var attendeeUrl = '@Url.Action("GetSelect2Contact", "Reports")';
  3032. var pageSize = 20;
  3033.  
  3034.  
  3035. var lastResults = [];
  3036. $('#_DSleadRef').select2({
  3037. placeholder: 'Any',
  3038. //Does the user have to enter any data before sending the ajax request
  3039. minimumInputLength: 0,
  3040. allowClear: true,
  3041. ajax: {
  3042. multiple: true,
  3043. quietMillis: 150,
  3044. url: attendeeUrl,
  3045. dataType: 'jsonp',
  3046. //Our search term and what page we are on
  3047. data: function (term, page) {
  3048. return {
  3049. datatype: (term = '' || term.length <= 0) ? parseInt(10) : parseInt(1),
  3050. pageSize: pageSize,
  3051. pageNum: page,
  3052. allowClear: true,
  3053. searchTerm: $('.select2-drop').find('input.select2-active').val()
  3054. };
  3055. },
  3056. results: function (data, page) {
  3057. lastResults = data.Results;
  3058. var more = (page * pageSize) < data.Total;
  3059. return { results: data.Results, more: more };
  3060. }
  3061. }, createSearchChoice: function (term) {
  3062. var text = $('.select2-drop').find('input.select2-active').val();
  3063. return { id: term, text: text };
  3064. }, initSelection: function (element, callback) {
  3065. var elementText = $(element).attr('tooltip');
  3066. $.ajax(SinglValueURL, {
  3067. data: {
  3068. searchTerm: elementText
  3069. },
  3070. dataType: "json"
  3071. }).done(function (data) {
  3072. callback(data.Results[0])
  3073. });
  3074. }
  3075.  
  3076. });
  3077.  
  3078. //
  3079.  
  3080.  
  3081.  
  3082.  
  3083. var SinglValueURL = '@Url.Action("GetProviderSolicitorValue", "AppTrack")';
  3084. var attendeeUrl = '@Url.Action("GetProviderOrSoliciterDemo", "AppTrack")';
  3085. var pageSize = 20;
  3086. var financetype = $("#financetype option:selected").val();
  3087.  
  3088. var lastResults = [];
  3089. $('#mortgage_lender').select2({
  3090. placeholder: 'Any',
  3091. //Does the user have to enter any data before sending the ajax request
  3092. minimumInputLength: 0,
  3093. allowClear: true,
  3094. ajax: {
  3095. multiple: true,
  3096. quietMillis: 150,
  3097. url: attendeeUrl,
  3098. dataType: 'jsonp',
  3099. //Our search term and what page we are on
  3100. data: function (term, page) {
  3101. return {
  3102. pageSize: pageSize,
  3103. pageNum: page,
  3104. allowClear: true,
  3105. searchTerm: $('.select2-drop').find('input.select2-active').val()
  3106. };
  3107. },
  3108. results: function (data, page) {
  3109. lastResults = data.Results;
  3110. var more = (page * pageSize) < data.Total;
  3111. return { results: data.Results, more: more };
  3112. }
  3113. }, createSearchChoice: function (term) {
  3114. var text = $('.select2-drop').find('input.select2-active').val();
  3115. return { id: term, text: text };
  3116. }, initSelection: function (element, callback) {
  3117. var elementText = $(element).attr('tooltip');
  3118. $.ajax(SinglValueURL, {
  3119. data: {
  3120. searchTerm: elementText
  3121. },
  3122. dataType: "json"
  3123. }).done(function (data) {
  3124. callback(data.Results[0])
  3125. });
  3126. }
  3127.  
  3128. });
  3129.  
  3130. var SinglValueURL = $("#SinglValueURL").val();
  3131. $('#mortgage_solicitor').select2({
  3132. placeholder: 'Any',
  3133. //Does the user have to enter any data before sending the ajax request
  3134. minimumInputLength: 0,
  3135. allowClear: true,
  3136. ajax: {
  3137. multiple: true,
  3138. quietMillis: 150,
  3139. url: attendeeUrl,
  3140. dataType: 'jsonp',
  3141. //Our search term and what page we are on
  3142. data: function (term, page) {
  3143. return {
  3144. datatype: (term = '' || term.length <= 0) ? parseInt(20) : parseInt(2),
  3145. financetype: financetype,
  3146. pageSize: pageSize,
  3147. pageNum: page,
  3148. allowClear: true,
  3149. searchTerm: $('.select2-drop').find('input.select2-active').val()
  3150. };
  3151. },
  3152. results: function (data, page) {
  3153. lastResults = data.Results;
  3154. var more = (page * pageSize) < data.Total;
  3155. return { results: data.Results, more: more };
  3156. }
  3157. }, createSearchChoice: function (term) {
  3158. var text = $('.select2-drop').find('input.select2-active').val();
  3159. return { id: term, text: text };
  3160. }, initSelection: function (element, callback) {
  3161.  
  3162. var elementText = $(element).attr('tooltip');
  3163. $.ajax(SinglValueURL, {
  3164. data: {
  3165. searchTerm: elementText
  3166. },
  3167. dataType: "json"
  3168. }).done(function (data) {
  3169. callback(data.Results[0])
  3170. });
  3171. }
  3172.  
  3173. });
  3174. });
  3175.  
  3176. function validateNumbersOnly(e) {
  3177.  
  3178. var unicode = e.charCode ? e.charCode : e.keyCode;
  3179. if ((unicode == 8) || (unicode == 9) || (unicode > 47 && unicode < 58) || unicode == 37 || unicode == 32 || unicode == 39) {
  3180. return true;
  3181. }
  3182. else {
  3183. return false;
  3184. }
  3185.  
  3186. }
  3187. /* charecter count */
  3188.  
  3189. $('#mortgage_note').on('input', function (event) {
  3190. //alert($(this).val().length);
  3191. $('#totalCharacters').text($(this).val().length);
  3192.  
  3193. });
  3194. function toUpperFirstLetter(obj) {
  3195.  
  3196. var mystring = obj.value;
  3197. var f, r;
  3198.  
  3199. f = mystring.substring(0, 1).toUpperCase();
  3200. r = mystring.substring(1).toLowerCase();
  3201. obj.value = f + r;
  3202. return true;
  3203. }
  3204. /* charecter count */
  3205. $('#_DSaid1').unbind('change').change(function () {
  3206. $("#hideRow").hide();
  3207. var hold = $(this);
  3208. var _spn = hold.next('.customStyleSelectBox').find('.customStyleSelectBoxInner');
  3209. _spn.html(hold.find(':selected').text());
  3210. var maintbl = $('#basetable1');
  3211. $('#loaddiv1').remove();
  3212. // 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>';
  3213. 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>';
  3214.  
  3215. maintbl.after(newobj);
  3216. FindContactsForAccount();
  3217. // ddoperation();
  3218. });
  3219.  
  3220.  
  3221. function FindContactsForAccount() {
  3222.  
  3223. var url = $('#hdfindcontacts').val();
  3224. var accountId = $('#_DSaid1 option:selected').val();
  3225.  
  3226. var Criteria = JSON.stringify({ accountId: accountId });
  3227.  
  3228. $.ajaxSetup({ cache: false });
  3229. $.ajax({
  3230. type: "POST",
  3231. url: url,
  3232. data: Criteria,
  3233. contentType: "application/json; charset=utf-8",
  3234. dataType: "json",
  3235. error: function (error) {
  3236. // alert('Error:' + error.responseText);
  3237. },
  3238. success: function (data) {
  3239.  
  3240. var bmap = [];
  3241. var nmap = [];
  3242. if (data.contactlists.length > 0) {
  3243.  
  3244. $('#ddbranch').html('');
  3245. $('#ddneg').html('');
  3246. if (data.contactlists[0].length > 0) {
  3247. for (j = 0; j < data.contactlists[0].length; j++) {
  3248. if (data.contactlists[0][j] != '') {
  3249. if (bmap.indexOf(data.contactlists[0][j]) == -1) {
  3250. bmap.push(data.contactlists[0][j]);
  3251. }
  3252. }
  3253. }
  3254. }
  3255. //for neg
  3256. if (data.contactlists[1].length > 0) {
  3257. for (k = 0; k < data.contactlists[1].length; k++) {
  3258. if (data.contactlists[1][k] != '') {
  3259. if (nmap.indexOf(data.contactlists[1][k]) == -1) {
  3260. nmap.push(data.contactlists[1][k]);
  3261. }
  3262. }
  3263. }
  3264. }
  3265.  
  3266. bmap.sort(function (a, b) {
  3267. if (a.toLowerCase() < b.toLowerCase()) return -1;
  3268. if (a.toLowerCase() > b.toLowerCase()) return 1;
  3269. return 0;
  3270. });
  3271. nmap.sort(function (a, b) {
  3272. if (a.toLowerCase() < b.toLowerCase()) return -1;
  3273. if (a.toLowerCase() > b.toLowerCase()) return 1;
  3274. return 0;
  3275. });
  3276. var laststring = '';
  3277. for (j = 0; j < bmap.length; j++) {
  3278. if (laststring != bmap[j].toLowerCase()) {
  3279. $('#ddbranch').append('<li onclick="ddoperationBranch(this)">' + bmap[j] + '</li>');
  3280. laststring = bmap[j].toLowerCase();
  3281. }
  3282. }
  3283. for (j = 0; j < nmap.length; j++) {
  3284. if (laststring != nmap[j].toLowerCase()) {
  3285. $('#ddneg').append('<li onclick="ddoperationneg(this)">' + nmap[j] + '</li>');
  3286. laststring = nmap[j].toLowerCase();
  3287. }
  3288. }
  3289.  
  3290.  
  3291. }
  3292. else if (data.contactlists.length == 0) {
  3293. $('#branch').val('');
  3294. $('#neg').val('');
  3295. $('#ddbranch').hide();
  3296. $('#ddneg').hide();
  3297. }
  3298. }
  3299. });
  3300. }
  3301. function ddoperationBranch(hold) {
  3302. $('input#branch').val(hold.textContent);
  3303. $('ul#ddbranch').hide();
  3304. }
  3305.  
  3306. function ddoperationneg(hold) {
  3307. $('input#neg').val(hold.textContent);
  3308. $('ul#ddneg').hide();
  3309. }
  3310. $('#exportall').click(function () {
  3311. var financeId = $('#financemortageproductselect').val();
  3312. var mortgage_date = $("#mortgage_date").val();
  3313. var mortgage_time = $("#mortgage_time").val();
  3314. var d = { financeid: financeId, followUpDate: mortgage_date, followUpTime: mortgage_time };
  3315. var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
  3316. var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
  3317. $.ajaxSetup({ cache: false });
  3318. $.ajax({
  3319. type: "POST",
  3320. url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
  3321. data: JSON.stringify(d),
  3322. contentType: "application/json; charset=utf-8",
  3323. dataType: "json", beforeSend: function () {
  3324. $('#overlaycontainer').show();
  3325. },
  3326. success: function (data) {
  3327. $('#overlaycontainer').hide();
  3328. if (data.filename != "") {
  3329. window.location = getUrl + "?filename=" + data.filename;
  3330. }
  3331. }, error: function (xhr, ajaxOptions, thrownError) {
  3332. $('#overlaycontainer').hide();
  3333. alert("No File Created!");
  3334. }
  3335. });
  3336. });
  3337.  
  3338.  
  3339. $('#exportallLife').click(function () {
  3340. var financeId = $('#LifeProductAdd').val();
  3341. var life_date = $("#life_followupdate").val();
  3342. var life_time = $("#life_followuptime").val();
  3343. var d = { financeid: financeId, followUpDate: life_date, followUpTime: life_time };
  3344. var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
  3345. var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
  3346. $.ajaxSetup({ cache: false });
  3347. $.ajax({
  3348. type: "POST",
  3349. url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
  3350. data: JSON.stringify(d),
  3351. contentType: "application/json; charset=utf-8",
  3352. dataType: "json", beforeSend: function () {
  3353. $('#overlaycontainer').show();
  3354. },
  3355. success: function (data) {
  3356. $('#overlaycontainer').hide();
  3357. if (data.filename != "") {
  3358. window.location = getUrl + "?filename=" + data.filename;
  3359. }
  3360. }, error: function (xhr, ajaxOptions, thrownError) {
  3361. $('#overlaycontainer').hide();
  3362. alert("No File Created!");
  3363. }
  3364. });
  3365. });
  3366.  
  3367. $('#exportallBuilding').click(function () {
  3368. var financeId = $('#BuildingContentProductAdd').val();
  3369. var Building_date = $("#buildingcontent_date").val();
  3370. var Building_time = $("#buildingcontent_time").val();
  3371. var d = { financeid: financeId, followUpDate: Building_date, followUpTime: Building_time };
  3372. var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
  3373. var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
  3374. $.ajaxSetup({ cache: false });
  3375. $.ajax({
  3376. type: "POST",
  3377. url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
  3378. data: JSON.stringify(d),
  3379. contentType: "application/json; charset=utf-8",
  3380. dataType: "json", beforeSend: function () {
  3381. $('#overlaycontainer').show();
  3382. },
  3383. success: function (data) {
  3384. $('#overlaycontainer').hide();
  3385. if (data.filename != "") {
  3386. window.location = getUrl + "?filename=" + data.filename;
  3387. }
  3388. }, error: function (xhr, ajaxOptions, thrownError) {
  3389. $('#overlaycontainer').hide();
  3390. alert("No File Created!");
  3391. }
  3392. });
  3393. });
  3394.  
  3395. $('#exportallPension').click(function () {
  3396. var financeId = $('#PensionProductAdd').val();
  3397. var Pension_date = $("#pension_date").val();
  3398. var Pension_time = $("#pension_time").val();
  3399. var d = { financeid: financeId, followUpDate: Pension_date, followUpTime: Pension_time };
  3400. var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
  3401. var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
  3402. $.ajaxSetup({ cache: false });
  3403. $.ajax({
  3404. type: "POST",
  3405. url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
  3406. data: JSON.stringify(d),
  3407. contentType: "application/json; charset=utf-8",
  3408. dataType: "json", beforeSend: function () {
  3409. $('#overlaycontainer').show();
  3410. },
  3411. success: function (data) {
  3412. $('#overlaycontainer').hide();
  3413. if (data.filename != "") {
  3414. window.location = getUrl + "?filename=" + data.filename;
  3415. }
  3416. }, error: function (xhr, ajaxOptions, thrownError) {
  3417. $('#overlaycontainer').hide();
  3418. alert("No File Created!");
  3419. }
  3420. });
  3421. });
  3422.  
  3423. $('#exportallInvestment').click(function () {
  3424. var financeId = $('#InvestmentProductAdd').val();
  3425. var Investment_date = $("#investment_date").val();
  3426. var Investment_time = $("#investment_time").val();
  3427. var d = { financeid: financeId, followUpDate: Investment_date, followUpTime: Investment_time };
  3428. var getUrl = '@Url.Action("DownloadIcsReport", "Scheduler")';
  3429. var Criteria = JSON.stringify({ financeid: $('#financemortageproductselect').val() });
  3430. $.ajaxSetup({ cache: false });
  3431. $.ajax({
  3432. type: "POST",
  3433. url: '@Url.Action("DownloadICSFileForApplicationPage", "Scheduler")',
  3434. data: JSON.stringify(d),
  3435. contentType: "application/json; charset=utf-8",
  3436. dataType: "json", beforeSend: function () {
  3437. $('#overlaycontainer').show();
  3438. },
  3439. success: function (data) {
  3440. $('#overlaycontainer').hide();
  3441. if (data.filename != "") {
  3442. window.location = getUrl + "?filename=" + data.filename;
  3443. }
  3444. }, error: function (xhr, ajaxOptions, thrownError) {
  3445. $('#overlaycontainer').hide();
  3446. alert("No File Created!");
  3447. }
  3448. });
  3449. });
  3450.  
  3451. function BindFinanceSubstatus(StatusId) {
  3452. //var StatusId = $("#mortagestatus option:selected").val();
  3453. if (StatusId == '6' || StatusId == '7') {
  3454. var Criteria = JSON.stringify({ StatusId: StatusId });
  3455. var url = '@Url.Action("BindSubFinanceStatus","Apptrack")';
  3456. $.ajaxSetup({ cache: false });
  3457. $.ajax({
  3458. type: "POST",
  3459. url: url,
  3460. data: Criteria,
  3461. contentType: "application/json; charset=utf-8",
  3462. dataType: "json",
  3463. //async: false,
  3464. error: function (error) {
  3465. // alert('Error:' + error.responseText);
  3466. },
  3467. success: function (data) {
  3468.  
  3469. if (data.substatusList.length > 0) {
  3470. $('#mortgage_substatus').empty();
  3471. for (var i = 0; i < data.substatusList.length; i++) {
  3472. $('#mortgage_substatus').append('<option value="' + data.substatusList[i].Value + '">' + data.substatusList[i].Text + '</option>');
  3473. }
  3474. var hold = $('.colFinanceSubstatus');
  3475. hold.css('display', '');
  3476. }
  3477. else {
  3478.  
  3479. $('#mortgage_substatus').empty();
  3480. $('#mortgage_substatus').append('<option value="0">None</option>');
  3481. var hold = $('.colFinanceSubstatus');
  3482. hold.css('display', 'none');
  3483. }
  3484. return true;
  3485. }
  3486. });
  3487. }
  3488. else {
  3489. $('#mortgage_substatus').empty();
  3490. $('#mortgage_substatus').append('<option value="0">None</option>');
  3491. var hold = $('.colFinanceSubstatus');
  3492. hold.css('display', 'none');
  3493. }
  3494. }
  3495. function SelectTextFromDDL(id) {
  3496. var x = document.getElementById(id);
  3497. for (var i = 0; i < x.options.length; i++) {
  3498. if (x.options[i].selected == true) {
  3499. return x.options[i].text;
  3500. }
  3501. }
  3502. }
  3503. function PDFPrint(tagid) {
  3504.  
  3505. var MethodName = $("select#_DSmethod option:selected").text();
  3506. var AdviserName = $("select#_DSbrokerrefAccountForm option:selected").text().substring(0, $("select#_DSbrokerrefAccountForm option:selected").text().indexOf("("));
  3507. var ContactWithinTwoHr = $("select#_Contact_within_2hrs option:selected").text();
  3508. var ApplicationDownloadURl = '@Url.Action("DownloadAttachment", "Apptrack")';
  3509.  
  3510.  
  3511. if (tagid.toLowerCase() == "mortgage") {
  3512. var mortgagename = $("#financemortageproductselect option:selected").text();
  3513. var Status = $("select#mortagestatus option:selected").text();
  3514. var SubStatus = $("select#mortgage_substatus option:selected").text();
  3515. var lendername = $("#s2id_mortgage_lender").text();
  3516. var mortgagetype = $("select#mortgage_reason option:selected").text();
  3517. var ratetype = ($("#RateFix").prop("checked") == true ? $("#RateFix").val() : ($("#RateTracker").prop("checked") == true ? $("#RateTracker").val() : ""));
  3518. var solicitor = $("#s2id_mortgage_solicitor").text();
  3519. var MortgagePDFFileURl = '@Url.Action("SaveMortgagePDF", "Apptrack")';
  3520.  
  3521.  
  3522. $.ajax({
  3523. url: MortgagePDFFileURl,
  3524. cache: false,
  3525. data: { strmortgagename: mortgagename, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strSubStatus: SubStatus, strLender: lendername, strMortgageType: mortgagetype, strRateType: ratetype, strsolicitor: solicitor },
  3526. type: "POST",
  3527. success: function (result) {
  3528. window.location = ApplicationDownloadURl;
  3529. }
  3530. });
  3531. }
  3532. else if (tagid.toLowerCase() == "portfolio") {
  3533.  
  3534. var lifename = $("#LifeProductAdd option:selected").text();
  3535. var Status = $("select#life_status option:selected").text();
  3536. var PolicyType = $("select#life_type option:selected").text();
  3537. var LifePDFFileURl = '@Url.Action("SaveLifePDF", "Apptrack")';
  3538.  
  3539.  
  3540. $.ajax({
  3541. url: LifePDFFileURl,
  3542. cache: false,
  3543. data: { strlifename: lifename, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strPolicyType: PolicyType },
  3544. type: "POST",
  3545. success: function (result) {
  3546.  
  3547. window.location = ApplicationDownloadURl;
  3548. }
  3549. });
  3550. }
  3551. else if (tagid.toLowerCase() == "building") {
  3552.  
  3553. var BuildingContentname = $("select#BuildingContentProductAdd option:selected ").text();
  3554. var Status = $("select#_DSBuildingOrContentStaus option:selected").text();
  3555. var Type = $("select#buildingcontent_type option:selected").text();
  3556. var BuildingsPDFFileURl = '@Url.Action("SaveBuildingsPDF", "Apptrack")';
  3557.  
  3558. $.ajax({
  3559. url: BuildingsPDFFileURl,
  3560. cache: false,
  3561. type: "POST",
  3562. data: { strBuildingContentname: BuildingContentname, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strType: Type },
  3563. success: function (result) {
  3564. window.location = ApplicationDownloadURl;
  3565. }
  3566. });
  3567. }
  3568. else if (tagid.toLowerCase() == "pension") {
  3569.  
  3570. var Pensionname = $("select#PensionProductAdd option:selected ").text();
  3571. var Status = $("select#_DSPensionStatus option:selected").text();
  3572. var pension_riskprofiles = $("select#pension_riskprofile option:selected").text();
  3573. var PensionPDFFileURl = '@Url.Action("SavePensionPDF", "Apptrack")';
  3574.  
  3575. $.ajax({
  3576. url: PensionPDFFileURl,
  3577. cache: false,
  3578. type: "POST",
  3579. data: { strPensionname: Pensionname, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strpension_riskprofiles: pension_riskprofiles },
  3580. success: function (result) {
  3581. window.location = ApplicationDownloadURl;
  3582. }
  3583. });
  3584. }
  3585. else if (tagid.toLowerCase() == "investment") {
  3586.  
  3587. var Investment = $("select#InvestmentProductAdd option:selected ").text();
  3588. var Status = $("select#_DSInvestmentStatus option:selected").text();
  3589. var investment_riskprofiles = $("select#investment_riskprofiles option:selected").text();
  3590. var followUp = $("select#mortgage_Followup option:selected").text()
  3591. var InvestmentsPDFFileURl = '@Url.Action("SaveInvestmentsPDF", "Apptrack")';
  3592.  
  3593. $.ajax({
  3594. url: InvestmentsPDFFileURl,
  3595. cache: false,
  3596. type: "POST",
  3597. data: { strInvestment: Investment, strMethod: MethodName, strAdviser: AdviserName, strContactWithinTwoHr: ContactWithinTwoHr, strStatus: Status, strinvestment_riskprofiles: investment_riskprofiles },
  3598. success: function (result) {
  3599. window.location = ApplicationDownloadURl;
  3600. }
  3601. });
  3602. }
  3603.  
  3604. }
  3605. </script>
  3606. <script type='text/javascript'>
  3607. jQuery(function($){
  3608. $('a#linkfactfind').mousedown(function (event) {
  3609. //For all click of mouse like left,middle,right
  3610. var cId = $("#hdn_Contt_id_f").val();
  3611. RedirectToFactFind(cId);
  3612. });
  3613. });
  3614. $('#mortage_notes_allow').val('true')
  3615. $('#mortage_notes_allow').on('change', function () { // on change of state
  3616. if (this.checked) // if changed state is "CHECKED"
  3617. {
  3618. $('#mortage_notes_allow').val('true')
  3619. // alert($('#mortage_notes_allow').val());
  3620. }
  3621. else {
  3622. $('#mortage_notes_allow').val('false')
  3623. //alert($('#mortage_notes_allow').val());
  3624. }
  3625. })
  3626. </script>
  3627.  
  3628. ==========================================================
  3629. @{ string _chachebreaker = Occfinance.Code.WebUtility.GetBreaker("~/Scripts/Attendance.js"); }
  3630.  
  3631. <script>
  3632. function SerachData() {
  3633. Reset();
  3634.  
  3635. var Year = $("#yearsearch").val();
  3636. var Name = $("#brokernamesearch").val();
  3637. var TeamId = $("#TeamId").val();
  3638.  
  3639. if (Year.length < 4 && Year.length > 0) {
  3640. alert('Invalid year.');
  3641. $("#yearsearch").focus();
  3642. return false;
  3643. }
  3644. var Criteria = { Year: Year, Name: Name, TeamId: TeamId };
  3645.  
  3646. $.ajax({
  3647. url: '@Url.Action("BrokerAttendanceListTab", "apptrack")',
  3648. type: 'POST',
  3649. cache: false,
  3650. async:false,
  3651. data: Criteria,
  3652. success: function (result) {
  3653. $('#divbrkyearlist').html(result);
  3654. }
  3655. });
  3656.  
  3657. }
  3658.  
  3659. $(document).ready(function () {
  3660. var Year = $("#yearsearch").val();
  3661.  
  3662. if (Year.length == 0) {
  3663. var cDate = new Date();
  3664. var year = "";
  3665. year = cDate.getFullYear();
  3666. $("#yearsearch").val(year);
  3667. }
  3668. });
  3669.  
  3670. </script>
  3671.  
  3672. <tbody>
  3673. @{
  3674. List<Occfinance.Models.AttendanceClients> clients = (List<Occfinance.Models.AttendanceClients>)Model;
  3675. if (clients.Count() > 0)
  3676. {
  3677. var _rowId = "";
  3678. for (int c = 0; c < clients.Count(); c++)
  3679. {
  3680. _rowId = "rowId" + c;
  3681. <tr @(c % 2 == 0 ? "" : "class=odd") id="@_rowId">
  3682. <td style="width: 60px;">
  3683. @if (Occfinance.Code.SessionWrapper.PermissionSession.IsFullPermission || Occfinance.Code.SessionWrapper.PermissionSession.IsUpdateAllData)
  3684. {
  3685. <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;" />
  3686. if (clients[c].AbsentHrsAllowed != 0)
  3687. {
  3688. <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">
  3689. }
  3690. else
  3691. {
  3692. <img id="imgdeletebr" style="cursor: default; float:left; padding: 2px;" src="@Url.Content("~/Images/delete.gif")" alt="Delete" title="No hours assigned to delete!">
  3693.  
  3694. }
  3695. }
  3696. <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">
  3697. </td>
  3698. <td>
  3699. <span id="spbrokername">@clients[c].contactname</span>
  3700. <input type="hidden" value="@clients[c].contactname" />
  3701. </td>
  3702. <td>@clients[c].email</td>
  3703. <td style="width: 10%;">
  3704. @clients[c].AbsentHrsAllowed
  3705.  
  3706. </td>
  3707. <td style="width: 10%;">
  3708. @clients[c].AbsentHrsUsed
  3709.  
  3710. </td>
  3711. <td style="width: 15%;">
  3712. @(clients[c].ActivityDate.HasValue ? clients[c].ActivityDate.Value.ToString("dd-MM-yyyy") : "")
  3713.  
  3714. </td>
  3715. </tr>
  3716. }
  3717. }
  3718. }
  3719.  
  3720.  
  3721. </tbody>
  3722.  
  3723. <script>
  3724. function SerachDayData() {
  3725. ResetDay();
  3726.  
  3727. var Name = $("#brokernamesearchday").val();
  3728. var TeamId = $("#TeamIdDay").val();
  3729. var cdate = $("#txtsearchdate").val();
  3730.  
  3731. if (cdate.length < 10 && cdate.length > 0) {
  3732. alert('Invalid date.');
  3733. $("#txtsearchdate").focus();
  3734. return false;
  3735. }
  3736.  
  3737. var Criteria = { DayVal: cdate, Name: Name, TeamId: TeamId };
  3738.  
  3739. $.ajax({
  3740. url: '@Url.Action("BrokerDayWiseAttendanceListTab", "apptrack")',
  3741. type: 'POST',
  3742. cache: false,
  3743. async: false,
  3744. data: Criteria,
  3745. success: function (result) {
  3746. $('#divbrkmonthlist').html(result);
  3747. }
  3748. });
  3749.  
  3750. }
  3751.  
  3752. function GoToSchedule(userid) {
  3753. if (userid > 0) {
  3754.  
  3755. var Criteria = { uid: userid };
  3756. $.ajax({
  3757. url: '@Url.Action("Attendance_Read", "Attendance")',
  3758. type: 'GET',
  3759. cache: false,
  3760. async: false,
  3761. data: Criteria,
  3762. dataType: "jsonp", contentType: "application/json",
  3763. success: function (result) {
  3764. $("#tab3").click();
  3765. }
  3766. });
  3767.  
  3768.  
  3769. }
  3770. }
  3771.  
  3772. @{
  3773. var today = DateTime.Today.ToString("yyyy/MM/dd");
  3774. }
  3775.  
  3776. <script>
  3777. var _data = [];
  3778. function StartTimeAppointments() {
  3779. now = new Date();
  3780. year = "" + now.getFullYear() - 3;
  3781. month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
  3782. day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
  3783.  
  3784. var hour = now.getHours();
  3785. var minute = now.getMinutes();
  3786. var second = now.getSeconds();
  3787. var ap = "AM";
  3788. if (hour > 11) { ap = "PM"; }
  3789. if (hour > 12) { hour = hour - 12; }
  3790. if (hour == 0) { hour = 12; }
  3791. if (hour < 10) { hour = "0" + hour; }
  3792. if (minute < 10) { minute = "0" + minute; }
  3793. if (second < 10) { second = "0" + second; }
  3794. var timeString = hour +
  3795. ':' +
  3796. minute +
  3797. " " +
  3798. ap;
  3799.  
  3800. return day + "/" + month + "/" + year + " " + "08:00 AM";
  3801. }
  3802. function EndTimeAppointments() {
  3803.  
  3804. now = new Date();
  3805. year = "" + now.getFullYear();
  3806. month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
  3807. day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
  3808.  
  3809. var hour = now.getHours();
  3810. var minute = now.getMinutes();
  3811. var second = now.getSeconds();
  3812. var ap = "AM";
  3813. if (hour > 11) { ap = "PM"; }
  3814. if (hour > 12) { hour = hour - 12; }
  3815. if (hour == 0) { hour = 12; }
  3816. if (hour < 10) { hour = "0" + hour; }
  3817. if (minute < 10) { minute = "0" + minute; }
  3818. if (second < 10) { second = "0" + second; }
  3819. var timeString = hour +
  3820. ':' +
  3821. minute +
  3822. " " +
  3823. ap;
  3824. return day + "/" + month + "/" + year + " " + "07:30 PM";
  3825. }
  3826.  
  3827. function js_yyyy_mm_dd() {
  3828. now = new Date();
  3829. year = "" + now.getFullYear();
  3830. month = "" + (now.getMonth() + 1); if (month.length == 1) { month = "0" + month; }
  3831. day = "" + now.getDate(); if (day.length == 1) { day = "0" + day; }
  3832. return day + "/" + month + "/" + year;
  3833. }
  3834.  
  3835.  
  3836. function scheduler_navigate(e) {
  3837.  
  3838. //makeHoliday(dno, title)
  3839.  
  3840. var action = e.action;
  3841. var view = e.view;
  3842.  
  3843. var showdate = dateFormat(new Date(e.date), 'dd/mm/yyyy')
  3844. var date = kendo.format("{0:d}", e.date);
  3845. var brokername = $('#brokernamesearchattendance').val();
  3846. var teammanager = $('#TeamIdAttendace').val();
  3847. $('#overlaycontainer').show();
  3848.  
  3849.  
  3850. $.ajax({
  3851. type: "POST",
  3852. url: '@Url.Action("SetValuestoSession", "Attendance")',
  3853. data: { Broker: brokername, ActivityDate: showdate, Team: teammanager, View: view },
  3854. success: function (result) {
  3855. $("#scheduler").data("kendoScheduler").refresh();
  3856. $("#scheduler").data("kendoScheduler").dataSource.read();
  3857. $("#scheduler").data("kendoScheduler").refresh();
  3858.  
  3859. if ((action == "next" || action == "previous") && view == "day") {
  3860. $('#txtsearchdateattendance').val(showdate);
  3861. }
  3862. else {
  3863. $('#txtsearchdateattendance').val('');
  3864. }
  3865. $('#overlaycontainer').hide();
  3866.  
  3867. }, error: function (result) {
  3868. $('#overlaycontainer').hide();
  3869. }
  3870.  
  3871. });
  3872. $('#overlaycontainer').hide();
  3873. }
  3874.  
  3875.  
  3876.  
  3877. function scheduler_edit(e) {
  3878.  
  3879. @* $('#DaysOffAbsentType').val('@((int)Occfinance.Helpers.eAttendenceType.FullDayPresent)');*@
  3880. $("#TotalDaysHoursUsed").kendoNumericTextBox();
  3881. $("#ActivityDate").kendoDatePicker(
  3882. {
  3883. format: "dd/MM/yyyy"
  3884. });
  3885.  
  3886. $("#ActivityStartTime").kendoTimePicker(
  3887. {
  3888.  
  3889. min: new Date(2014, 6, 10, 09, 0, 0),
  3890. max: new Date(2014, 6, 10, 18, 00, 0)
  3891. }
  3892. );
  3893. $("#ActivityEndTime").kendoTimePicker({
  3894. min: new Date(2014, 6, 10, 09, 0, 0),
  3895. max: new Date(2014, 6, 10, 18, 00, 0)
  3896. }
  3897. );
  3898.  
  3899.  
  3900. }
  3901. $("#scheduler").kendoScheduler({
  3902.  
  3903. //date: new Date(js_yyyy_mm_dd()),
  3904. date: new Date('@today'),
  3905. startTime: new Date(StartTimeAppointments()),
  3906. endTime: new Date(EndTimeAppointments()),
  3907. showWorkHours: true,
  3908. majorTick: 30,
  3909.  
  3910. workDayStart: new Date(StartTimeAppointments()),
  3911. workDayEnd: new Date(EndTimeAppointments()),
  3912. // navigate: scheduler_navigate,
  3913. edit: scheduler_edit,
  3914. height: 1000,
  3915. footer: "",
  3916. //selectable: true,
  3917. timezone: "Europe/London", // Use the London timezone
  3918. currentTimeMarker: {
  3919. useLocalTimezone: false
  3920. }, editable: {
  3921. confirmation: "Are you sure you want to delete this attendence?",
  3922. template: kendo.template($("#edit-Template").html())
  3923. },
  3924. views: [
  3925. {
  3926. type: "month", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
  3927. },
  3928. {
  3929. type: "week", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
  3930. },
  3931. {
  3932. type: "day", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}", editable: { create: false, destroy: true }
  3933. },
  3934.  
  3935.  
  3936. //,
  3937. //{
  3938. // type: "agenda", selectedDateFormat: "{0:ddd, dd/MM/yyyy} - {1:ddd, dd/MM/yyyy}",
  3939. // editable: { create: false, destroy: true }
  3940. //}
  3941. ],
  3942. allDaySlot: true,
  3943. autoBind: true,
  3944. messages: {
  3945. deleteWindowTitle: "Remove attendence",
  3946. save: "Update",
  3947. editor: {
  3948. editorTitle: "Edit attendence"
  3949. }
  3950. },
  3951. dataSource: {
  3952.  
  3953. sync: function () {
  3954. this.read();
  3955. },
  3956.  
  3957. batch: true,
  3958. transport: {
  3959. read: {
  3960. url: "@Url.Action("Attendance_Read", "Attendance")",
  3961. dataType: "jsonp", contentType: "application/json"
  3962. },
  3963. update: {
  3964. url: "@Url.Action("Attendence_Update", "Attendance")",
  3965. dataType: "jsonp", contentType: "application/json"
  3966. },
  3967. destroy: {
  3968. url: "@Url.Action("Attendence_Destroy", "Attendance")",
  3969. dataType: "jsonp"
  3970. },
  3971.  
  3972. parameterMap: function (options, operation) {
  3973. if (operation == "update" && options.models) {
  3974. var starttime = kendo.parseDate(options.models[0].ActivityStartTime);
  3975. var endtime = kendo.parseDate(options.models[0].ActivityEndTime);
  3976.  
  3977. ShowActivateDivs($.parseJSON(JSON.stringify(options.models[0].DaysOffAbsentType)));
  3978.  
  3979. return {
  3980.  
  3981. Title: $.parseJSON(JSON.stringify(options.models[0].Title)),
  3982. TotalDaysHoursUsed: $.parseJSON(JSON.stringify(options.models[0].TotalDaysHoursUsed)),
  3983. ActivityDate: $.parseJSON(JSON.stringify(options.models[0].ActivityDate)),
  3984. ActivityStartTime: $.parseJSON(JSON.stringify(starttime)),
  3985. ActivityEndTime: $.parseJSON(JSON.stringify(endtime)),
  3986. DaysOffAbsentType: $.parseJSON(JSON.stringify(options.models[0].DaysOffAbsentType)),
  3987. userid: $.parseJSON(JSON.stringify(options.models[0].userid)),
  3988.  
  3989. };
  3990. }
  3991. if (operation == "destroy" && options.models) {
  3992. return {
  3993. userid: $.parseJSON(JSON.stringify(options.models[0].userid)),
  3994. ActivityDate: $.parseJSON(JSON.stringify(options.models[0].ActivityDate)),
  3995. };
  3996. }
  3997. }
  3998. },
  3999. schema: {
  4000. timezone: "Europe/London", // Use the London timezone
  4001. model: {
  4002.  
  4003. id: "DayWiseAtendanceId",
  4004. fields: {
  4005. title: { from: "Title", defaultValue: "No title" },
  4006. start: { type: "date", from: "Start" },
  4007. end: { type: "date", from: "End" },
  4008. startTimezone: { from: "StartTimezone" },
  4009. endTimezone: { from: "EndTimezone" },
  4010. description: { from: "Description" },
  4011. isAllDay: { type: "boolean", from: "IsAllDay" },
  4012. clientid: { from: "clientid" },
  4013. //parent: { from: "parent" },
  4014. companyname: { from: "companyname" },
  4015. TeamName: { from: "TeamName" },
  4016. TeamId: { from: "TeamId" },
  4017. affiliateid: { from: "affiliateid" },
  4018. contactname: { from: "contactname" },
  4019. address: { from: "address" },
  4020. userid: { from: "userid" },
  4021. AdminId: { from: "AdminId" },
  4022. TotalDaysHoursUsed: { from: "TotalDaysHoursUsed" },
  4023. ActivityDate: { type: "date", from: "ActivityDate" },
  4024. ActivityStartTime: { from: "ActivityStartTime" },
  4025. ActivityEndTime: { from: "ActivityEndTime" },
  4026. DaysOffAbsentType: { from: "DaysOffAbsentType" },
  4027. DayWiseAtendanceId: { from: "DayWiseAtendanceId" },
  4028. IsHoliday: { from: "IsHoliday" },
  4029. Holiday: { type: "date", from: "Holiday" },
  4030. HolidayTitle: { from: "HolidayTitle" },
  4031. HolidayDescription: { from: "HolidayDescription" }
  4032. }
  4033. }
  4034. }
  4035. },
  4036.  
  4037.  
  4038.  
  4039. edit: function (e) {
  4040. if (e.event.IsHoliday == 1 || e.event.IsHoliday == 2) {
  4041. e.preventDefault();
  4042. return false;
  4043. }
  4044.  
  4045. },
  4046.  
  4047. moveStart: function (e) {
  4048. if (e.event.IsHoliday == 1 || e.event.IsHoliday == 2) {
  4049. e.preventDefault();
  4050. return false;
  4051. }
  4052.  
  4053. },
  4054.  
  4055. dataBound: function (e) {
  4056. if (e.sender.view().name.toLowerCase() == "day") {
  4057.  
  4058. $('.k-scheduler-times').hide();
  4059.  
  4060. $('.k-scheduler-dayview .k-scheduler-content .k-scheduler-table').hide();
  4061.  
  4062. }
  4063. },
  4064.  
  4065. resources: [
  4066. {
  4067. field: "IsHoliday",
  4068. dataSource: [
  4069. { text: "", value: 1, color: "#9ACD32" },
  4070. ],
  4071. title: "",
  4072. multiple: false,
  4073. editable: false,
  4074. moveStart: false
  4075. },
  4076. {
  4077. field: "IsHoliday",
  4078. dataSource: [
  4079. { text: "Weekend", value: 2, color: "#556B2F" },
  4080. ],
  4081. title: "Weekend",
  4082. multiple: false,
  4083. editable: false,
  4084. moveStart: false
  4085. },
  4086. {
  4087. field: "DaysOffAbsentType",
  4088. dataSource: [
  4089. { text: "", value: 1, color: "#66CCFF" },
  4090. ],
  4091. title: "Present"
  4092. },
  4093. {
  4094. field: "DaysOffAbsentType",
  4095. dataSource: [
  4096. { text: "", value: 2, color: "#FF7F50" },
  4097. ],
  4098. title: "Half Day(Sickness)"
  4099. }
  4100. ,
  4101. {
  4102. field: "DaysOffAbsentType",
  4103. dataSource: [
  4104. { text: "", value: 3, color: "#CF98A8" },
  4105. ],
  4106. title: "Half Day(Holiday)"
  4107. }
  4108. ,
  4109. {
  4110. field: "DaysOffAbsentType",
  4111. dataSource: [
  4112. { text: "", value: 4, color: "#FFE4C4" },
  4113. ],
  4114. title: "Half Day(Others)"
  4115. }
  4116.  
  4117. ,
  4118. {
  4119. field: "DaysOffAbsentType",
  4120. dataSource: [
  4121. { text: "", value: 5, color: "#FFFF00" },
  4122. ],
  4123. title: "Absent(Sickness)"
  4124. }
  4125. ,
  4126. {
  4127. field: "DaysOffAbsentType",
  4128. dataSource: [
  4129. { text: "", value: 6, color: "#C0FF3E" },
  4130. ],
  4131. title: "Absent(Holiday)"
  4132. }
  4133. ,
  4134. {
  4135. field: "DaysOffAbsentType",
  4136. dataSource: [
  4137. { text: "", value: 7, color: "#FFD700" },
  4138. ],
  4139. title: "Absent(Others)"
  4140. }
  4141.  
  4142. ]
  4143. });
  4144.  
  4145. function ShowActivateDivs(typeid) {
  4146.  
  4147. if (typeid == 1) {
  4148. $("#aDivP").show();
  4149. $("#divPresent").addClass("divActiveCss");
  4150. }
  4151. else if (typeid == 2) {
  4152. $("#aDivH").show();
  4153. $("#divHalfDay").addClass("divActiveCss");
  4154. }
  4155. else if (typeid == 3) {
  4156. $("#aDivHH").show();
  4157. $("#divAbsentHoliday").addClass("divActiveCss");
  4158. }
  4159. else if (typeid == 4) {
  4160. $("#aDivHO").show();
  4161. $("#divHalfDayOther").addClass("divActiveCss");
  4162. }
  4163. else if (typeid == 5) {
  4164. $("#aDivA").show();
  4165. $("#divAbsent").addClass("divActiveCss");
  4166. }
  4167. else if (typeid == 6) {
  4168. $("#aDivAHO").show();
  4169. $("#divAbsentholiday").addClass("divActiveCss");
  4170. }
  4171.  
  4172. else if (typeid == 7) {
  4173. $("#aDivAO").show();
  4174. $("#divAbsentOther").addClass("divActiveCss");
  4175. }
  4176.  
  4177. }
  4178.  
  4179. //var scheduler = $("#scheduler").data("kendoScheduler");
  4180. //scheduler.refresh();
  4181.  
  4182. var eList = [];
  4183. var _eSender;
  4184. var _data = [];
  4185. function kando_dataBound(e) {
  4186. $('#overlaycontainer').show();
  4187. _eSender = e.sender;
  4188. var eventCount = e.sender._data.length;
  4189. var icount = 0;
  4190. if (eventCount > 0) {
  4191. var scheduler = this,
  4192. view = this.view(),
  4193. slots = view.table.find("[role='gridcell']");
  4194. slots.each(function () {
  4195.  
  4196.  
  4197. var slot = scheduler.slotByElement(this);
  4198.  
  4199. var date = dateFormat(new Date(slot.startDate), 'dd/mm/yyyy');
  4200. for (var x = 0; x < eventCount; x++) {
  4201.  
  4202.  
  4203. var holidayDate = dateFormat(new Date(e.sender._data[x].Holiday), 'dd/mm/yyyy');
  4204. if (date == holidayDate) {
  4205. $(this).css("background-color", "#9ACD32");
  4206. // $(this).css("width", "0px");
  4207.  
  4208. if (icount == 0) {
  4209. $(this).css("color", "white");
  4210. }
  4211. $(this).html('');
  4212. $('#overlaycontainer').hide();
  4213.  
  4214. e.disable = true;
  4215. }
  4216. //else {
  4217.  
  4218. // if (e.sender._data[x].DaysOffAbsentType == 1)
  4219. // $(this).css("background-color", "#6B8E23");
  4220. // else if (e.sender._data[x].DaysOffAbsentType == 2)
  4221. // $(this).css("background-color", "#FFB6C1");
  4222. // else if (e.sender._data[x].DaysOffAbsentType == 3)
  4223. // $(this).css("background-color", "#CD5C5C");
  4224.  
  4225. //}
  4226. icount = icount + 1;
  4227. }
  4228.  
  4229. });
  4230. $('#overlaycontainer').hide();
  4231. }
  4232.  
  4233. }
  4234.  
  4235. function makeHoliday(dno, title) {
  4236. var tbl = $('table.k-scheduler-table').find('td').length;
  4237. $('table.k-scheduler-table').find('td').each(function (i, tag) {
  4238. var dayNo = $(tag).find('span').html();
  4239. if (!$(tag).hasClass('k-other-month')) {
  4240. if (parseInt(dayNo) == parseInt(dno)) {
  4241. $(this).addClass('holiday');
  4242. }
  4243. }
  4244. });
  4245.  
  4246. $('table.k-scheduler-table').find('th').each(function (i, tag) {
  4247. var dSpan = $(tag).find('span');
  4248. if (dSpan != null || dSpan != undefined) {
  4249. var dayNo = $(tag).find('span').html();
  4250.  
  4251. if (!$(tag).hasClass('k-other-month')) {
  4252. if (parseInt(dayNo) == parseInt(dno)) {
  4253. $(this).addClass('holiday');
  4254. }
  4255. }
  4256. }
  4257. });
  4258. }
  4259.  
  4260. </script>
  4261.  
  4262. <div id="scheduler"></div>
  4263. <div id="overlaycontainer" style="display: none;">
  4264. <div class="overlay-container"></div>
  4265. <img src="@Url.Content("~/images/loading.gif")" width="31" height="31" />
  4266. </div>
  4267. <div id="popup_box" style="display:none">
  4268. </div>
  4269.  
  4270. @Html.Partial("AttendanceEditTemplate")
Add Comment
Please, Sign In to add comment