function ReceivingModeOnChange(pModeSelected, pAgentSelected) { ResetAmountFields(); $("#" + mId + "pAgent").empty(); PaymentModeChange(pModeSelected, pAgentSelected); } function ResetAmountFields() { //Reset Fields $("#" + mId + "txtPayAmt").val(''); $("#" + mId + "txtPayAmt").attr("readonly", false); $("#" + mId + "lblSendAmt").val('0.00'); $("#" + mId + "lblServiceChargeAmt").val('0'); $("#" + mId + "lblExRate").text('0.00'); $("#lblDiscAmt").text('0.00'); $("#" + mId + "lblPayCurr").text(''); //GetElement("spnSchemeOffer").innerHTML = ""; //GetElement("spnWarningMsg").innerHTML = ""; } function PaymentModeChange(pModeSelected, pAgentSelected) { var pMode = ""; if (pModeSelected === "" || pModeSelected === null) pMode = $("#" + mId + "pMode option:selected").text(); else { pMode = pModeSelected; } pCountry = GetValue(mId + "pCountry"); $('#trAccno').hide(); $("#" + mId + "txtRecDepAcNo").attr("class", "form-control"); $('#trForCPOB').hide(); //GetElement(mId + "paymentThrough").className = ""; if (pMode === "BANK DEPOSIT") { $('#trAccno').show(); $("#" + mId + "txtRecDepAcNo").attr("class", "required form-control"); $('#trAccno').show(); } var dataToSend = { MethodName: "loadAgentBank", pMode: pMode, pCountry: pCountry }; var options = { url: 'SendV2.aspx?x=' + new Date().getTime(), data: dataToSend, dataType: 'JSON', type: 'POST', async: false, success: function (response) { //LoadAgentSetting(); ParseLoadDDl(response, GetElement(mId + "pAgent"), 'agentSelection', ""); if (pAgentSelected !== "" && pAgentSelected !== null && pAgentSelected !== undefined) { SetDDLValueSelected(mId + "pAgent", pAgentSelected); } var agentId = $("#" + mId + "pAgent").val(); if (agentId !== "" && agentId !== null && agentId !== undefined) { var payMode = $("#" + mId + "pMode").val(); PopulateBankDetails(agentId, payMode, null, null); $('.same').show(); } LoadCustomerRate(); } }; $.ajax(options); } function ParseLoadDDl(response, myDDL, recall, selectField) { var data = response; //CheckSession(data); var ddl2 = GetElement(mId + "pAgentDetail"); var ddl3 = GetElement(mId + "pAgentMaxPayoutLimit"); $(ddl2).empty(); $(ddl3).empty(); $(myDDL).empty(); //GetElement("spnPayoutLimitInfo").innerHTML = ""; if ($("#" + mId + "pMode option:selected").val() !== "" && recall === "agentSelection") { $('#hdnreqAgent').text(data[0].agentSelection); } var option; if (selectField !== "" && selectField !== undefined) { option = document.createElement("option"); option.text = selectField; option.value = ""; myDDL.options.add(option); } for (var i = 0; i < data.length; i++) { option = document.createElement("option"); option.text = data[i].AGENTNAME.toUpperCase(); option.value = data[i].bankId; var option2 = document.createElement("option"); option2.value = data[i].bankId; option2.text = data[i].FLAG; var option3 = document.createElement("option"); option3.value = data[i].bankId; option3.text = data[i].maxPayoutLimit; try { myDDL.options.add(option); ddl2.options.add(option2); ddl3.options.add(option3); } catch (e) { alert(e); } } if (data[0].AGENTNAME === "[SELECT BANK]") { $('#pAgent_err').show(); GetElement("pAgent_err").innerHTML = "*"; GetElement(mId + "pAgent").className = "required form-control"; } else { $('#pAgent_err').hide(); GetElement("pAgent_err").innerHTML = ""; GetElement(mId + "pAgent").className = "form-control"; } var pCountry = $("#" + mId + "pCountry option:selected").text(); var pCurr = $("#" + mId + "lblPayCurr").text(); GetElement("spnPayoutLimitInfo").innerHTML = "Payout Limit for " + pCountry + " : " + data[0].maxPayoutLimit; } function PopulateBankDetails(bankId, receiveMode, isBranchByName, branchSelected) { //ManageHiddenFields(receiveMode); return; $("#" + mId + "branch").empty(); var partnerId = $("#" + mId + "hddPayoutPartner").val(); var receivingCountryId = $("#" + mId + "pCountry").val(); var dataToSend = ''; if (isBranchByName === '' || isBranchByName === undefined) { dataToSend = { bankId: bankId, type: 'bb', pMode: receiveMode, partnerId: partnerId, receivingCountryId: receivingCountryId }; } else { dataToSend = { bankId: bankId, type: 'bb', isBranchByName: isBranchByName, branchSelected: branchSelected, pMode: receiveMode, partnerId: partnerId, receivingCountryId: receivingCountryId }; } $.get("/AgentNew/SendTxn/FormLoader.aspx", dataToSend, function (data) { GetElement("divBankBranch").innerHTML = data; }); } function LoadCustomerRate() { var pCountry = $("#" + mId + "pCountry option:selected").val(); var pMode = $("#" + mId + "pMode option:selected").val(); var pModeTxt = $("#" + mId + "pMode option:selected").text(); var pAgent = $("#" + mId + "pAgent option:selected").val(); if (pAgent === "undefined") pAgent = null; if (pModeTxt === "CASH PAYMENT TO OTHER BANK") pAgent = $("#" + mId + "paymentThrough option:selected").val(); var collCurr = $("#" + mId + "lblPerTxnLimitCurr").text(); var dataToSend = { MethodName: 'LoadCustomerRate', pCountry: pCountry, pMode: pMode, pAgent: pAgent, collCurr: collCurr }; var options = { url: '', data: dataToSend, dataType: 'JSON', type: 'POST', success: function (response) { var data = response; var collectionAmount = Number($("#" + mId + "txtCollAmt").val()); $("#" + mId + "customerRateFields").hide(); if (data === null || data === undefined || data === "") return; if (data[0].ErrCode !== "0") { $("#" + mId + "lblExRate").text(data[0].Msg); if (collectionAmount > 0) { $("#" + mId + "customerRateFields").show(); } return; } var exRate = data[0].exRate; var pCurr = data[0].pCurr; var limit = data[0].limit; var limitCurr = data[0].limitCurr; exRate = roundNumber(exRate, 10); $("#" + mId + "lblExRate").text(exRate); $("#" + mId + "lblExCurr").text(pCurr); $("#" + mId + "lblPerTxnLimit").text(limit); $("#" + mId + "lblPerTxnLimitCurr").text(limitCurr); $("#" + mId + "customerRateFields").hide(); if (collectionAmount > 0) { $("#" + mId + "customerRateFields").show(); } return; } }; $.ajax(options); return true; }