// JScript File
var bLoaded = false;
var ADMIN_USER = false;
function SetAutoClientUC() {
if (!bLoaded) {
new AutoSuggest('ClientIdSearchUC_', '40px', '349px');
bLoaded = true;
ADMIN_USER = true;
}
if (eID('hdnBidMode').value != "2" && eID('hdnBidMode').value != "3") {
if (eID('chkWalkinClient').checked) {
var sSearchText = eID('ddlSearch').options[eID('ddlSearch').selectedIndex].value;
if (eID('txtSearchBeneficiaryId') != null) {
new AutoSuggestDP('DPSearchUC1_', '70px', '408px');
}
else {
if (eID('hdBack').value == "Y" && (eID('hdSearch').value == "B")) {
}
else if (eID('hdBack').value == "Y" && (eID('hdSearch').value != "P")) {
new AutoSuggestDP('DPSearchUC_', '70px', '408px');
}
if (eID('hdValidPan').value == "N") {
if ((sSearchText == 'P') && (eID('txtSearchText').value != "")) {
new AutoSuggestDP('DPSearchUC_', '70px', '408px');
}
else {
if (sSearchText != 'B')
new AutoSuggestDP('DPSearchUC_', '70px', '408px');
}
}
}
}
}
PaymentModeChanged();
// if (eID('rblPaymentMode_0').checked) {
// PaymentModeChanged(C_V_PAYMENT_PG);
// }
// else {
// PaymentModeChanged(C_V_PAYMENT_CHEQUE);
// }
if (eID('hdnBidMode').value == "2" && (eID('hdBidStatus').value == "PIR" || eID('hdBidStatus').value == "PIMR") && (eID('chkWalkinClient').checked)) {
new AutoSuggestDP('DPSearchUC_', '70px', '408px');
}
}
function ValidateClientId() {
var sClientId = eID('ClientIdSearchUC_txtAuto');
strClientMessage = '';
if (Trim(sClientId.value) == "") {
//showModalPopup("IPO Transaction", 'Please enter Client Id', null);
strClientMessage = 'Please enter Client Id';
sClientId.focus();
return false;
}
else {
if (IsAlphaNumeric(sClientId.value) == false) {
// showModalPopup("IPO Transaction", 'Client Id contains invalid characters', null);
strClientMessage = 'Client Id contains invalid characters';
sClientId.focus();
return false;
}
}
return true;
}
function ToggleWalkinClient() {
try {
// if (eID('chkWalkinClient').checked) {
// PaymentModeChanged(C_V_PAYMENT_CHEQUE);
// }
// else {
// PaymentModeChanged(C_V_PAYMENT_PG);
// }
PaymentModeChanged();
}
catch (e) {
}
}
function ShowIPODetails(sValue) {
eID('dvIPODetails').style.display = 'none';
eID('dvMarginDetails').style.display = 'none';
if (sValue == '1') {
eID('lnkIPODetails').className = "alertTab";
eID('dvIPODetails').style.display = '';
}
else if (sValue == '3') {
eID('lnkIPODetails').className = "alertTab";
eID('dvMarginDetails').style.display = '';
}
}
// Added by Sakthi
function ShowMoreDetails() {
if (eID('dvMoreDetails').style.display == 'none') {
eID('dvMoreDetails').style.display = '';
eID('imglink').src = "../images/bdown.gif";
}
else {
eID('dvMoreDetails').style.display = 'none';
eID('imglink').src = "../images/bup.gif";
}
}
function BidTypeChanged(sValue) {
eID('txtQty1').value = "";
eID('txtQty2').value = "";
eID('txtQty3').value = "";
eID('txtPrice1').value = "";
eID('txtPrice2').value = "";
eID('txtPrice3').value = "";
$(eID('txtAmt1')).text("");
$(eID('txtAmt2')).text("");
$(eID('txtAmt3')).text("");
$(eID('txtQuantity1')).text("");
$(eID('txtQuantity2')).text("");
$(eID('txtQuantity3')).text("");
var bDisable = false;
switch (parseInt(sValue)) {
case C_V_BIDTYPE_MANUAL:
bDisable = false;
break;
case C_V_BIDTYPE_CUTOFF:
var $lblCapPrice = $(eID('lblCapPrice'));
eID('txtPrice1').value = $lblCapPrice.text();
bDisable = true;
break;
case C_V_BIDTYPE_PARTIAL:
var $lblPartialPrice = $(eID('lblPartial'));
eID('txtPrice1').value = $lblPartialPrice.text();
bDisable = true;
break;
}
eID('txtQty2').disabled = bDisable;
eID('txtQty3').disabled = bDisable;
eID('txtPrice1').disabled = bDisable;
eID('txtPrice2').disabled = bDisable;
eID('txtPrice3').disabled = bDisable;
return true;
}
function ClearIPOData() {
eID('txtIPOName').innerText = '';
eID('txtIPOCode').innerText = '';
eID('txtFromDate_txtDate').innerText = '';
eID('txtToDate_txtDate').innerText = '';
eID('ddlOfferType').options[eID('ddlOfferType').selectedIndex].value = 0;
eID('ddlIPOType').options[eID('ddlIPOType').selectedIndex].value = 0;
eID('ddlIPOType').disabled = false;
}
function PaymentModeChanged(sValue) {
try {
sValue = $('#rblPaymentMode input[type="radio"]:checked').val();
//eID('tdChequeNo').style.display = 'none';
//eID('tdTxtChequeNo').style.display = 'none';
//eID('tdMICRNo').style.display = 'none';
//eID('tdChequeDate').style.display = 'none';
//eID('tdTxtChequeDate').style.display = 'none';
//eID('trMICR').style.display = 'none';
//eID('trDrawnOnBank').style.display = 'none';
//eID('tdTxtMICRNo').style.display = 'none';
eID('tdAvailAmtIPO').style.display = 'none';
eID('tdLblAvailAmt').style.display = 'none';
eID('trASBAline1').style.display = 'none';
eID('trASBAline2').style.display = 'none';
eID('dvPGOption').style.display = 'none';
if (sValue == C_V_PAYMENT_PG) {
eID('tdAvailAmtIPO').style.display = '';
eID('tdLblAvailAmt').style.display = '';
eID('dvPGOption').style.display = '';
// eID('tdAvailBal').style.display = '';
// eID('tdLblAvailBal').style.display = '';
//eID('txtChequeNo').value = '';
//eID('txtChequeDate_txtDate').value = '';
//eID('txtMICRNo').value = '';
//eID('ddlBank').selectedIndex = 0;
eID('ddlASBALocation').selectedIndex = 0;
eID('ddlASBABank').selectedIndex = 0;
eID('txtASBABranchName').value = '';
eID('txtASBAAccountNo').value = '';
}
else if (sValue == C_V_PAYMENT_CHEQUE) {
eID('tdChequeNo').style.display = '';
eID('tdTxtChequeNo').style.display = '';
eID('tdMICRNo').style.display = '';
eID('tdChequeDate').style.display = '';
eID('tdTxtChequeDate').style.display = '';
eID('trMICR').style.display = '';
eID('trDrawnOnBank').style.display = '';
eID('tdTxtMICRNo').style.display = '';
eID('ddlASBALocation').selectedIndex = 0;
eID('ddlASBALocation').disabled = true;
eID('ddlASBABank').selectedIndex = 0;
eID('txtASBABranchName').value = '';
eID('txtASBAAccountNo').value = '';
}
else {//ASBA
eID('trASBAline1').style.display = '';
eID('trASBAline2').style.display = '';
//eID('txtChequeNo').value = '';
//eID('txtChequeDate_txtDate').value = '';
//eID('txtMICRNo').value = '';
//eID('ddlBank').selectedIndex = 0;
}
}
catch (e) {
}
}
function CalculateBidValue(QtyName, PriceName, BidValueName, PayableAmtName) {
try {
var txtQty = eID(QtyName);
var txtPrice = eID(PriceName);
var txtBidValue = eID(BidValueName);
var txtPayableAmt = eID(PayableAmtName);
var sPriceval = txtPrice.value;
var $lblMktLot = $(eID('lblMktLot'));
var $lblRetDis = $(eID('lblDiscountRetail'));
if (sPriceval.indexOf('.') == -1) {
if (isNaN(parseFloat(sPriceval)))
sPriceval = "0";
var stemp = parseFloat(sPriceval);
}
if (txtQty.value != "" && txtPrice.value != "") {
if (!(isNaN(txtQty.value) && isNaN(txtPrice.value))) {
var strBidValue = parseFloat(txtQty.value) * parseFloat(txtPrice.value * 100) * parseFloat($lblMktLot.text());
$(txtBidValue).text(strBidValue / 100);
var strPayAmt = "0";
var lQuantity = parseFloat(txtQty.value) * parseFloat($lblMktLot.text())
if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1) {
if (eID('hdnRetDiscountFlag').value == "1")
//strPayAmt = parseFloat(strBidValue / 100) * (1 - (parseFloat($(eID('lblDiscountRetail')).text()) / 100));
{
var discount = (parseFloat(txtPrice.value) * (parseFloat($(eID('lblDiscountRetail')).text()) / 100));
var strPrice = parseFloat(txtPrice.value) - discount;
strPayAmt = strPrice * parseFloat(txtQty.value) * parseFloat($lblMktLot.text());
}
else {
strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * (parseFloat($(eID('lblDiscountRetail')).text())));
}
// strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * parseFloat($(eID('lblDiscountRetail')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2) {
if (eID('hdnNIBDiscountFlag').value == "1") {
var discount = (parseFloat(txtPrice.value) * (parseFloat($(eID('lblDiscountNIB')).text()) / 100));
var strPrice = parseFloat(txtPrice.value) - discount;
strPayAmt = strPrice * parseFloat(txtQty.value) * parseFloat($lblMktLot.text());
}
// strPayAmt = parseFloat(strBidValue / 100) * (1 - (parseFloat($(eID('lblDiscountNIB')).text()) / 100));
else {
strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * (parseFloat($(eID('lblDiscountNIB')).text())));
}
// strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * parseFloat($(eID('lblDiscountNIB')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3) {
if (eID('hdnQIBDiscountFlag').value == "1") {
var discount = (parseFloat(txtPrice.value) * (parseFloat($(eID('lblDiscountQIB')).text()) / 100));
var strPrice = parseFloat(txtPrice.value) - discount;
strPayAmt = strPrice * parseFloat(txtQty.value) * parseFloat($lblMktLot.text());
}
// strPayAmt = parseFloat(strBidValue / 100) * (1 - (parseFloat($(eID('lblDiscountQIB')).text()) / 100));
else {
strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * (parseFloat($(eID('lblDiscountQIB')).text())));
}
// strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * parseFloat($(eID('lblDiscountQIB')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4) {
if (eID('hdnEMPDiscountFlag').value == "1")
{
var discount = (parseFloat(txtPrice.value) * (parseFloat($(eID('lblDiscountEMP')).text()) / 100));
var strPrice = parseFloat(txtPrice.value) - discount;
strPayAmt = strPrice * parseFloat(txtQty.value) * parseFloat($lblMktLot.text());
}
// strPayAmt = parseFloat(strBidValue / 100) * (1 - (parseFloat($(eID('lblDiscountEMP')).text()) / 100));
else {
strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * (parseFloat($(eID('lblDiscountEMP')).text())));
}
//strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * parseFloat($(eID('lblDiscountEMP')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 99) {
strPayAmt = parseFloat(strBidValue / 100) - (parseFloat(lQuantity) * (parseFloat($(eID('lblDiscountEMP')).text())));
}
$(txtPayableAmt).text(parseFloat(strPayAmt).toFixed(2));
}
}
else {
$(txtBidValue).text("");
$(txtPayableAmt).text("");
}
CalculateMaxBid();
GetMarginAmount();
}
catch (e) {
}
return true;
}
function CalculateMaxBid() {
var txtBidValue1 = eID("txtAmt1");
var txtBidValue2 = eID("txtAmt2");
var txtBidValue3 = eID("txtAmt3");
var txtMaxBidValue = eID("hdnMaxBidValue");
var lblBestBid = eID("lblBestBidAmt");
var max = 0;
if (!(isNaN($(txtBidValue1).text()))) {
max = parseFloat($(txtBidValue1).text());
}
if ((!isNaN($(txtBidValue2).text())) && parseFloat($(txtBidValue2).text()) > max) {
max = parseFloat($(txtBidValue2).text());
}
if ((!isNaN($(txtBidValue3).text())) && parseFloat($(txtBidValue3).text()) > max) {
max = parseFloat($(txtBidValue3).text());
}
txtMaxBidValue.value = parseFloat(max);
$(lblBestBid).text(parseFloat(max));
if (isNaN($(lblBestBid).text())) {
txtMaxBidValue.value = "0.00";
$(lblBestBid).text("");
}
}
/*
function GetMarginAmount()
{
try
{
var ddlAppType = eID("ddlIPOCategory");
var rdCutoff = eID("rblBidType_1");
var rdManual = eID("rblBidType_0");
var rdPartialPay = eID("rblBidType_2");
var max = eID("hdnMaxBidValue").value;
var qty1 = $(eID('txtQuantity1')).text();
var qty2 = $(eID('txtQuantity2')).text();
var qty3 = $(eID('txtQuantity3')).text();
var pr1 = eID("txtPrice1").value;
var pr2 = eID("txtPrice2").value;
var pr3 = eID("txtPrice3").value;
var mrgntopay = 0;
var payAmt = 0;
// if(! rdPartialPay.checked)
// {
if(eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1)
{
if(eID('hdnRetMarginFlag').value == "1")
{
mrgntopay = parseFloat(max) * parseFloat($(eID('lblMarginRetail')).text())/100;
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = qty1 * $(eID('lblMarginRetail')).text();
}
if(parseFloat(mrgntopay) != 0)
{
if(eID('hdnRetDiscountFlag').value == "1")
{
mrgntopay = (parseFloat(mrgntopay) - (parseFloat(mrgntopay) * parseFloat($(eID('lblDiscountRetail')).text())/100));
payAmt = parseFloat(max) * (1 - (parseFloat($(eID('lblDiscountRetail')).text())/100));
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = parseFloat(mrgntopay) - (qty1 * parseFloat($(eID('lblDiscountRetail')).text()));
payAmt = parseFloat(max) - (qty1 * parseFloat($(eID('lblDiscountRetail')).text()));
}
}
}
else if(eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value==2)
{
var $lblMarginNIB = $(eID('lblMarginNIB'));
if(eID('hdnNIBMarginFlag').value == "1")
{
mrgntopay = parseFloat(max) * parseFloat($(eID('lblMarginNIB')).text())/100;
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = qty1 * $(eID('lblMarginNIB')).text();
}
if(parseFloat(mrgntopay) != 0)
{
if(eID('hdnNIBDiscountFlag').value == "1")
{
mrgntopay = (parseFloat(mrgntopay) - (parseFloat(mrgntopay) * parseFloat($(eID('lblDiscountNIB')).text())/100));
payAmt = parseFloat(max) * (1 - (parseFloat($(eID('lblDiscountNIB')).text())/100));
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = parseFloat(mrgntopay) - (qty1 * parseFloat($(eID('lblDiscountNIB')).text()));
payAmt = parseFloat(max) - (qty1 * parseFloat($(eID('lblDiscountNIB')).text()));
}
}
}
else if(eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value==3)
{
if(eID('hdnQIBMarginFlag').value == "1")
{
mrgntopay = parseFloat(max) * parseFloat($(eID('lblMarginQIB')).text())/100;
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = qty1 * $(eID('lblMarginQIB')).text();
}
if(parseFloat(mrgntopay) != 0)
{
if(eID('hdnQIBDiscountFlag').value == "1")
{
mrgntopay = (parseFloat(mrgntopay) - (parseFloat(mrgntopay) * parseFloat($(eID('lblDiscountQIB')).text())/100));
payAmt = parseFloat(max) * (1 - (parseFloat($(eID('lblMarginQIB')).text())/100));
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = parseFloat(mrgntopay) - (qty1 * parseFloat($(eID('lblDiscountQIB')).text()));
payAmt = parseFloat(max) - (qty1 * parseFloat($(eID('lblDiscountQIB')).text()));
}
}
}
else if(eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4)
{
if(eID('hdnEMPMarginFlag').value == "1")
{
mrgntopay = parseFloat(max) * parseFloat($(eID('lblMarginEMP')).text())/100;
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = qty1 * $(eID('lblMarginEMP')).text();
}
if(parseFloat(mrgntopay) != 0)
{
if(eID('hdnEMPDiscountFlag').value == "1")
{
mrgntopay = (parseFloat(mrgntopay) - (parseFloat(mrgntopay) * parseFloat($(eID('lblDiscountEMP')).text())/100));
payAmt = parseFloat(max) * (1 - (parseFloat($(eID('lblDiscountEMP')).text())/100));
}
else
{
qty1= BestBidQty(qty1, pr1,qty2,pr2,qty3,pr3);
mrgntopay = parseFloat(mrgntopay) - (qty1 * parseFloat($(eID('lblDiscountEMP')).text()));
payAmt = parseFloat(max) - (qty1 * parseFloat($(eID('lblDiscountEMP')).text()));
}
}
}
if(parseFloat(mrgntopay) < 0)
mrgntopay = "0.00";
$(eID("lblMarginPay")).text(parseFloat(mrgntopay));
if($(eID("lblMarginPay")).text()!="0.00")
{
$(eID("lblMarginPay")).text(parseFloat(mrgntopay));
}
if(isNaN($(eID("lblMarginPay")).text()))
{
$(eID("lblMarginPay")).text("");
}
payAmt = CalculatePayableAmount();
$(eID("lblPayableAmt")).text(parseFloat(payAmt));
if($(eID("lblPayableAmt")).text()!="0.00")
{
$(eID("lblPayableAmt")).text(parseFloat(payAmt));
}
if(isNaN($(eID("lblPayableAmt")).text()))
{
$(eID("lblPayableAmt")).text("");
}
}
catch(e)
{
$(eID("lblMarginPay")).text("");
}
}*/
function GetMarginAmount() {
try {
var ddlAppType = eID("ddlIPOCategory");
var rdCutoff = eID("rblBidType_1");
var rdManual = eID("rblBidType_0");
var rdPartialPay = eID("rblBidType_2");
var max = eID("hdnMaxBidValue").value;
var qty1 = $(eID('txtQuantity1')).text();
var qty2 = $(eID('txtQuantity2')).text();
var qty3 = $(eID('txtQuantity3')).text();
var pr1 = eID("txtPrice1").value;
var pr2 = eID("txtPrice2").value;
var pr3 = eID("txtPrice3").value;
var mrgntopay = 0;
var payAmt = 0;
var dblMarginToPay = 0;
var dblDiscount = 0;
var dblBidAmt1 = 0;
var dblBidAmt2 = 0;
var dblBidAmt3 = 0;
var lQty1 = 0;
var lQty2 = 0;
var lQty3 = 0;
var dblMarginToPay1 = 0;
var dblMarginToPay2 = 0;
var dblMarginToPay3 = 0;
dblBidAmt1 = parseFloat($(eID('txtAmt1')).text());
dblBidAmt2 = parseFloat($(eID('txtAmt2')).text());
dblBidAmt3 = parseFloat($(eID('txtAmt3')).text());
if (isNaN(parseFloat(dblBidAmt1)))
dblBidAmt1 = 0;
if (isNaN(parseFloat(dblBidAmt2)))
dblBidAmt2 = 0;
if (isNaN(parseFloat(dblBidAmt3)))
dblBidAmt3 = 0;
lQty1 = parseFloat($(eID('txtQuantity1')).text());
lQty2 = parseFloat($(eID('txtQuantity2')).text());
lQty3 = parseFloat($(eID('txtQuantity3')).text());
if (isNaN(parseFloat(lQty1)))
lQty1 = 0;
if (isNaN(parseFloat(lQty2)))
lQty2 = 0;
if (isNaN(parseFloat(lQty3)))
lQty3 = 0;
if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1) {
dblMarginToPay = parseFloat($(eID('lblMarginRetail')).text());
dblDiscount = (parseFloat($(eID('lblDiscountRetail')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2) {
dblMarginToPay = parseFloat($(eID('lblMarginNIB')).text());
dblDiscount = (parseFloat($(eID('lblDiscountNIB')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3) {
dblMarginToPay = parseFloat($(eID('lblMarginQIB')).text());
dblDiscount = (parseFloat($(eID('lblDiscountQIB')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4) {
dblMarginToPay = parseFloat($(eID('lblMarginEMP')).text());
dblDiscount = (parseFloat($(eID('lblDiscountEMP')).text()));
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 99) {
dblMarginToPay = parseFloat($(eID('lblMarginNonCust')).text());
dblDiscount = 0.00;
}
if ((eID('hdnRetMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1)
|| (eID('hdnNIBMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2)
|| (eID('hdnQIBMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3)
|| (eID('hdnEMPMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4)
|| (eID('hdnNonCustMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 99)) {
dblMarginToPay1 = dblBidAmt1 * dblMarginToPay / 100;
dblMarginToPay2 = dblBidAmt2 * dblMarginToPay / 100;
dblMarginToPay3 = dblBidAmt3 * dblMarginToPay / 100;
}
else {
dblMarginToPay1 = lQty1 * dblMarginToPay;
dblMarginToPay2 = lQty2 * dblMarginToPay;
dblMarginToPay3 = lQty3 * dblMarginToPay;
}
payAmt = CalculatePayableAmount();
if (dblMarginToPay1 != 0 || dblMarginToPay2 != 0 || dblMarginToPay3 != 0) {
if ((eID('hdnRetDiscountFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1)
|| (eID('hdnNIBDiscountFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2)
|| (eID('hdnQIBDiscountFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3)
|| (eID('hdnEMPDiscountFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4)
|| (eID('hdnNonCustMarginFlag').value == "1" && eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 99)) {
dblMarginToPay1 = dblMarginToPay1 - (dblMarginToPay1 * dblDiscount / 100);
dblMarginToPay2 = dblMarginToPay2 - (dblMarginToPay2 * dblDiscount / 100);
dblMarginToPay3 = dblMarginToPay3 - (dblMarginToPay3 * dblDiscount / 100);
//dblMarginToPay = payAmt * dblMarginToPay / 100;
}
else {
dblMarginToPay1 = dblMarginToPay1 - (lQty1 * dblDiscount);
dblMarginToPay2 = dblMarginToPay2 - (lQty2 * dblDiscount);
dblMarginToPay3 = dblMarginToPay3 - (lQty3 * dblDiscount);
//dblMarginToPay = payAmt * dblMarginToPay / 100;
}
}
dblMarginToPay = dblMarginToPay1 > dblMarginToPay2 ? (dblMarginToPay1 > dblMarginToPay3 ? dblMarginToPay1 : dblMarginToPay3) : (dblMarginToPay2 > dblMarginToPay3 ? dblMarginToPay2 : dblMarginToPay3);
if (parseFloat(dblMarginToPay) < 0)
dblMarginToPay = "0.00";
$(eID("lblMarginPay")).text(parseFloat(dblMarginToPay).toFixed(2));
if ($(eID("lblMarginPay")).text() != "0.00") {
$(eID("lblMarginPay")).text(parseFloat(dblMarginToPay).toFixed(2));
}
if (isNaN($(eID("lblMarginPay")).text())) {
$(eID("lblMarginPay")).text("");
}
payAmt = CalculatePayableAmount();
$(eID("lblPayableAmt")).text(parseFloat(payAmt).toFixed(2));
if ($(eID("lblPayableAmt")).text() != "0.00") {
$(eID("lblPayableAmt")).text(parseFloat(payAmt).toFixed(2));
}
if (isNaN($(eID("lblPayableAmt")).text())) {
$(eID("lblPayableAmt")).text("");
}
}
catch (e) {
$(eID("lblMarginPay")).text("");
}
}
function CalculatePayableAmount() {
var lQuantity1 = 0;
var lQuantity2 = 0;
var lQuantity3 = 0;
lQuantity1 = parseFloat($(eID("txtPayableAmt1")).text());
lQuantity2 = parseFloat($(eID("txtPayableAmt2")).text());
lQuantity3 = parseFloat($(eID("txtPayableAmt3")).text());
if (isNaN(parseFloat(lQuantity1)))
lQuantity1 = 0;
if (isNaN(parseFloat(lQuantity2)))
lQuantity2 = 0;
if (isNaN(parseFloat(lQuantity3)))
lQuantity3 = 0;
var resPayableAmt = 0;
resPayableAmt = lQuantity1 > lQuantity2 ? (lQuantity1 > lQuantity3 ? lQuantity1 : lQuantity3) : (lQuantity2 > lQuantity3 ? lQuantity2 : lQuantity3);
return resPayableAmt;
}
function CalculateOrderQuantity(LotName, QtyName) {
var txtQty = eID(QtyName);
try {
var lblMktLot = $(eID('lblMktLot')).text();
var txtLot = eID(LotName);
if (!isNaN(txtLot.value) && parseFloat(txtLot.value) > 0) {
$(txtQty).text(parseFloat(lblMktLot) * parseFloat(txtLot.value));
}
else {
$(txtQty).text('');
}
}
catch (e) {
$(txtQty).text('');
}
}
function ValidateUserDetails() {
var bValid = true;
if (ADMIN_USER) {
//var bValid = true;
var strMessage = "";
//Validation for walk in client
if (eID('chkWalkinClient').checked) {
if (eID('ClientIdSearchUC_ddlGroupId').options[eID('ClientIdSearchUC_ddlGroupId').selectedIndex].text == "Select") {
bValid = false;
strMessage = "
Please select Group Id";
}
if (eID('txtClientName').value == "") {
bValid = false;
strMessage = " Please enter Client Name";
}
/* if(eID('hdBack').value == "Y")
{
if (eID('DPSearchUC_txtDPAuto').value == "")
{
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
else if (eID('DPSearchUC_txtDPAuto').value.indexOf('-') == -1)
{
bValidUser = false;
strMessage += "" + "Please enter valid DP Id";
}
if(eID('hdSearch').value != "B")
{
if(eID('txtBeneficiaryId').value == "")
{
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
else if((eID('DPSearchUC_txtDPAuto').value.indexOf("IN") == 0 && eID('txtBeneficiaryId').value.length != 8)
|| (eID('DPSearchUC_txtDPAuto').value.indexOf("IN") != 0 && eID('txtBeneficiaryId').value.length != 16))//for NSDL
{
bValid = false;
strMessage = strMessage + "
Please enter correct Beneficiary Id";
}
}
if(eID('txtPanNo').value == "")
{
bValid = false;
strMessage = strMessage + "
Please enter PanNo";
}
else if(eID('txtPanNo').value.length != 10)
{
bValid = false;
strMessage = strMessage + "
Please enter correct PanNo";
}
// if(typeof(revPanNo) != 'undefined' && revPanNo != null)
// {
// if(typeof(revPanNo.isvalid) != 'undefined')
// {
// if(!revPanNo.isvalid)
// {
// bValid = false;
// strMessage += '
' + revPanNo.errormessage;
// }
// }
// }
}
else*/
{
if (eID('hdSearch').value == "P") {
if (eID('ddlBeneficiaryId') != null) {
if (eID('ddlBeneficiaryId').options[eID('ddlBeneficiaryId').selectedIndex].value == "") {
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
if (eID('txtDPId').value == "") {
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
}
else {
if (eID('txtSearchBeneficiaryId').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
else if ((eID('DPSearchUC1_txtDPAuto').value.indexOf("IN") == 0 && eID('txtSearchBeneficiaryId').value.length != 8)
|| (eID('DPSearchUC1_txtDPAuto').value.indexOf("IN") != 0 && eID('txtSearchBeneficiaryId').value.length != 16)
|| (eID('DPSearchUC1_txtDPAuto').value.indexOf("IN") == 0 && eID('txtSearchBeneficiaryId').value.length == 16 && eID('txtSearchBeneficiaryId').value.indexOf(eID('DPSearchUC1_txtDPAuto').value == 1 ) ))
{
bValid = false;
strMessage = strMessage + "
Please enter correct Beneficiary Id";
}
if (eID('DPSearchUC1_txtDPAuto').value == "") {
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
else if (eID('DPSearchUC1_txtDPAuto').value.indexOf('-') == -1) {
bValidUser = false;
strMessage += "" + "Please enter valid DP Id";
}
}
if (eID('txtSearchText').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter PanNo";
}
}
else if (eID('hdSearch').value == "B") {
if (eID('txtSearchText').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
if (eID('txtDPId').value == "") {
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
if (eID('txtPanNo').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter PanNo";
}
else if (eID('txtPanNo').value.length != 10) {
bValid = false;
strMessage = strMessage + "
Please enter correct PanNo";
}
if (typeof (revPanNo) != 'undefined' && revPanNo != null) {
if (typeof (revPanNo.isvalid) != 'undefined') {
if (!revPanNo.isvalid) {
bValid = false;
strMessage += '
' + revPanNo.errormessage;
}
}
}
}
else {
if (eID('DPSearchUC_txtDPAuto').value == "") {
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
else if (eID('DPSearchUC_txtDPAuto').value.indexOf('-') == -1) {
bValidUser = false;
strMessage += "" + "Please enter valid DP Id";
}
if (eID('txtBeneficiaryId').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
else if ((eID('DPSearchUC_txtDPAuto').value.indexOf("IN") == 0 && eID('txtBeneficiaryId').value.length != 8)
|| (eID('DPSearchUC_txtDPAuto').value.indexOf("IN") != 0 && eID('txtBeneficiaryId').value.length != 16)
|| (eID('DPSearchUC_txtDPAuto').value.indexOf("IN") != 0 && eID('txtBeneficiaryId').value.length == 16 && eID('txtBeneficiaryId').value.indexOf(eID('DPSearchUC_txtDPAuto').value.substring(0, 8)) != 0))
{
bValid = false;
strMessage = strMessage + "
Please enter correct Beneficiary Id";
}
if (eID('txtPanNo').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter PanNo";
}
else if (eID('txtPanNo').value.length != 10) {
bValid = false;
strMessage = strMessage + "
Please enter correct PanNo";
}
if (typeof (revPanNo) != 'undefined' && revPanNo != null) {
if (typeof (revPanNo.isvalid) != 'undefined') {
if (!revPanNo.isvalid) {
bValid = false;
strMessage += '
' + revPanNo.errormessage;
}
}
}
}
}
}
else {
if (!ValidateClientId()) {
strMessage = strClientMessage;
bValid = false;
}
}
if(bValid == false)
{
showModalPopup("IPO Transaction", strMessage, window, false);
}
}
return bValid;
}
function ValidateBidDetails() {
var bValidEntry = true;
var strMessage = '';
var RetailQty = $(eID('lblMaxBidQtyRetail')).text();
var EMPQty = $(eID('lblMaxBidQtyEMP')).text();
var NIBQty = $(eID('lblMaxBidQtyNIB')).text();
var QIBQty = $(eID('lblMaxBidQtyQIB')).text();
var sIPOCategory = eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value;
var PrevQty = eID('hdnPrevQty').value;
var PrevPrice = eID('hdnPrevPrice').value;
var arrQty = PrevQty.split(':');
var arrPrice = PrevPrice.split(':');
var ModifyFlag = eID('hdnModifyFlag').value;
var QtyModifyFlag = eID('hdnQtyModifyFlag').value;
var PriceModifyFlag = eID('hdnPriceModifyFlag').value;
if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2 || eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3) {
if (eID('rblBidType_1').checked == true) {
bValidEntry = false;
strMessage = strMessage + " Cut-Off is allowed only for Retail,EMP client";
}
}
var bPartialBid = false;
if (eID('rblBidType_2').checked == true) {
bPartialBid = true;
}
if (bValidEntry) {
if (eID('txtQty1').value == "") {
bValidEntry = false;
strMessage = strMessage + '
Please enter Qty1(Lot) for Bid1';
}
else {
var qty = parseInt(eID('txtQty1').value);
if (ModifyFlag == "1" && eID('hdnBidMode').value == "2") {
if (QtyModifyFlag == "0") {
if (qty - parseInt(arrQty[0]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for Qty1(Lot) ';
}
}
else if (QtyModifyFlag == "1") {
if (qty - parseInt(arrQty[0]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for Qty1(Lot) ';
}
}
}
if ((!isNaN(eID('txtQty1').value) && eID('txtQty1').value != "" && parseInt(eID('txtQty1').value) < parseInt($(eID('lblMinLot')).text()))
|| (!isNaN(eID('txtQty2').value) && eID('txtQty2').value != "" && parseInt(eID('txtQty2').value) < parseInt($(eID('lblMinLot')).text()))
|| (!isNaN(eID('txtQty3').value) && eID('txtQty3').value != "" && parseInt(eID('txtQty3').value) < parseInt($(eID('lblMinLot')).text()))) {
bValidEntry = false;
strMessage = strMessage + '
Min Lot for Bid is ' + $(eID('lblMinLot')).text();
}
if (sIPOCategory == 1) {
if (parseInt(eID('txtQty1').value) > parseInt(RetailQty) && parseInt(RetailQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty1(Lot) should be less than or equal to the Max Qty(Lot) ' + RetailQty;
}
}
else if (sIPOCategory == 2) {
if (parseInt(eID('txtQty1').value) > parseInt(NIBQty) && parseInt(NIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty1(Lot) should be less than or equal to the Max Qty(Lot) ' + NIBQty;
}
}
else if (sIPOCategory == 3) {
if (parseInt(eID('txtQty1').value) > parseInt(QIBQty) && parseInt(QIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty1(Lot) should be less than or equal to the Max Qty(Lot) ' + QIBQty;
}
}
else if (sIPOCategory == 4) {
if (parseInt(eID('txtQty1').value) > parseInt(EMPQty) && parseInt(EMPQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty1(Lot) should be less than or equal to the Max Qty(Lot) ' + EMPQty;
}
}
if (eID('txtQty2').value == "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Please enter data for Qty2';
}
if (!isNaN(eID('txtQty2').value) && eID('txtQty2').value != "") {
if (ModifyFlag == "1" && eID('hdnBidMode').value == "2") {
if (QtyModifyFlag == "0") {
if (qty - parseInt(arrQty[1]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for Qty2(Lot) ';
}
}
else if (QtyModifyFlag == "1") {
if (qty - parseInt(arrQty[1]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for Qty2(Lot) ';
}
}
}
if (sIPOCategory == 1) {
if (parseInt(eID('txtQty2').value) > parseInt(RetailQty) && parseInt(RetailQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty2(Lot) should be less than or equal to the Max Qty(Lot) ' + RetailQty;
}
}
else if (sIPOCategory == 2) {
if (parseInt(eID('txtQty2').value) > parseInt(NIBQty) && parseInt(NIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty2(Lot) should be less than or equal to the Max Qty(Lot) ' + NIBQty;
}
}
else if (sIPOCategory == 3) {
if (parseInt(eID('txtQty2').value) > parseInt(QIBQty) && parseInt(QIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty2(Lot) should be less than or equal to the Max Qty(Lot) ' + QIBQty;
}
}
else if (sIPOCategory == 4) {
if (parseInt(eID('txtQty2').value) > parseInt(EMPQty) && parseInt(EMPQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty2(Lot) should be less than or equal to the Max Qty(Lot) ' + EMPQty;
}
}
}
if (eID('txtQty3').value == "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Please enter data for Qty3';
}
if (!isNaN(eID('txtQty3').value) && eID('txtQty3').value != "") {
if (ModifyFlag == "1" && eID('hdnBidMode').value == "2") {
if (QtyModifyFlag == "0") {
if (qty - parseInt(arrQty[2]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for Qty3(Lot) ';
}
}
else if (QtyModifyFlag == "1") {
if (qty - parseInt(arrQty[2]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for Qty3(Lot) ';
}
}
}
if (sIPOCategory == 1) {
if (parseInt(eID('txtQty3').value) > parseInt(RetailQty) && parseInt(RetailQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty3(Lot) should be less than or equal to the Max Qty(Lot) ' + RetailQty;
}
}
else if (sIPOCategory == 2) {
if (parseInt(eID('txtQty3').value) > parseInt(NIBQty) && parseInt(NIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty3(Lot) should be less than or equal to the Max Qty(Lot) ' + NIBQty;
}
}
else if (sIPOCategory == 3) {
if (parseInt(eID('txtQty3').value) > parseInt(QIBQty) && parseInt(QIBQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty3(Lot) should be less than or equal to the Max Qty(Lot) ' + QIBQty;
}
}
else if (sIPOCategory == 4) {
if (parseInt(eID('txtQty3').value) > parseInt(EMPQty) && parseInt(EMPQty) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Qty3(Lot) should be less than or equal to the Max Qty(Lot) ' + EMPQty;
}
}
}
if ($(eID('txtQuantity1')).text().length > 11) {
bValidEntry = false;
strMessage = strMessage + '
Order Qty1 should be less than or equal to 99999999999';
}
if ($(eID('txtQuantity2')).text().length > 11) {
bValidEntry = false;
strMessage = strMessage + '
Order Qty2 should be less than or equal to 99999999999';
}
if ($(eID('txtQuantity3')).text().length > 11) {
bValidEntry = false;
strMessage = strMessage + '
Order Qty3 should be less than or equal to 99999999999';
}
}
if (eID('txtPrice1').value == "") {
bValidEntry = false;
strMessage = strMessage + '
Please enter Price for Bid1';
}
if (eID('txtPrice1').value != "") {
if (typeof (revPrice1) != 'undefined' && revPrice1 != null) {
if (typeof (revPrice1.isvalid) != 'undefined') {
if (!revPrice1.isvalid) {
bValid = false;
strMessage += '
' + revPrice1.errormessage;
}
}
}
}
else if (ModifyFlag == "1" && eID('rblBidType_0').checked == true && eID('hdnBidMode').value == "2") {
var Price = parseFloat(eID('txtPrice1').value);
if (PriceModifyFlag == "0") {
if (price - parseInt(arrPrice[0]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for price1 ';
}
}
else if (PriceModifyFlag == "1" && eID('rblBidType_0').checked == true) {
if (price - parseInt(arrPrice[2]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for price1 ';
}
}
}
if (eID('txtPrice2').value != "") {
if (typeof (revPrice2) != 'undefined' && revPrice2 != null) {
if (typeof (revPrice2.isvalid) != 'undefined') {
if (!revPrice2.isvalid) {
bValid = false;
strMessage += '
' + revPrice2.errormessage;
}
}
}
}
else if (ModifyFlag == "1" && eID('rblBidType_0').checked == true && eID('hdnBidMode').value == "2") {
var Price = parseFloat(eID('txtPrice2').value);
if (PriceModifyFlag == "0") {
if (price - parseInt(arrPrice[1]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for price2 ';
}
}
else if (PriceModifyFlag == "1" && eID('rblBidType_0').checked == true) {
if (price - parseInt(arrPrice[2]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for price2 ';
}
}
}
if (eID('txtPrice3').value != "") {
if (typeof (revPrice3) != 'undefined' && revPrice3 != null) {
if (typeof (revPrice3.isvalid) != 'undefined') {
if (!revPrice3.isvalid) {
bValid = false;
strMessage += '
' + revPrice3.errormessage;
}
}
}
}
else if (ModifyFlag == "1" && eID('rblBidType_0').checked == true && eID('hdnBidMode').value == "2") {
var Price = parseFloat(eID('txtPrice3').value);
if (PriceModifyFlag == "0") {
if (price - parseInt(arrPrice[2]) < 0) {
bValidEntry = false;
strMessage = strMessage + '
Only upward modification is allowed for price3 ';
}
}
else if (PriceModifyFlag == "1" && eID('rblBidType_0').checked == true) {
if (price - parseInt(arrPrice[2]) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Only downward modification is allowed for price3 ';
}
}
}
if (bValidEntry) {
var $lblMktLot = $(eID('lblMktLot'));
var Amount;
var RetailAmount = $(eID('lblMaxBidAmtRetail')).text();
var EMPAmount = $(eID('lblMaxBidAmtEMP')).text();
var NonCustMaxAmount = $(eID('lblMaxBidAmtNonCust')).text();
if (NonCustMaxAmount == 'Non-Disclosed')
NonCustMaxAmount = '9999999999';
var NIBAmount = $(eID('lblMinAmtNIB')).text();
var QIBAmount = $(eID('lblMinAmtQIB')).text();
var NonCustMinAmt = $(eID('lblMinAmtNonCust')).text();
if (NonCustMinAmt == 'Non-Disclosed')
NonCustMinAmt = '0';
var TickPrice = $(eID('lblTickSize')).text();
var floorPr = $(eID('lblFloorPrice')).text();
if (floorPr == 'Non-Disclosed')
floorPr = TickPrice;
var CapPr = $(eID('lblCapPrice')).text();
if (CapPr == 'Non-Disclosed')
CapPr = '999998';
var RetailQty = $(eID('lblMaxBidQtyRetail')).text();
var EMPQty = $(eID('lblMaxBidQtyEMP')).text();
var NIBQty = $(eID('lblMaxBidQtyNIB')).text();
var QIBQty = $(eID('lblMaxBidQtyQIB')).text();
var NonCustQty = $(eID('lblMaxBidQtyNonCust')).text();
var sPrice1 = parseFloat(eID('txtPrice1').value);
if (sPrice1 < parseFloat(floorPr) && !bPartialBid) {
bValidEntry = false;
strMessage = strMessage + '
Price 1(Rs.) Per share should be greater than ' + floorPr;
}
else if (sPrice1 > parseFloat(CapPr)) {
bValidEntry = false;
strMessage = strMessage + '
Price 1(Rs.) Per share should be less than ' + CapPr;
}
if (parseFloat(sPrice1) > 0 && ((parseFloat(sPrice1).toFixed(2) * 100) % (parseFloat(TickPrice) * 100) != 0)) {
bValidEntry = false;
strMessage = strMessage + '
Price 1(Rs.) should be in mulitiples of Tick size ' + TickPrice;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "") {
var sPrice2 = parseFloat(eID('txtPrice2').value);
if (sPrice2 < parseFloat(floorPr) && !bPartialBid) {
bValidEntry = false;
strMessage = strMessage + '
Price 2(Rs.) Per share should be greater than ' + floorPr;
}
else if (sPrice2 > parseFloat(CapPr)) {
bValidEntry = false;
strMessage = strMessage + '
Price 2(Rs.) Per share should be less than ' + CapPr;
}
if (sPrice2 > 0 && (sPrice2 * 100) % parseFloat(TickPrice * 100) != 0) {
bValidEntry = false;
strMessage = strMessage + '
Price 2(Rs.) should be in mulitiples of Tick size ' + TickPrice;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "") {
var sPrice3 = parseFloat(eID('txtPrice3').value);
if (sPrice3 < parseFloat(floorPr) && !bPartialBid) {
bValidEntry = false;
strMessage = strMessage + '
Price 3(Rs.) Per share should be greater than ' + floorPr;
}
else if (sPrice3 > parseFloat(CapPr)) {
bValidEntry = false;
strMessage = strMessage + '
Price 3(Rs.) Per share should be less than ' + CapPr;
}
if (sPrice3 > 0 && (sPrice3 * 100) % parseFloat(TickPrice * 100) != 0) {
bValidEntry = false;
strMessage = strMessage + '
Price 3(Rs.) should be in mulitiples of Tick size ' + TickPrice;
}
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value == "" && parseFloat(eID('txtQty2').value) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Please enter data for Price2';
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value == "" && parseFloat(eID('txtQty3').value) > 0) {
bValidEntry = false;
strMessage = strMessage + '
Please enter data for Price3';
}
if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 1) {
// Amount = eID('txtQty1').value * eID('txtPrice1').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt1')).text());
RetailAmount = parseFloat(RetailAmount);
if (Amount > RetailAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount1 should be less than ' + RetailAmount;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
//Amount = eID('txtQty2').value * eID('txtPrice2').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt2')).text());
if (Amount > RetailAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount2 should be less than ' + RetailAmount;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
//Amount = eID('txtQty3').value * eID('txtPrice3').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt3')).text());
if (Amount > RetailAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount3 should be less than ' + RetailAmount;
}
}
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 2) {
//Amount = eID('txtQty1').value * eID('txtPrice1').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt1')).text());
NIBAmount = parseFloat(NIBAmount);
if (Amount < NIBAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount1 should be greater than ' + NIBAmount;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
//Amount = eID('txtQty2').value * eID('txtPrice2').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt2')).text());
if (Amount < NIBAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount2 should be greater than ' + NIBAmount;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
// Amount = eID('txtQty3').value * eID('txtPrice3').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt3')).text());
if (Amount < NIBAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount3 should be greater than ' + NIBAmount;
}
}
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 3) {
//Amount = eID('txtQty1').value * eID('txtPrice1').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt1')).text());
QIBAmount = parseFloat(QIBAmount);
if (Amount < QIBAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount1 should be greater than ' + QIBAmount;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
// Amount = eID('txtQty2').value * eID('txtPrice2').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt2')).text());
if (Amount < QIBAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount2 should be greater than ' + QIBAmount;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
// Amount = eID('txtQty3').value * eID('txtPrice3').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt3')).text());
if (Amount < QIBAmount) {
bValidEntry = false;
bValidAmount = false;
strMessage = strMessage + '
Payable Amount3 should be greater than ' + QIBAmount;
}
}
}
else if(eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 4)
{
// Amount = eID('txtQty1').value * eID('txtPrice1').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt1')).text());
EMPAmount = parseFloat(EMPAmount);
if(Amount > EMPAmount)
{
bValidEntry = false;
strMessage = strMessage + '
Payable Amount1 should be less than ' + EMPAmount;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
// Amount = eID('txtQty2').value * eID('txtPrice2').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt2')).text());
if (Amount > EMPAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount2 should be less than ' + EMPAmount;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
// Amount = eID('txtQty3').value * eID('txtPrice3').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt3')).text());
if (Amount > EMPAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount3 should be less than ' + EMPAmount;
}
}
}
else if (eID('ddlIPOCategory').options[eID('ddlIPOCategory').selectedIndex].value == 99) {
// Amount = eID('txtQty1').value * eID('txtPrice1').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt1')).text());
NonCustMaxAmount = parseFloat(NonCustMaxAmount);
if (Amount > NonCustMaxAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount1 should be less than ' + NonCustMaxAmount;
}
if (eID('txtQty2').value != "" && eID('txtPrice2').value != "" && parseFloat(eID('txtPrice2').value) > 0) {
// Amount = eID('txtQty2').value * eID('txtPrice2').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt2')).text());
if (Amount > NonCustMaxAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount2 should be less than ' + NonCustMaxAmount;
}
}
if (eID('txtQty3').value != "" && eID('txtPrice3').value != "" && parseFloat(eID('txtPrice3').value) > 0) {
// Amount = eID('txtQty3').value * eID('txtPrice3').value * $lblMktLot.text();
Amount = parseFloat($(eID('txtPayableAmt3')).text());
if (Amount > NonCustMaxAmount) {
bValidEntry = false;
strMessage = strMessage + '
Payable Amount3 should be less than ' + NonCustMaxAmount;
}
}
}
}
}
if (bValidEntry == false) {
showModalPopup("IPO Transaction", strMessage, window, false);
}
return bValidEntry;
}
function ValdateChequeDetails() {
var bValidCheque = true;
var strMessage = "";
if (ADMIN_USER) {
if (eID('txtChequeNo').value == "") {
bValidCheque = false;
strMessage = "
Please enter Cheque No";
}
// if(!eID('chkWalkinClient').checked)
// {
if (eID('txtChequeDate_txtDate').value == "") {
bValidCheque = false;
strMessage = strMessage + "
Please enter Cheque Date";
}
else {
if (CompareDate(eID('txtChequeDate_txtDate').value, '>', eID('lblEndDate').innerHTML)) {
bValidCheque = false;
strMessage = strMessage + "
Cheque Date cannot be greater than IPO End Date";
}
}
if (eID('ddlBank').options[eID('ddlBank').selectedIndex].value == "-1") {
bValidCheque = false;
strMessage = strMessage + "
Please select cheque drawn bank";
}
// }
if (bValidCheque == false) {
showModalPopup("IPO Transaction", strMessage, window, false);
}
}
return bValidCheque;
}
function ValidateManualUserDetails() {
var bValid = true;
if (ADMIN_USER) {
var strMessage = "";
//Validation for walk in client
if (eID('chkWalkinClient').checked) {
if (eID('DPSearchUC_txtDPAuto').value == "") {
bValidUser = false;
strMessage += "" + "Please enter DP Id";
}
else if (eID('DPSearchUC_txtDPAuto').value.indexOf('-') == -1) {
bValidUser = false;
strMessage += "" + "Please enter valid DP Id";
}
if (eID('txtBeneficiaryId').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter Beneficiary Id";
}
else if ((eID('DPSearchUC_txtDPAuto').value.indexOf("IN") == 0 && eID('txtBeneficiaryId').value.length != 8)
|| (eID('DPSearchUC_txtDPAuto').value.indexOf("IN") != 0 && eID('txtBeneficiaryId').value.length != 16) //for NSDL
|| (eID('DPSearchUC_txtDPAuto').value.indexOf("IN") != 0 && eID('txtBeneficiaryId').value.length == 16 && eID('txtBeneficiaryId').value.indexOf(eID('DPSearchUC_txtDPAuto').value.substring(0,8)) != 0 ))
{
bValid = false;
strMessage = strMessage + "
Please enter correct Beneficiary Id";
}
if (eID('txtPanNo').value == "") {
bValid = false;
strMessage = strMessage + "
Please enter PanNo";
}
else if (eID('txtPanNo').value.length != 10) {
bValid = false;
strMessage = strMessage + "
Please enter correct PanNo";
}
if (typeof (revPanNo) != 'undefined' && revPanNo != null) {
if (typeof (revPanNo.isvalid) != 'undefined') {
if (!revPanNo.isvalid) {
bValid = false;
strMessage += '
' + revPanNo.errormessage;
}
}
}
}
if (bValid == false) {
showModalPopup("IPO Transaction", strMessage, window, false);
}
}
return bValid;
}
function ValidateBidEntry() {
try {
var bValidBid = true;
var sBidMode = eID('hdnBidMode').value;
if (sBidMode == '1') {
bValidBid = ValidateUserDetails();
}
else if (sBidMode == '2') {
if (ADMIN_USER && eID('chkWalkinClient').checked) {
bValidBid = ValidateManualUserDetails();
}
}
if (bValidBid) {
bValidBid = ValidateBidDetails();
if (bValidBid) {
if ($('#rblPaymentMode input[type="radio"]:checked').val() == C_V_PAYMENT_CHEQUE) {
bValidBid = ValdateChequeDetails();
}
else if ($('#rblPaymentMode input[type="radio"]:checked').val() == C_V_PAYMENT_ASBA) {
bValidBid = ValdateASBADetails();
}
if (bValidBid) {
if (ADMIN_USER) {
if (eID('chkWalkinClient').checked) {
if (eID('txtApplicationNo').value == "") {
bValidBid = false;
showModalPopup("IPO Transaction", 'Please enter Application No', window, false);
}
}
else if (eID('chkExternalApp').checked) {
if (eID('txtApplicationNo').value == "") {
bValidBid = false;
showModalPopup("IPO Transaction", 'Please enter Application No', window, false);
}
}
}
if (bValidBid && !eID('chkAgree').checked) {
bValidBid = false;
showModalPopup("IPO Transaction", 'Click on I Agree to accept the terms and conditions before placing the bid', window, false);
}
}
}
}
else {
bValidBid = false;
}
}
catch (e) {
bValidBid = false;
}
return bValidBid;
}
function BestBidQty(qty1, pr1, qty2, pr2, qty3, pr3) {
qty1 = parseFloat(qty1);
pr1 = parseFloat(pr1);
qty2 = parseFloat(qty2);
pr2 = parseFloat(pr2);
qty3 = parseFloat(qty3);
pr3 = parseFloat(pr3);
if (isNaN(parseFloat(qty1)))
qty1 = 0;
if (isNaN(parseFloat(qty2)))
qty2 = 0;
if (isNaN(parseFloat(qty3)))
qty3 = 0;
var maxQty = 0;
maxQty = qty1 > qty2 ? (qty1 > qty3 ? qty1 : qty3) : (qty2 > qty3 ? qty2 : qty3);
return maxQty;
}
//function BeneficiaryIDChanged()
//{
// var sBeneficiaryId = eID('ddlBeneficiaryId').options[eID('ddlBeneficiaryId').selectedIndex].value;
// if((sBeneficiaryId != 'Select')&&(sBeneficiaryId != '-100'))
// {
// eID('ddlDPId').selectedIndex = eID('ddlBeneficiaryId').selectedIndex;
// eID('txtDPId').value = eID('ddlDPId').options[eID('ddlDPId').selectedIndex].text;
// }
// if(sBeneficiaryId == '-100')
// {
// eID('ddlDPId').selectedIndex = eID('ddlBeneficiaryId').selectedIndex;
// eID('txtDPId').value = '';
// eID('ddlBeneficiaryId').style.display = "none";
// eID('txtSearchBeneficiaryId').style.display = "";
// }
//}
function OpenIPOTnC() {
window.open(C_S_IPO_TERMS_CONDITION_URL, "", "toolbar=no, menubar=no, location=no, scrollbars=yes, directories=no, width=670, height=390, left=190, resizable=yes, top=100");
}
function HideIPODiv() {
ShowIPODetails('1');
var modalPopupBehavior = $find('mpeIPO');
modalPopupBehavior.hide();
return false;
}
function ValidateCalcLotsDetails() {
var strMessage = "";
var bValidEntry = true;
try {
var TickPrice = $(eID('lblTickSize')).text();
if (eID('txtCalcPrice').value != 'Non-Disclosed' && eID('txtCalcPrice').value != '')
var sPrice1 = parseFloat(eID('txtCalcPrice').value);
else
var sPrice1 = 999998.00;
var floorPr = $(eID('lblFloorPrice')).text();
if (floorPr == 'Non-Disclosed')
floorPr = $(eID('lblTickSize')).text();
var CapPr = $(eID('lblCapPrice')).text();
if (CapPr == 'Non-Disclosed')
CapPr = 999998.00;
var InvstAmt = eID('txtInvstAmt').value;
if (InvstAmt == "") {
bValidEntry = false;
strMessage = '
Please enter Investment Amount for calculating lots.';
}
if (eID('txtCalcPrice').value == "") {
bValidEntry = false;
strMessage = strMessage + '
Please enter Price for calculating lots.';
}
if (eID('txtCalcPrice').value != "") {
if (sPrice1 < parseFloat(floorPr)) {
bValidEntry = false;
strMessage = strMessage + '
Price should be greater than or equal to Floor Price ' + floorPr;
}
else if (sPrice1 > parseFloat(CapPr)) {
bValidEntry = false;
strMessage = strMessage + '
Price should be less than or equal to Cap Price ' + CapPr;
}
if (sPrice1 > 0 && (sPrice1 * 100) % parseFloat(TickPrice * 100) != 0) {
bValidEntry = false;
strMessage = strMessage + '
Price should be in mulitiples of Tick size ' + TickPrice;
}
}
if (strMessage != "") {
showModalPopup("IPO Transaction", strMessage, window, false);
}
}
catch (e) {
alert(e.message);
}
if (!bValidEntry) {
$(eID('lblResutLots')).text('');
}
//if (bValidEntry)
// CalculateInvestmentLots()
return bValidEntry;
}
function CalculateInvestmentLots() {
try {
$(eID('lblResutLots')).text("");
var dblCalcLots = 0;
var intResult = 0;
var dblMktLotQty = parseFloat($(eID('lblMktLot')).text());
var dblCalcPrice = parseFloat(eID('txtCalcPrice').value);
var intInvstAmt = parseFloat(eID('txtInvstAmt').value);
dblCalcLots = dblMktLotQty * dblCalcPrice;
intResult = parseFloat(intInvstAmt / dblCalcLots);
$(eID('lblResutLots')).text(parseInt(intResult));
eID('txtInvstAmt').value = parseFloat(parseInt(intResult) * dblCalcLots);
}
catch (e) {
$(eID('lblResutLots')).text('');
alert(e.message);
}
}
function IPOCategoryChanged() {
eID('txtQty1').value = '';
eID('txtQty2').value = '';
eID('txtQty3').value = '';
$(eID('txtQuantity1')).text('');
$(eID('txtQuantity2')).text('');
$(eID('txtQuantity3')).text('');
$(eID('txtAmt1')).text('');
$(eID('txtAmt2')).text('');
$(eID('txtAmt3')).text('');
eID('hdnMaxBidValue').Value = "0.00";
$(eID('lblMarginPay')).text('');
$(eID('lblBestBidAmt')).text('');
// $(eID('txtPrice1')).text('');
// $(eID('txtPrice2')).text('');
// $(eID('txtPrice3')).text('');
}
function InstrTypeChange() {
if (eID('ddlInstrumentType').options[eID('ddlInstrumentType').selectedIndex].value == 1) {
eID('lblIPOType').style.display = "none";
eID('ddlIPOType').style.display = "none";
$(eID('lblIPOName')).text('Bond Name');
$(eID('lblIPOCode')).text('Bond Code');
$(eID('btnAdd')).text('Add Bond');
}
else {
eID('lblIPOType').style.display = "block";
eID('ddlIPOType').style.display = "block";
$(eID('lblIPOName')).text('IPO Name');
$(eID('lblIPOCode')).text('IPO Code');
$(eID('btnAdd')).text('Add IPO');
}
}
function ValidateSearchDetails() {
if (eID('hdSearch').value == "P") {
if (eID('txtSearchText').value == "") {
showModalPopup("IPO Transaction", 'Please enter PAN No', null);
eID('txtSearchText').focus();
return false;
}
else {
// var sRegex =/(?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{10})$/;
var sRegex = /[A-Za-z]{5}\d{4}[A-Za-z]{1}/;
if (!sRegex.test(eID('txtSearchText').value)) {
showModalPopup("IPO Transaction", 'Kindly enter valid Pan number', null);
eID('txtSearchText').focus();
return false;
}
}
}
if (eID('hdSearch').value == "B") {
if (eID('txtSearchText').value == "") {
showModalPopup("IPO Transaction", 'Please enter Beneficiary Id', null);
eID('txtSearchText').focus();
return false;
}
else
if ((eID('txtSearchText').value.length != 16) && (eID('txtSearchText').value.length != 8)) {
showModalPopup("IPO Transaction", 'Please enter correct Beneficiary Id', null);
eID('txtSearchText').focus();
return false;
}
}
return true;
}
function fnEnableMode()
{
try
{
if (eID('ddlImportType').options[eID('ddlImportType').selectedIndex].value == "0") //Registered Client
{
eID('ddlPaymentMode').disabled = false;
// eID('ddlPaymentMode').options[eID('ddlPaymentMode').selectedIndex].value = 2;
eID('ddlPaymentMode').selectedIndex = 0;
}
else
{
//eID('ddlPaymentMode').options[eID('ddlPaymentMode').selectedIndex].value = 2;
eID('ddlPaymentMode').selectedIndex = 0;
eID('ddlPaymentMode').disabled = true;
}
}
catch (e)
{
alert('Error occured in function fnEnableMode');
}
return true;
}
function Upload()
{
try
{
document.getElementById('ctl00_C1_spLoader1').className = "txtbd";
return true;
}
catch (e)
{ }
}
//iVal --> 1 for Submit
//iVal --> 2 for Delete
function SubmitBlkOE(iVal) {
try {
var obj, ochkElement;
oTable = document.getElementById(C_S_BLKOE_GRIDID);
var bCheck = false;
if (window.opener)
obj = window.opener;
else
obj = window.parent;
for (i = 1; i < oTable.rows.length; i++)//Modified for cross browser compatibility
{
//Multiplication factor 2 is used since we have delete image button which also
//accounts for input tag
ochkElement = oTable.getElementsByTagName("INPUT")[i];
if (ochkElement.checked) {
bCheck = true;
break;
}
}
if (bCheck) {
if (iVal == 1) //Case for Submit
{
if (confirm("Do you want to place the selected orders ?")) {
document.getElementById('ctl00_C1_btnSubmitSelected').style.display = "none";
document.getElementById('ctl00_C1_imgLoader').className = "txtbd";
}
else {
return false;
}
}
else //Case for Delete
{
if (confirm("Do you want to delete the selected orders ?")) {
document.getElementById('ctl00_C1_btnDelete').style.display = "none";
document.getElementById('ctl00_C1_imgLoader').className = "txtbd";
}
else {
return false;
}
}
return true;
}
else {
if (iVal == 1)
showModalPopup('IPOBulkOrderEntry', 'Kindly select orders to be submitted', null);
else
showModalPopup('IPOBulkOrderEntry', 'Kindly select orders to be deleted', null);
return false;
}
}
catch (e) {
showModalPopup('IPOBulkOrderEntry', 'Error occured in function SubmitBlkOE:\n\n' + e.message, null);
}
}
// Checks all the checkboxes of the grid which are enabled for cancelling the orders
function SelectCancelOrders() {
try {
var obj, ochkElement;
var bNewStatus = false;
oTable = document.getElementById(C_S_BLKOE_GRIDID);
bNewStatus = document.getElementById('ctl00_C1_FTReportGridUC1_ctl01_chkSelectAll').checked;
for (i = 1; i < oTable.rows.length; i++)//Modified for cross browser compatibility
{
ochkElement = oTable.getElementsByTagName("INPUT")[i]; //Modified for cross browser compatibility
if (ochkElement.disabled == false)
ochkElement.checked = bNewStatus;
}
}
catch (e) {
showModalPopup('IPOBulkOrderEntry', 'Error occured in function SelectCancelOrders:\n\n' + e.message, null);
}
}
function HideDuplicatePANPanel() {
var modalPopupBehavior = $find('mpeDuplicatePAN');
modalPopupBehavior.hide();
return false;
}
function DisableIssueType() {
if (eID('ddlOfferType').selectedIndex == 3) {
eID('ddlIPOType').disabled = true;
eID('ddlIPOType').selectedIndex = 0;
}
else
eID('ddlIPOType').disabled = false;
}
function OpenPanURL(strURL) {
try {
window.open(strURL, 'PAN', "toolbar=no, menubar=no, location=no, scrollbars=yes, directories=no, width=800, height=535, left=190, resizable=yes, top=160");
}
catch (e)
{ }
}
function ValdateASBADetails() {
var bValidASBA = true;
var strMessage = "";
if (eID('ddlASBALocation').selectedIndex == 0) {
bValidASBA = false;
strMessage = "
Please select ASBA Location";
}
if (eID('ddlASBABank').selectedIndex == 0) {
bValidASBA = false;
strMessage = strMessage + "
Please enter ASBA Bank"
}
if (Trim(eID('txtASBAAccountNo').value) == '') {
bValidASBA = false;
strMessage = strMessage + "
Please enter Account Number"
}
if (bValidASBA == false) {
showModalPopup("IPO Transaction", strMessage, window, false);
}
return bValidASBA;
}