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.
 
 
 
 
 

970 lines
33 KiB

$(document).ready(function () {
$("#branchRequired").hide();
$('#branchSelect').hide();
$('#branchManual').hide();
$(document).on("change", "#" + mId + "receiverMobileNumber", function () {
var isValid = CheckForMobileNumber(this, "Mobile No.");
if (isValid === false) {
$(this).val('');
$(this).focus();
}
});
$("#searchCustomer").click(function () {
ClearAllData();
$('#step2SendRemittance').hide();
$('#step2SendRemittanceAgreement').hide();
$('#signatureDiv').hide();
$('#step2SendRemittanceSaveButton').hide();
var myDDL = GetElement("ContentPlaceHolder1_ddlBenedeciary");
$(myDDL).empty();
var reqField = "senderIdNumber,";
if (ValidRequiredFieldWithDoc(reqField) === false) {
return false;
}
var customerIdNumber = $("#" + mId + "senderIdNumber").val();
$("#searchStatement").attr("disabled", "disabled");
var dataToSend = { MethodName: "loadCustomerDataSendPage", CustomerIdNumber: customerIdNumber };
var options =
{
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
success: function (response) {
$("#searchCustomer").removeAttr("disabled");
if (response[0].errorCode === 0) {
$('#step2SendRemittance').show();
$('#step2SendRemittanceAgreement').show();
$('#signatureDiv').show();
$('#step2SendRemittanceSaveButton').show();
$("#" + mId + "customerName").text(response[0].CUSTOMERNAME);
$("#" + mId + "membershiId").text(response[0].MEMBERSHIPID);
CustomerSignature();
ParseDDlDynamic(response, 'ddlBenedeciary', 'FULLNAME', 'RECEIVERID', 'Select Beneficiary');
}
else {
alert(response[0].Msg);
$('#step2SendRemittance').hide();
$('#step2SendRemittanceAgreement').hide();
$('#signatureDiv').hide();
$('#step2SendRemittanceSaveButton').hide();
$("#" + mId + "senderIdNumber").val('');
$("#" + mId + "senderIdNumber").focus();
}
}
};
$.ajax(options);
});
$("#ContentPlaceHolder1_TransactionAgreement").click(function () {
if ($("#ContentPlaceHolder1_TransactionAgreement").is(":checked")) {
$("#" + mId + "Save").removeAttr("disabled");
} else {
$("#" + mId + "Save").attr("disabled", "disabled");
}
});
$("#" + mId + "ddlBenedeciary").on("change", function () {
ClearAllData();
var benefeciaryId = $("#" + mId + "ddlBenedeciary").val();
if (benefeciaryId === null || benefeciaryId === '' || benefeciaryId === undefined) {
return false;
}
var dataToSend = { MethodName: "getBenefeciaryDetails", BenefeciaryId: benefeciaryId };
var options =
{
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
success: function (response) {
if (response[0].errorCode === 0) {
$("#" + mId + "receiverFullName").val(response[0].fullName);
$("#" + mId + "receiveraddress").val(response[0].address);
$("#" + mId + "receiverMobileNumber").val(response[0].mobile);
$("#" + mId + "purpose").val(response[0].address);
$("#" + mId + "relationship").val(response[0].address);
$("#" + mId + "accountNo").val(response[0].receiverAccountNo);
if (response[0].relationship === '11339') {
$("#" + mId + "otherRelationshipTextBox").val(response[0].relationOther);
$('#otherRelationDiv').show();
}
if (response[0].purposeOfRemit === '11347') {
$('#purposeOtherDiv').show();
$("#" + mId + "purposeOther").val(response[0].purposeOther);
}
if ($.isNumeric(response[0].purposeOfRemit)) {
SetDDLValueSelected(mId + "purpose", response[0].purposeOfRemit);
} else {
SetDDLTextSelected(mId + "purpose", response[0].purposeOfRemit);
}
if ($.isNumeric(response[0].relationship)) {
SetDDLValueSelected(mId + "relationship", response[0].relationship);
} else {
SetDDLTextSelected(mId + "relationship", response[0].relationship);
}
SetDDLTextSelected(mId + "pCountry", response[0].country);
PcountryOnChange('c', response[0].paymentMethod.toUpperCase(), response[0].bankId);
if (response[0].branchDetails) {
if (response[0].manualType === 'Y') {
$("#" + mId + "branch_manual").val(response[0].branchDetails);
}
else {
var dataSelectDDL = {
id: response[0].branchDetails.split('|')[0],
text: response[0].branchDetails.split('|')[1]
};
if (dataSelectDDL.id !== 'N/A') {
var newOption = new Option(dataSelectDDL.text, dataSelectDDL.id, false, false);
$('.js-example-basic-single').append(newOption).trigger('change');
$('.js-example-basic-single').val(dataSelectDDL.id); // Select the option with a value of '1'
$('.js-example-basic-single').trigger('change');
}
}
}
ShowHideAccountNo();
}
else {
alert(response[0].Msg);
}
}
};
$.ajax(options);
});
$("#" + mId + "purpose").on("change", function () {
let purposeValue = $("#" + mId + "purpose option:selected").val();
if (purposeValue === '11347') {
$("#purposeOtherDiv").show();
} else {
$("#purposeOtherDiv").hide();
}
});
$("#" + mId + "relationship").on("change", function () {
let relationValue = $("#" + mId + "relationship option:selected").val();
if (relationValue === '11339') {
$("#otherRelationDiv").show();
} else {
$("#otherRelationDiv").hide();
}
});
$("#accountDiv").hide();
$("#" + mId + "pCountry").on("change", function () {
ResetAmountFields();
$("#" + mId + "branch").empty();
$("#" + mId + "pMode").empty();
$("#" + mId + "pAgent").empty();
$('.same').hide();
$("#" + mId + "branch").removeClass('required');
$("#tdLblBranch").hide();
$("#tdTxtBranch").hide();
$('#txtpBranch_aText').attr("class", "disabled form-control");
$("#txtpBranch_err").hide();
$("#txtpBranch_aValue").val('');
$("#txtpBranch_aText").val('');
$("#" + mId + "txtRecDepAcNo").val('');
$("#" + mId + "lblExCurr").text('');
$("#" + mId + "lblPayCurr").text('');
$("#" + mId + "lblPerTxnLimit").text('0.00');
if ($("#" + mId + "pCountry option:selected ").val() !== "") {
PcountryOnChange('c', "");
}
var pmode = $("#" + mId + "pMode").val();
var partnerId = $("#" + mId + "hddPayoutPartner").val();
if (partnerId === '394130' || pmode === "2") {
$("#" + mId + "branch").addClass('required');
$('.same').show();
}
});
$("#" + mId + "pMode").on("change", function () {
$("#" + mId + "branch").empty();
ClearCalculatedAmount();
$('.displayPayerInfo').hide();
$("#" + mId + "txtRecDepAcNo").val('');
$("#tdLblBranch").hide();
$("#tdTxtBranch").hide();
$('#txtpBranch_aText').attr("class", "disabled form-control");
$("#txtpBranch_err").hide();
$("#txtpBranch_aValue").val('');
$("#txtpBranch_aText").val('');
ReceivingModeOnChange("", "");
GetPayoutPartner();
var pmode = $("#" + mId + "pMode").val();
var partnerId = $("#" + mId + "hddPayoutPartner").val();
CheckForBranchShowIde();
if (partnerId === '394130' || pmode === "2") {
$("#" + mId + "branch").addClass('required');
//if ((partnerId === apiPartnerIds[0]) && pmode === "2") {
// $('#agentBranchRequired').hide();
// $("#" + mId + "branch").removeClass('required');
//}
$('.same').show();
//if ((partnerId === apiPartnerIds[0]) && pmode === "2") {
// LoadPayerData();
//}
}
});
$("#" + mId + "pAgent").on("change", function () {
var bankId = $("#" + mId + "pAgent option:selected").val();
if (bankId === "" || bankId === null) {
return;
}
var pmode = $("#" + mId + "pMode").val();
var partnerId = $("#" + mId + "hddPayoutPartner").val();
//$('.same').hide();
$("#" + mId + "branch").removeClass('required');
$('.displayPayerInfo').hide();
PopulateBranch();
});
$(document).on('blur', '#' + mId + 'txtCollAmt', function () {
CollAmtOnChange();
});
$("#" + mId + "pMode").on('change', function () {
ShowHideAccountNo();
});
});
function ShowHideAccountNo() {
var pmode = $("#" + mId + "pMode").val();
if (pmode === "2") {
$("#accountDiv").show();
} else {
$("#accountDiv").hide();
}
}
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 PcountryOnChange(obj, pmode, pAgentSelected = "") {
var pCountry = $("#" + mId + "pCountry").val();
if (pCountry === "" || pCountry === null)
return;
var method = "";
if (obj === 'c') {
method = "PaymentModePcountry";
}
if (obj === 'pcurr') {
method = "PCurrPcountry";
}
var country = $("#" + mId + "pCountry option:selected ").text();
if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
$('#branchSelect').hide();
$('#branchManual').show();
}
else {
$('#branchSelect').show();
$('#branchManual').hide();
}
var dataToSend = { MethodName: method, pCountry: pCountry };
var options =
{
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
async: false,
success: function (response) {
if (obj === 'c') {
LoadPayMode(response, document.getElementById(mId + "pMode"), 'pcurr', "", pmode);
ReceivingModeOnChange("", pAgentSelected);
GetPayoutPartner(response[0].serviceTypeId);
CheckForBranchShowIde();
}
else if (obj === 'pcurr') {
if (response === "")
return false;
$("#" + mId + "lblPayCurr").text(response[0].currencyCode);
$("#" + mId + "lblExCurr").text(response[0].currencyCode);
return true;
}
return true;
},
error: function (result) {
alert("Due to unexpected errors we were unable to load data");
}
};
$.ajax(options);
}
function LoadLocationDDL(response) {
var data = response;
var ddl = GetElement(mId + "locationDDL");
$(ddl).empty();
$("#" + mId + "subLocationDDL").empty();
var option;
option = document.createElement("option");
for (var i = 0; i < data.length; i++) {
option = document.createElement("option");
if (data[i].LOCATIONNAME === 'Any State') {
$('#subLocation').hide();
}
option.text = data[i].LOCATIONNAME;
option.value = data[i].LOCATIONID;
if ($("#" + mId + "hddLocation").val()) {
if (option.value === $("#" + mId + "hddLocation").val()) {
option.selected = true;
}
}
try {
ddl.options.add(option);
}
catch (e) {
alert(e);
}
}
if ($("#" + mId + "hddSubLocation").val()) {
LoadSublocation();
}
}
function LoadPayMode(response, myDDL, recall, selectField, obj) {
var data = response;
//CheckSession(data);
$(myDDL).empty();
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].typeTitle;
option.value = data[i].serviceTypeId;
try {
myDDL.options.add(option);
}
catch (e) {
alert(e);
}
}
if (recall === 'pcurr') {
SetDDLTextSelected(mId + "pMode", obj);
}
}
function ReceivingModeOnChange(pModeSelected, pAgentSelected) {
ResetAmountFields();
$("#" + mId + "pAgent").empty();
PaymentModeChange(pModeSelected, pAgentSelected);
}
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: '',
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();
$('.same').show();
}
}
};
$.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();
}
function ClearCalculatedAmount() {
$("#" + mId + "txtCollAmt").val('');
$("#" + mId + "lblSendAmt").val(0);
$("#" + mId + "lblServiceChargeAmt").val(0);
$("#" + mId + "lblExRate").val(0);
$("#" + mId + "txtPayAmt").val('');
$("#" + mId + "customerRateFields").hide();
}
function GetPayoutPartner(payMode) {
var pCountry = $("#" + mId + "pCountry").val();
var pMode = $("#" + mId + "pMode").val();
var dataToSend = { MethodName: 'getPayoutPartner', PCountry: pCountry, PMode: pMode };
var options = {
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
async: false,
success:
function (response) {
var datas = response;
var agentId = "";
if (datas.length > 0) {
agentId = datas[0].agentId;
}
$("#" + mId + "hddPayoutPartner").val(agentId);
},
error: function (result) {
alert("Due to unexpected errors we were unable to load data");
}
};
$.ajax(options);
}
function SetDDLTextSelected(ddl, selectText) {
$("#" + ddl + " option").each(function () {
if ($(this).text() === $.trim(selectText)) {
$(this).prop('selected', true);
return;
}
});
}
function PopulateBranch() {
var dataToSend = {
MethodName: 'PopulateBranch',
payoutPartner: $('#' + mId + 'hddPayoutPartner').val(),
Bank: $('#' + mId + 'pAgent').val(),
Country: $('#' + mId + 'pCountry').val(),
PayMode: $('#' + mId + 'pMode').val(),
};
var options = {
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
async: false,
success:
function (response) {
ParseBranchDDl(response, GetElement(mId + "branch"), '', "");
},
error: function (result) {
alert("Due to unexpected errors we were unable to load data");
}
};
$.ajax(options);
}
function ParseBranchDDl(response, myDDL, recall, selectField) {
var data = response;
//CheckSession(data);
$(myDDL).empty();
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].agentId;
try {
myDDL.options.add(option);
}
catch (e) {
alert(e);
}
}
}
function CollAmtOnChange() {
var collAmt = $("#" + mId + "txtCollAmt").val();
if (collAmt === "")
collAmt = "0";
var collAmtFormatted = CurrencyFormatted(collAmt); //collAmt;
collAmtFormatted = CommaFormatted(collAmtFormatted);
var collCurr = $("#" + mId + "lblPerTxnLimitCurr").text();
if (collAmt === "0") {
ClearCalculatedAmount();
return;
}
checkdata(collAmt, 'cAmt');
}
function CurrencyFormatted(amount) {
var i = parseFloat(amount);
if (isNaN(i)) { i = 0.00; }
var minus = '';
if (i < 0) { minus = '-'; }
i = Math.abs(i);
i = parseInt((i + .005) * 100);
i = i / 100;
s = new String(i);
if (s.indexOf('.') < 0) { s += '.00'; }
if (s.indexOf('.') == (s.length - 2)) { s += '0'; }
//s = minus + s;
//if (amount < 0)
// s = -1 * amount;
return CommaFormatted(s, amount);
}
function CommaFormatted(amount, amountMain) {
var delimiter = ",";
var a = amount.split('.', 2);
var d = a[1];
var i = parseInt(a[0]);
if (isNaN(i)) { return ''; }
var minus = '';
if (i < 0) { minus = '-'; }
i = Math.abs(i);
var n = new String(i);
var a = [];
while (n.length > 3) {
var nn = n.substr(n.length - 3);
a.unshift(nn);
n = n.substr(0, n.length - 3);
}
if (n.length > 0) { a.unshift(n); }
n = a.join(delimiter);
if (d.length < 1) { amount = n; }
else { amount = n + '.' + d; }
amount = minus + amount;
if (amountMain > 0)
return "(" + amount + ")";
else
return amount;
}
function checkdata(amt, obj) {
if (amt > 0)
CalculateTxn(amt, obj);
else
ClearCalculatedAmount();
}
function CalculateTxn(amt, obj, isManualSc) {
var collAmt = parseFloat($("#" + mId + "txtCollAmt").val().replace(',', '').replace(',', '').replace(',', ''));
var customerId = $("#" + mId + "txtSearchData_aValue").val();
if (isManualSc === '' || isManualSc === undefined) {
isManualSc = 'N';
}
if (isManualSc === 'N') {
if (obj === '' || obj === null) {
if (document.getElementById(mId + "txtPayAmt").disabled) {
obj = 'cAmt';
amt = GetValue(mId + "txtCollAmt");
}
else {
obj = 'pAmt';
amt = GetValue(mId + "txtPayAmt");
}
}
}
else {
obj = $("#" + mId + "hddCalcBy").val();
if (obj === 'cAmt') {
amt = GetValue(mId + "txtCollAmt");
}
else {
amt = GetValue(mId + "txtPayAmt");
}
}
var pCountry = GetValue(mId + "pCountry");
var pCountrytxt = $("#" + mId + "pCountry option:selected").text();
var pMode = GetValue(mId + "pMode");
var pModetxt = $("#" + mId + "pMode option:selected").text();
if (pCountry === "" || pCountry === null || pCountry === undefined) {
alert("Please choose payout country");
GetElement(mId + "pCountry").focus();
return false;
}
if (pMode === "" || pMode === null || pMode === undefined) {
alert("Please choose payment mode");
GetElement(mId + "pMode").focus();
return false;
}
var sAgent = $("#" + mId + "sendingAgentOnBehalfDDL option:selected").val();
var pAgent = Number(GetValue(mId + "pAgent"));
var pAgentBranch = GetValue("txtpBranch_aValue");
if (pModetxt === "CASH PAYMENT TO OTHER BANK") {
pAgent = Number($("#" + mId + "paymentThrough option:selected").val());
pAgentBranch = "";
if (pAgent === "" || pAgent === undefined)
pAgent = "";
}
collAmt = GetValue(mId + "txtCollAmt");
var txtCustomerLimit = GetValue("txtCustomerLimit");
var txnPerDayCustomerLimit = GetValue(mId + "txnPerDayCustomerLimit");
var schemeCode = GetValue(mId + "ddlScheme");
if (obj === "cAmt") {
collAmt = amt;
payAmt = 0;
}
if (obj === "pAmt") {
payAmt = amt;
collAmt = 0;
}
var payCurr = $("#" + mId + "pCurrDdl").val();
var collCurr = $("#" + mId + "lblPerTxnLimitCurr").text();
var senderId = $('#finalSenderId').text();
var couponId = $("#" + mId + "iTelCouponId").val();
var sc = $("#" + mId + "lblServiceChargeAmt").val();
if (pCountry === "203" && payCurr === "USD") {
if ((pMode === "1" && pAgent !== 2091) || (pMode !== "12" && pAgent !== 2091)) {
alert('USD receiving is only allow for Door to Door');
ClearCalculatedAmount();
return false;
}
}
var collectAmount = Number($("#" + mId + "txtCollAmt").val());
var payoutAmount = Number($("#" + mId + "txtPayAmt").val());
var payoutPartner = $("#" + mId + "hddPayoutPartner").val();
var IsExrateFromPartner = $("#" + mId + "hddFetchExrateFromPartner").val();
var PCountryCode = $("#" + mId + "hddPCountryCode").val();
if (collectAmount <= 0 && payoutAmount <= 0) {
return;
}
$("#" + mId + "hddCalcBy").val(obj);
var dataToSend = {
MethodName: 'CalculateTxn', pCountry: pCountry, pCountrytxt: pCountrytxt, pMode: pMode, pAgent: pAgent
, pAgentBranch: pAgentBranch, collAmt: collAmt, payAmt: payAmt, payCurr: payCurr, collCurr: collCurr
, pModetxt: pModetxt, senderId: senderId, schemeCode: schemeCode, couponId: couponId, isManualSc: isManualSc
, sc: sc, payoutPartner: payoutPartner, IsExrateFromPartner: IsExrateFromPartner, PCountryCode: PCountryCode
};
var options =
{
url: '',
data: dataToSend,
dataType: 'JSON',
type: 'POST',
async: false,
success: function (response) {
ParseCalculateData(response, obj);
}
};
$.ajax(options);
$("#DivLoad").hide();
return true;
}
function ParseCalculateData(response, amtType) {
var data = response;
if (data[0].ErrCode === '1') {
alert(data[0].Msg);
ClearCalculatedAmount();
return;
}
$("#" + mId + "lblSendAmt").val(parseFloat(Number(data[0].sAmt).toFixed(3))); //
$("#" + mId + "hddTamt").val(parseFloat(Number(data[0].sAmt).toFixed(3))); //
$("#" + mId + "lblExRate").text(roundNumber(data[0].exRate, 8));
$("#" + mId + "lblPayCurr").text(data[0].pCurr);
$("#" + mId + "lblExCurr").text(data[0].pCurr);
if ($("#" + mId + "allowEditSC").val() === 'Y') {
$("#" + mId + "editServiceCharge").attr("disabled", false);
}
$("#" + mId + "lblPerTxnLimit").text(data[0].limit);
$("#" + mId + "lblPerTxnLimitCurr").text(data[0].limitCurr);
if (!$("#" + mId + "editServiceCharge").is(':checked')) {
$("#" + mId + "lblServiceChargeAmt").attr('disabled', 'disabled');
}
$("#" + mId + "lblServiceChargeAmt").val(parseFloat(data[0].scCharge).toFixed(0));
$("#" + mId + "hddServiceCharge").val(parseFloat(data[0].scCharge).toFixed(0));
SetValueById(mId + "txtCollAmt", parseFloat(Number(data[0].collAmt).toFixed(3)), ""); //
SetValueById(mId + "lblSendAmt", parseFloat(Number(data[0].sAmt).toFixed(3)), ""); //
$("#" + mId + "hddTPExRate").val(data[0].tpExRate);
var exRateOffer = data[0].exRateOffer;
var scOffer = data[0].scOffer;
var scDiscount = data[0].scDiscount;
var collectionAmount = Number($("#" + mId + "txtCollAmt").val());
if (collectionAmount > 0) {
$("#" + mId + "customerRateFields").show();
}
}
function roundNumber(rnum, rlength) { // Arguments: number to round, number of decimal places
var newnumber = Math.round(rnum * Math.pow(10, rlength)) / Math.pow(10, rlength);
return parseFloat(newnumber); // Output the result to the form field (change for your purposes)
}
function ValidateDetailsMain() {
var isFormDataValid = ValidateDetails();
if (isFormDataValid === true) {
return CheckSignatureCustomerFromCustomerRegister();
}
else {
return false;
}
}
function ValidateDetails() {
var reqField = "senderIdNumber,receiverFullName,receiveraddress,receiverMobileNumber,pCountry,pMode,txtCollAmt,purpose,relationship,ddlCollMode,ddlReferralName,";
//var pmodeId = $("#" + mId + "pMode").val();
//if (pmodeId != "1" && pmodeId != undefined) {
// reqField += "branch,";
// $("#branchRequired").show();
//} else {
// $("#" + mId + "branch").removeClass("required");
// $("#" + mId + "branch").css('background-color', '#FFFFFF');
// $("#branchRequired").hide();
//}
let purposeValue = $("#" + mId + "purpose option:selected").val();
if (purposeValue === '11347') {
reqField += "purposeOther,";
}
let relationValue = $("#" + mId + "relationship option:selected").val();
if (relationValue === '11339') {
reqField += "otherRelationshipTextBox,";
}
if (ValidRequiredFieldWithDoc(reqField) === false) {
return false;
} else {
var pMode = $("#" + mId + "pMode").val();
var pAgent = $("#" + mId + "pAgent").val();
var pbranch = $("#" + mId + "branch").val();
var accountNo = $("#" + mId + "accountNo").val();
if (pMode === "2") {
if (pAgent === '' || pAgent === undefined || pAgent === null) {
$("#" + mId + "pAgent").css('background-color', '#FFCCD2');
alert('Required Field(s)\n _____________________________ \n The red fields are required!');
return false;
}
if (accountNo === '' || accountNo === undefined || accountNo === null) {
$("#" + mId + "accountNo").css('background-color', '#FFCCD2');
alert('Required Field(s)\n _____________________________ \n The red fields are required!');
return false;
}
}
debugger
$("#" + mId + "hddPmode").val(pMode);
$("#" + mId + "hddPagent").val(pAgent);
$("#" + mId + "hddpBranch").val(pbranch);
var country = $("#" + mId + "pCountry option:selected ").text();
$("#" + mId + "hddPagentName").val($("#" + mId + "pAgent option:selected").text());
if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
$("#" + mId + "hddPBranchName").val($("#" + mId + "branch_manual").val());
}
else {
$("#" + mId + "hddPBranchName").val($("#" + mId + "branch option:selected").text());
}
return true;
}
}
function SetMessageBox(msg, errorCode) {
alert(msg);
}
function VerifyDetails() {
var dataToSend = {
Methodname: 'ValidateDetails'
, membershipId: $("#" + mId + "senderIdNumber").val()
, receiverName: $("#" + mId + "receiverFullName").val()
}
$.post('', dataToSend, function (response) {
var data = JSON.parse(response);
if (data[0].ERROR_CODE == '0') {
var pMode = $("#" + mId + "pMode").val();
var pgent = $("#" + mId + "pAgent").val();
var pbranch = $("#" + mId + "branch").val();
$("#" + mId + "hddPmode").val(pMode);
$("#" + mId + "hddPagent").val(pgent);
$("#" + mId + "hddpBranch").val(pbranch);
return true;
} else {
alert(data[0].Msg);
return false;
}
}).fail(function (response) {
return false;
});
}
function SetDDLValueSelected(ddl, selectText) {
$("#" + ddl + " option").each(function () {
if ($(this).val() === $.trim(selectText)) {
$(this).prop('selected', true);
return;
}
});
}
function ClearAllData() {
$("#" + mId + "receiverFullName").val('');
$("#" + mId + "receiveraddress").val('');
$("#" + mId + "receiverMobileNumber").val('');
$("#" + mId + "purpose").val('');
$("#" + mId + "relationship").val('');
$("#" + mId + "purposeOther").val('');
$("#" + mId + "otherRelationshipTextBox").val('');
$('#otherRelationDiv').hide();
$('#purposeOtherDiv').hide();
$("#" + mId + "purpose").val('');
$("#" + mId + "relationship").val('');
$("#" + mId + "pCountry").val('');
$("#" + mId + "pAgent").empty();
$("#" + mId + "branch").empty();
SetDDLTextSelected(mId + "pCountry", '');
ClearCalculatedAmount();
}
function CheckForMobileNumber(nField, fieldName) {
var numberPattern = /^[+]?[0-9]{6,16}$/;
test = numberPattern.test(nField.value);
if (!test) {
alert(fieldName + " Is Not Valid !");
nField.value = "";
return false
}
return true;
}
function CheckForBranchShowIde() {
var country = $("#" + mId + "pCountry option:selected ").text();
if (country.toUpperCase() === 'NEPAL' || country.toUpperCase() === 'VIETNAM') {
$('#branchSelect').hide();
$('#branchManual').show();
if ($('#ContentPlaceHolder1_pMode').val() === '1' && country.toUpperCase() === 'NEPAL') {
$('#branchSelect').hide();
$('#branchManual').hide();
}
}
else {
$('#branchSelect').show();
$('#branchManual').hide();
}
}