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.

816 lines
27 KiB

  1. ClearData();
  2. ////////// Start Function For Load Calendars Data ////////////
  3. function LoadCalendars() {
  4. ShowCalDefault("#" + mId + "txtSendIdValidDate");
  5. CalIDIssueDate("#" + mId + "txtSendIdExpireDate");
  6. CalSenderDOB("#" + mId + "txtSendDOB");
  7. CalReceiverDOB("#" + mId + "txtRecDOB");
  8. //CalFromToday("#"+mId+"txtRecValidDate");
  9. }
  10. LoadCalendars();
  11. ///////// End Function For Load Calendars Data ///////////////
  12. //////// Start Function For Mobile/Phone No Validation ///////
  13. function CheckForMobileNumber(nField, fieldName) {
  14. var numberPattern = /^[+]?[0-9]{6,16}$/;
  15. var maxLength = nField.maxLength;
  16. test = numberPattern.test(nField.value);
  17. if (!test) {
  18. alert(fieldName + ' Is Not Valid ! Maximum ' + maxLength + ' Numeric Characters only valid ');
  19. nField.value = '';
  20. nField.focus();
  21. return false;
  22. }
  23. return true;
  24. }
  25. function CheckForPhoneNumber(nField, fieldName) {
  26. var numberPattern = /^[+]?[0-9]{6,15}$/;
  27. var maxLength = nField.maxLength;
  28. test = numberPattern.test(nField.value);
  29. if (!test) {
  30. alert(fieldName + ' Is Not Valid ! Maximum ' + maxLength + ' Numeric Characters only valid ');
  31. nField.value = '';
  32. nField.focus();
  33. return false;
  34. }
  35. return true;
  36. }
  37. /////// End Function For Mobile/Phone No Validation //////////
  38. function PostMessageToParentNew(id) {
  39. if (id === undefined || id === "undefined" || id === null || id === "") {
  40. alert('No customer selected!');
  41. }
  42. else {
  43. ClearSearchField();
  44. PopulateReceiverDDL(id);
  45. SearchCustomerDetails(id);
  46. }
  47. }
  48. function PostMessageToParentNewFromCalculator(collAmt) {
  49. if (collAmt === undefined || collAmt === "undefined" || collAmt === null || collAmt === "") {
  50. alert('No Amount selected!');
  51. alert('No Amount selected!');
  52. }
  53. else {
  54. SetValueById(mId + "txtCollAmt", collAmt, "");
  55. CalculateTxn();
  56. }
  57. }
  58. function checkdata(amt, obj) {
  59. if (amt > 0)
  60. CalculateTxn(amt, obj);
  61. else
  62. ClearCalculatedAmount();
  63. }
  64. function CalcOnEnter(e) {
  65. var evtobj = window.event ? event : e;
  66. var charCode = e.which || e.keyCode;
  67. if (charCode === 13) {
  68. $("#btnCalculate").focus();
  69. }
  70. }
  71. function ClearCollModeAndAvailableBal() {
  72. $('#availableBalSpan').hide();
  73. $('#availableBal').text('0');
  74. $('#11063').removeAttr('checked');
  75. $('#11064').removeAttr('checked');
  76. $('#11062').prop('checked', true);
  77. }
  78. function ParseCalculateData(response, amtType) {
  79. var data = response;
  80. CheckSession1(data);
  81. if (data[0].ErrCode === '1') {
  82. alert(data[0].Msg);
  83. ClearAmountFields();
  84. return;
  85. }
  86. if (data[0].ErrCode === '101') {
  87. SetValueById("spnWarningMsg", "", data[0].Msg);
  88. }
  89. var availableBal = parseFloat($('#availableBal').text().replace(',', '').replace(',', '').replace(',', ''));
  90. var camt = parseFloat(Number(data[0].collAmt).toFixed(3));
  91. if ($('#11063').is(':checked') || $('#11064').is(':checked')) {
  92. var txnRequestFromAgent = $("#" + mId + "hddTxnRequestFromAgent").val();
  93. if (txnRequestFromAgent !== "true") {
  94. if (camt > availableBal) {
  95. alert('Insufficient Available Balance!');
  96. ClearAmountFields();
  97. return false;
  98. }
  99. }
  100. }
  101. $("#" + mId + "lblSendAmt").val(parseFloat(Number(data[0].sAmt).toFixed(3))); //
  102. $("#" + mId + "lblExRate").text(roundNumber(data[0].exRate, 8));
  103. $("#" + mId + "lblPayCurr").text(data[0].pCurr);
  104. $("#" + mId + "lblExCurr").text(data[0].pCurr);
  105. if ($("#" + mId + "allowEditSC").val() === 'Y') {
  106. $("#" + mId + "editServiceCharge").attr("disabled", false);
  107. }
  108. $("#" + mId + "lblPerTxnLimit").text(data[0].limit);
  109. $("#" + mId + "lblPerTxnLimitCurr").text(data[0].limitCurr);
  110. if (!$("#" + mId + "editServiceCharge").is(':checked')) {
  111. $("#" + mId + "lblServiceChargeAmt").attr('disabled', 'disabled');
  112. }
  113. $("#" + mId + "lblServiceChargeAmt").val(parseFloat(data[0].scCharge).toFixed(0));
  114. $("#" + mId + "hdnCalcOriginalSc").val(parseFloat(data[0].calcOriginalSc).toFixed(0));
  115. if (data[0].IsFreeSc == "Y") {
  116. $("#" + mId + "editServiceCharge").removeAttr('checked');
  117. $("#" + mId + "editServiceCharge").attr("disabled", true); // editServiceCharge
  118. $("#" + mId + "lblServiceChargeAmt").attr("readonly", true); // lblServiceChargeAmt
  119. $("#" + mId + "lblLoyaltyFreeSc").show();
  120. }
  121. SetValueById(mId + "txtCollAmt", parseFloat(Number(data[0].collAmt).toFixed(3)), ""); //
  122. //added by gunn
  123. if ($("#" + mId + "introducerTxt_aSearch").val() !== "") {
  124. var res = CheckReferralBalAndCamt();
  125. if (res === false) {
  126. $("#" + mId + "txtPayAmt").val('');
  127. $("#" + mId + "txtPayAmt").focus();
  128. return;
  129. }
  130. }
  131. SetValueById(mId + "lblSendAmt", parseFloat(Number(data[0].sAmt).toFixed(3)), ""); //
  132. SetValueById(mId + "txtPayAmt", parseFloat(Number(data[0].pAmt).toFixed(2)), "");
  133. $("#" + mId + "hddTPExRate").val(data[0].tpExRate);
  134. var exRateOffer = data[0].exRateOffer;
  135. var scOffer = data[0].scOffer;
  136. var scDiscount = data[0].scDiscount;
  137. SetValueById("scDiscount", data[0].scDiscount, "");
  138. SetValueById("exRateOffer", data[0].exRateOffer, "");
  139. var html = "<span style='color: red;'>" + exRateOffer + "</span> (Exchange Rate)<br />";
  140. html += "<span style='color: red;'>" + scDiscount + "</span> (Service Charge)";
  141. SetValueById("spnSchemeOffer", "", html);
  142. $("#" + mId + "customerRateFields").hide();
  143. var collectionAmount = Number($("#" + mId + "txtCollAmt").val());
  144. if (collectionAmount > 0) {
  145. $("#" + mId + "customerRateFields").show();
  146. }
  147. //disable service charge if promotion is defined
  148. if ($('#hddPromotionCode').val() !== '') {
  149. $("#" + mId + "editServiceCharge").attr("disabled", true);
  150. $("#" + mId + "lblServiceChargeAmt").attr("readonly", true);
  151. }
  152. $("#" + mId + "hddExRateConfirmID").val(data[0].exRateConfirmId);
  153. $("#" + mId + "hdnRewardAmt").val(data[0].rewardAmt);
  154. $("#" + mId + "hdnIsPromoCode").val(data[0].isPromoCode);
  155. $("#" + mId + "hdnRowId").val(data[0].rowId);
  156. }
  157. function CheckSession1(data) {
  158. if (data === undefined || data === "" || data === null)
  159. return;
  160. if (data.session_end === "1") {
  161. document.location = "../../../Logout.aspx";
  162. }
  163. }
  164. //load payement mode
  165. function LoadPayMode(response, myDDL, recall, selectField, obj) {
  166. var data = response;
  167. CheckSession(data);
  168. $(myDDL).empty();
  169. var option;
  170. if (selectField !== "" && selectField !== undefined) {
  171. option = document.createElement("option");
  172. option.text = selectField;
  173. option.value = "";
  174. myDDL.options.add(option);
  175. }
  176. for (var i = 0; i < data.length; i++) {
  177. option = document.createElement("option");
  178. option.text = data[i].typeTitle;
  179. option.value = data[i].serviceTypeId;
  180. try {
  181. myDDL.options.add(option);
  182. }
  183. catch (e) {
  184. alert(e);
  185. }
  186. }
  187. if (recall === 'pcurr') {
  188. SetDDLTextSelected(mId + "pMode", obj);
  189. }
  190. }
  191. function ParseLoadDDl(response, myDDL, recall, selectField) {
  192. var data = response;
  193. CheckSession(data);
  194. var ddl2 = GetElement(mId + "pAgentDetail");
  195. var ddl3 = GetElement(mId + "pAgentMaxPayoutLimit");
  196. $(ddl2).empty();
  197. $(ddl3).empty();
  198. $(myDDL).empty();
  199. GetElement("spnPayoutLimitInfo").innerHTML = "";
  200. if ($("#" + mId + "pMode option:selected").val() !== "" && recall === "agentSelection") {
  201. $('#hdnreqAgent').text(data[0].agentSelection);
  202. }
  203. var option;
  204. if (selectField !== "" && selectField !== undefined) {
  205. option = document.createElement("option");
  206. option.text = selectField;
  207. option.value = "";
  208. myDDL.options.add(option);
  209. }
  210. for (var i = 0; i < data.length; i++) {
  211. option = document.createElement("option");
  212. option.text = data[i].AGENTNAME.toUpperCase();
  213. option.value = data[i].bankId;
  214. var option2 = document.createElement("option");
  215. option2.value = data[i].bankId;
  216. option2.text = data[i].FLAG;
  217. var option3 = document.createElement("option");
  218. option3.value = data[i].bankId;
  219. option3.text = data[i].maxPayoutLimit;
  220. try {
  221. myDDL.options.add(option);
  222. ddl2.options.add(option2);
  223. ddl3.options.add(option3);
  224. }
  225. catch (e) {
  226. alert(e);
  227. }
  228. }
  229. if (data[0].AGENTNAME === "[SELECT BANK]") {
  230. $('#pAgent_err').show();
  231. GetElement("pAgent_err").innerHTML = "*";
  232. GetElement(mId + "pAgent").className = "required form-control";
  233. }
  234. else {
  235. $('#pAgent_err').hide();
  236. GetElement("pAgent_err").innerHTML = "";
  237. GetElement(mId + "pAgent").className = "form-control";
  238. }
  239. var pCountry = $("#" + mId + "pCountry option:selected").text();
  240. var pCurr = $("#" + mId + "lblPayCurr").text();
  241. GetElement("spnPayoutLimitInfo").innerHTML = "Payout Limit for " + pCountry + " : " + data[0].maxPayoutLimit;
  242. }
  243. function SetDDLTextSelected(ddl, selectText) {
  244. $("#" + ddl + " option").each(function () {
  245. if ($(this).text() === $.trim(selectText)) {
  246. $(this).prop('selected', true);
  247. return;
  248. }
  249. });
  250. }
  251. function SetDDLValueSelected(ddl, selectText) {
  252. $("#" + ddl + " option").each(function () {
  253. if ($(this).val() === $.trim(selectText)) {
  254. $(this).prop('selected', true);
  255. return;
  256. }
  257. });
  258. }
  259. function ClickEnroll() {
  260. if ($("#" + mId + "EnrollCust").is(':checked')) {
  261. if ($("#" + mId + "NewCust").is(':checked') === false && $('#senderName').text() === "" || $('#senderName').text() === null) {
  262. ClearSearchSection();
  263. ClearData();
  264. }
  265. $('#lblMem').show();
  266. $('#valMem').show();
  267. $('#memberCode_err').html("*");
  268. return;
  269. }
  270. $("#" + mId + "NewCust").attr("checked", false);
  271. $('#lblMem').hide();
  272. $('#valMem').hide();
  273. $('#memberCode_err').html("");
  274. }
  275. function ExistingData() {
  276. if ($("#" + mId + "ExistCust").is(':checked')) {
  277. GetElement(mId + "NewCust").checked = false;
  278. ClearData();
  279. }
  280. else {
  281. GetElement(mId + "NewCust").checked = true;
  282. ClearData();
  283. }
  284. }
  285. //clear data btnClear
  286. function ClearData() {
  287. var a = false;
  288. var b = false;
  289. if ($("#" + mId + "NewCust").is(':checked')) {
  290. $(".readonlyOnCustomerSelect").removeAttr("disabled");
  291. $('.readonlyOnReceiverSelect').removeAttr("disabled");
  292. $(".showOnCustomerSelect").addClass("hidden");
  293. a = false;
  294. b = true;
  295. ClearSearchSection();
  296. HideElement('tblSearch');
  297. $('#divHideShow').hide();
  298. GetElement(mId + "ExistCust").checked = false;
  299. }
  300. else {
  301. $(".readonlyOnCustomerSelect").attr("disabled", "disabled");
  302. $(".showOnCustomerSelect").removeClass("hidden");
  303. ShowElement('tblSearch');
  304. $('#divHideShow').show();
  305. GetElement(mId + "ExistCust").checked = true;
  306. }
  307. $("#" + mId + "txtSendFirstName").attr("readonly", a);
  308. $("#" + mId + "txtSendMidName").attr("readonly", a);
  309. $("#" + mId + "txtSendLastName").attr("readonly", a);
  310. $("#" + mId + "txtSendSecondLastName").attr("readonly", a);
  311. $("#" + mId + "txtSendIdNo").attr("readonly", a);
  312. $("#" + mId + "txtSendNativeCountry").attr("readonly", a);
  313. $('#availableBal').text('0');
  314. }
  315. function CheckSession(data) {
  316. if (data === undefined || data === "" || data === null)
  317. return;
  318. if (data[0].session_end === "1") {
  319. document.location = "../../../Logout.aspx";
  320. }
  321. }
  322. function GetpAgentId() {
  323. var pagent = $("#" + mId + "pAgent option:selected").val();
  324. return pagent;
  325. }
  326. function RemoveDisableProperty() {
  327. $("#" + mId + "txtSendMobile").prop("disabled", false);
  328. $("#" + mId + "ddlSalary").removeAttr("disabled");
  329. $("#" + mId + "txtSendEmail").attr("disabled", false);
  330. $("#" + mId + "ddlIdIssuedCountry").removeAttr("disabled");
  331. //$("#" + mId + "occupation").removeAttr("disabled");
  332. }
  333. function ClearSearchSection() {
  334. ClearSearchField();
  335. $("#" + mId + "ddlReceiver").empty();
  336. $("#" + mId + "pMode").empty();
  337. $("#" + mId + "pAgent").empty();
  338. $("#tdLblBranch").hide();
  339. $("#tdTxtBranch").hide();
  340. $("#trAccno").hide();
  341. $("#spnPayoutLimitInfo").hide();
  342. $("#divSenderIdImage").hide();
  343. SetDDLValueSelected(mId + "occupation", "");
  344. SetDDLValueSelected(mId + "relationship", "");
  345. $("#" + mId + "ddlSalary").val("");
  346. SetDDLValueSelected(mId + "custLocationDDL", "");
  347. SetDDLValueSelected(mId + "branch", "");
  348. SetDDLValueSelected(mId + "pCurrDdl", "");
  349. $("#" + mId + "locationDDL").empty();
  350. $("#" + mId + "subLocationDDL").empty();
  351. $("#" + mId + "branch").empty();
  352. $("#" + mId + "pCurrDdl").empty();
  353. $("#branch").empty();
  354. SetValueById(mId + "sourceOfFund", "", "");
  355. ClearReceiverData();
  356. }
  357. function ValidateDate(date) {
  358. if (date === "") {
  359. return true;
  360. }
  361. if (Date.parse(date)) {
  362. return true;
  363. } else {
  364. return false;
  365. }
  366. }
  367. function GetDataInList() {
  368. $("#" + mId + "UnmappedDepositMapping").html('');
  369. $("#" + mId + "UnApprovedDepositMapping").html('');
  370. var tranDate = $("#" + mId + "tranDate").val();
  371. var particulars = $("#" + mId + "particulars").val();
  372. var customerId = $("#" + mId + "txtSearchData_aValue").val();
  373. var amount = $("#" + mId + "amount").val();
  374. var dataToSend = { MethodName: 'getListData', customerId: customerId, particulars: particulars, tranDate: tranDate, amount: amount };
  375. $.ajax({
  376. type: "POST",
  377. data: dataToSend,
  378. async: true,
  379. success: function (response) {
  380. $("#myModal2").modal('show');
  381. $("#" + mId + "UnmappedDepositMapping").html(response.split('[[<<>>]]')[0]);
  382. $("#" + mId + "UnApprovedDepositMapping").html(response.split('[[<<>>]]')[1]);
  383. ShowCalDefault("#" + mId + "tranDate");
  384. },
  385. fail: function () {
  386. alert("Error from Deposit Mapping");
  387. }
  388. });
  389. }
  390. function ShowHide(me, tbl) {
  391. var text = me.value;
  392. if (text === "+") {
  393. me.value = "-";
  394. me.title = "Hide";
  395. ShowElement(tbl);
  396. } else {
  397. me.value = "+";
  398. me.title = "Show";
  399. HideElement(tbl);
  400. }
  401. }
  402. function Show(me, tbl) {
  403. me.value = "-";
  404. me.title = "Hide";
  405. ShowElement(tbl);
  406. }
  407. function CreateDDLFromData(data, elementId, defaultText = null, selectedValue = null) {
  408. var ddl = GetElement(elementId);
  409. $(ddl).empty();
  410. var option;
  411. if (defaultText !== null) {
  412. option = document.createElement("option");
  413. option.text = defaultText;
  414. option.value = '';
  415. ddl.options.add(option);
  416. }
  417. for (var i = 0; i < data.length; i++) {
  418. option = document.createElement("option");
  419. option.text = data[i].payerName;
  420. option.value = data[i].payerId;
  421. if (selectedValue === option.value) {
  422. option.selected = true;
  423. }
  424. try {
  425. ddl.options.add(option);
  426. }
  427. catch (e) {
  428. alert(e);
  429. }
  430. }
  431. }
  432. $(document).on('click', '#clearBtn', function () {
  433. $("#" + mId + "tranDate").val('');
  434. $("#" + mId + "particulars").val('');
  435. GetDataInList();
  436. });
  437. $(document).on('click', "#filterBtn", function () {
  438. GetDataInList();
  439. });
  440. ////////// Start Function For Clear DDL Receiver /////////////
  441. function ClearReceiverDDLData() {
  442. var ddl = GetElement(mId + "ddlReceiver");
  443. $(ddl).empty();
  444. }
  445. ////////// End Function For Clear DDL Receiver ////////////////
  446. ////////// Start Function For Clear All Data /////////////////
  447. function ClearAllCustomerInfo() {
  448. $('.infoDiv').css('pointer-events', 'auto');
  449. $('#additionalCDDI').hide();
  450. $('#calc').attr('disabled', false);
  451. $("#" + mId + "hddIsAdditionalCDDI").val('N');
  452. $("#" + mId + "hddAgentRefId").val('');
  453. ClearSearchSection();
  454. ClearAmountFields();
  455. ///need to change
  456. ClearSenderInfoData();
  457. ClearReceiverData();
  458. ClearCollModeAndAvailableBal();
  459. ClearCDDIInfo();
  460. ClearCalculatedAmount();
  461. $('.displayPayerInfo').hide();
  462. $('#availableBalSpan').hide();
  463. ClearLocationRModeCurrencyInfoData();
  464. ClearIntroducerData();
  465. }
  466. ////////// End Function For Clear All Data /////////////////
  467. ////////// Start Function For Showing Customer Data /////////////////
  468. function ShowHistory() {
  469. var customerId = $('#ContentPlaceHolder1_txtSearchData_aValue').val();
  470. if (customerId === "" || customerId === null || customerId === undefined) {
  471. alert('Please Choose Existing Sender');
  472. return false;
  473. }
  474. url = "/RemittanceSystem/RemittanceReports/Reports.aspx?reportName=customerHistory&customerId='" + customerId + "'";
  475. OpenInNewWindow(url);
  476. }
  477. ////////// Start Function For Sender Info Data ///////////////
  478. function ClearSenderInfoData() {
  479. SetDDLValueSelected(mId + "ddlCustomerType", "");
  480. $('#senderName').text("");
  481. $('#finalSenderId').text("");
  482. $("#" + mId + "txtSendFirstName").val("");
  483. $("#" + mId + "txtSendMidName").val("");
  484. $("#" + mId + "txtSendLastName").val("");
  485. $("#" + mId + "txtSendSecondLastName").val("");
  486. $("#" + mId + "txtSendEmail").val("");
  487. $("#" + mId + "txtSendPostal").val("");
  488. SetDDLValueSelected(mId + "ddlSendCustomerType", "");
  489. $("#" + mId + "sCustStreet").val("");
  490. $("#" + mId + "companyName").val("");
  491. $("#" + mId + "txtSendCity").val("");
  492. SetDDLValueSelected(mId + "ddlEmpBusinessType", "11010");
  493. SetDDLValueSelected(mId + "custLocationDDL", "");
  494. SetDDLValueSelected(mId + "ddlIdIssuedCountry", "");
  495. SetDDLTextSelected(mId + "ddSenIdType", "SELECT");
  496. $("#" + mId + "txtSendIdNo").val("");
  497. $("#" + mId + "txtSendMobile").val("");
  498. $("#" + mId + "txtSendTel").val("");
  499. SetDDLValueSelected(mId + "ddlSenGender", "");
  500. $("#" + mId + "txtSendIdValidDate").val("");
  501. $("#" + mId + "txtSendIdExpireDate").val("");
  502. SetDDLValueSelected(mId + "txtSendNativeCountry", "");
  503. SetDDLValueSelected(mId + "occupation", "");
  504. $("#" + mId + "memberCode").val("");
  505. $("#" + mId + "txtSendDOB").val("");
  506. $("#" + mId + "txtSendAdd1").val("");
  507. $("#" + mId + "txtSendAdd2").val("");
  508. $("#" + mId + "lblPerTxnLimit").text('0.00');
  509. }
  510. ////////// End Function For Sender Info Data /////////////////
  511. /////////// Start Function For Receiver Info Data ////////////
  512. function ClearReceiverData() {
  513. $('#receiverName').text('');
  514. $('#finalBenId').text('');
  515. //new added for receiver name validation
  516. ClearReceiverValidationData();
  517. SetDDLValueSelected(mId + "ddlPayoutPartner", '');
  518. $('#divPartnerSelect').hide();
  519. SetDDLValueSelected(mId + "ddlReceiver", "");
  520. SetDDLValueSelected(mId + "ddlRecIdType", "");
  521. $("#" + mId + "txtRecFName").val("");
  522. $("#" + mId + "txtRecMName").val("");
  523. $("#" + mId + "txtRecLName").val("");
  524. $("#" + mId + "txtRecSLName").val("");
  525. $("#" + mId + "txtRecAdd1").val("");
  526. $("#" + mId + "txtRecAdd2").val("");
  527. $("#" + mId + "txtRecCity").val("");
  528. $("#" + mId + "txtRecMobile").val("");
  529. $("#" + mId + "txtRecTel").val("");
  530. SetDDLValueSelected(mId + "ddlRecIdType", "");
  531. $("#" + mId + "txtRecIdNo").val("");
  532. SetDDLValueSelected(mId + "ddlRecGender", "");
  533. SetDDLValueSelected(mId + "purpose", "");
  534. $("#" + mId + "txtRecPostal").val("");
  535. $("#" + mId + "txtRecEmail").val("");
  536. $("#" + mId + "txtRecIdNo").removeClass('required');
  537. $("#" + mId + "txtRecIdNo_err").hide();
  538. $("#" + mId + "purposeOther").val("");
  539. $("#" + mId + "relationOther").val("");
  540. $("#purposeOtherDiv").hide();
  541. $("#relationOtherDiv").hide();
  542. $("#sourceOfFundOthersDiv").hide();
  543. }
  544. /////////// End Function For Receiver Info Data //////////////
  545. function ClearReceiverValidationData() {
  546. //new added for receiver name validation
  547. $('#receiverNameFromPartnerTR').hide();
  548. $('#lblReceiverNamePartner').text('');
  549. $('#lblReceiverName').text('');
  550. $('#hddReceiverNameFromPartner').val('');
  551. $('#hddShowPopupForReceiver').val('N');
  552. $('#calc').attr('disabled', false);
  553. $('#btnSendTxnCDDI').attr('disabled', false);
  554. }
  555. ///////////// Start Function For Location/Reciving Mode/Payout Currency Info Data //////////
  556. function ClearLocationRModeCurrencyInfoData() {
  557. SetDDLValueSelected(mId + "pCountry", "");
  558. $(mId + "locationDDL").empty();
  559. $(mId + "paymentThrough").empty();
  560. $(mId + "pAgent").empty();
  561. $(mId + "pAgentMaxPayoutLimit").empty();
  562. $(mId + "ddlScheme").empty();
  563. $("#" + mId + "txtRecDepAcNo").val("");
  564. $("#" + mId + "txtCollAmt").val("");
  565. $("#" + mId + "lblPerTxnLimit").val("0.00");
  566. $("#" + mId + "lblSendAmt").val("0");
  567. $("#" + mId + "editServiceCharge", '', "false");
  568. $("#" + mId + "allowEditSC", '', "N");
  569. $("#" + mId + "lblServiceChargeAmt").val("0");
  570. $("#" + mId + "lblExRate").text("0.00");
  571. $(mId + "depositedBankDDL").empty();
  572. $(mId + "pMode").empty();
  573. $(mId + "subLocationDDL").empty();
  574. $(mId + "branch").empty();
  575. $(mId + "iTelCouponId").empty();
  576. $(mId + "pCurrDdl").empty();
  577. $(mId + "txtPayAmt").empty();
  578. $(mId + "iTelCouponId").empty();
  579. $(mId + "iTelCouponId").empty();
  580. $("#" + mId + "scDiscount").val("0");
  581. $("#" + mId + "exRateOffer").val("0");
  582. $("#" + mId + "aValue").val("");
  583. $("#" + mId + "aText").val("");
  584. $("#" + mId + "aSearch").val("");
  585. $("#" + mId + "payerText").text("");
  586. $("#" + mId + "payerBranchText").text("");
  587. $("#" + mId + "aText").val("");
  588. $("#" + mId + "lblSendAmt").val("0");
  589. $("#" + mId + "lblSendAmt").val("0");
  590. $("#" + mId + "lblSendAmt").val("0");
  591. }
  592. ///////////// End Function For Location Info Data ////////////
  593. ///////////// Start Function For Agent Info Data /////////////
  594. ///////////// End Function For Agent Info Data ///////////////
  595. ///////////// Start Function For CDDI Info Data /////////////
  596. function ClearCDDIInfo() {
  597. SetDDLValueSelected(mId + "purpose", "8060");
  598. SetDDLValueSelected(mId + "sourceOfFund", "");
  599. SetDDLValueSelected(mId + "relationship", "");
  600. SetValueById(mId + "txtPayMsg", "", "");
  601. }
  602. ///////////// End Function For CDDI Info Data ///////////////
  603. ///////////////// Start Function For Amount Info Data ////////
  604. function ClearCalculatedAmount() {
  605. $("#" + mId + "txtCollAmt").val('');
  606. $("#" + mId + "lblSendAmt").val(0);
  607. $("#" + mId + "lblServiceChargeAmt").val(0);
  608. $("#" + mId + "lblExRate").val(0);
  609. $("#" + mId + "txtPayAmt").val('');
  610. $("#" + mId + "customerRateFields").hide();
  611. }
  612. function ClearAmountFields() {
  613. $("#" + mId + "lblSendAmt").val('0.00');
  614. $("#" + mId + "lblExRate").text('0.00');
  615. $("#" + mId + "lblPerTxnLimit").text('0.00');
  616. $("#" + mId + "lblServiceChargeAmt").val('0');
  617. $('#lblDiscAmt').text('0.00');
  618. $('#' + mId + "txtCollAmt").val("");
  619. $('#' + mId + "txtPayAmt").val("");
  620. GetElement("spnSchemeOffer").innerHTML = "";
  621. }
  622. function ChangeCalcBy() {
  623. ClearCalculatedAmount();
  624. if ($("#" + mId + "txtPayAmt").is(":disabled")) {
  625. $("#" + mId + "txtCollAmt").attr('disabled', true);
  626. $("#" + mId + "txtPayAmt").attr('disabled', false);
  627. $('#' + mId + "hddCalcBy").val("pAmt");
  628. } else {
  629. $("#" + mId + "txtPayAmt").attr('disabled', true);
  630. $("#" + mId + "txtCollAmt").attr('disabled', false);
  631. $('#' + mId + "hddCalcBy").val("cAmt");
  632. }
  633. }
  634. function ReCalculate() {
  635. if (!$("#" + mId + "lblServiceChargeAmt").attr("readonly")) {
  636. if (parseFloat($("#" + mId + "lblServiceChargeAmt").val()) >= 0) {
  637. CalculateTxn($("#" + mId + "txtCollAmt").val(), 'cAmt', 'Y');
  638. }
  639. else {
  640. alert('Service charge can not be negative!');
  641. $("#" + mId + "lblServiceChargeAmt").val('0');
  642. $("#" + mId + "lblServiceChargeAmt").focus();
  643. }
  644. }
  645. }
  646. function ResetAmountFields() {
  647. //Reset Fields
  648. $("#" + mId + "txtPayAmt").val('');
  649. $("#" + mId + "txtPayAmt").attr("readonly", false);
  650. $("#" + mId + "lblSendAmt").val('0.00');
  651. $("#" + mId + "lblServiceChargeAmt").val('0');
  652. $("#" + mId + "lblExRate").text('0.00');
  653. $("#lblDiscAmt").text('0.00');
  654. $("#" + mId + "lblPayCurr").text('');
  655. GetElement("spnSchemeOffer").innerHTML = "";
  656. GetElement("spnWarningMsg").innerHTML = "";
  657. }
  658. //added by gunn
  659. function CheckReferralBalAndCamt() {
  660. var availableLimit = $("#" + mId + "hdnRefAvailableLimit").val();
  661. var collAmt = GetValue(mId + "txtCollAmt");
  662. if (parseFloat(collAmt) > parseFloat(availableLimit)) {
  663. alert("Introducer available balance exceeded");
  664. return false;
  665. }
  666. }
  667. //added by gunn
  668. function GetReferralAvailabelLimit() {
  669. var dataToSend = { MethodName: 'getReferralBalance', referralCode: $("#" + mId + "introducerTxt_aValue").val() };
  670. $.ajax({
  671. type: "POST",
  672. url: 'SendV2.aspx?x=' + new Date().getTime(),
  673. data: dataToSend,
  674. async: false,
  675. success: function (response) {
  676. $('#availableBalSpanReferral').show();
  677. $("#" + mId + "referralBalId").html(response);
  678. var bal = parseFloat($('#availableBalReferral').text().replace(/,/g, ''));
  679. $("#" + mId + "hdnRefAvailableLimit").val(bal);
  680. },
  681. fail: function () {
  682. alert("Error from GetReferralBalance");
  683. }
  684. });
  685. ReCalculate();
  686. }
  687. function CheckAvailableBalance(collectionMode) {
  688. var customerId = $("#ContentPlaceHolder1_txtSearchData_aValue").val();
  689. var branchId = $("#" + mId + "sendingAgentOnBehalfDDL").val().split('|')[0];
  690. var dataToSend = { MethodName: 'CheckAvialableBalance', collectionMode: collectionMode, customerId: customerId, branchId: branchId };
  691. $.post('SendV2.aspx?', dataToSend, function (response) {
  692. $('#availableBalSpan').show();
  693. $("#availableBalSpan").html(response);
  694. }).fail(function () {
  695. alert("Due to unexpected errors we were unable to load data");
  696. });
  697. }
  698. ///////////////// End Function For Amount Info Data //////////
  699. ///////////////// Start Function For Introducer Data /////////
  700. function ClearIntroducerData() {
  701. IntroducerDataClear();
  702. $("#availableBalSpanReferral").text("");
  703. $("#" + mId + "referralBalId").hide();
  704. }
  705. function EmailValidation(thisField, emailData, displayName) {
  706. var pattern = /([A-Za-z0-9\+_\-]+)(\.[A-Za-z0-9\+_\-]+)*@([A-Za-z0-9\-]+\.)+[A-Za-z]{2,6}/;
  707. if (!pattern.test(emailData)) {
  708. alert(displayName + " Email Validation Not Match");
  709. $(thisField).val('');
  710. $(thisField).focus();
  711. return false;
  712. }
  713. return true;
  714. }
  715. ///////////////// End Function For Introducer Data ///////////