// JScript File
function eID(cltId)
{
return document.getElementById("ctl00_C1_" + cltId);
}
function ValidateIPOMaster(source, arguments)
{
try
{
var sErrorMessage = "";
//debugger;
// alert('IPO type ' + eOEID('ddlIPOType').selectedIndex);
// alert('Registrar ' + eOEID('ddlRegistrar').selectedIndex);
if (eID('txtIPOCode').value == "")
sErrorMessage += '
' + 'Please enter IPO Code';
if (eID('txtIPOName').value == "")
sErrorMessage += '
' + 'Please enter IPO Name';
if (eID('txtFaceVal').value == "")
sErrorMessage += '
' + 'Please enter Face Value';
//if (eID('txtFloorPrice').value == "")
// sErrorMessage += '
' + 'Please enter Floor price';
if (eID('txtCapPrice').value == "")
sErrorMessage += '
' + 'Please enter Cap Price';
if (eID('txtTickSize').value == "")
sErrorMessage += '
' + 'Please enter Tick Size';
if (eID('txtRegLot').value == "")
sErrorMessage += '
' + 'Please enter Market Lot Quantity';
if (eID('txtMinLotQty').value == "")
sErrorMessage += '
' + 'Please enter Minimum Lot Quantity';
if(eID('gvExchgeCode_ctl02_txtExchCode').value.length == 0 && eID('gvExchgeCode_ctl03_txtExchCode').value.length == 0)
sErrorMessage += '
' + 'Please enter either NSE / BSE exchange code';
if(eID('txtStartDate_txtDate').value == "")
sErrorMessage += '
' + 'Please enter Start Date';
if(eID('txtEndDate_txtDate').value == "")
sErrorMessage += '
' + 'Please enter End Date';
if(eID('tpStartTime_ddlHrs').value == "00" && eID('tpStartTime_ddlMins').value == "00")
sErrorMessage += '
' + 'Please select Start Time';
if(eID('tpEndTime_ddlHrs').value == "00" && eID('tpEndTime_ddlMins').value == "00")
sErrorMessage += '
' + 'Please select End Time';
if(parseFloat(eID('txtFloorPrice').value) == parseFloat(0))
sErrorMessage += '
' + 'Floor price cannot be equal to 0';
if(parseFloat(eID('txtCapPrice').value) == parseFloat(0))
sErrorMessage += '
' + 'Cap price cannot be equal to 0';
if(eID('txtFloorPrice').value.length > 0 && eID('txtCapPrice').value.length > 0)
{
if(parseFloat(eID('txtFloorPrice').value) > parseFloat(eID('txtCapPrice').value))
sErrorMessage += '
' + 'Cap price cannot be less than Floor price';
}
if(parseFloat(eID('txtFloorPrice').value) < parseFloat(0))
sErrorMessage += '
' + 'Floor price cannot be less than 0';
if(parseFloat(eID('txtCapPrice').value) < parseFloat(0))
sErrorMessage += '
' + 'Cap price cannot be less than 0';
if(eID('txtFloorPrice').value.length > 0 && eID('txtTickSize').value.length > 0)
{
if(parseFloat(ConvertToPaise(eID('txtFloorPrice').value)) % parseFloat(ConvertToPaise(eID('txtTickSize').value)) != parseFloat(0))
sErrorMessage += '
' + 'Floor price is not in multiples of Tick size';
}
if(eID('txtCapPrice').value.length > 0 && eID('txtTickSize').value.length > 0)
{
if(parseFloat(ConvertToPaise(eID('txtCapPrice').value)) % parseFloat(ConvertToPaise(eID('txtTickSize').value)) != parseFloat(0))
sErrorMessage += '
' + 'Cap price is not in multiples of Tick size';
}
if(eID('txtCapPrice').value.length > 0 && eID('txtTotalPubIssue').value.length > 0)
{
if(parseFloat(eID('txtCapPrice').value) > parseFloat(eID('txtTotalPubIssue').value))
sErrorMessage += '
' + 'Cap price cannot be greater than Total Public Issue amount';
}
if(eID('txtTickSize').value.length > 0)
{
if(parseFloat(eID('txtTickSize').value) == parseFloat(0))
sErrorMessage += '
' + 'Tick size cannot be equal to 0';
}
if(eID('txtRegLot').value.length > 0)
{
if(parseFloat(eID('txtRegLot').value) == parseFloat(0))
sErrorMessage += '
' + 'Market Lot Qty cannot be equal to 0';
}
if(eID('txtMinLotQty').value.length > 0)
{
if(parseFloat(eID('txtMinLotQty').value) == parseFloat(0))
sErrorMessage += '
' + 'Minimum Lots cannot be equal to 0';
}
if(eID('chkPartialPrice').checked == true)
{
if(eID('txtPartialPrice').value.length > 0 && eID('txtCapPrice').value.length > 0)
{
if(parseFloat(eID('txtPartialPrice').value) > parseFloat(eID('txtCapPrice').value))
sErrorMessage += '
' + 'Please enter Partial price less than Cap price';
}
}
if(eID('txtTotalQty').value.length > 0)
{
if(parseFloat(eID('txtTotalQty').value) == parseFloat(0))
sErrorMessage += '
' + 'Total Issue qty cannot be equal to 0';
}
if(eID('txtRegLot').value.length > 0 && eID('txtTotalQty').value.length > 0)
{
if(parseFloat(eID('txtRegLot').value) >= parseFloat(eID('txtTotalQty').value))
sErrorMessage += '
' + 'Market lot quantity cannot be equal to or greater than total issue quantity';
}
if(eID('ddlIPOType').selectedIndex == 0)
sErrorMessage += '
' + 'Please select IPO type';
if(eID('ddlIPOType').selectedIndex == 2)
{
if(parseFloat(eID('txtFloorPrice').value) != parseFloat(eID('txtCapPrice').value))
sErrorMessage += '
' + 'Floor Price and Cap Price should be same for Fixed IPO type';
}
//debugger;
//alert(eID('vsIPOMaster').text());
if(sErrorMessage.length > 0)
{
//remove 1st
//source.errormessage = sErrorMessage.substring(9);
showModalPopup('NetNetAdmin',sErrorMessage,window,false);
arguments.IsValid = false;
}
}
catch(e)
{
// alert('validation' + e.message);
}
}
//Function to convert price in Paise
function ConvertToPaise(strPrice)
{
try
{
if (strPrice == "") return "0";
var strOutput = 0;
strOutput = parseFloat(parseFloat(strPrice) * 100);
strOutput=Math.round(strOutput);
return strOutput;
}
catch(e)
{
return "0";
}
}
function EnablePartialPrice()
{
try
{
if(eID('chkPartialPrice').checked == true)
{
eID('txtPartialPrice').disabled = false;
}
else
{
eID('txtPartialPrice').value = '';
eID('txtPartialPrice').disabled = true;
}
return true;
}
catch(e)
{
// alert('EnablePartialPrice ' + e.message);
}
}
function SelectBank()
{
try
{
if(eID('ddlBankName').selectedIndex == 0)
{
showModalPopup("IPO Master",'Please select Bank Name',null);
return false;
}
else
return true;
}
catch(e)
{
//alert('SelectBank' + e.message);
}
}
function AddApplnNo()
{
try
{
eID('lblResponse').innerText = "";
var sRegexClientId = /^([0-9 ]+)$/;
if(eID('txtApplNoFrm').value.length == 0 && eID('txtApplNoTo').value.length == 0)
{
showModalPopup("IPO Master",'Please enter From and To range', null);
return false;
}
if(eID('txtApplNoFrm').value.length > 0 && eID('txtApplNoTo').value.length == 0)
{
showModalPopup("IPO Master",'Please enter To range',null);
return false;
}
if(eID('txtApplNoFrm').value.length == 0 && eID('txtApplNoTo').value.length > 0)
{
showModalPopup("IPO Master",'Please enter From range',null);
return false;
}
if((eID('txtApplNoFrm').value != '') &&(sRegexClientId.test(eID('txtApplNoFrm').value) == false))
{
showModalPopup("IPO Master",'Please enter From Application Number in numeric only (non negative)',null);
eID('txtApplNoFrm').focus();
return false;
}
if((eID('txtApplNoTo').value != '') &&(sRegexClientId.test(eID('txtApplNoTo').value) == false))
{
showModalPopup("IPO Master",'Please enter To Application Number in numeric only (non negative)',null);
eID('txtApplNoFrm').focus();
return false;
}
if(parseFloat(eID('txtApplNoFrm').value) > parseFloat(eID('txtApplNoTo').value))
{
showModalPopup("IPO Master",'Please enter From ApplicationNo less than To Applictaion No',null);
eID('txtApplNoFrm').focus();
return false;
}
else
{
return true;
}
}
catch(e)
{
//alert('AddApplnNo' + e.message);
}
}
function AddChequeinFavour()
{
try
{
eID('lblResponse').innerText = "";
if(eID('txtInFavorOf').value.length == 0)
{
showModalPopup("IPO Master",'Please fill in favour of field',null);
return false;
}
else
return true;
}
catch(e)
{
//alert('AddChequeinFavour' + e.message);
}
}
function SelectItem()
{
try
{
eID('lblResponse').innerText = "";
if(eID('lstInFavorOf').selectedIndex == -1)
{
showModalPopup("IPO Master",'Please select item from the list to be removed',null);
return false;
}
else
return true;
}
catch(e)
{}
}
function SelectItemtoDeleteEdit(sValue)
{
try
{
eID('lblResponse').innerText = "";
if(eID('AppFrmListBox').selectedIndex == -1)
{
if(sValue == 1)
{
showModalPopup("IPO Master",'Please select item from the list to be edited',null);
return false;
}
else
{
showModalPopup("IPO Master",'Please select item from the list to be deleted',null);
return false;
}
}
else
return true;
}
catch(e)
{}
}
function CalculateTotalPubIssue()
{
try
{
var strQty = eID("txtTotalQty").value;
var strFaceVal = eID("txtFaceVal").value;
var txtTotalPubIssue = eID("txtTotalPubIssue");
if (strQty!="" && strFaceVal!="")
{
if(!(isNaN(strQty) && isNaN(strFaceVal)))
{
var strTotal = parseFloat(strQty) * parseFloat(strFaceVal * 100);
txtTotalPubIssue.value= strTotal / 100;
if(txtTotalPubIssue.value == "0" || txtTotalPubIssue.value == "NaN")
{
txtTotalPubIssue.value = "";
}
if(txtTotalPubIssue.value.indexOf('.') == -1)
{
txtTotalPubIssue.value = txtTotalPubIssue.value+".00";
}
}
else
{
txtTotalPubIssue.value="";
}
}
else
{
txtTotalPubIssue.value="";
}
}
catch(e)
{}
}
//CR966
function funEnableDisablebtn() {
try {
if (eID("rbAppSeries_0").checked == true) {
eID("txtApplNoFrm").disabled = false;
eID("txtApplNoTo").disabled = false;
eID("txtApplNoFrm").value = "";
eID("txtApplNoTo").value = "";
eID("ddlUsability").disabled = false;
eID("btnAddApplNo").disabled = false;
eID("btnEditApplNo").disabled = false;
eID("AppFrmListBox").disabled = false;
eID("AppFrmListBox").options.length = 0;
eID("btnDeleteApplnNo").disabled = false;
// eID("dvApplnNo").style.display = '';
return true;
} else {
//txtApplNoFrm/txtApplNoTo/ddlUsability/btnAddApplNo/btnEditApplNo/AppFrmListBox/btnDeleteApplnNo
eID("txtApplNoFrm").disabled = true;
eID("txtApplNoTo").disabled = true;
eID("ddlUsability").disabled = true;
eID("btnAddApplNo").disabled = true;
eID("btnEditApplNo").disabled = true;
eID("AppFrmListBox").disabled = true;
eID("btnDeleteApplnNo").disabled = true;
eID("txtApplNoFrm").value = "";
eID("txtApplNoTo").value = "";
eID("AppFrmListBox").options.length = 0;
// eID("dvApplnNo").style.display = 'none';
return true;
}
}
catch (e) {
}
}