third commit

parent 979f32ea
package ibase.webitm.ejb.vhb.msq1;
import java.rmi.RemoteException;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp;
import java.util.ArrayList;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import ibase.utility.BaseLogger;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.ITMDBAccessEJB;
import ibase.webitm.ejb.ValidatorEJB;
import ibase.webitm.utility.ITMException;
public class QuatationAmedmentIC extends ValidatorEJB{
E12GenericUtility genericUtility = new E12GenericUtility();
public String itemChanged(Document dom, Document dom1, Document dom2, String objContext, String currentColumn, String editFlag, String xtraParams) throws RemoteException, ITMException
{
BaseLogger.log("3", getUserInfo(), null,"Inside itemchanged method 111111");
ResultSet rs=null;
PreparedStatement pstmt=null;
String sql="",loginSite="",hospCode="",hospName= "",custCode="",custName="",currCode="", siteCode="", QuotNo="", ls_line_no="";
long ls_line_no1=0l;
double exchRate= 1.0;
Timestamp quoDate=null;
double lineNo1=0.0 , quantity=0.0 , rate=0.0 , quantityOld=0.0, amendmentCount=1.0;
String ll_line_no="", quotNo="";
String itemCode = "";
String itemName = "";
String unit ="";
double quantity1 = 0.0;
double rate1 = 0.0;
double newRate =0.0;
double oldRate = 0.0;
Timestamp ldt_date = new Timestamp(System.currentTimeMillis());
try {
switch(objContext)
{
case "1":
{
switch(currentColumn)
{
case "itm_default":
{
setItem(dom, 1, "amd_date", ldt_date);
setItem(dom, 1, "exch_rate", exchRate);
break;
}
case "quot_no":
{
QuotNo = whenNull(getItemString(dom, 1, "quot_no"));
sql="select hosp_code , hosp_name , cust_code , cust_name , curr_code , add_date , exch_rate , site_code from sales_quot where quot_no = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, QuotNo);
rs = pstmt.executeQuery();
if (rs.next())
{
hospCode = rs.getString("hosp_code");
hospName = rs.getString("hosp_name");
custCode = rs.getString("cust_code");
custName = rs.getString("cust_name");
currCode = rs.getString("curr_code");
quoDate=rs.getTimestamp("add_date");
exchRate = rs.getDouble("exch_rate");
siteCode = rs.getString("site_code");
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
setItem(dom, 1, "hosp_code", hospCode);
setItem(dom, 1, "hosp_name", hospName);
setItem(dom, 1, "cust_code", custCode);
setItem(dom, 1, "cust_name", custName);
setItem(dom, 1, "curr_code", currCode);
setItem(dom, 1, "exch_rate", exchRate);
setItem(dom, 1, "site_code", siteCode);
setItem(dom, 1, "quot_date", quoDate);
break;
}
}
break;
}
case "2":
{
switch(currentColumn)
{
case "itm_default":
{
ll_line_no= genericUtility.getValueFromXTRA_PARAMS(xtraParams,"line_no");
if(ll_line_no != null && ll_line_no.trim().length() > 0)
{
lineNo1=Double.parseDouble(ll_line_no);
}else
{
lineNo1= 0;
}
BaseLogger.log("3", getUserInfo(), null,"Line No:::" +lineNo1);
if(lineNo1 > 0)
{
setItem(dom, 1, "line_no", String.valueOf(lineNo1));
}
setItem(dom, 1, "quantity", quantity);
setItem(dom, 1, "rate", rate);
setItem(dom, 1, "quantity__o", quantityOld);
setItem(dom, 1, "amendment_count", amendmentCount);
break;
}
case "line_no__quot":
{
ls_line_no = getItemString(dom, 1, currentColumn);
if(ls_line_no != null && ls_line_no.length() > 0)
{
ls_line_no1 = Long.parseLong(ls_line_no);
}
else
{
ls_line_no1 = 0;
}
String quotNo1 = whenNull(getItemString(dom1, 1, "quot_no"));
sql=" select quot_no , item_code , descr , unit, " +
" quantity , rate , rate_new , old_rate," +
" from sales_quotdet " +
" where quot_no = ? and line_no = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1, quotNo1);
pstmt.setLong(2, ls_line_no1);
rs=pstmt.executeQuery();
if(rs.next())
{
quotNo = rs.getString("quot_no");
itemCode = rs.getString("item_code");
itemName = rs.getString("descr");
unit = rs.getString("unit");
quantity1 = rs.getDouble("quantity");
rate = rs.getDouble("rate");
newRate = rs.getDouble("rate_new");
oldRate = rs.getDouble("old_rate");
}
setItem(dom, 1, "quot_no", quotNo);
setItem(dom, 1, "item_code", itemCode);
setItem(dom, 1, "item_name", itemName);
setItem(dom, 1, "unit", unit);
setItem(dom, 1, "quantity", String.valueOf(quantity1));
setItem(dom, 1, "rate", rate);
setItem(dom, 1, "rate_new", newRate);
setItem(dom, 1, "rate_new__o", oldRate);
rs.close();
rs = null;
pstmt.close();
pstmt = null;
break;
}
}
break;
}
}
}
catch (Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
finally
{
try {
if (conn != null)
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null)
{
pstmt.close();
pstmt = null;
}
}
} catch (Exception d) {
d.printStackTrace();
throw new ITMException(d);
}
}
return "";
}
}
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