Commit faeab465 authored by steurwadkar's avatar steurwadkar

Changes made for Group scheme in Sales Order html wizard screen

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@179811 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 1c59f6b3
......@@ -2047,7 +2047,7 @@ var lineNoForTax = 0;
function form3Pre()
{
//alert("form3Pre");
document.getElementById("finish").style.display = "none"; // to undisplay
document.getElementById("previous").style.display = "none"; // to undisplay
document.getElementById("reset").style.display = "none";
......@@ -6063,7 +6063,8 @@ function gotoChildTextbox(curTdObj)
function getScheme()
{
var x = document.getElementsByClassName("trClass");
var totalLength = x.length;
var y = document.getElementsByClassName("schemeRow");
var totalLength = x.length - y.length;
console.log("totalLength"+totalLength);
// var rowss = x[0].rows;
// var rowsLength = x[0].rows.length;
......@@ -6071,41 +6072,37 @@ function gotoChildTextbox(curTdObj)
var xmlString ="<DocumentRoot><description>Datawindow Root</description><group0><description>description1</description><Header0><description>Header0 members</description>"
;
var custCodeDlv = document.getElementById("cust_code__dlv").value;
var itemSer = document.getElementById("item_ser").value;
var custCode = document.getElementById("cust_code").value;
var orderDate = document.getElementById("order_date").value;
var siteCode = document.getElementById("site_code").value;
var dueDate = document.getElementById("due_date").value;
var siteCode = document.getElementById("site_code").value;
console.log("custCodeDlv-->"+custCodeDlv+"itemSer-->"+itemSer+"custCode-->"+custCode+"orderDate-->"+orderDate+"siteCode-->"+siteCode+"dueDate-->"+dueDate);
xmlString = xmlString + "<Detail1 domID='1' selected = 'N'>";
xmlString = xmlString + "<cust_code__dlv>"+"<![CDATA[" + custCodeDlv + "]]>"+"</cust_code__dlv>";
xmlString = xmlString + "<item_ser>"+"<![CDATA[" + itemSer + "]]>"+"</item_ser>";
xmlString = xmlString + "<cust_code>"+"<![CDATA[" + custCode + "]]>"+"</cust_code>";
xmlString = xmlString + "<order_date>"+"<![CDATA[" + orderDate + "]]>"+"</order_date>";
xmlString = xmlString + "<site_code>"+"<![CDATA[" + siteCode + "]]>"+"</site_code>";
xmlString = xmlString + "<due_date>"+"<![CDATA[" + dueDate + "]]>"+"</due_date>";
xmlString = xmlString + "</Detail1>"
for(var r=1;r<totalLength+1;r++)
for(var r=1;r<=totalLength;r++)
{
//alert(document.getElementById("Detail3."+r+".tax_xml").value);
xmlString = xmlString + "<Detail2 domID='"+r+"' selected = 'N'>";
//document.getElementById("Detail3."+r+".tax_xml").value;
var item = document.getElementById("Detail3."+r+".item_code").value;
var quantity = document.getElementById("Detail3."+r+".quantity").value;
var itemType = document.getElementById("Detail3."+r+".item_type").value;
var siteCode = document.getElementById("site_code").value;
var itemSer = document.getElementById("Detail3."+r+".item_ser").value;
var custCode = document.getElementById("cust_code").value;
var orderDate = document.getElementById("order_date").value;
var siteCode = document.getElementById("site_code").value;
var dueDate = document.getElementById("due_date").value;
console.log("custCodeDlv-->"+custCodeDlv+"itemSer-->"+itemSer+"custCode-->"+custCode+"orderDate-->"+orderDate+"siteCode-->"+siteCode+"dueDate-->"+dueDate);
var rate = document.getElementById("Detail3."+r+".rate").value;
xmlString = xmlString + "<item_code__ord>"+"<![CDATA[" + item + "]]>"+"</item_code__ord>";
xmlString = xmlString + "<quantity>"+"<![CDATA[" + quantity + "]]>"+"</quantity>";
xmlString = xmlString + "<itemType>"+"<![CDATA[" + itemType + "]]>"+"</itemType>";
xmlString = xmlString + "<site_code>"+"<![CDATA[" + siteCode + "]]>"+"</site_code>";
xmlString = xmlString + "<rate>"+"<![CDATA[" + rate + "]]>"+"</rate>";
xmlString = xmlString + "</Detail2>";
xmlString = xmlString + "<Detail1 domID='"+r+"' selected = 'N'>";
//xmlString = xmlString + "</Detail2>";
//xmlString = xmlString + "</Detail1>"
xmlString = xmlString + "<cust_code__dlv>"+"<![CDATA[" + custCodeDlv + "]]>"+"</cust_code__dlv>";
xmlString = xmlString + "<item_ser>"+"<![CDATA[" + itemSer + "]]>"+"</item_ser>";
xmlString = xmlString + "<cust_code>"+"<![CDATA[" + custCode + "]]>"+"</cust_code>";
xmlString = xmlString + "<order_date>"+"<![CDATA[" + orderDate + "]]>"+"</order_date>";
xmlString = xmlString + "<site_code>"+"<![CDATA[" + siteCode + "]]>"+"</site_code>";
xmlString = xmlString + "<due_date>"+"<![CDATA[" + dueDate + "]]>"+"</due_date>";
xmlString = xmlString + "</Detail1>"
console.log("item"+item);
console.log("quantity"+quantity);
......@@ -6113,6 +6110,8 @@ function gotoChildTextbox(curTdObj)
xmlString = xmlString + "</Header0></group0></DocumentRoot>";
console.log("testcreateXmlForScheme"+encodeURI(xmlString));
var formNo = 2;
var prevSchemeInfo = document.getElementById("EXISITING_COL_VALUES").value;
var objName = 'sorderWiz';
var url = "/ibase/webitm/jsp/SorderWizardScheme.jsp?xmlDataString="+encodeURI(xmlString)
......@@ -6126,7 +6125,7 @@ function gotoChildTextbox(curTdObj)
// localStorage.setItem('xmlDataNew',xmlString);
$("#SchemeDiv").load(url);
$("#SchemeDiv").load(url, setPreviousSchemeData(prevSchemeInfo));
}
......@@ -6145,12 +6144,15 @@ function closePopUpOfScheme()
//added by kaustubh on 25 dec 2017 start
function setChecked(rowID)
function setCheckedScheme(rowID)
{
document.getElementById("Detail2."+rowID+".disQty").readOnly = false;
var qtyTextBox = document.getElementById("Detail2."+rowID+".disQty");
qtyTextBox.readOnly = false;
qtyTextBox.focus();
qtyTextBox.select();
var obj = document.getElementById("Detail2."+rowID+".selectbox");
console.log(obj);
//console.log(obj);
if(obj.checked)
{
obj.setAttribute('checked','checked');
......@@ -6172,7 +6174,7 @@ function setChecked(rowID)
//alert("checkedValue"+inputElements.length);
var jsonStr = "";
var jsonStr = "", schemeInfoStr = "";
var jsonArray = new Array();
var isDataSel = false;
var obj = null;
......@@ -6207,7 +6209,7 @@ function setChecked(rowID)
rateKey ="rate";
rateValue =rate1;
distKey ="discount";
distValue ="99.99";
distValue =discount1;
amtKey ="net_amt";
amtValue ="";
taxKey="tax_amt";
......@@ -6223,30 +6225,31 @@ function setChecked(rowID)
clgrateKey="rate__clg";
clgrateValue="0";
console.log("descr"+descr+"itemCode"+itemCode+"quantity"+quantity);
// jsonStr = '{"'+itemCodeKey+'":"'+itemCodeVal+'","'+descrKey+'":"'+descrVal+'","'+qtyKey+'":"'+qtyVal+'"}';
jsonStr = '{"'+itemCodeKey+'":"'+itemCodeVal+'","'+descrKey+'":"'+descrVal+'","'+qtyKey+'":"'+qtyVal+'","'+rateKey+'":"'+rateValue+'","'+distKey+'":"'+distValue+'","'+amtKey+'":"'+amtValue+'","'+taxKey+'":"'+taxValue+'","'+chapKey+'":"'+chapValue+'","'+classKey+'":"'+classValue+'","'+envKey+'":"'+envValue+'","'+clgrateKey+'":"'+clgrateValue+'"}';
// jsonStr = '{"'+itemCodeKey+'":"'+itemCodeVal+'","'+descrKey+'":"'+descrVal+'","'+qtyKey+'":"'+qtyVal+'","'+rateKey+'":"'+rateValue+'","'+distKey+'":"'+distValue+'","'+amtKey+'":"'+amtValue+'","'+taxKey+'":"'+taxValue+'","'+chapKey+'":"'+chapValue+'","'+classKey+'":"'+classValue+'","'+envKey+'":"'+envValue+'"}';
console.log("jsonStr["+jsonStr+"]");
obj = JSON.parse(jsonStr);
jsonArray.push(obj);
//addRow('Details',itemCode,descr,quantity);
isDataSel = true;
//break;
if(quantity > 0)
{
jsonStr = '{"'+itemCodeKey+'":"'+itemCodeVal+'","'+descrKey+'":"'+descrVal+'","'+qtyKey+'":"'+qtyVal+'","'+rateKey+'":"'+rateValue+'","'+distKey+'":"'+distValue+'","'+amtKey+'":"'+amtValue+'","'+taxKey+'":"'+taxValue+'","'+chapKey+'":"'+chapValue+'","'+classKey+'":"'+classValue+'","'+envKey+'":"'+envValue+'","'+clgrateKey+'":"'+clgrateValue+'"}';
console.log("jsonStr["+jsonStr+"]");
obj = JSON.parse(jsonStr);
jsonArray.push(obj);
isDataSel = true;
schemeInfoStr += (i+1)+":"+qtyVal+"~";
}
}
}
if(isDataSel)
{
console.log("jsonArray", jsonArray);
addRow('Details',jsonArray);
document.getElementById("EXISITING_COL_VALUES").value = schemeInfoStr
addRow('Details',jsonArray);
}
else
{
alert();
//alert("Please select atleast one item.");
document.getElementById("EXISITING_COL_VALUES").value = "";
addRow('Details',jsonArray);
}
}
......@@ -6257,13 +6260,26 @@ function setChecked(rowID)
console.log("jsonArray"+jsonArray);
console.log("jsonArrayLength"+jsonArray.length);
var existTabVal = "";
var table = document.getElementById(tableid);
var rows = table.rows;
var rowCount = table.rows.length;
var preRowCnt = 0;
console.log("rowCount"+rowCount);
var preSchemeRows = table.getElementsByClassName("schemeRow");
var preSchmeRowLen = preSchemeRows.length;
if(preSchmeRowLen > 0)
{
for( var i=rowCount; i>(rowCount-preSchmeRowLen); i--)
{
table.deleteRow(i-1);
}
rowCount = rowCount - preSchmeRowLen;
}
for(var a=0;a<=jsonArray.length-1;a++)
{
var table = document.getElementById(tableid);
var rows = table.rows;
var rowCount = table.rows.length;
console.log("rowCount"+rowCount);
// var copyRow = table.rows[rowCount-1].cloneNode(true);
var copyRow = table.rows[1].cloneNode(true);
console.log("copyRow"+copyRow);
......@@ -6328,7 +6344,8 @@ function setChecked(rowID)
copyRow.id = "itemRow"+rowCount;
table.getElementsByTagName("tbody")[0].appendChild(copyRow);
var divdelte = document.createElement("div");
copyRow.classList.add("schemeRow");
/*var divdelte = document.createElement("div");
console.log("xxx"+copyRow.id);
divdelte.innerHTML = "<span title='Delete' style='display: block; position:absolute;' currdomid='1' class='deleteDetailBtn' onclick='javascript:deleteRow("+rowCount+")' >"
......@@ -6336,7 +6353,7 @@ function setChecked(rowID)
+"<img src='/ibase/webitm/images/remove.png' height = '16' width = '16' class='removeImg'></img>"
+"</p>"
"</span>"
copyRow.appendChild(divdelte);
copyRow.appendChild(divdelte); */
var keys = Object.keys(eachObj);
......@@ -6372,12 +6389,14 @@ function setChecked(rowID)
console.log("itmCodexxxxx"+itmCode);
}
}
rowCount++;
existTabVal = existTabVal + copyRow.id+"-"+itmCode.trim()+"~"+quan+"::";
console.log("existTabVal"+existTabVal);
document.getElementById("EXISITING_COL_VALUES").value = existTabVal;
//document.getElementById("EXISITING_COL_VALUES").value = existTabVal;
}
......@@ -6410,34 +6429,27 @@ function setChecked(rowID)
// Added by Kaustubh on 11 Jan 2018 start
function calAmount(rowNo)
function calAmount(rowNo, schemeCode)
{
var totQtyTkn = 0;
var qty = parseFloat(document.getElementById("Detail2."+rowNo+"."+"quantity").value);
var disQty = parseFloat(document.getElementById("Detail2."+rowNo+"."+"disQty").value);
var maxAllowFreeQty = parseFloat(document.getElementsByName("free_quantity_"+schemeCode)[0].value);
var qtyTknElems = document.getElementsByName("quantity_"+schemeCode);
console.log("qty"+qty+"disQty"+disQty);
for(var i=0; i<qtyTknElems.length;i++)
{
var eachQty = qtyTknElems[i].value;console.log("eachQty["+isNaN(eachQty)+"]");
if(!isNaN(eachQty))
totQtyTkn += parseFloat(eachQty);
}
/* if(disQty <= qty)
{
var minQty = qty - disQty ;
console.log("minQty"+minQty);
document.getElementById("Detail2."+rowNo+".quantity").value = minQty;
}
else
{
alert("Not a valid Quantity");
document.getElementById("Detail2."+rowNo+".disQty").value = "0";
return false;
}
*/
if(disQty > qty)
{
alert("You can not purchase more than "+qty+" qunatities");
console.log("totQtyTkn["+totQtyTkn+"] maxAllowFreeQty["+maxAllowFreeQty+"]");
console.log("totQtyTkn>maxAllowFreeQty["+totQtyTkn>maxAllowFreeQty+"]");
if(totQtyTkn>maxAllowFreeQty){
alert("Maximum free quantity cannot be more than "+ maxAllowFreeQty + " as per scheme code "+schemeCode);
document.getElementById("Detail2."+rowNo+".disQty").value = "0";
}
}
......@@ -6473,6 +6485,35 @@ function setChecked(rowID)
alert("rowID");
document.getElementById("Detail3."+rowID+".disQty").style.readOnly = false;
}
function isNumberKey(evt)
{
var charCode = (evt.which) ? evt.which : evt.keyCode;
if (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))
return false;
return true;
}
function setPreviousSchemeData(prevSchemeInfo)
{
setTimeout(function(){
if(prevSchemeInfo != undefined && prevSchemeInfo.trim().length > 0)
{
var prevSchmeArry = prevSchemeInfo.split("~");
for(var i=0; i<prevSchmeArry.length-1; i++)
{
var eachData = prevSchmeArry[i].split(":");
var rowId = eachData[0];
var qtyData = eachData[1];
var checkBoxElem = document.getElementById("Detail2."+rowId+".selectbox");
checkBoxElem.click();
document.getElementById("Detail2."+rowId+".disQty").value = qtyData;
}
}
},700);
}
// Added by Kaustubh on 11 Jan 2018 end
......
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