Commit 5046c5cc authored by awarekar's avatar awarekar

Sales Budget Cust Wizard related changes

- Created Pre save component .
- Function to Save only edited details and function to Disable buttons
- display item description at bottom
- and display related changes (set width of item , height of div )

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@198819 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6d9dc438
package ibase.webitm.ejb.fin;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class SalesBudgetCustPreSaveWizEJB extends ValidatorEJB
{
E12GenericUtility genericUtility = new E12GenericUtility();
public String preSave() throws RemoteException,ITMException
{
return "";
}
public String preSave(String xmlString, String editFlag, String xtraParams, Connection conn)throws RemoteException,ITMException
{
System.out.println(" preSave called 2 ==> "+xmlString);
String errString = "";
Document dom = null;
try
{
if (xmlString != null && xmlString.trim().length() > 0)
{
dom = genericUtility.parseString(xmlString);
errString = executepreSave( dom, editFlag, xtraParams, conn );
}
}
catch(Exception e)
{
System.out.println("Exception :ShipmentPrs :" + e.getMessage() + ":");
e.printStackTrace();
throw new ITMException(e);
}
return errString;
}
public String executepreSave( Document dom, String editFlag, String xtraParams, Connection conn ) throws RemoteException, ITMException, SQLException
{
System.out.println("executepreSave method called \t editFlag is ["+editFlag+"]");
String errString = "";
NodeList parentNodeList = null;
Node parentNode = null;
String updateFlag="";
int parentNodeListLength=0 ,cnt =0,cnt2=0;
boolean isLocCon = false;
boolean isError = false;
String sql="",sql2="",sql3="",custCode="", posCode="", itemSer = "", acctPrd="", tranId = "";
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
if (conn == null || conn.isClosed())
{
conn = getConnection();
isLocCon = true;
}
parentNodeList = dom.getElementsByTagName("Detail1");
parentNodeListLength = parentNodeList.getLength();
custCode = checkNull(genericUtility.getColumnValue("cust_code",dom));
posCode = checkNull(genericUtility.getColumnValue("pos_code",dom));
itemSer = checkNull(genericUtility.getColumnValue("item_ser",dom));
acctPrd = checkNull(genericUtility.getColumnValue("acct_prd",dom));
sql ="SELECT * FROM SALES_BUDGET_CUST WHERE CUST_CODE =? and POS_CODE = ? and ITEM_SER = ? and ACCT_PRD = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, custCode);
pstmt.setString(2, posCode);
pstmt.setString(3, itemSer);
pstmt.setString(4, acctPrd);
rs = pstmt.executeQuery();
while (rs.next())
{
tranId = checkNull(rs.getString("TRAN_ID"));
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
System.out.println("x==> tranIds :"+tranId);
if ( tranId != null )
{
sql2 = "DELETE FROM SALES_BUDGET_CUST WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql2);
pstmt.setString(1, tranId);
cnt =pstmt.executeUpdate();
if( cnt > 0)
{
System.out.println("x==> DELETE of SALES_BUDGET_CUST success ["+cnt+"]");
}
pstmt.close();
pstmt = null;
sql3 = "DELETE FROM SALES_BUDGET_CUST_DET WHERE TRAN_ID = ?";
pstmt = conn.prepareStatement(sql3);
pstmt.setString(1, tranId);
cnt =pstmt.executeUpdate();
if( cnt2 > 0)
{
System.out.println("x==> DELETE of SALES_BUDGET_CUST_DET success ["+cnt2+"]");
}
pstmt.close();
pstmt = null;
}
else
{
System.out.println("x==> TranID in NULL !");
}
}
catch(Exception e)
{
System.out.println("The Exception occurs in CostallocPrs :"+e);
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try
{
System.out.println("Inside finally CostCtrAllocPosEJB isError["+isError+"] connStatus["+isLocCon+"]");
if(isLocCon)
{
if(isError)
{
System.out.println("Inside rollbacking....");
conn.rollback();
}
else
{
System.out.println("Inside committing....");
conn.commit();
}
if (conn != null )
{
conn.close();
}
}
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
return errString;
}
private String checkNull( String input )
{
return E12GenericUtility.checkNull( input );
}
}
...@@ -404,7 +404,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -404,7 +404,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
String childNodeName = null,custCode="",posCode="",custName="",posD="",posDescr="",itmDes="",priceDesc=""; String childNodeName = null,custCode="",posCode="",custName="",posD="",posDescr="",itmDes="",priceDesc="";
int childNodeListLength=0; int childNodeListLength=0;
int ctr=0,count=1; int ctr=0,count=1;
String chgTerm="",siteCode="",currDate="",userId="",itemCode="",itemUnit="",rate="",nullVar="",itemDescr=""; String chgTerm="",siteCode="",currDate="",userId="",itemCode="",itemUnit="",rate="",nullVar="",itemDescr="",itemInfo="";
ArrayList<String> acctPrdlist=new ArrayList<String>(); ArrayList<String> acctPrdlist=new ArrayList<String>();
try try
{ {
...@@ -662,7 +662,16 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -662,7 +662,16 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
itemCode = rs.getString("ITEM_CODE"); itemCode = rs.getString("ITEM_CODE");
itemDescr = rs.getString("SH_DESCR"); itemDescr = rs.getString("SH_DESCR");
itemUnit = rs.getString("UNIT"); itemUnit = rs.getString("UNIT");
System.out.println("ITEM_CODE"+itemCode+" item_desc" + itemDescr); if (itemDescr == null )
{
itemInfo = itemCode;
}
else
{
itemInfo = itemDescr+" ("+itemCode+")";
}
System.out.println("ITEM_CODE"+itemCode+" item_desc" + itemDescr+ "and Last itemInfo="+itemInfo);
String sql5 = "SELECT RATE FROM PRICELIST WHERE ITEM_CODE = ?"; String sql5 = "SELECT RATE FROM PRICELIST WHERE ITEM_CODE = ?";
pstmt2 = conn.prepareStatement( sql5 ); pstmt2 = conn.prepareStatement( sql5 );
...@@ -684,7 +693,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB ...@@ -684,7 +693,7 @@ public class SalesBudgetCustWizEJB extends ValidatorEJB
valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n"); valueXmlString.append("<attribute selected=\"Y\" updateFlag=\"E\" status=\"O\" pkNames=\"\"/>\r\n");
valueXmlString.append("<prd_code><![CDATA[" + acctPrdlist.get(i) + "]]></prd_code>"); valueXmlString.append("<prd_code><![CDATA[" + acctPrdlist.get(i) + "]]></prd_code>");
valueXmlString.append("<item_code><![CDATA[" + itemCode + "]]></item_code>"); valueXmlString.append("<item_code><![CDATA[" + itemCode + "]]></item_code>");
valueXmlString.append("<item_descr><![CDATA[" + itemDescr + "]]></item_descr>"); valueXmlString.append("<item_descr><![CDATA[" + itemInfo + "]]></item_descr>");
valueXmlString.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>"); valueXmlString.append("<item_ser><![CDATA[" + itemSer + "]]></item_ser>");
valueXmlString.append("<quantity><![CDATA[" + initialQnty + "]]></quantity>"); valueXmlString.append("<quantity><![CDATA[" + initialQnty + "]]></quantity>");
valueXmlString.append("<unit><![CDATA[" + itemUnit + "]]></unit>"); valueXmlString.append("<unit><![CDATA[" + itemUnit + "]]></unit>");
......
...@@ -134,7 +134,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -134,7 +134,7 @@ border: 1px solid #E7E7E7 !important;
<TABLE border="0" width="99%" height="2%" class="header_td" cellpadding="0" cellspacing="0" style="background-color: #f7f8fa;"> <TABLE border="0" width="99%" height="2%" class="header_td" cellpadding="0" cellspacing="0" style="background-color: #f7f8fa;">
<TR> <TR>
<TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:16px;" width="2%" > <TD class="header_main" nowrap="true" align="left" valign="middle" style="padding-left: 10px;font-size:18px;" width="2%" >
Salses Budget Salses Budget
</TD> </TD>
...@@ -233,7 +233,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -233,7 +233,7 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%"> <td class="td_rightAlign" nowrap="true" width = "1%">
<strong>Customer code: </strong> <strong>Customer Code : </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" value="{$cust_code}" class="input_editable" name="Detail1.{normalize-space($dbID)}.cust_code" id="Detail1.{normalize-space($dbID)}.cust_code" placeholder="Enter Customer code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'cust_code');" ISCHANGED="false"/> <input type="text" value="{$cust_code}" class="input_editable" name="Detail1.{normalize-space($dbID)}.cust_code" id="Detail1.{normalize-space($dbID)}.cust_code" placeholder="Enter Customer code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'cust_code');" ISCHANGED="false"/>
...@@ -245,7 +245,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -245,7 +245,7 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%" > <td class="td_rightAlign" nowrap="true" width = "1%" >
<strong>POS code*: </strong> <strong>Position Code* : </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" class="input_editable" value="{$pos_code}" name="Detail1.{normalize-space($dbID)}.pos_code" id="Detail1.{normalize-space($dbID)}.pos_code" placeholder="Enter POS code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'pos_code');" ISCHANGED="false"/> <input type="text" class="input_editable" value="{$pos_code}" name="Detail1.{normalize-space($dbID)}.pos_code" id="Detail1.{normalize-space($dbID)}.pos_code" placeholder="Enter POS code" maxlength="10" onchange="callItemChange('{normalize-space($dbID)}', 'pos_code');" ISCHANGED="false"/>
...@@ -257,7 +257,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -257,7 +257,7 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%" > <td class="td_rightAlign" nowrap="true" width = "1%" >
<strong>Item series*: </strong> <strong>Item Series* : </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" class="input_editable" value="{$item_ser}" name="Detail1.{normalize-space($dbID)}.item_ser" id="Detail1.{normalize-space($dbID)}.item_ser" placeholder="Enter Item series" maxlength="5" onchange="callItemChange('{normalize-space($dbID)}', 'item_ser');" ISCHANGED="false"/> <input type="text" class="input_editable" value="{$item_ser}" name="Detail1.{normalize-space($dbID)}.item_ser" id="Detail1.{normalize-space($dbID)}.item_ser" placeholder="Enter Item series" maxlength="5" onchange="callItemChange('{normalize-space($dbID)}', 'item_ser');" ISCHANGED="false"/>
...@@ -269,10 +269,10 @@ border: 1px solid #E7E7E7 !important; ...@@ -269,10 +269,10 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%" > <td class="td_rightAlign" nowrap="true" width = "1%" >
<strong>Price List*: </strong> <strong>Price List* : </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" value="{$price_list}" class="input_editable" name="Detail1.{normalize-space($dbID)}.price_list" id="Detail1.{normalize-space($dbID)}.price_list" placeholder="Enter Price List" maxlength="200" onchange="callItemChange('{normalize-space($dbID)}', 'price_list');" ISCHANGED="false" /> <input type="text" value="{$price_list}" class="input_editable" name="Detail1.{normalize-space($dbID)}.price_list" id="Detail1.{normalize-space($dbID)}.price_list" placeholder="Enter Price List" maxlength="5" onchange="callItemChange('{normalize-space($dbID)}', 'price_list');" ISCHANGED="false" />
<a href="javascript:callPriceList( '{normalize-space($dbID)}','{normalize-space($price_list)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a> <a href="javascript:callPriceList( '{normalize-space($dbID)}','{normalize-space($price_list)}' );"> <img src="/ibase/webitm/images/pophelp.png" border="0"/> </a>
<input type="text" value="{$prc_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.prc_descr" id="Detail1.{normalize-space($dbID)}.prc_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" /> <input type="text" value="{$prc_descr}" class="input_editable" name="Detail1.{normalize-space($dbID)}.prc_descr" id="Detail1.{normalize-space($dbID)}.prc_descr" maxlength="5" style="width:300px" ISCHANGED="false" readonly="true" />
</td> </td>
...@@ -281,7 +281,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -281,7 +281,7 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%" > <td class="td_rightAlign" nowrap="true" width = "1%" >
<strong>Account Period*:</strong> <strong>Account Period* :</strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" class="input_editable" value="{$acct_prd}" name="Detail1.{normalize-space($dbID)}.acct_prd" id="Detail1.{normalize-space($dbID)}.acct_prd" placeholder="Enter Period" maxlength="6" ISCHANGED="false"/> <input type="text" class="input_editable" value="{$acct_prd}" name="Detail1.{normalize-space($dbID)}.acct_prd" id="Detail1.{normalize-space($dbID)}.acct_prd" placeholder="Enter Period" maxlength="6" ISCHANGED="false"/>
...@@ -325,7 +325,7 @@ border: 1px solid #E7E7E7 !important; ...@@ -325,7 +325,7 @@ border: 1px solid #E7E7E7 !important;
<tr width ="100%"> <tr width ="100%">
<td class="td_rightAlign" nowrap="true" width = "1%"> <td class="td_rightAlign" nowrap="true" width = "1%">
<strong>Remarks: </strong> <strong>Remarks : </strong>
</td> </td>
<td class="td_leftAlign" > <td class="td_leftAlign" >
<input type="text" value="{$remarks}" class="input_editable" name="Detail1.{normalize-space($dbID)}.remarks" id="Detail1.{normalize-space($dbID)}.remarks" maxlength="200" style="width:450px" ISCHANGED="false" /> <input type="text" value="{$remarks}" class="input_editable" name="Detail1.{normalize-space($dbID)}.remarks" id="Detail1.{normalize-space($dbID)}.remarks" maxlength="200" style="width:450px" ISCHANGED="false" />
......
...@@ -123,6 +123,66 @@ function displayPrdActivity( prdCode, prdDescr ) ...@@ -123,6 +123,66 @@ function displayPrdActivity( prdCode, prdDescr )
} }
} }
////////////////////////////////////////////////////// Display Rate in Div ////////////////////////////////////////////////////
function displayItemRate( dbId )
{
console.log("In displayItemRate");
var itamInfo = "";
var itemLabel = "Item: ";
var rateLabel = "Rate: ";
//var itemCode = document.getElementById("Detail2."+dbId+".item_code").value;
var itemDesc = document.getElementById("Detail2."+dbId+".item_descr").value;
if(itemDesc == null || itemDesc.length ==0 || itemDesc == "null")
{
console.log("In if"+itemDesc);
itamInfo = itemCode;
}
else
{
console.log("In else"+itemDesc);
//itamInfo = itemCode+" ( "+itemDesc+" )";
itamInfo = itemDesc;
}
var ItemRate = document.getElementById("Detail2."+dbId+".rate").value;
document.getElementById("Label_item_code_disp").innerHTML = itemLabel;
document.getElementById("Label_rate_disp").innerHTML = rateLabel;
document.getElementById("item_code_disp").innerHTML = itamInfo;
document.getElementById("rate_disp").innerHTML = ItemRate;
}
////////////////////////////////////////////////// Set height to Div ///////////////////////////////////////////////////////////
function addLoadEvent(func)
{
var oldonload = window.onload;
if (typeof window.onload != 'function')
{
window.onload = func;
}
else
{
window.onload = function()
{
if (oldonload)
{
oldonload();
}
func();
}
}
}
addLoadEvent(setDivHeight);
function setDivHeight()
{
console.log("ameylll");
document.getElementById("dataDiv").style.height = (window.innerHeight - 140 ) + "px";
}
//////////////////////////////////////////////////////NET AMOUNT //////////////////////////////////////////////////// //////////////////////////////////////////////////////NET AMOUNT ////////////////////////////////////////////////////
...@@ -209,18 +269,16 @@ function doHideMsg(str) ...@@ -209,18 +269,16 @@ function doHideMsg(str)
document.getElementById(str).style.display = 'none'; document.getElementById(str).style.display = 'none';
} }
function disableButtons(formNo) function disableButtons()
{ {
if (formNo == 1) console.log("disable button form 2 called");
if(document.getElementById("ActPrevious") != null && document.getElementById("ActPrevious") != 'undefined')
{ {
//console.log("disable button form 1 called"); document.getElementById("ActPrevious").disabled = true;
document.Wizard_activity.ActNext.disabled = true;
} }
else if (formNo == 2) if(document.getElementById("ActNext") != null && document.getElementById("ActNext") != 'undefined')
{ {
//console.log("disable button form 1 called"); document.getElementById("ActNext").disabled = true;
document.Wizard_Travel.Cancel.disabled = true;
document.Wizard_Travel.Finish.disabled = true;
} }
} }
...@@ -238,8 +296,19 @@ function setNetAmount( dbId ) ...@@ -238,8 +296,19 @@ function setNetAmount( dbId )
alert("Quantity can't be Negative! Please enter valid Quantity"); alert("Quantity can't be Negative! Please enter valid Quantity");
document.getElementById("Detail2."+dbId+".quantity").focus(); document.getElementById("Detail2."+dbId+".quantity").focus();
} }
else if ( qty == 0)
{
//alert("Quantity equals 0");
document.getElementById("Detail2."+dbId+".selectbox").checked = false;
document.getElementById("Detail2."+dbId+".selectbox").value = "false";
document.getElementById("Detail2."+dbId+".selectbox").setAttribute('checked','N');
}
else else
{ {
document.getElementById("Detail2."+dbId+".selectbox").checked = true;
document.getElementById("Detail2."+dbId+".selectbox").value = "true";
document.getElementById("Detail2."+dbId+".selectbox").setAttribute('checked','Y');
obj1 = document.getElementById("Detail2."+dbId+".rate"); obj1 = document.getElementById("Detail2."+dbId+".rate");
var rate = trims(obj1.value); var rate = trims(obj1.value);
var amt = qty * rate ; var amt = qty * rate ;
......
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