Commit ad29303f authored by wansari's avatar wansari

D14IKAT004 updated method calQuantity


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97423 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6f91acec
...@@ -15,7 +15,7 @@ function callpop(x) ...@@ -15,7 +15,7 @@ function callpop(x)
//this function is used to set the value in text field in wizard after selecting checkbox from pop help //this function is used to set the value in text field in wizard after selecting checkbox from pop help
function selectCheckbox() function selectCheckbox()
{ {
var supp_code=""; var supp_code="";
var det=""; var det="";
var extra=""; var extra="";
...@@ -23,6 +23,11 @@ function selectCheckbox() ...@@ -23,6 +23,11 @@ function selectCheckbox()
var otherField1 = ""; var otherField1 = "";
var otherField2 = ""; var otherField2 = "";
var otherField3 = ""; var otherField3 = "";
var otherField4 = "";
var otherField5 = "";
var stdExrt = "";
var exchRateBuy = "";
var descr1 = ""; var descr1 = "";
var descr2 = ""; var descr2 = "";
...@@ -43,6 +48,8 @@ function selectCheckbox() ...@@ -43,6 +48,8 @@ function selectCheckbox()
otherField1=otherField1+document.getElementById("DetailITCode."+ i +".otherField1").value; otherField1=otherField1+document.getElementById("DetailITCode."+ i +".otherField1").value;
otherField2=otherField2+document.getElementById("DetailITCode."+ i +".otherField2").value; otherField2=otherField2+document.getElementById("DetailITCode."+ i +".otherField2").value;
otherField3=otherField3+document.getElementById("DetailITCode."+ i +".otherField3").value; otherField3=otherField3+document.getElementById("DetailITCode."+ i +".otherField3").value;
otherField4=otherField4+document.getElementById("DetailITCode."+ i +".otherField4").value;
otherField5=otherField5+document.getElementById("DetailITCode."+ i +".otherField5").value;
descr1=descr1+document.getElementById("DetailITCode."+ i +".descr1").value; descr1=descr1+document.getElementById("DetailITCode."+ i +".descr1").value;
} }
...@@ -60,8 +67,10 @@ function selectCheckbox() ...@@ -60,8 +67,10 @@ function selectCheckbox()
window.opener.document.getElementById("crterm").value=otherField1; window.opener.document.getElementById("crterm").value=otherField1;
window.opener.document.getElementById("prlist").value=otherField2; window.opener.document.getElementById("prlist").value=otherField2;
window.opener.document.getElementById("dlvterm").value=otherField3; window.opener.document.getElementById("dlvterm").value=otherField3;
window.opener.document.getElementById("curr_code").value=otherField4;
window.opener.document.getElementById("exch_rate").value=otherField5;
window.opener.document.getElementById("crdescr").value=descr1; window.opener.document.getElementById("crdescr").value=descr1;
window.close(); window.close();
} }
...@@ -267,10 +276,100 @@ function selectCheckbox() ...@@ -267,10 +276,100 @@ function selectCheckbox()
{ {
window.opener.document.getElementById("site_code").value=supp_code; window.opener.document.getElementById("site_code").value=supp_code;
window.opener.document.getElementById("sitedescr").value=det; window.opener.document.getElementById("sitedescr").value=det;
window.close();
}
}
else if(field=="site_code__dlv")
{
for (var i = 1; i<=Wizard_SuppDetails.selectbox.length; i++)
{
//i=i+1;
if (Wizard_SuppDetails.selectbox[i-1].checked)
{
supp_code=supp_code+document.getElementById("DetailITCode."+ i +".fieldId").value;
det=det+document.getElementById("DetailITCode."+ i +".fieldValue").value;
}
}
if(supp_code=="")
{
alert('No Selection Made ! \nPlease Select the Code !');
}
else
{
window.opener.document.getElementById("site_code__dlv").value=supp_code;
window.opener.document.getElementById("dlvDescr").value=det;
window.close();
}
}
else if(field=="term_table")
{
if(Wizard_SuppDetails.selectbox.length==undefined ) //this is for if only one checkbox
{
if(Wizard_SuppDetails.selectbox.checked)
{
supp_code=supp_code+document.getElementById("DetailITCode.1.fieldId").value;
}
}
else
{
for (var i = 1; i<=Wizard_SuppDetails.selectbox.length; i++)
{
//i=i+1;
if (Wizard_SuppDetails.selectbox[i-1].checked)
{
supp_code=supp_code+document.getElementById("DetailITCode."+ i +".fieldId").value;
det=det+document.getElementById("DetailITCode."+ i +".fieldValue").value;
}
}
}
if(supp_code=="")
{
alert('No Selection Made ! \nPlease Select the Code !');
}
else
{
window.opener.document.getElementById("term_table").value=supp_code;
//window.opener.document.getElementById("dlvDescr").value=det;
window.close();
}
}
else if(field=="curr_code")
{
for (var i = 1; i<=Wizard_SuppDetails.selectbox.length; i++)
{
//i=i+1;
if (Wizard_SuppDetails.selectbox[i-1].checked)
{
supp_code=supp_code+document.getElementById("DetailITCode."+ i +".fieldId").value;
det=det+document.getElementById("DetailITCode."+ i +".fieldValue").value;
stdExrt=stdExrt+document.getElementById("DetailITCode."+ i +".otherField").value;
exchRateBuy=exchRateBuy+document.getElementById("DetailITCode."+ i +".otherField1").value;
}
}
if(supp_code=="")
{
alert('No Selection Made ! \nPlease Select the Code !');
}
else
{
window.opener.document.getElementById("curr_code").value=supp_code;
if(exchRateBuy == "" || exchRateBuy == null)
{
window.opener.document.getElementById("exch_rate").value = stdExrt;
}
else
{
window.opener.document.getElementById("exch_rate").value = exchRateBuy;
}
window.close(); window.close();
} }
} }
} }
//this function used to tick on only one checkbox at a time //this function used to tick on only one checkbox at a time
function checkone(id) function checkone(id)
{ {
...@@ -337,8 +436,8 @@ function sidebar() ...@@ -337,8 +436,8 @@ function sidebar()
var a="<h3 onclick='run("+x+")' style='font-family: Arial Unicode MS, Arial, sans-serif;'>Product Set"+ var a="<h3 onclick='run("+x+")' style='font-family: Arial Unicode MS, Arial, sans-serif;'>Product Set"+
"<label id='main"+x+"' style='width:500px;background-color: transparent;'></label>"+ "<label id='main"+x+"' style='width:500px;background-color: transparent;'></label>"+
"Total Quantity<label id='display."+x+"' style='background-color: transparent;'></label>"+
"</h3>"+ "</h3>"+
"<div style='padding: 0.8em 0.8em;' >"+ "<div style='padding: 0.8em 0.8em;' >"+
"<div id='suppDtlDiv"+x+"' style='height: 180px; overflow: auto; margin-left: 0px; width:100%;'>"+ "<div id='suppDtlDiv"+x+"' style='height: 180px; overflow: auto; margin-left: 0px; width:100%;'>"+
...@@ -524,6 +623,14 @@ function setColumnValues( retVal ) ...@@ -524,6 +623,14 @@ function setColumnValues( retVal )
{ {
tr = tr + "<td>"+ y[j].childNodes[0].nodeValue +"</td>"; tr = tr + "<td>"+ y[j].childNodes[0].nodeValue +"</td>";
var fld = window.opener.document.getElementById("fld").value;
fld++;
tr = tr + "<input type='hidden' id='Detail2."+fld+".quantity' class='editInputClass' style='width:75px; text-align: right;' />";
window.opener.document.getElementById("fld").value = fld;
temp = temp + fld +",";
count++;
qt++;
} }
else if (j == 0) else if (j == 0)
{ {
...@@ -549,7 +656,7 @@ function setColumnValues( retVal ) ...@@ -549,7 +656,7 @@ function setColumnValues( retVal )
tr = tr + "<input type='hidden' id='Detail2."+fld+".item_code' name='Detail2."+fld+".item_code' value='"+y[j].childNodes[0].nodeValue+"' class='editInputClass' style='width: 60px;text-align: right;' />"; tr = tr + "<input type='hidden' id='Detail2."+fld+".item_code' name='Detail2."+fld+".item_code' value='"+y[j].childNodes[0].nodeValue+"' class='editInputClass' style='width: 60px;text-align: right;' />";
tr = tr + "<input type='hidden' value='"+dte+"' id='Detail2."+fld+".dlv_date' name='Detail2."+fld+".dlv_date' class='editInputClass' style='width: 60px;text-align: right;'/>"; tr = tr + "<input type='hidden' value='"+dte+"' id='Detail2."+fld+".dlv_date' name='Detail2."+fld+".dlv_date' class='editInputClass' style='width: 60px;text-align: right;'/>";
tr = tr + "<input type='hidden' value='"+dte+"' id='Detail2."+fld+".dlv_date' name='Detail2."+fld+".dlv_date' class='editInputClass' style='width: 60px;text-align: right;'/>"; tr = tr + "<input type='hidden' value='"+dte+"' id='Detail2."+fld+".dlv_date' name='Detail2."+fld+".dlv_date' class='editInputClass' style='width: 60px;text-align: right;'/>";
tr = tr + "<td><input type='text' onkeyup='calQuantity(this.id,"+xlen+","+xrows+","+qt+","+fld+")' id='Detail2."+fld+".quantity' name='Detail2."+fld+".quantity' title='"+fld+"' onkeypress='return isNumberKey(event)' placeholder='"+y[j].childNodes[0].nodeValue+"' maxlength='8' ISCHANGED='true' class='editInputClass' style='width:75px; text-align: right;' /></td>"; tr = tr + "<td><input type='text' onkeyup='calQuantity(this.id,"+xlen+","+xrows+","+qt+","+fld+","+t+")' id='Detail2."+fld+".quantity' name='Detail2."+fld+".quantity' title='"+fld+"' onkeypress='return isNumberKey(event)' placeholder='"+y[j].childNodes[0].nodeValue+"' maxlength='4' ISCHANGED='true' class='editInputClass' style='width:75px; text-align: right;' /></td>";
temp = temp + fld +","; temp = temp + fld +",";
count++; count++;
...@@ -575,7 +682,7 @@ function setColumnValues( retVal ) ...@@ -575,7 +682,7 @@ function setColumnValues( retVal )
for (var i = 1; i <=xlen; i++) for (var i = 1; i <=xlen; i++)
{ {
tr = tr + "<td><input type='text' id='tab."+t+".fld."+i+"' title='"+i+"' class='editInputClass' style='width:75px; text-align: right;'/></td>"; tr = tr + "<td><input type='text' id='tab."+t+".fld."+i+"' title='"+i+"' class='editDisplayClass' maxlength='0' ISCHANGED='false' readOnly = '1' style='width:75px; text-align: right;'/></td>";
} }
tr = tr + "</tr>"; tr = tr + "</tr>";
/////////////////////////////////////////////////// ///////////////////////////////////////////////////
...@@ -621,6 +728,8 @@ function setColumnValues( retVal ) ...@@ -621,6 +728,8 @@ function setColumnValues( retVal )
$('#suppDtlDiv'+y, window.opener.document).append(a); $('#suppDtlDiv'+y, window.opener.document).append(a);
$('#itemDtl'+y+' tbody', window.opener.document).append(tr); $('#itemDtl'+y+' tbody', window.opener.document).append(tr);
window.opener.document.getElementById("display."+t+"").innerHTML = "0";
} }
function loadXMLString(txt) function loadXMLString(txt)
...@@ -981,11 +1090,11 @@ function checkRate() ...@@ -981,11 +1090,11 @@ function checkRate()
{ {
for(var i=1;i<=100;i++) for(var i=1;i<=100;i++)
{ {
if(document.getElementById("Detail3."+i+".rate").value == 0) if(document.getElementById("Detail3."+i+".rate").value == 0 || document.getElementById("Detail3."+i+".tot_amt").value == 0)
{ {
if(document.getElementById("Detail3."+i+".selectbox").checked == true) if(document.getElementById("Detail3."+i+".selectbox").checked == true)
{ {
alert("Record "+i+" has 0 rate and amount...! can not save the record."); alert("Record "+i+" has 0 amount...! can not save the record.");
return false; return false;
} }
else else
...@@ -1000,17 +1109,17 @@ function checkRate() ...@@ -1000,17 +1109,17 @@ function checkRate()
} }
} }
function calQuantity(id,cols,row,qt,fld) function calQuantity(id,cols,row,qt,fld,t)
{ {
//alert(document.getElementById(id).title); //alert(document.getElementById(id).title);
var title = document.getElementById(id).title; /*var title = document.getElementById(id).title;
var next = parseInt(title)+cols; var next = parseInt(title)+cols;
var pre = parseInt(title)-cols; var pre = parseInt(title)-cols;
var nextId = "Detail2."+next+".quantity"; var nextId = "Detail2."+next+".quantity";
var preId = "Detail2."+pre+".quantity"; var preId = "Detail2."+pre+".quantity";*/
var final = 0; var final = 0;
...@@ -1019,35 +1128,43 @@ function calQuantity(id,cols,row,qt,fld) ...@@ -1019,35 +1128,43 @@ function calQuantity(id,cols,row,qt,fld)
var firstId="Detail2."+first+".quantity"; var firstId="Detail2."+first+".quantity";
var cnt = row*cols; var cnt = row * cols;
cnt = (first-1) + cnt; cnt = (first-1) + cnt;
//alert(first); var current = parseInt(qt) % cols;
//alert(cnt);
var current = parseInt(title) % cols;
if(current == 0) if(current == 0)
{ {
current = cols; current = cols;
} }
var loop = (first+current)-1;
for(var f=current;f<=cnt;f=f+cols) for(var f=loop;f<=cnt;f=f+cols)
{ {
if(document.getElementById("Detail2."+f+".quantity") == undefined || document.getElementById("Detail2."+f+".quantity").value == "" || document.getElementById("Detail2."+f+".quantity").value == null) if(document.getElementById("Detail2."+f+".quantity") == undefined || document.getElementById("Detail2."+f+".quantity").value == "" || document.getElementById("Detail2."+f+".quantity").value == null)
{ {
document.getElementById("Detail2."+f+".quantity").value = 0; continue;
} }
else else
{ {
final = final + parseInt(document.getElementById("Detail2."+f+".quantity").value); final = final + parseInt(document.getElementById("Detail2."+f+".quantity").value);
} }
} }
document.getElementById("tab."+t+".fld."+current+"").value = final;
//alert("Final="+final); var qty = 0;
document.getElementById("tab.1.fld."+current+"").value = final;
for(var i=1; i<=cols; i++)
{
if(document.getElementById("tab."+t+".fld."+i+"").value != "")
{
qty = qty + parseInt(document.getElementById("tab."+t+".fld."+i+"").value);
//document.getElementById("display").value = qty;
document.getElementById("display."+t+"").innerHTML = qty;
}
}
/*var a = document.getElementById(id).value; /*var a = document.getElementById(id).value;
...@@ -1118,4 +1235,4 @@ function calQuantity(id,cols,row,qt,fld) ...@@ -1118,4 +1235,4 @@ function calQuantity(id,cols,row,qt,fld)
}*/ }*/
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment