Commit 17c3eec3 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@179917 ce508802-f39f-4f6c-b175-0d175dae99d5
parent d823cf67
......@@ -6144,7 +6144,7 @@ function closePopUpOfScheme()
//added by kaustubh on 25 dec 2017 start
function setCheckedScheme(rowID)
function setCheckedScheme(rowID, schemeCode)
{
var qtyTextBox = document.getElementById("Detail2."+rowID+".disQty");
qtyTextBox.readOnly = false;
......@@ -6156,6 +6156,7 @@ function setCheckedScheme(rowID)
if(obj.checked)
{
obj.setAttribute('checked','checked');
calAmount(rowID, schemeCode);
}
else
{
......@@ -6242,8 +6243,74 @@ function setCheckedScheme(rowID)
if(isDataSel)
{
console.log("jsonArray", jsonArray);
document.getElementById("EXISITING_COL_VALUES").value = schemeInfoStr
addRow('Details',jsonArray);
var schemeTable = document.getElementById("schemeDetails");
var schemeRows = schemeTable.rows;
var schemeJsonObj = new Array();
var schemeJsonStr = "";
for(var i=1; i<schemeRows.length; i++)
{
var schemeCode = document.getElementById("Detail2."+i+".applicable_scheme").value;
var schemeQty = document.getElementById("Detail2."+i+".quantity").value;
if(schemeJsonStr.indexOf(schemeCode)==-1)
{
schemeJsonStr += '"'+schemeCode+'":"'+schemeQty+'",';
}
}
schemeJsonStr = schemeJsonStr.substring(0,schemeJsonStr.length-1);
schemeJsonStr = "{"+schemeJsonStr+"}";
var schemeJsonObj = JSON.parse(schemeJsonStr);
var schemeKeys = Object.keys(schemeJsonObj);
var errSchemeStr = "";
for(var i=0; i<schemeKeys.length; i++)
{
var eachSchemeCode = schemeKeys[i];
var eachSchemeQty = schemeJsonObj[eachSchemeCode];
var utilisedQty = 0;
var utilisedQtyArry = document.getElementsByName("quantity_"+eachSchemeCode);
for(var j=0; j<utilisedQtyArry.length; j++)
{
var eachQty = utilisedQtyArry[j].value;
var chkBox = document.getElementById("Detail2."+(j+1)+".selectbox");
if(chkBox.checked)
{
if(!isNaN(eachQty))
utilisedQty += parseFloat(eachQty);
}
}
if(utilisedQty<eachSchemeQty)
{
errSchemeStr += eachSchemeCode +",";
}
}
errSchemeStr = errSchemeStr.substring(0, errSchemeStr.length-1);
if(errSchemeStr.trim().length > 0)
{
errSchemeStr = "You have not taken full free quantity for scheme(s) " + errSchemeStr;
errSchemeStr += "\n Do you want to continue?";
var flag = confirm(errSchemeStr);
if(flag)
{
document.getElementById("EXISITING_COL_VALUES").value = schemeInfoStr
addRow('Details',jsonArray);
}
}
else
{
document.getElementById("EXISITING_COL_VALUES").value = schemeInfoStr
addRow('Details',jsonArray);
}
}
else
{
......@@ -6439,8 +6506,12 @@ function setCheckedScheme(rowID)
for(var i=0; i<qtyTknElems.length;i++)
{
var eachQty = qtyTknElems[i].value;console.log("eachQty["+isNaN(eachQty)+"]");
if(!isNaN(eachQty))
totQtyTkn += parseFloat(eachQty);
var chkBox = document.getElementById("Detail2."+(i+1)+".selectbox");
if(chkBox.checked)
{
if(!isNaN(eachQty))
totQtyTkn += parseFloat(eachQty);
}
}
console.log("totQtyTkn["+totQtyTkn+"] maxAllowFreeQty["+maxAllowFreeQty+"]");
......@@ -6449,6 +6520,7 @@ function setCheckedScheme(rowID)
if(totQtyTkn>maxAllowFreeQty){
alert("Maximum free quantity cannot be more than "+ maxAllowFreeQty + " as per scheme code "+schemeCode);
document.getElementById("Detail2."+rowNo+".disQty").value = "0";
document.getElementById("Detail2."+rowNo+".selectbox").checked = false;
}
}
......
......@@ -36,6 +36,13 @@ input:focus{
outline: none;
}
.table-body>tr>td {
word-wrap: break-word;
}
.tableClass {
table-layout: fixed;
}
</style>
<script>
......@@ -63,23 +70,26 @@ input:focus{
<thead class="table-head">
<tr class = "trClass">
<th class="tHeader" nowrap="true" style="width:50px;">
<th class="tHeader" nowrap="true" style="width:40px;">
</th>
<th class="tHeader" nowrap="true" valign="bottom">
Scheme Code
</th>
<th class="tHeader" nowrap="false" style="max-width:100px;" valign="bottom">
Scheme Description
</th>
<th class="tHeader" nowrap="true" valign="bottom">
Item Code
</th>
<th class="tHeader" nowrap="true" valign="bottom">
<th class="tHeader" nowrap="false" style="max-width:100px;" valign="bottom">
Item Description
</th>
<th class="tHeader" nowrap="true" valign="bottom" align="right">
Free Quantity
</th>
<th class="tHeader" style="width:230px;" nowrap="true" valign="bottom" align="right">
<th class="tHeader" nowrap="true" valign="bottom" align="right">
Free Quantity taken
</th>
......@@ -94,7 +104,7 @@ input:focus{
style="width:100%;border:none;text-align: right; outline:none" maxlength="10" /> -->
<Input type='checkbox' class="editInputClass editInputCur messageCheckbox" value="{$domId}" name="Detail2.{normalize-space($domId)}.selectbox"
id="Detail2.{normalize-space($domId)}.selectbox" onclick="setCheckedScheme('{$domId}');" style="width:100%;border:none;text-align: right; outline:none" maxlength="10" />
id="Detail2.{normalize-space($domId)}.selectbox" onclick="setCheckedScheme('{$domId}', '{applicable_scheme}');" style="width:100%;border:none;text-align: right; outline:none" maxlength="10" />
</td>
......@@ -105,6 +115,16 @@ input:focus{
style="width:100px;background-color: transparent;border: none;color:#666666;" tabindex="-1"/>
</td>
<td style="max-width:100px;color:#666666;">
<xsl:value-of select="scheme_descr"/>
<input type="hidden" maxlength="4" readOnly = "1"
value="{scheme_descr}" name="Detail2.{normalize-space($domId)}.scheme_descr" id="Detail2.{normalize-space($domId)}.scheme_descr"
style="width:100px;background-color: transparent;border: none;color:#666666;" tabindex="-1"/>
</td>
<td nowrap="true">
......@@ -114,8 +134,9 @@ input:focus{
</td>
<td nowrap="true">
<input type="text" maxlength="4" readOnly = "1"
<td style="max-width:100px;color:#666666;">
<xsl:value-of select="item_descr"/>
<input type="hidden" maxlength="4" readOnly = "1"
value="{item_descr}" name="Detail2.{normalize-space($domId)}.item_descr" id="Detail2.{normalize-space($domId)}.item_descr"
style="width:300px;background-color: transparent;border: none;color:#666666;" tabindex="-1"/>
</td>
......
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