You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1500 lines
45 KiB

  1. var isChrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
  2. var apiPartnerIds;
  3. var mId = "";
  4. function LoadModule(menuType) {
  5. scroll(0, 0);
  6. return;
  7. //switch (menuType.toLowerCase()) {
  8. // case "adminstration":
  9. // window.open("/Administration.aspx?mtype=adminstration", "mainFrame")
  10. // break;
  11. // case "customer_management":
  12. // window.open("/Administration.aspx?mtype=customer_management", "mainFrame")
  13. // break;
  14. // case "applicationsetting":
  15. // window.open("/Administration.aspx?mtype=applicationsetting", "mainFrame")
  16. // break;
  17. // case "sub_administration":
  18. // window.open("/Administration.aspx?mtype=sub_administration", "mainFrame")
  19. // break;
  20. // case "system_security":
  21. // window.open("/Administration.aspx?mtype=system_security", "mainFrame")
  22. // break;
  23. // case "remittance":
  24. // window.open("/Administration.aspx?mtype=remittance", "mainFrame")
  25. // break;
  26. // case "servicecharge_and_commission":
  27. // window.open("/Administration.aspx?mtype=servicecharge_and_commission", "mainFrame")
  28. // break;
  29. // case "creditrisk_management":
  30. // window.open("/Administration.aspx?mtype=creditrisk_management", "mainFrame")
  31. // break;
  32. // case "transaction":
  33. // window.open("/Administration.aspx?mtype=transaction", "mainFrame")
  34. // break;
  35. // case "report":
  36. // window.open("/Administration.aspx?mtype=report", "mainFrame")
  37. // break;
  38. // case "account":
  39. // window.open("/Administration.aspx?mtype=account", "mainFrame")
  40. // break;
  41. // case "remittance_report":
  42. // window.open("/Administration.aspx?mtype=remittance_report", "mainFrame")
  43. // break;
  44. // case "account_report":
  45. // window.open("/Administration.aspx?mtype=account_report", "mainFrame")
  46. // break;
  47. // case "sub_account":
  48. // window.open("/Administration.aspx?mtype=sub_account", "mainFrame")
  49. // break;
  50. //}
  51. }
  52. function LoadModuleAgentMenu(menuType) {
  53. return;
  54. //switch (menuType.toLowerCase()) {
  55. // case "send_money":
  56. // window.open("/AgentMenuTileView.aspx?mtype=send_money", "mainFrame");
  57. // break;
  58. // case "pay_money":
  59. // window.open("/AgentMenuTileView.aspx?mtype=pay_money", "mainFrame");
  60. // break;
  61. // case "reports":
  62. // window.open("/AgentMenuTileView.aspx?mtype=reports", "mainFrame");
  63. // break;
  64. // case "other_services":
  65. // window.open("/AgentMenuTileView.aspx?mtype=other_services", "mainFrame");
  66. // break;
  67. //}
  68. }
  69. function ValidateExtension(id) {
  70. var allowedFiles = [".png", ".jpg", ".jpeg"];
  71. var fileUpload = document.getElementById(id);
  72. var regex = new RegExp("([a-zA-Z0-9\s_\\.\-:])+(" + allowedFiles.join('|') + ")$");
  73. if (!regex.test(fileUpload.value.toLowerCase())) {
  74. alert("Please upload files having extensions: " + allowedFiles.join(', ') + " only.");
  75. document.getElementById(id).value = '';
  76. return false;
  77. }
  78. return true;
  79. }
  80. function ValidateExtensionForOtherDoc(id) {
  81. var allowedFiles = [".png", ".jpg", ".jpeg", ".pdf"];
  82. var fileUpload = document.getElementById(id);
  83. var regex = new RegExp("([a-zA-Z0-9\s_\\.\-:])+(" + allowedFiles.join('|') + ")$");
  84. if (!regex.test(fileUpload.value.toLowerCase())) {
  85. alert("Please upload files having extensions: " + allowedFiles.join(', ') + " only.");
  86. document.getElementById(id).value = '';
  87. return false;
  88. }
  89. return true;
  90. }
  91. Date.prototype.toUSFormat = function () {
  92. var dd = this.getDate();
  93. if (dd < 10) dd = '0' + dd;
  94. var mm = this.getMonth() + 1;
  95. if (mm < 10) mm = '0' + mm;
  96. var yyyy = this.getFullYear();
  97. return String(mm + "\/" + dd + "\/" + yyyy);
  98. }
  99. function OpenInNewWindowModifyChrome(url, param) {
  100. if (param === undefined || param === "") {
  101. param = "width=600,height=400,resizable=1,status=1,toolbar=0,scrollbars=1,center=1";
  102. }
  103. return window.open(url, window.self, param);
  104. }
  105. function PopUpWindowWithCallBackBigSize(url, param) {
  106. if (param === undefined || param === "") {
  107. param = "dialogHeight:1000px;dialogWidth:1100px;dialogLeft:150;dialogTop:50;center:yes";
  108. }
  109. if (isChrome) {
  110. return window.open(url, "_blank", param);
  111. } else {
  112. return window.showModalDialog(url, window.self, param);
  113. }
  114. //return window.showModalDialog(url, window.self, param);
  115. }
  116. function RemoveComma(value) {
  117. return value.replace(/,/g, "");
  118. }
  119. function FilterString(value) {
  120. //alert(value);
  121. value = value.replace("NaN", "");
  122. return value.replace(/[^a-zA-Z0-9 .()]/g, "");
  123. }
  124. function FilterStringReceiverName(value) {
  125. //alert(value);
  126. value = value.replace("NaN", "");
  127. return value.replace(/[^a-zA-Z0-9^/ .()]/g, "");
  128. }
  129. function bookmarksite() {
  130. var title = document.title, url = window.location.href;
  131. if (window.sidebar) // firefox
  132. window.sidebar.addPanel(title, url, "");
  133. else if (window.opera && window.print) { // opera
  134. var elem = document.createElement('a');
  135. elem.setAttribute('href', url);
  136. elem.setAttribute('title', title);
  137. elem.setAttribute('rel', 'sidebar');
  138. elem.click();
  139. }
  140. else if (document.all)// ie
  141. window.external.AddFavorite(url, title);
  142. }
  143. function EnableDisableBtn(id, boolDisabled) {
  144. try {
  145. var ctl = GetElement(id);
  146. ctl.disabled = boolDisabled;
  147. var cssClass = "button" + (boolDisabled ? "Disabled" : "");
  148. var thisClass = ctl.className;
  149. thisClass = thisClass.replace("buttonDisabled", "");
  150. thisClass = thisClass.replace("buttonEnabled", "");
  151. cssClass = cssClass + " " + thisClass;
  152. SetCSSByObj(ctl, cssClass);
  153. } catch (ex) {
  154. return;
  155. }
  156. }
  157. function LoadRegion(flag, divZip, divDistrict, region) {
  158. if (flag === 'o') { //o - for Other
  159. ShowElement(divZip);
  160. HideElement(divDistrict);
  161. GetElement(region).innerHTML = "State";
  162. return;
  163. }
  164. else if (flag === 'n') { //n - for Nepal
  165. ShowElement(divDistrict);
  166. HideElement(divZip);
  167. GetElement(region).innerHTML = "Zone";
  168. return;
  169. }
  170. }
  171. function MoveWindowToTop() {
  172. var target = window.parent.document.getElementById('Td1');
  173. target.scrollIntoView();
  174. }
  175. function ReadData(id, singleQuote, focusIfNull) {
  176. var obj = document.getElementById(id);
  177. if (obj) return (singleQuote ? "'" + obj.value + "'" : obj.value);
  178. return "null";
  179. }
  180. function IsCSVFile(fileName) {
  181. var file_parts = fileName.split(".");
  182. if (file_parts[file_parts.length - 1].toUpperCase() === "CSV")
  183. return true;
  184. return false;
  185. }
  186. function GetListBoxItems(id, selectedOnly) {
  187. var list = document.getElementById(id);
  188. var valueList = "";
  189. var cnt = list.options.length;
  190. var values = [];
  191. for (var i = 0; i < cnt; i++) {
  192. var item = list.options[i];
  193. if (item.selected || (!selectedOnly)) {
  194. values.push(item.value);
  195. }
  196. }
  197. return values;
  198. }
  199. function HideElement(id) {
  200. ObjHide(GetElement(id));
  201. }
  202. function ObjHide(obj) {
  203. try {
  204. obj.style.display = "none";
  205. } catch (ex) { return; }
  206. }
  207. function ShowElement(id) {
  208. ObjShow(GetElement(id));
  209. }
  210. function ObjShow(obj) {
  211. try {
  212. obj.style.display = "block";
  213. } catch (ex) { return; }
  214. }
  215. var guid = (function () {
  216. function s4() {
  217. return Math.floor((1 + Math.random()) * 0x10000)
  218. .toString(16)
  219. .substring(1);
  220. }
  221. return function () {
  222. return s4() + s4() + '' + s4() + '' + s4();
  223. };
  224. })();
  225. function OpenInNewWindow(url) {
  226. url = url + "&srcCode=" + guid;
  227. window.open(url, "", "width=825,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1");
  228. }
  229. function OpenInNewSmallWindow(url) {
  230. url = url + "&srcCode=" + guid;
  231. window.open(url, "", "width=430,height=300,resizable=1,status=1,toolbar=0,scrollbars=1,center=1");
  232. }
  233. function GetValue(id) {
  234. var obj = document.getElementById(id);
  235. if (obj === null || obj === undefined)
  236. return "";
  237. return obj.value;
  238. }
  239. function GetElement(id) {
  240. return document.getElementById(id);
  241. }
  242. function GetDateValue(id) {
  243. var value = GetValue(id);
  244. if (value === "")
  245. return value;
  246. var dateParts = value.split("/");
  247. if (dateParts.length < 3)
  248. return "";
  249. var y = dateParts[0].toString("0000");
  250. var m = dateParts[1].toString("00");
  251. var d = dateParts[2].toString("00");
  252. return y + "/" + m + '/' + d;
  253. }
  254. function GetDateValueNew(id) {
  255. var value = GetValue(id);
  256. if (value === "")
  257. return value;
  258. var dateParts = value.split("-");
  259. if (dateParts.length < 3)
  260. return "";
  261. var y = dateParts[0].toString("0000");
  262. var m = dateParts[1].toString("00");
  263. var d = dateParts[2].toString("00");
  264. return y + "/" + m + '/' + d;
  265. }
  266. function SelectOrClearByElement(elements, boolSelect) {
  267. for (var i = 0; i < elements.length; i++) {
  268. try {
  269. elements[i].checked = boolSelect;
  270. } catch (ex) {
  271. return;
  272. }
  273. }
  274. }
  275. function SelectOrClearById(cbContainerId, boolSelect) {
  276. var elements = GetElement(cbContainerId).getElementsByTagName("input");
  277. SelectOrClearByElement(elements, boolSelect);
  278. }
  279. function EnableOrDisableDdlByElement(elements, boolDisabled) {
  280. for (var i = 0; i < elements.length; i++) {
  281. try {
  282. elements[i].disabled = boolDisabled;
  283. } catch (ex) {
  284. return;
  285. }
  286. }
  287. }
  288. function EnableOrDisableDdlById(cbContainerId, boolDisabled) {
  289. var elements = GetElement(cbContainerId).getElementsByTagName("select");
  290. EnableOrDisableDdlByElement(elements, boolDisabled);
  291. }
  292. function PrintWindow() {
  293. window.parent.frames["frmame_main"].focus();
  294. window.parent.frames["frmame_main"].document.execCommand('print', false, null);
  295. return false;
  296. }
  297. function ReportPrint() {
  298. window.print();
  299. return false;
  300. }
  301. function DownloadReport(path) {
  302. url = path + "/Download.aspx?mode=report";
  303. OpenInNewWindow(url);
  304. }
  305. function HasValidExtension(fileName, ext) {
  306. var file_parts = fileName.split(".");
  307. if (file_parts[file_parts.length - 1].toUpperCase() === ext.toUpperCase())
  308. return true;
  309. return false;
  310. }
  311. function DownloadInNewWindow(url) {
  312. window.open(url, "", "width=825,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1");
  313. }
  314. function SelectFunctions(me, parent) {
  315. var elements = document.getElementsByName("functionId");
  316. var cssName = me.className;
  317. var cssLength = cssName.length;
  318. var newCss = "";
  319. var boolChecked = false;
  320. if (cssName.substr(cssLength - 8, cssLength) === "Selected") {
  321. newCss = cssName.substr(0, cssLength - 8);
  322. } else {
  323. newCss = cssName + "Selected";
  324. boolChecked = true;
  325. }
  326. var parentLength = parent.length;
  327. for (var i = 0; i < elements.length; i++) {
  328. if (!elements[i].disabled) {
  329. var value = elements[i].value;
  330. if (value.substr(0, parentLength) === parent) {
  331. elements[i].checked = boolChecked;
  332. }
  333. }
  334. }
  335. me.className = newCss;
  336. }
  337. function Redirect(url) {
  338. window.parent.location = url;
  339. }
  340. function RedirectLocal(url) {
  341. window.location = url;
  342. }
  343. function OpenDialog(url, height, width, left, top) {
  344. if (isChrome) {
  345. var param = "";
  346. if (param === undefined || param === "")
  347. param = "width=1000,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1";
  348. return window.open(url, "_blank", param);
  349. } else {
  350. return window.showModalDialog(url, window.self, "dialogHeight:" + height + "px;dialogWidth:" + width + "px;dialogLeft:" + left + "px;dialogTop:" + top + "px");
  351. }
  352. }
  353. function CloseDialog(returnValue) {
  354. window.returnValue = returnValue;
  355. window.close();
  356. }
  357. function GoBack() {
  358. if (confirm("Are you sure to want to go back?")) {
  359. window.history.back(1);
  360. }
  361. }
  362. function OpenWindow(url) {
  363. var browser = navigator.appName;
  364. if (browser === "Microsoft Internet Explorer") {
  365. window.opener = self;
  366. }
  367. window.open(url, "", "width=900,height=750,toolbar=no,scrollbars=yes,location=no,resizable =yes");
  368. window.moveTo(0, 0);
  369. window.resizeTo(screen.width, screen.height - 100);
  370. self.close();
  371. }
  372. function PopUpWindow(url, param) {
  373. if (param === undefined || param === "") {
  374. param = "dialogHeight:500px;dialogWidth:600px;dialogLeft:300;dialogTop:100;center:yes";
  375. }
  376. if (isChrome) {
  377. window.open(url, "_blank", param);
  378. } else {
  379. return window.showModalDialog(url, window.self, param);
  380. }
  381. }
  382. function PopUpWithCallBack(url, param) {
  383. if (param === undefined || param === "") {
  384. param = "dialogHeight:400px;dialogWidth:500px;dialogLeft:300;dialogTop:100;center:yes";
  385. }
  386. if (isChrome) {
  387. window.open(url, "_blank", param);
  388. } else {
  389. window.showModalDialog(url, window.self, param);
  390. }
  391. CallBack();
  392. }
  393. //function OpenInNewWindow(url) {
  394. // window.open(url, "_blank", "width=825,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1");
  395. //}
  396. function PopUpWindowWithCallBack(url, param) {
  397. if (param === undefined || param === "") {
  398. param = "width=1000,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1";
  399. }
  400. if (isChrome) {
  401. return window.open(url, "_blank", param);
  402. } else {
  403. return window.showModalDialog(url, window.self, param);
  404. }
  405. }
  406. function downloadInNewWindow(url) {
  407. window.open(url, "", "width=825,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1");
  408. }
  409. function FindPos(obj) {
  410. var curleft = curtop = 0;
  411. if (obj.offsetParent) {
  412. curleft = obj.offsetLeft;
  413. curtop = obj.offsetTop;
  414. while (obj === obj.offsetParent) {
  415. curleft += obj.offsetLeft;
  416. curtop += obj.offsetTop;
  417. }
  418. }
  419. return [curleft, curtop];
  420. }
  421. function numericOnly(obj, e, supportDecimal, doNotSupportNegative) {
  422. var evtobj = window.event ? event : e;
  423. if (evtobj.altKey || evtobj.ctrlKey)
  424. return true;
  425. var charCode = e.which || e.keyCode;
  426. if (doNotSupportNegative) {
  427. if (charCode === 189 || charCode === 109) {
  428. return false;
  429. }
  430. }
  431. if (charCode === 46 || charCode === 8 || charCode === 9 || charCode === 37 || charCode === 39 || charCode === 109)
  432. return true;
  433. var char = String.fromCharCode(charCode);
  434. if (char === "." || char === "¾" || charCode === 110) {
  435. if (obj.value.indexOf(".") > -1)
  436. return false;
  437. else
  438. return true;
  439. }
  440. if ((char >= "0" && char <= "9") || (charCode >= 96 && charCode <= 105))
  441. return true;
  442. return false;
  443. }
  444. function TrackChanges(hddField) {
  445. GetElement(hddField).value = 'y';
  446. }
  447. function manageOnPaste(me) {
  448. return true;
  449. }
  450. function resetInput(obj, hint, type, isNum, allowBlank) {
  451. var val = parseFloat(obj.value);
  452. if (type === 1) {
  453. if (val === hint || (isNum && isNaN(obj.value))) { obj.value = ""; }
  454. }
  455. else {
  456. if (val.length === 0 || (isNum && isNaN(obj.value))) {
  457. if (allowBlank) {
  458. obj.value = "";
  459. } else {
  460. obj.value = hint;
  461. }
  462. }
  463. }
  464. }
  465. function ParseMessageToArray(mes) {
  466. var results = mes.split("-:::-");
  467. return results;
  468. }
  469. function GetIds(name) {
  470. var elements = document.getElementsByName(name);
  471. var list = "";
  472. for (var i = 0; i < elements.length; i++) {
  473. try {
  474. if (elements[i].checked) {
  475. list = list + (list !== "" ? ", " : "") + elements[i].value;
  476. }
  477. }
  478. catch (ex) {
  479. return "";
  480. }
  481. }
  482. return list;
  483. }
  484. function CurrencyFormatted(amount) {
  485. var i = parseFloat(amount);
  486. if (isNaN(i)) { i = 0.00; }
  487. var minus = '';
  488. if (i < 0) { minus = '-'; }
  489. i = Math.abs(i);
  490. i = parseInt((i + .005) * 100);
  491. i = i / 100;
  492. s = new String(i);
  493. if (s.indexOf('.') < 0) { s += '.00'; }
  494. if (s.indexOf('.') === (s.length - 2)) { s += '0'; }
  495. s = minus + s;
  496. return s;
  497. }
  498. function CommaFormatted(amount) {
  499. var delimiter = ",";
  500. var a = amount.split('.', 2);
  501. var d = a[1];
  502. var i = parseInt(a[0]);
  503. if (isNaN(i)) { return ''; }
  504. var minus = '';
  505. if (i < 0) { minus = '-'; }
  506. i = Math.abs(i);
  507. var n = new String(i);
  508. a = [];
  509. while (n.length > 3) {
  510. var nn = n.substr(n.length - 3);
  511. a.unshift(nn);
  512. n = n.substr(0, n.length - 3);
  513. }
  514. if (n.length > 0) { a.unshift(n); }
  515. n = a.join(delimiter);
  516. if (d.length < 1) { amount = n; }
  517. else { amount = n + '.' + d; }
  518. amount = minus + amount;
  519. return amount;
  520. }
  521. function UpdateComma(obj) {
  522. var s = new String();
  523. var amt = obj.value.replace(",", "");
  524. amt = amt.replace(",", "");
  525. amt = amt.replace(",", "");
  526. amt = amt.replace(",", "");
  527. s = CurrencyFormatted(amt);
  528. s = CommaFormatted(s);
  529. obj.value = s;
  530. }
  531. function roundNumber(rnum, rlength) {
  532. var newnumber = Math.round(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
  533. return parseFloat(newnumber);
  534. }
  535. function roundNumberUp(rnum, rlength) {
  536. var ad = 5 / Math.pow(10, rlength + 1);
  537. return roundNumber(rnum + ad, rlength);
  538. }
  539. function roundNumberDown(rnum, rlength) {
  540. var ad = 5 / Math.pow(10, rlength + 1);
  541. return roundNumber(rnum - ad, rlength);
  542. }
  543. document.onkeydown = KeyDownHandler;
  544. document.onkeyup = KeyUpHandler;
  545. var CTRL = false;
  546. var SHIFT = false;
  547. var ALT = false;
  548. var CHAR_CODE = -1;
  549. function KeyDownHandler(e) {
  550. var x = '';
  551. if (document.all) {
  552. var evnt = window.event;
  553. x = evnt.keyCode;
  554. }
  555. else {
  556. x = e.keyCode;
  557. }
  558. DetectKeys(x, true);
  559. MenuControl();
  560. }
  561. function KeyUpHandler(e) {
  562. var x = '';
  563. if (document.all) {
  564. var evnt = window.event;
  565. x = evnt.keyCode;
  566. }
  567. else {
  568. x = e.keyCode;
  569. }
  570. DetectKeys(x, false);
  571. MenuControl();
  572. }
  573. function MenuControl() {
  574. }
  575. function DetectKeys(KeyCode, IsKeyDown) {
  576. if (KeyCode === '16') {
  577. SHIFT = IsKeyDown;
  578. CHAR_CODE = -1;
  579. }
  580. else if (KeyCode === '17') {
  581. CTRL = IsKeyDown;
  582. CHAR_CODE = -1;
  583. }
  584. else if (KeyCode === '18') {
  585. ALT = IsKeyDown;
  586. CHAR_CODE = -1;
  587. }
  588. else {
  589. if (IsKeyDown)
  590. CHAR_CODE = KeyCode;
  591. else
  592. CHAR_CODE = -1;
  593. }
  594. }
  595. function Lock() {
  596. if (ALT && CHAR_CODE === 76) {
  597. if (confirm("Are you sure you want to lock application?")) {
  598. var url = window.parent.document.getElementById("frmame_main").contentWindow.location.href;
  599. window.parent.location.replace('/Lock.aspx?url=' + url);
  600. }
  601. }
  602. }
  603. function checkRateMasking(obj, beforeLength, afterLength) {
  604. if (isNaN(obj.value)) {
  605. alert("Please, Enter valid number !");
  606. setTimeout(function () { obj.focus(); }, 1);
  607. return 1;
  608. }
  609. if (obj.value.indexOf(".") >= 0) {
  610. var resStr = obj.value.split(".");
  611. if (beforeLength !== "99" && obj.value !== "0" && obj.value !== "") {
  612. var bdValue = resStr[0];
  613. var bdValueLength = bdValue.length;
  614. if (parseFloat(obj.value) < 0)
  615. bdValueLength = bdValue.length - 1;
  616. if (bdValueLength > beforeLength) {
  617. if (parseInt(bdValueLength) > parseInt(beforeLength)) {
  618. alert("Error, Only " + beforeLength + " digit(s) are allowed before decimal !");
  619. setTimeout(function () { obj.focus(); }, 1);
  620. return 1;
  621. }
  622. }
  623. }
  624. if (afterLength !== "99" && obj.value !== "0" && obj.value !== "") {
  625. if (resStr[1].length > afterLength) {
  626. if (resStr[1].length > afterLength) {
  627. alert("Error, Only " + afterLength + " digit(s) are allowed after decimal !");
  628. setTimeout(function () { obj.focus(); }, 1);
  629. return 1;
  630. }
  631. }
  632. }
  633. }
  634. else {
  635. if (beforeLength !== "99" && obj.value !== "0" && obj.value !== "") {
  636. bdValue = obj.value;
  637. bdValueLength = bdValue.length;
  638. if (bdValue < 0)
  639. bdValueLength = bdValue.length - 1;
  640. if (parseInt(bdValueLength) > parseInt(beforeLength)) {
  641. alert("Error, Only " + beforeLength + " digit(s) are allowed before decimal !");
  642. setTimeout(function () { obj.focus(); }, 1);
  643. return 1;
  644. }
  645. }
  646. }
  647. return 0;
  648. }
  649. function CheckNumberWithMsg(obj) {
  650. if (isNaN(obj.value)) {
  651. alert("Input value = " + obj.value + "\n\nPlease enter valid number!");
  652. obj.value = 0;
  653. setTimeout(function () { obj.focus(); }, 1);
  654. }
  655. }
  656. function checkRateCapping2(obj, currentValue, min, max, value, id, errorImg) {
  657. if (isNaN(obj.value)) {
  658. alert("Please, Enter valid number !");
  659. setTimeout(function () { obj.focus(); }, 1);
  660. return 1;
  661. }
  662. value = roundNumber(value, 6);
  663. var msg = "";
  664. GetElement("status_" + id).innerHTML = "";
  665. EnableDisableBtn("btnUpdate_" + id, false);
  666. if (value > max) {
  667. msg = "Calculated value = " + value + "\n\nRate must lie between " + min + " and " + max;
  668. alert(msg);
  669. obj.value = currentValue;
  670. if (currentValue > max) {
  671. GetElement("status_" + id).innerHTML = "<img src=\"" + errorImg + "\" border=\"0\" onclick=\"alert('" + msg + "');\"/>";
  672. EnableDisableBtn("btnUpdate_" + id, true);
  673. }
  674. else if (currentValue < min) {
  675. GetElement("status_" + id).innerHTML = "<img src=\"" + errorImg + "\" border=\"0\" onclick=\"alert('" + msg + "');\"/>";
  676. EnableDisableBtn("btnUpdate_" + id, true);
  677. }
  678. else
  679. setTimeout(function () { obj.focus(); }, 1);
  680. return 1;
  681. }
  682. if (value < min) {
  683. msg = "Calculated value = " + value + "\n\nRate must lie between " + min + " and " + max;
  684. alert(msg);
  685. obj.value = currentValue;
  686. if (currentValue > max) {
  687. GetElement("status_" + id).innerHTML = "<img src=\"" + errorImg + "\" border=\"0\" onclick=\"alert('" + msg + "');\"/>";
  688. EnableDisableBtn("btnUpdate_" + id, true);
  689. }
  690. else if (currentValue < min) {
  691. GetElement("status_" + id).innerHTML = "<img src=\"" + errorImg + "\" border=\"0\" onclick=\"alert('" + msg + "');\"/>";
  692. EnableDisableBtn("btnUpdate_" + id, true);
  693. }
  694. else
  695. setTimeout(function () { obj.focus(); }, 1);
  696. return 1;
  697. }
  698. return 0;
  699. }
  700. function checkRateCapping(obj, currentValue, min, max, value) {
  701. if (isNaN(obj.value)) {
  702. alert("Please, Enter valid number !");
  703. setTimeout(function () { obj.focus(); }, 1);
  704. return 1;
  705. }
  706. value = roundNumber(value, 6);
  707. if (value > max) {
  708. alert("Calculated value = " + value + "\n\nRate must lie between " + min + " and " + max);
  709. if (currentValue > max)
  710. currentValue = 0;
  711. obj.value = currentValue;
  712. setTimeout(function () { obj.focus(); }, 1);
  713. return 1;
  714. }
  715. if (value < min) {
  716. alert("Calculated value = " + value + "\n\nRate must lie between " + min + " and " + max);
  717. if (currentValue < min)
  718. currentValue = 0;
  719. obj.value = currentValue;
  720. setTimeout(function () { obj.focus(); }, 1);
  721. return 1;
  722. }
  723. return 0;
  724. }
  725. function checkCrossRateCapping(obj, currentValue, cMin, cMax, pMin, pMax, crossRate, crossRateMaskAd) {
  726. if (isNaN(obj.value)) {
  727. alert("Please, Enter valid number !");
  728. setTimeout(function () { obj.focus(); }, 1);
  729. return 1;
  730. }
  731. var minCustomerRate = pMin / cMax;
  732. minCustomerRate = roundNumber(minCustomerRate, crossRateMaskAd);
  733. var maxCustomerRate = pMax / cMin;
  734. maxCustomerRate = roundNumber(maxCustomerRate, crossRateMaskAd);
  735. if (crossRate > maxCustomerRate) {
  736. alert("Input value = " + crossRate + "\n\nRate must lie between " + minCustomerRate + " and " + maxCustomerRate);
  737. setTimeout(function () { obj.focus(); }, 1);
  738. obj.value = currentValue;
  739. return 1;
  740. }
  741. else if (crossRate < minCustomerRate) {
  742. alert("Input value = " + crossRate + "\n\nRate must lie between " + minCustomerRate + " and " + maxCustomerRate);
  743. setTimeout(function () { obj.focus(); }, 1);
  744. obj.value = currentValue;
  745. return 1;
  746. }
  747. return 0;
  748. }
  749. function ParseResultJsPrint(errorCode, msg, id) {
  750. return errorCode + "-:::-" + msg + "-:::-" + id;
  751. }
  752. function cVal(data) {
  753. var res = parseFloat(data);
  754. if (isNaN(res)) res = 0;
  755. return res;
  756. }
  757. function hideMessageBox() {
  758. var rptCentraizeMassege = document.getElementById("rptCentraizeMassege");
  759. rptCentraizeMassege.innerHTML = "";
  760. rptCentraizeMassege.className = "";
  761. }
  762. function SetValueById(id, value, innerHTML) {
  763. SetValueByObj(GetElement(id), value, innerHTML);
  764. }
  765. function SetValueByObj(obj, value, innerHTML) {
  766. if (innerHTML) {
  767. obj.innerHTML = innerHTML;
  768. } else {
  769. obj.value = value;
  770. }
  771. }
  772. function SetValueIfNotById(id, value, innerHTML, notValue) {
  773. SetValueIfNotByObj(GetElement(id), value, innerHTML, notValue);
  774. }
  775. function SetValueIfNotByObj(obj, value, innerHTML, notValue) {
  776. value1 = GetValueByObj(obj, innerHTML);
  777. if (value1.toLowerCase() !== notValue.toLowerCase()) {
  778. if (innerHTML) {
  779. obj.innerHTML = value;
  780. } else {
  781. obj.value = value;
  782. }
  783. }
  784. }
  785. function SetValueIfBlankById(id, value, innerHTML) {
  786. SetValueIfBlankByObj(GetElement(id), value, innerHTML);
  787. }
  788. function SetValueIfBlankByObj(obj, value, innerHTML) {
  789. var value1 = GetValueByObj(obj, innerHTML);
  790. if (value1 === "") {
  791. if (innerHTML) {
  792. obj.innerHTML = value;
  793. } else {
  794. obj.value = value;
  795. }
  796. }
  797. }
  798. function SetValueIfZeroById(id, value, innerHTML) {
  799. SetValueIfZeroByObj(GetElement(id), value, innerHTML);
  800. }
  801. function SetValueIfZeroByObj(obj, value, innerHTML) {
  802. var value1 = parseFloat(GetValueByObj(obj, innerHTML));
  803. if (value1 === 0) {
  804. if (innerHTML) {
  805. obj.innerHTML = value;
  806. } else {
  807. obj.value = value;
  808. }
  809. }
  810. }
  811. function SetCSSById(id, css) {
  812. SetCSSByObj(GetElement(id), css);
  813. }
  814. function SetCSSByObj(obj, css) {
  815. obj.className = css;
  816. }
  817. function CheckNumber(obj) {
  818. obj.value = cVal(obj.value);
  819. }
  820. function IntegerOnly(obj) {
  821. if (isNaN(obj.value)) {
  822. obj.value = "";
  823. return;
  824. }
  825. if (obj.value.indexOf(".") > -1) {
  826. obj.value = "";
  827. return;
  828. }
  829. }
  830. function FloatOnly(obj) {
  831. if (isNaN(obj.value)) {
  832. obj.value = "";
  833. return;
  834. }
  835. }
  836. function setCookie(c_name, value, exdays) {
  837. var exdate = new Date();
  838. exdate.setDate(exdate.getDate() + exdays);
  839. var c_value = escape(value) + ((exdays === null) ? "" : "; expires=" + exdate.toUTCString());
  840. document.cookie = c_name + "=" + c_value;
  841. }
  842. function getCookie(c_name) {
  843. var i, x, y, ARRcookies = document.cookie.split(";");
  844. for (i = 0; i < ARRcookies.length; i++) {
  845. x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("="));
  846. y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1);
  847. x = x.replace(/^\s+|\s+$/g, "");
  848. if (x === c_name) {
  849. return unescape(y);
  850. }
  851. }
  852. return "";
  853. }
  854. function FixDecimalWithRound(num, afterDecimalCount) {
  855. return num.toFixed(afterDecimalCount).replace(/\.?0+$/, "");
  856. }
  857. function SetColorById(id, value) {
  858. if (value < 0)
  859. GetElement(id).setAttribute('style', 'color: red !important;');
  860. else
  861. GetElement(id).setAttribute('style', 'color: green !important;');
  862. }
  863. function datediff(fromDate, interval) {
  864. var second = 1000, minute = second * 60, hour = minute * 60, day = hour * 24, week = day * 7;
  865. var currentDate = new Date()
  866. fromDate = new Date(fromDate);
  867. toDate = new Date(currentDate);
  868. var timediff = toDate - fromDate;
  869. if (isNaN(timediff)) return NaN;
  870. switch (interval) {
  871. case "years": return toDate.getFullYear() - fromDate.getFullYear();
  872. case "months": return (
  873. (toDate.getFullYear() * 12 + toDate.getMonth())
  874. -
  875. (fromDate.getFullYear() * 12 + fromDate.getMonth())
  876. );
  877. case "weeks": return Math.floor(timediff / week);
  878. case "days": return Math.floor(timediff / day);
  879. case "hours": return Math.floor(timediff / hour);
  880. case "minutes": return Math.floor(timediff / minute);
  881. case "seconds": return Math.floor(timediff / second);
  882. default: return undefined;
  883. }
  884. }
  885. function PrintMessage(msg, errorCode) {
  886. window.parent.SetMessageBox(msg, errorCode);
  887. }
  888. function CheckForSpecialCharacter(nField, fieldName) {
  889. var userInput = nField.value;
  890. if (userInput === "" || userInput === undefined) {
  891. return;
  892. }
  893. if (/^[a-zA-Z0-9- ./\\()-]*$/.test(userInput) === false) {
  894. alert('Special Character(e.g. !@#$%^&*) are not allowed in field : ' + fieldName);
  895. setTimeout(function () { nField.focus(); }, 1);
  896. }
  897. }
  898. function CheckForMobileNumber(nField, fieldName) {
  899. var userInput = nField.value;
  900. if (userInput === "" || userInput === undefined) {
  901. return;
  902. }
  903. if (/^[0-9- ./\\()]*$/.test(userInput) === false) {
  904. alert('Special Character(e.g. !@#$%^&*) are not allowed in field : ' + fieldName);
  905. setTimeout(function () { nField.focus(); }, 1);
  906. }
  907. }
  908. function CheckAlfabetOnly(nField, fieldName) {
  909. var userInput = nField.value;
  910. if (userInput === "" || userInput === undefined) {
  911. return;
  912. }
  913. if (/^[a-zA-Z ]*$/.test(userInput) === false) {
  914. alert('Only Character are allowed in field : ' + fieldName);
  915. setTimeout(function () { nField.focus(); }, 1);
  916. }
  917. }
  918. function CheckAddressValidation(nField, fieldName) {
  919. var userInput = nField.value;
  920. if (userInput === "" || userInput === undefined) {
  921. return;
  922. }
  923. if (/^[a-zA-Z .,/\()]*$/.test(userInput) === false) {
  924. alert('Only Character are allowed in field : ' + fieldName);
  925. setTimeout(function () { nField.focus(); }, 1);
  926. }
  927. }
  928. function RemoveElement(id) {
  929. var el = document.getElementById(id);
  930. if (el)
  931. document.body.removeChild(el);
  932. }
  933. function RemoveProcessDiv() {
  934. var id = "divProcess";
  935. RemoveElement(id);
  936. }
  937. function RemoveProcessDivWithMsg(msg) {
  938. var id = "divProcess";
  939. RemoveElement(id);
  940. alert(msg);
  941. }
  942. function Process() {
  943. var id = "divProcess";
  944. RemoveProcessDiv();
  945. var newdiv = document.createElement('div');
  946. newdiv.setAttribute('id', id);
  947. newdiv.style.width = "100%";
  948. var height = document.body.scrollHeight;
  949. if (height <= 826)
  950. height = '826';
  951. var html = "<center>";
  952. html += "<div class=\"still-bg\" id=\"progress\" style=\"height:" + height + "px;\">";
  953. html += "<div class=\"inner-bg\">";
  954. html += "<h3 style=\"color:white;\">Processing... Please wait.</h3>";
  955. html += "</div>";
  956. html += "</div>";
  957. html += "</center>";
  958. newdiv.innerHTML = html;
  959. document.body.appendChild(newdiv);
  960. return true;
  961. }
  962. function ProcessWithConfirm(msg) {
  963. if (msg === undefined || msg === null) msg = "Are you sure to approve SELECTED transaction?";
  964. if (confirm(msg)) {
  965. return Process();
  966. }
  967. return false;
  968. }
  969. function SpecialCharToLineBreak(val) {
  970. var sep = "-:::-";
  971. var list = val.split(sep);
  972. return list.join("\n");
  973. }
  974. function onlyAlphabets(e, t) {
  975. try {
  976. var charCode = "";
  977. if (window.event) {
  978. charCode = window.event.keyCode;
  979. }
  980. else if (e) {
  981. charCode = e.which;
  982. }
  983. else { return true; }
  984. if ((charCode > 64 && charCode < 91) || (charCode > 96 && charCode < 123) || charCode === 8 || charCode === 32 || charCode === 9 || charCode === 0)
  985. return true;
  986. else
  987. return false;
  988. }
  989. catch (err) {
  990. alert(err.Description);
  991. }
  992. }
  993. function MakeNumericContactNoIdNo(obj, e) {
  994. var evtobj = window.event ? event : e;
  995. if (evtobj.altKey || evtobj.ctrlKey)
  996. return true;
  997. var charCode = e.which || e.keyCode;
  998. if (charCode === 46 || charCode === 8 || charCode === 9 || charCode === 37 || charCode === 39 || charCode === 109 || charCode === 189 || charCode === 111 || charCode === 109)
  999. return true;
  1000. var char = String.fromCharCode(charCode);
  1001. if (!isNaN(char))
  1002. return true;
  1003. if ((char >= "0" && char <= "9") || (charCode >= 96 && charCode <= 105 || charCode === 173 || charCode === 191 || charCode === 189 || charCode === 111 || charCode === 109))
  1004. return true;
  1005. return false;
  1006. }
  1007. function isInt(value) {
  1008. if (isNaN(value)) {
  1009. return false;
  1010. }
  1011. var x = parseFloat(value);
  1012. return (x | 0) === x;
  1013. }
  1014. function ContactNoValidation(obj) {
  1015. var rIdNo = obj.value;
  1016. var isIntegerVal = isInt(rIdNo);
  1017. if (isIntegerVal === true) {
  1018. var rIdN = parseInt(rIdNo);
  1019. if (rIdN === 0) {
  1020. rIdNo = rIdN;
  1021. }
  1022. }
  1023. if (rIdNo === 0 || rIdNo === "0" || rIdNo === "00" || rIdNo === "1234" || rIdNo.length < 6 || rIdNo.length > 10) {
  1024. alert("Invalid Input.");
  1025. obj.value = "";
  1026. obj.focus();
  1027. return false;
  1028. }
  1029. return true;
  1030. }
  1031. function IdNoValidation(obj) {
  1032. var rIdNo = obj.value;
  1033. var isIntegerVal = isInt(rIdNo);
  1034. if (isIntegerVal === true) {
  1035. var rIdN = parseInt(rIdNo);
  1036. if (rIdN === 0) {
  1037. rIdNo = rIdN;
  1038. }
  1039. }
  1040. if (rIdNo === 0 || rIdNo === "0" || rIdNo === "1234") {
  1041. alert("Invalid Input.");
  1042. obj.value = "";
  1043. obj.focus();
  1044. return false;
  1045. }
  1046. return true;
  1047. }
  1048. function OpenInNewWindowWithCallBack(url, param, callback) {
  1049. if (param === undefined || param === "")
  1050. param = "width=825,height=500,resizable=1,status=1,toolbar=0,scrollbars=1,center=1";
  1051. var res = window.open(url, "", param);
  1052. if (typeof (callback) === "function") {
  1053. try {
  1054. res.attachEvent("onbeforeunload", callback);
  1055. }
  1056. catch (err) {
  1057. res.onbeforeunload = callback;
  1058. }
  1059. }
  1060. }
  1061. var validchars = /^[A-Za-z0-9\/\\ -]{1,20}$/;
  1062. function checkIfValidChars(strValue) {
  1063. try {
  1064. if (!validchars.test(strValue)) {
  1065. alert("Cheque number you provided is invalid.");
  1066. return false;
  1067. }
  1068. }
  1069. catch (err) {
  1070. alert(err);
  1071. }
  1072. return true;
  1073. }
  1074. function checkIfAllCharIsSame(strValue) {
  1075. try {
  1076. if (strValue.length > 1) {
  1077. var charToCompare = strValue[0];
  1078. var isAllCharSame = true;
  1079. for (var i = 0; i < strValue.length; i++) {
  1080. if (charToCompare !== strValue[i]) {
  1081. isAllCharSame = false;
  1082. break;
  1083. }
  1084. }
  1085. if (isAllCharSame) {
  1086. alert("Cheque number you provided is invalid.");
  1087. return false;
  1088. }
  1089. }
  1090. }
  1091. catch (err) {
  1092. alert(err);
  1093. }
  1094. return true;
  1095. }
  1096. function checkIfFistCharIsValid(strValue) {
  1097. try {
  1098. if (strValue === "-" || strValue === "/" || strValue === "\\") {
  1099. alert("Cheque number cannot started with this value [-/\\].");
  1100. return false;
  1101. }
  1102. }
  1103. catch (err) {
  1104. alert(err);
  1105. }
  1106. return true;
  1107. }
  1108. function checkIfCharsRepeated(strValue) {
  1109. try {
  1110. if (strValue.length > 1) {
  1111. var charToCompare = "-- // \\\\ -/ /- -\\ \\- /\\ \\/".split(" ");
  1112. var isCharRepeated = false;
  1113. for (var i = 0; i < charToCompare.length && !isCharRepeated; i++) {
  1114. for (var j = 0; j < strValue.length - 1; j++) {
  1115. if (charToCompare[i] === strValue.substring(j, j + 2)) {
  1116. isCharRepeated = true;
  1117. break;
  1118. }
  1119. }
  1120. }
  1121. if (isCharRepeated) {
  1122. alert("Cheque number you provided is invalid.");
  1123. return false;
  1124. }
  1125. }
  1126. }
  1127. catch (err) {
  1128. alert(err);
  1129. }
  1130. return true;
  1131. }
  1132. function ValidRequiredField(RequiredField) {
  1133. var Isvalid = true;
  1134. var OtherPersonFld = new Array;
  1135. var fld = RequiredField.split(',');
  1136. for (n = 0; n < fld.length - 1; n++) {
  1137. OtherPersonFld[n] = fld[n];
  1138. }
  1139. for (i = 0; i < OtherPersonFld.length; i++) {
  1140. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1141. var a = $('#' + OtherPersonFld[i]).val();
  1142. if (a === "" || a === null || a === "0") {
  1143. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1144. Isvalid = false;
  1145. }
  1146. }
  1147. if (Isvalid === false) {
  1148. alert("Required Field(s)\n _____________________________ \n The red fields are required!")
  1149. }
  1150. return Isvalid;
  1151. }
  1152. function ValidRequiredFieldNew(RequiredField) {
  1153. var Isvalid = true;
  1154. var OtherPersonFld = new Array;
  1155. var fld = RequiredField.split(',');
  1156. for (n = 0; n < fld.length - 1; n++) {
  1157. OtherPersonFld[n] = mId + fld[n];
  1158. }
  1159. for (i = 0; i < OtherPersonFld.length; i++) {
  1160. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1161. var a = $('#' + OtherPersonFld[i]).val();
  1162. if (a === "" || a === null || a === "0") {
  1163. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1164. Isvalid = false;
  1165. }
  1166. }
  1167. if (Isvalid === false) {
  1168. alert("Required Field(s)\n _____________________________ \n The red fields are required!")
  1169. }
  1170. return Isvalid;
  1171. }
  1172. function ValidRequiredFieldAC(RequiredField) {
  1173. var Isvalid = true;
  1174. var OtherPersonFld = new Array;
  1175. var fld = RequiredField.split(',');
  1176. for (n = 0; n < fld.length - 1; n++) {
  1177. OtherPersonFld[n] = fld[n];
  1178. }
  1179. for (i = 0; i < OtherPersonFld.length; i++) {
  1180. GetElement(OtherPersonFld[i]).style.background = "#FFFFFF";
  1181. $(OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1182. if (GetElement(OtherPersonFld[i]).value === "") {
  1183. $(OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1184. Isvalid = false;
  1185. }
  1186. }
  1187. if (Isvalid === false) {
  1188. alert("Required Field(s)\n _____________________________ \n The red fields are required!");
  1189. }
  1190. return Isvalid;
  1191. }
  1192. function ValidRequiredFieldWithDoc(RequiredField) {
  1193. var Isvalid = true;
  1194. var OtherPersonFld = new Array;
  1195. var fld = RequiredField.split(',');
  1196. for (n = 0; n < fld.length; n++) {
  1197. OtherPersonFld[n] = mId + fld[n];
  1198. }
  1199. for (i = 0; i < OtherPersonFld.length; i++) {
  1200. if (OtherPersonFld[i] == 'ContentPlaceHolder1_reg_front_id') {
  1201. $('#front').css('background-color', '#FFFFFF');
  1202. var a = $('#' + OtherPersonFld[i]).val();
  1203. if (a === "" || a === null || a === "0") {
  1204. $('#front').css('background-color', '#FFCCD2');
  1205. Isvalid = false;
  1206. }
  1207. } else if (OtherPersonFld[i] == 'ContentPlaceHolder1_reg_back_id') {
  1208. $('#back').css('background-color', '#FFFFFF');
  1209. var b = $('#' + OtherPersonFld[i]).val();
  1210. if (b === "" || b === null || b === "0") {
  1211. $('#back').css('background-color', '#FFCCD2');
  1212. Isvalid = false;
  1213. }
  1214. } else {
  1215. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1216. var c = $('#' + OtherPersonFld[i]).val();
  1217. if (c === "" || c === null || c === "0") {
  1218. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1219. Isvalid = false;
  1220. }
  1221. }
  1222. }
  1223. if (Isvalid === false) {
  1224. //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1225. //swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  1226. alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1227. }
  1228. return Isvalid;
  1229. }
  1230. function ValidRequiredFieldWithDocNew(RequiredField) {
  1231. var Isvalid = true;
  1232. var OtherPersonFld = new Array;
  1233. var fld = RequiredField.split(',');
  1234. for (n = 0; n < fld.length; n++) {
  1235. OtherPersonFld[n] = fld[n];
  1236. }
  1237. for (i = 0; i < OtherPersonFld.length; i++) {
  1238. if (OtherPersonFld[i] == 'ContentPlaceHolder1_reg_front_id') {
  1239. $('#front').css('background-color', '#FFFFFF');
  1240. var a = $('#' + OtherPersonFld[i]).val();
  1241. if (a === "" || a === null || a === "0") {
  1242. $('#front').css('background-color', '#FFCCD2');
  1243. Isvalid = false;
  1244. }
  1245. } else if (OtherPersonFld[i] == 'ContentPlaceHolder1_reg_back_id') {
  1246. $('#back').css('background-color', '#FFFFFF');
  1247. var b = $('#' + OtherPersonFld[i]).val();
  1248. if (b === "" || b === null || b === "0") {
  1249. $('#back').css('background-color', '#FFCCD2');
  1250. Isvalid = false;
  1251. }
  1252. } else if (OtherPersonFld[i] == 'ContentPlaceHolder1_reg_form') {
  1253. $('#reg_Form').css('background-color', '#FFFFFF');
  1254. var b = $('#' + OtherPersonFld[i]).val();
  1255. if (b === "" || b === null || b === "0") {
  1256. $('#reg_Form').css('background-color', '#FFCCD2');
  1257. Isvalid = false;
  1258. }
  1259. }
  1260. else if (OtherPersonFld[i] == 'ContentPlaceHolder1_beneficiary_reg') {
  1261. $('#beneficiaryReg').css('background-color', '#FFFFFF');
  1262. var b = $('#' + OtherPersonFld[i]).val();
  1263. if (b === "" || b === null || b === "0") {
  1264. $('#beneficiaryReg').css('background-color', '#FFCCD2');
  1265. Isvalid = false;
  1266. }
  1267. } else {
  1268. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1269. var c = $('#' + OtherPersonFld[i]).val();
  1270. if (c === "" || c === null || c === "0") {
  1271. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1272. Isvalid = false;
  1273. }
  1274. }
  1275. }
  1276. if (Isvalid === false) {
  1277. //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1278. //swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  1279. alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1280. }
  1281. return Isvalid;
  1282. }
  1283. function ValidRequiredFieldWithDocNewForAdmin(RequiredField) {
  1284. var Isvalid = true;
  1285. var OtherPersonFld = new Array;
  1286. var fld = RequiredField.split(',');
  1287. for (n = 0; n < fld.length; n++) {
  1288. OtherPersonFld[n] = fld[n];
  1289. }
  1290. for (i = 0; i < OtherPersonFld.length; i++) {
  1291. if (OtherPersonFld[i] == 'reg_front_id') {
  1292. $('#front').css('background-color', '#FFFFFF');
  1293. var a = $('#' + OtherPersonFld[i]).val();
  1294. if (a === "" || a === null || a === "0") {
  1295. $('#front').css('background-color', '#FFCCD2');
  1296. Isvalid = false;
  1297. }
  1298. } else if (OtherPersonFld[i] == 'reg_back_id') {
  1299. $('#back').css('background-color', '#FFFFFF');
  1300. var b = $('#' + OtherPersonFld[i]).val();
  1301. if (b === "" || b === null || b === "0") {
  1302. $('#back').css('background-color', '#FFCCD2');
  1303. Isvalid = false;
  1304. }
  1305. } else if (OtherPersonFld[i] == 'reg_form') {
  1306. $('#reg_Form').css('background-color', '#FFFFFF');
  1307. var b = $('#' + OtherPersonFld[i]).val();
  1308. if (b === "" || b === null || b === "0") {
  1309. $('#reg_Form').css('background-color', '#FFCCD2');
  1310. Isvalid = false;
  1311. }
  1312. }
  1313. else if (OtherPersonFld[i] == 'beneficiary_reg') {
  1314. $('#beneficiaryReg').css('background-color', '#FFFFFF');
  1315. var b = $('#' + OtherPersonFld[i]).val();
  1316. if (b === "" || b === null || b === "0") {
  1317. $('#beneficiaryReg').css('background-color', '#FFCCD2');
  1318. Isvalid = false;
  1319. }
  1320. } else {
  1321. $('#' + OtherPersonFld[i]).css('background-color', '#FFFFFF');
  1322. var c = $('#' + OtherPersonFld[i]).val();
  1323. if (c === "" || c === null || c === "0") {
  1324. $('#' + OtherPersonFld[i]).css('background-color', '#FFCCD2');
  1325. Isvalid = false;
  1326. }
  1327. }
  1328. }
  1329. if (Isvalid === false) {
  1330. //ShowAlertMessage('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1331. //swal('Required Field(s)\n _____________________________ \n The red fields are required!');
  1332. alert('Required Field(s)\n _____________________________ \n The red fields are required!', 'info');
  1333. }
  1334. return Isvalid;
  1335. }
  1336. function ParseDDlDynamic(response, DDL, textField, idField, defaultText) {
  1337. var data = response;
  1338. var myDDL = GetElement(mId + DDL);
  1339. $(myDDL).empty();
  1340. var option;
  1341. if (defaultText !== "" && defaultText !== undefined) {
  1342. option = document.createElement("option");
  1343. option.text = defaultText;
  1344. option.value = "";
  1345. myDDL.options.add(option);
  1346. }
  1347. for (var i = 0; i < data.length; i++) {
  1348. option = document.createElement("option");
  1349. option.text = data[i][textField].toUpperCase();
  1350. option.value = data[i][idField];
  1351. try {
  1352. myDDL.options.add(option);
  1353. }
  1354. catch (e) {
  1355. alert(e);
  1356. }
  1357. }
  1358. }