<script>
function AmountWithCommas(x) {
var currencyId = '${currencyId}';
if (x != "") {
var y = x.replace(/,/g, '');
y = y.toString();
var afterPoint = '';
if (y.indexOf('.') > 0)
afterPoint = y.substring(y.indexOf('.'), y.length);
y = Math.floor(y);
y = y.toString();
var lastThree = y.substring(y.length - 3);
var otherNumbers = y.substring(0, y.length - 3);
if (otherNumbers != '')
lastThree = ',' + lastThree;
var res = otherNumbers.replace(/\B(?=(\d{2})+(?!\d))/g, ",") + lastThree + afterPoint;
document.getElementById("auctionAmount").value = res;
var z = x.replace(/,/g, '');
document.getElementById("amountValue").value = z;
//alert(z);
if (currencyId == 1) {
onAuctionAmount(z);
} else if (currencyId == 2) {
GetNumber2(z)
} else {
onAuctionAmount(z)
}
}
if (document.getElementById("invoiceExcludingRatio").value != "") {
onInvoiceOnloadExcludingRatioWord();
}
}
var a = ['', 'ONE ', 'TWO ', 'THREE ', 'FOUR ', 'FIVE ', 'SIX ', 'SEVEN ', 'EIGHT ', 'NINE ', 'TEN ', 'ELEVEN ', 'TWELVE ', 'THIRTEEN ', 'FOURTEEN ', 'FIFTEEN ', 'SIXTEEN ', 'SEVENTEEN ', 'EIGHTEEN ', 'NINETEEN '];
var b = ['', '', 'TWENTY', 'THIRTY', 'FORTY', 'FIFTY', 'SIXTY', 'SEVENTY', 'EIGHTY', 'NINETY'];
function onAuctionAmount(num) {
//alert(num);
// alert(num);
var a = ['', 'ONE ', 'TWO ', 'THREE ', 'FOUR ', 'FIVE ', 'SIX ', 'SEVEN ', 'EIGHT ', 'NINE ', 'TEN ', 'ELEVEN ', 'TWELVE ', 'THIRTEEN ', 'FOURTEEN ', 'FIFTEEN ', 'SIXTEEN ', 'SEVENTEEN ', 'EIGHTEEN ', 'NINETEEN '];
var b = ['', '', 'TWENTY', 'THIRTY', 'FORTY', 'FIFTY', 'SIXTY', 'SEVENTY', 'EIGHTY', 'NINETY'];
var val = num.split(".");
num = val[0];
// alert(num.toString().length);
if ((num = num.toString()).length > 10)
return 'overflow';
n = ('00000000000' + num).substr(-11).match(/^(\d{2})(\d{2})(\d{2})(\d{2})(\d{1})(\d{2})$/);
if (!n)
return;
var str = '';
str += (n[1] != 0) ? (a[Number(n[1])] || b[n[1][0]] + ' ' + a[n[1][1]]) + ' HUNDRED CRORE ' : '';
str += (n[2] != 0) ? (a[Number(n[2])] || b[n[2][0]] + ' ' + a[n[2][1]]) + ' CRORE ' : '';
str += (n[3] != 0) ? (a[Number(n[3])] || b[n[3][0]] + ' ' + a[n[3][1]]) + ' LAKH ' : '';
str += (n[4] != 0) ? (a[Number(n[4])] || b[n[4][0]] + ' ' + a[n[4][1]]) + ' THOUSAND ' : '';
str += (n[5] != 0) ? (a[Number(n[5])] || b[n[5][0]] + ' ' + a[n[5][1]]) + ' HUNDRED ' : '';
str += (n[6] != 0) ? ((str != '') ? 'AND ' : '') + (a[Number(n[6])] || b[n[6][0]] + ' ' + a[n[6][1]]) + '' : '';
//alert(str);
document.getElementById("auctionAmountWord").innerHTML = str;
}
function onInvoiceOnloadExcludingRatioWord() {
var x = document.getElementById("invoiceExcludingRatio").value;
var temp = x.replace(/%/, '');
var s = (document.getElementById("amountValue").value / 100) * temp;
//alert("s ==="+s)
document.getElementById("invoiceExcludingAmount").value = s.toFixed(2);
document.getElementById("invoiceExcludingAmounts").innerHTML = s.toFixed(2);
}
function auctionAmountChange() {
var invoiceExcludingRatio = document.getElementById("invoiceExcludingRatio").value;
$('#interestTotalEventAmount').html(interestLevelComma($('#auctionAmount').val()));
// alert("Arul Here == "+invoiceExcludingRatio.replace(/%/g , ""));
invoiceExcludingRatio = invoiceExcludingRatio.replace(/%/g, "");
if (invoiceExcludingRatio > 0) {
onInvoiceExcludingRatioWord();
}
}
function auctionProfileValue() {
if (document.getElementById("amountValue").value != "") {
// var y = ((parseFloat(document.getElementById("selectedInvoicesValue").value) / parseFloat(document.getElementById("amountValue").value))) * 100;
if (document.getElementById("selectedBoardedInvoicesValue").value == 0) {
var y = 0;
} else {
var y = (parseFloat(1) - ((parseFloat(document.getElementById("amountValue").value)) / parseFloat(document.getElementById("selectedBoardedInvoicesValue").value))) * 100;
}
if (y < 0) {
y = 0;
}
var p = parseInt(y);
// alert(p);
document.getElementById("progressval").innerHTML = p;
document.getElementById("auctionProfile").value = p;
// alert(p);
progress_bar('progressbar');
} else {
// var y = (parseFloat(1)) * 100;
var y = 0;
if (y < 0) {
y = 0;
}
var p = parseInt(y);
document.getElementById("progressval").innerHTML = p;
document.getElementById("auctionProfile").value = p;
progress_bar('progressbar');
//alert(p);
}
}
</script>
<input type="text" value="" id="auctionAmount" name="auctionAmount" onKeyUp="AmountWithCommas(this.value);" onblur="auctionProfileValue(); auctionAmountChange();" />
<strong class="font12" id="auctionAmountWord" ></strong>
<input id="amountValue" name="amountValue" type="hidden" value="" />
No comments:
Post a Comment