Commit 85c8fd90 authored by msharma's avatar msharma

Revert Source


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@92683 ce508802-f39f-4f6c-b175-0d175dae99d5
parent fd67fe18
......@@ -189,11 +189,14 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
double rateStd=0,totFreeCost=0,discount=0;
String sorder ="",sordLineNo="";
String pickLowerRate = "";
String reasonCode = "";//added by kunal on 24/12/12
double priceListRate = 0,sRateClg=0;
HashMap infoMap = null;
String sretLocCode="",taxCal="",itemCodeOrd="";
double effCost=0;
// returnType=""; // added by cpatil on 12/002/13
SimpleDateFormat simpleDateFormat = null;
int months = 0;
java.util.Date defaultExpDate = null;
try
{
ITMDBAccessEJB dbEjb = new ITMDBAccessEJB();
......@@ -208,6 +211,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
conn = connDriver.getConnectDB("DriverITM");
connDriver=null;
simpleDateFormat = new SimpleDateFormat(genericUtility.getApplDateFormat());
switch( currentFormNo )
{
case 1 :
......@@ -259,6 +263,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
valueXmlString.append("<ret_opt protect =\"0\">").append(retOpt).append("</ret_opt>");
}
}
if (currentColumn.trim().equals("itm_default") )
{
......@@ -308,19 +313,26 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
valueXmlString.append("<price_list__clg protect =\"0\">").append("").append("</price_list__clg>");
}
valueXmlString.append("<ret_opt protect =\"0\">").append("").append("</ret_opt>");
valueXmlString.append("<exch_rate protect =\"0\">").append("0").append("</exch_rate>");
// added by cpatil on 12/02/13 start
//returnType = distCommon.getDisparams("999999","RETURN_TYPE",conn);
//returnType = returnType == null ?"" : returnType.trim();
//if(returnType.equalsIgnoreCase("NULLFOUND"))
//{
// returnType="";
//}
//valueXmlString.append("<return_type protect =\"0\">").append(returnType).append("</return_type>");
//valueXmlString.append("<ret_opt protect =\"0\">").append("").append("</ret_opt>");
valueXmlString.append("<exch_rate protect =\"0\">").append("0").append("</exch_rate>");
//sql =" select rtrim(fld_value),descr from gencodes where fld_name='P_TYPE' and udf_str1 = 'D' ";
sql = " SELECT RTRIM(FLD_VALUE)R FROM GENCODES WHERE FLD_NAME='TRAN_TYPE' AND MOD_NAME='W_SALESRETURN' AND UDF_STR1='D' "; //change done by kunal on 26/12/12 as manoj instruction
pstmt= conn.prepareStatement( sql );
rs = pstmt.executeQuery();
if( rs.next() )
{
tranType = rs.getString(1);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
//added by kunal on 24/12/12
valueXmlString.append("<tran_type protect =\"0\">").append(tranType).append("</tran_type>");
// added by cpatil on 12/02/13 end
}
else if (currentColumn.trim().equals("tran_date") )
......@@ -343,7 +355,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
sql = " select tran_mode, site_code, cust_code__bil, curr_code, "
+ " exch_rate, anal_code, item_ser, tran_date, sales_pers, "
+ " cust_code, sale_order, sales_pers__1, sales_pers__2 "
+ " cust_code, sale_order, sales_pers__1, sales_pers__2,tran_code "
+ " from invoice where invoice_id = ? ";
pstmt= conn.prepareStatement( sql );
pstmt.setString( 1, invoiceId );
......@@ -364,6 +376,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
saleOrder = rs.getString(11);
salesPers1 = rs.getString(12);
salesPers2 = rs.getString(13);
tranCode=rs.getString("tran_code");//Added by manoj sharma 05112012 to set transporter from invoice
}
rs.close();
pstmt.close();
......@@ -457,7 +470,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
if( rs.next() )
{
custName = rs.getString(1);
tranCode = rs.getString(2);
tranCode = tranCode == null ?rs.getString(2) : tranCode.trim();//Added by manoj sharma 05112012 to set transporter from invoice
}
rs.close();
pstmt.close();
......@@ -616,7 +629,8 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
//CHECKING IN RECEVABLES IF ANY DUES ARE O/S FOR CUST CODE OR NOT
//IF YES THEN ISSUE CREDIT NOTE ELSE REPLACE THE GOODS
sql =" select count(1) from receivables "
//committed by akhilesh on 25/12/12 as discuss with kbaghar by manoj this logic is not use in taro-edi
/*sql =" select count(1) from receivables "
+" where tran_ser in ('S-INV','DRNRCP', 'CRNRCP') "
+" and cust_code = ? "
+" and item_ser = ? "
......@@ -645,7 +659,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
valueXmlString.append("<ret_opt>").append("<![CDATA[" + getAbsString( retOpt ) + "]]>").append("</ret_opt>");
setNodeValue( dom, "ret_opt", getAbsString( retOpt ) );
*/
priceListClg = distCommon.getDisparams("999999","PRICE_LIST__CLG",conn);
if((priceListClg == null) || (priceListClg.trim().length() == 0))
{
......@@ -884,6 +898,10 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
invoiceId = genericUtility.getColumnValue("invoice_id", dom1);
fullRet = genericUtility.getColumnValue("full_ret",dom1);
retOpt = genericUtility.getColumnValue("ret_opt",dom1);
reasonCode = genericUtility.getColumnValue("reas_code",dom1);
if (invoiceId == null || invoiceId.trim().length() == 0 || "null".equalsIgnoreCase( invoiceId.trim() ) )
{
valueXmlString.append("<line_no__inv protect =\"1\">").append("<![CDATA["+""+"]]>").append("</line_no__inv>");
......@@ -895,7 +913,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append("<line_no__inv protect =\"0\">").append("<![CDATA["+""+"]]>").append("</line_no__inv>");
valueXmlString.append("<item_code protect =\"1\">").append("<![CDATA["+""+"]]>").append("</item_code>");
}
valueXmlString.append("<status protect =\"0\">").append("<![CDATA["+"S"+"]]>").append("</status>");
//valueXmlString.append("<status protect =\"0\">").append("<![CDATA["+"S"+"]]>").append("</status>");
valueXmlString.append("<cost_rate protect =\"1\">").append("<![CDATA["+""+"]]>").append("</cost_rate>");
retOpt = retOpt == null ?"" : retOpt.trim();
......@@ -951,7 +969,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
{
valueXmlString.append("<rate protect =\"1\">").append("<![CDATA[0]]>").append("</rate>");
}
valueXmlString.append("<status protect =\"0\">").append("<![CDATA["+""+"]]>").append("</status>");
//valueXmlString.append("<status protect =\"0\">").append("<![CDATA["+""+"]]>").append("</status>");
retOpt = retOpt == null ?"" : retOpt.trim();
if ("D".equals(retOpt))
......@@ -986,6 +1004,16 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
valueXmlString.append("<tax_env protect =\"0\">").append("<![CDATA[" + ""+"]]>").append("</tax_env>");
}
valueXmlString.append("<ret_rep_flag protect =\"1\">").append("<![CDATA[R]]>").append("</ret_rep_flag>");
valueXmlString.append("<status>").append("<![CDATA[S]]>").append("</status>"); //added by kunal on 7/12/12 as per Manoj instruction
months = Integer.parseInt(distCommon.getDisparams("999999","DEFAULT_EXP_MONTHS",conn)==null?"0":distCommon.getDisparams("999999","DEFAULT_EXP_MONTHS",conn)) ;
System.out.println("months = "+months );
valueXmlString.append("<mfg_date>").append("<![CDATA["+simpleDateFormat.format(new Date(2012, 00,01))+"]]>").append("</mfg_date>");//added by kunal on 7/12/12 as per Manoj instruction
valueXmlString.append("<exp_date>").append("<![CDATA["+simpleDateFormat.format(addMonths(new Date(2012, 00,01),months))+"]]>").append("</exp_date>");//added by kunal on 7/12/12 as per Manoj instruction
System.out.println("reas_code"+reasonCode);
valueXmlString.append("<reas_code>").append("<![CDATA["+reasonCode+"]]>").append("</reas_code>"); //added by kunal on 24/12/12 as per Manoj instruction
}
else if(currentColumn.trim().equalsIgnoreCase("item_code"))
......@@ -1156,6 +1184,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
rate = distCommon.pickRate(priceList,tranDate,itemCode," ","L",qtyStdUom, conn);
varValue = distCommon.getPriceListType(priceList,conn);
varValue = varValue == null ?"" : varValue.trim();
if ("B".equals(varValue) && rate < 0)
{
rate = 0;
......@@ -3818,7 +3847,7 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
double lcQty=0;
StringBuffer errStringXml = new StringBuffer("<?xml version=\"1.0\"?>\r\n<Root><Errors>");
String errorType = "";
String tranType = "";
try
{
conn = connDriver.getConnectDB("DriverITM");
......@@ -4200,6 +4229,33 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
errFields.add( childNodeName.toLowerCase() );
}
}
if( childNodeName.equalsIgnoreCase( "reas_code" ) )//added by kunal on 24/12/12
{
mreasCode = getAbsString( genericUtility.getColumnValue( "reas_code", dom ) );
mcount = 0;
sqlStr = " select count(*) mcount "
+" from sreturn_reason "
+" where reason_code = ? ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, mreasCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
mcount = rs.getInt( "mcount" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( mcount == 0 )
{
errCode = "VUREASON";
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
}
}//end for
break;
case 2 :
......@@ -6152,4 +6208,17 @@ public class SReturnForm extends ValidatorEJB implements SReturnFormLocal, SRetu
}
return retVal ;
}
private java.util.Date addMonths(java.util.Date date, int months) throws Exception ,ITMException //added by Kunal on 10/12/12
{
java.util.Date calculatedDate = null;
if (date != null) {
final GregorianCalendar calendar = new GregorianCalendar();
calendar.setTime(date);
calendar.add(Calendar.MONTH, months);
calculatedDate = new java.util.Date(calendar.getTime().getTime());
}
return calculatedDate;
}
}
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