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.

203 lines
7.8 KiB

4 years ago
  1. function ReceivingModeOnChange(pModeSelected, pAgentSelected) {
  2. ResetAmountFields();
  3. $("#" + mId + "pAgent").empty();
  4. PaymentModeChange(pModeSelected, pAgentSelected);
  5. }
  6. function ResetAmountFields() {
  7. //Reset Fields
  8. $("#" + mId + "txtPayAmt").val('');
  9. $("#" + mId + "txtPayAmt").attr("readonly", false);
  10. $("#" + mId + "lblSendAmt").val('0.00');
  11. $("#" + mId + "lblServiceChargeAmt").val('0');
  12. $("#" + mId + "lblExRate").text('0.00');
  13. $("#lblDiscAmt").text('0.00');
  14. $("#" + mId + "lblPayCurr").text('');
  15. //GetElement("spnSchemeOffer").innerHTML = "";
  16. //GetElement("spnWarningMsg").innerHTML = "";
  17. }
  18. function PaymentModeChange(pModeSelected, pAgentSelected) {
  19. var pMode = "";
  20. if (pModeSelected === "" || pModeSelected === null)
  21. pMode = $("#" + mId + "pMode option:selected").text();
  22. else {
  23. pMode = pModeSelected;
  24. }
  25. pCountry = GetValue(mId + "pCountry");
  26. $('#trAccno').hide();
  27. $("#" + mId + "txtRecDepAcNo").attr("class", "form-control");
  28. $('#trForCPOB').hide();
  29. //GetElement(mId + "paymentThrough").className = "";
  30. if (pMode === "BANK DEPOSIT") {
  31. $('#trAccno').show();
  32. $("#" + mId + "txtRecDepAcNo").attr("class", "required form-control");
  33. $('#trAccno').show();
  34. }
  35. var dataToSend = { MethodName: "loadAgentBank", pMode: pMode, pCountry: pCountry };
  36. var options =
  37. {
  38. url: 'SendV2.aspx?x=' + new Date().getTime(),
  39. data: dataToSend,
  40. dataType: 'JSON',
  41. type: 'POST',
  42. async: false,
  43. success: function (response) {
  44. //LoadAgentSetting();
  45. ParseLoadDDl(response, GetElement(mId + "pAgent"), 'agentSelection', "");
  46. if (pAgentSelected !== "" && pAgentSelected !== null && pAgentSelected !== undefined) {
  47. SetDDLValueSelected(mId + "pAgent", pAgentSelected);
  48. }
  49. var agentId = $("#" + mId + "pAgent").val();
  50. if (agentId !== "" && agentId !== null && agentId !== undefined) {
  51. var payMode = $("#" + mId + "pMode").val();
  52. PopulateBankDetails(agentId, payMode, null, null);
  53. $('.same').show();
  54. }
  55. LoadCustomerRate();
  56. }
  57. };
  58. $.ajax(options);
  59. }
  60. function ParseLoadDDl(response, myDDL, recall, selectField) {
  61. var data = response;
  62. //CheckSession(data);
  63. var ddl2 = GetElement(mId + "pAgentDetail");
  64. var ddl3 = GetElement(mId + "pAgentMaxPayoutLimit");
  65. $(ddl2).empty();
  66. $(ddl3).empty();
  67. $(myDDL).empty();
  68. //GetElement("spnPayoutLimitInfo").innerHTML = "";
  69. if ($("#" + mId + "pMode option:selected").val() !== "" && recall === "agentSelection") {
  70. $('#hdnreqAgent').text(data[0].agentSelection);
  71. }
  72. var option;
  73. if (selectField !== "" && selectField !== undefined) {
  74. option = document.createElement("option");
  75. option.text = selectField;
  76. option.value = "";
  77. myDDL.options.add(option);
  78. }
  79. for (var i = 0; i < data.length; i++) {
  80. option = document.createElement("option");
  81. option.text = data[i].AGENTNAME.toUpperCase();
  82. option.value = data[i].bankId;
  83. var option2 = document.createElement("option");
  84. option2.value = data[i].bankId;
  85. option2.text = data[i].FLAG;
  86. var option3 = document.createElement("option");
  87. option3.value = data[i].bankId;
  88. option3.text = data[i].maxPayoutLimit;
  89. try {
  90. myDDL.options.add(option);
  91. ddl2.options.add(option2);
  92. ddl3.options.add(option3);
  93. }
  94. catch (e) {
  95. alert(e);
  96. }
  97. }
  98. if (data[0].AGENTNAME === "[SELECT BANK]") {
  99. $('#pAgent_err').show();
  100. GetElement("pAgent_err").innerHTML = "*";
  101. GetElement(mId + "pAgent").className = "required form-control";
  102. }
  103. else {
  104. $('#pAgent_err').hide();
  105. GetElement("pAgent_err").innerHTML = "";
  106. GetElement(mId + "pAgent").className = "form-control";
  107. }
  108. var pCountry = $("#" + mId + "pCountry option:selected").text();
  109. var pCurr = $("#" + mId + "lblPayCurr").text();
  110. GetElement("spnPayoutLimitInfo").innerHTML = "Payout Limit for " + pCountry + " : " + data[0].maxPayoutLimit;
  111. }
  112. function PopulateBankDetails(bankId, receiveMode, isBranchByName, branchSelected) {
  113. //ManageHiddenFields(receiveMode);
  114. return;
  115. $("#" + mId + "branch").empty();
  116. var partnerId = $("#" + mId + "hddPayoutPartner").val();
  117. var receivingCountryId = $("#" + mId + "pCountry").val();
  118. var dataToSend = '';
  119. if (isBranchByName === '' || isBranchByName === undefined) {
  120. dataToSend = { bankId: bankId, type: 'bb', pMode: receiveMode, partnerId: partnerId, receivingCountryId: receivingCountryId };
  121. }
  122. else {
  123. dataToSend = { bankId: bankId, type: 'bb', isBranchByName: isBranchByName, branchSelected: branchSelected, pMode: receiveMode, partnerId: partnerId, receivingCountryId: receivingCountryId };
  124. }
  125. $.get("/AgentNew/SendTxn/FormLoader.aspx", dataToSend, function (data) {
  126. GetElement("divBankBranch").innerHTML = data;
  127. });
  128. }
  129. function LoadCustomerRate() {
  130. var pCountry = $("#" + mId + "pCountry option:selected").val();
  131. var pMode = $("#" + mId + "pMode option:selected").val();
  132. var pModeTxt = $("#" + mId + "pMode option:selected").text();
  133. var pAgent = $("#" + mId + "pAgent option:selected").val();
  134. if (pAgent === "undefined")
  135. pAgent = null;
  136. if (pModeTxt === "CASH PAYMENT TO OTHER BANK")
  137. pAgent = $("#" + mId + "paymentThrough option:selected").val();
  138. var collCurr = $("#" + mId + "lblPerTxnLimitCurr").text();
  139. var dataToSend = {
  140. MethodName: 'LoadCustomerRate', pCountry: pCountry, pMode: pMode, pAgent: pAgent, collCurr: collCurr
  141. };
  142. var options =
  143. {
  144. url: '',
  145. data: dataToSend,
  146. dataType: 'JSON',
  147. type: 'POST',
  148. success: function (response) {
  149. var data = response;
  150. var collectionAmount = Number($("#" + mId + "txtCollAmt").val());
  151. $("#" + mId + "customerRateFields").hide();
  152. if (data === null || data === undefined || data === "")
  153. return;
  154. if (data[0].ErrCode !== "0") {
  155. $("#" + mId + "lblExRate").text(data[0].Msg);
  156. if (collectionAmount > 0) {
  157. $("#" + mId + "customerRateFields").show();
  158. }
  159. return;
  160. }
  161. var exRate = data[0].exRate;
  162. var pCurr = data[0].pCurr;
  163. var limit = data[0].limit;
  164. var limitCurr = data[0].limitCurr;
  165. exRate = roundNumber(exRate, 10);
  166. $("#" + mId + "lblExRate").text(exRate);
  167. $("#" + mId + "lblExCurr").text(pCurr);
  168. $("#" + mId + "lblPerTxnLimit").text(limit);
  169. $("#" + mId + "lblPerTxnLimitCurr").text(limitCurr);
  170. $("#" + mId + "customerRateFields").hide();
  171. if (collectionAmount > 0) {
  172. $("#" + mId + "customerRateFields").show();
  173. }
  174. return;
  175. }
  176. };
  177. $.ajax(options);
  178. return true;
  179. }
  180. //function ValidateCDDI() {
  181. // var isCDDI = $("#" + mId + "hddIsAdditionalCDDI").val();
  182. // var hddAgentRefId = $("#" + mId + "hddAgentRefId").val();
  183. // var xmlDataForCDDI = '';
  184. // if (isCDDI === 'Y') {
  185. // xmlDataForCDDI = GetXMLData();
  186. // sessionStorage.setItem("XmlDataForCDDI", xmlDataForCDDI);
  187. // }
  188. //}