Commit 77fc2284 authored by msalam's avatar msalam

changes fro DI89sun240


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91248 ce508802-f39f-4f6c-b175-0d175dae99d5
parent cdc65042
......@@ -600,6 +600,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
childNodeName = childNode.getNodeName();
if (childNodeName.equalsIgnoreCase("item_code"))
{
String countCode = null;
//itemNodeList = dom2.getElementsByTagName("item_code");
//lineNoList = dom2.getElementsByTagName("line_no");
detail2List = dom2.getElementsByTagName("Detail2");
......@@ -913,7 +914,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
{
if( "NE".equalsIgnoreCase( orderTypeHdr ) )
{
sql= "select state_code from customer where cust_code = ?";
sql= "select state_code, count_code from customer where cust_code = ?";
//System.out.println("select itemSerHdr var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
......@@ -921,6 +922,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
if(rs.next())
{
stateCode = rs.getString(1) == null ? "" : rs.getString(1);
countCode = rs.getString(2) == null ? "" : rs.getString(2);
}
rs.close();
pstmt.close();
......@@ -932,7 +934,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
+ " and a.item_code = ?"
+ " and a.app_from <= ?"
+ " and a.valid_upto >= ?"
+ " and (b.site_code = ? or b.state_code = ?)" // stateCode value not fetched
+ " and ( b.site_code = ? or b.state_code = ? or b.count_code = ? )" // stateCode value not fetched
+ " and a.order_type = ?";
//System.out.println("select scheme_code var_value.." + sql);
pstmt = conn.prepareStatement(sql);
......@@ -941,7 +943,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.setTimestamp(3,OrderDate);
pstmt.setString(4,siteCode);
pstmt.setString(5,stateCode);
pstmt.setString(6,orderTypeHdr);
pstmt.setString(6,countCode);
pstmt.setString(7,orderTypeHdr);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -954,13 +957,28 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
}
else
{
sql= "select state_code, count_code from customer where cust_code = ?";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,custCode);
rs = pstmt.executeQuery();
if(rs.next())
{
stateCode = rs.getString(1) == null ? "" : rs.getString(1);
countCode = rs.getString(2) == null ? "" : rs.getString(2);
}
rs.close();
pstmt.close();
pstmt = null;
rs = null;
sql = " select a.scheme_code "
+ " from scheme_applicability a, scheme_applicability_det b"
+ " where a.scheme_code = b.scheme_code"
+ " and a.item_code = ?"
+ " and a.app_from <= ?"
+ " and a.valid_upto >= ?"
+ " and (b.site_code = ? or b.state_code = ?)" // stateCode value not fetched
+ " and (b.site_code = ? or b.state_code = ? or b.count_code = ? )" // stateCode value not fetched
+ " and a.order_type is NULL";
//System.out.println("select scheme_code var_value.." + sql);
pstmt = conn.prepareStatement(sql);
......@@ -969,6 +987,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.setTimestamp(3,OrderDate);
pstmt.setString(4,siteCode);
pstmt.setString(5,stateCode);
pstmt.setString(6,countCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -980,6 +999,37 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
rs = null;
}//end else "NE".equalsIgnoreCase
}//end else if( ( disLink.equalsIgnoreCase("A")
String natureVal = genericUtility.getColumnValue( "nature", dom );
String sqlStr = null;
String itemCodeParent = null;
if( "F".equalsIgnoreCase( natureVal ) )
{
sqlStr = "select item_code__parent from item where item_code = ? ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
itemCodeParent = rs.getString( "item_code__parent" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( itemCodeParent == null || itemCodeParent.trim().length() == 0 || "null".equalsIgnoreCase( itemCodeParent ) )
{
errCode = "VTSCHITEM";
errString = getErrorString("item_code",errCode,userId);
break;
}
}
}//end item_code
else if (childNodeName.equalsIgnoreCase("item_ser"))
{
......@@ -1060,6 +1110,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
else if (childNodeName.startsWith("qty"))
{
//System.out.println( "Detail 2 Validation called for qty " );
String countCode = null;
itemCode = genericUtility.getColumnValue("item_code",dom);
siteCode = genericUtility.getColumnValue("site_code",dom1);
......@@ -1116,7 +1167,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
errString = getErrorString("qty_1",errCode,userId);
break;
}
sql = " select state_code "
sql = " select state_code, count_code "
+ " from customer "
+ " where cust_code = ?";
//System.out.println("select cust_code var_value.." + sql);
......@@ -1126,6 +1177,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
if(rs.next())
{
stateCode = rs.getString(1) == null ? "" : rs.getString(1);
countCode = rs.getString(2) == null ? "" : rs.getString(2);
}
rs.close();
pstmt.close();
......@@ -1137,7 +1190,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
+ " and a.order_type = ? "
+ " and a.app_from <= ?"
+ " and a.valid_upto >= ?"
+ " and (b.site_code = ? or b.state_code = ?)";
+ " and (b.site_code = ? or b.state_code = ? or b.count_code = ? )";
//System.out.println("select ITEM_SER var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
......@@ -1146,6 +1199,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.setTimestamp(4,OrderDate);
pstmt.setString(5,siteCode);
pstmt.setString(6,stateCode);
pstmt.setString(7,countCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1164,7 +1218,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
+ " and a.app_from <= ?"
+ " and a.valid_upto >=?"
+ " and (b.site_code = ?"
+ " or b.state_code = ?)";
+ " or b.state_code = ? or b.count_code = ? )";
//System.out.println("select ITEM_SER var_value.." + sql);
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
......@@ -1172,6 +1226,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
pstmt.setTimestamp(3,OrderDate);
pstmt.setString(4,siteCode);
pstmt.setString(5,stateCode);
pstmt.setString(6,countCode);
rs = pstmt.executeQuery();
if(rs.next())
{
......@@ -1314,6 +1369,478 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
}
}
}
//validation as given by jasmina on 130310-DI89SUN240
String natureVal = genericUtility.getColumnValue( "nature", dom );
if( "F".equalsIgnoreCase( natureVal ) )
{
String stateCd = null, browItemCode = null, itemCodeParentCur = null;
String itemCodeParent = null, colname = null;
double qtyper = 0.0, batqty = 0.0, appMinQty = 0.0, appMaxQty = 0.0, minqty = 0.0, freeQty = 0.0, totChargeQty = 0.0;
double totFreeQty = 0.0;
double chargrQty = 0.0, prvChargeQty = 0.0, unconfirmChargeQty = 0.0;
double mqty = 0.0, unconfirmFreeQty = 0.0, prvFreeQty = 0.0;
double qtyVal = 0.0;
int curLineno;
Timestamp appfromDate = null, validuptoDate = null, tranDateTs = null;
String curscheme = null, sqlStr = null;
String applyCustList = null;
String noapplyCustList = null, applicableordtypes = null, tranDateStr = null;
String[] token;
String prevscheme = null, applyCust = null;
String custSchemeCode = null, noapplyCust = null;
int llRow = 0, llSchcnt = 0, llCnt = 0, i = 0;
boolean proceed;
PreparedStatement pstmt1 = null;
//ResultSet rs1;
itemCode = genericUtility.getColumnValue( "item_code", dom );
siteCode = genericUtility.getColumnValue( "site_code", dom1 );
custCode = genericUtility.getColumnValue( "cust_code", dom1 );
tranDateStr = genericUtility.getColumnValue( "order_date", dom1 );
tranDateTs = Timestamp.valueOf(genericUtility.getValidDateString( tranDateStr, genericUtility.getApplDateFormat(), genericUtility.getDBDateFormat()) + " 00:00:00.0");
orderType = genericUtility.getColumnValue( "order_type", dom1 );
tranId = genericUtility.getColumnValue( "tran_id", dom );
//scheme define on groups of items
sqlStr = " select item_code__parent item_code__parent "
+" from item "
+" where item_code = ? "//:ls_item_code
+" and item_code__parent is not null ";
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, itemCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
itemCodeParent = rs.getString( "item_code__parent" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( itemCodeParent != null && itemCodeParent.trim().length() > 0 )
{
sqlStr = " select state_code, count_code "
//into :mstate_cd, :ls_count_code
+" from customer where cust_code = ? "; //:ls_cust_code ;
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, custCode );
rs = pstmt.executeQuery();
if( rs.next() )
{
stateCd = rs.getString( "state_code" );
countCode = rs.getString( "count_code" );
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
orderType = getAbsString( orderType );
siteCode = getAbsString( siteCode );
stateCd = getAbsString( stateCd );
countCode = getAbsString( countCode );
sqlStr = " select a.scheme_code "
+" from scheme_applicability a, "
+" scheme_applicability_det b"
+" where a.scheme_code = b.scheme_code"
+" and a.item_code = ? " //'" + ls_item_code__parent + "'" + &
+" and a.app_from <= ? " // + &
+" and a.valid_upto >= ? " // + &
+" and (b.site_code = ? " //'" + ls_site_code + "'" + &
+" or b.state_code = ? " //'" + mstate_cd + "'" + &
+" or b.count_code = ? ) "; // '" + ls_count_code + "')"
pstmt = conn.prepareStatement( sqlStr );
pstmt.setString( 1, itemCodeParent );
pstmt.setTimestamp( 2, tranDateTs );
pstmt.setTimestamp( 3, tranDateTs );
pstmt.setString( 4, siteCode );
pstmt.setString( 5, stateCd );
pstmt.setString( 6, countCode );
rs = pstmt.executeQuery();
while( rs.next() )
{
curscheme = rs.getString( "scheme_code" );
sql = " select (case when apply_cust_list is null then ' ' else apply_cust_list end) apply_cust_list , "
+" (case when noapply_cust_list is null then ' ' else noapply_cust_list end) noapply_cust_list, "
+" order_type "
//into :ls_apply_cust_list,
//:ls_noapply_cust_list,
//:ls_applicableordtypes
+" from scheme_applicability "
+" where scheme_code = ? "; //:ls_curscheme;
pstmt1 = conn.prepareStatement( sql );
pstmt1.setString( 1, curscheme );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
applyCustList = rs1.getString( "apply_cust_list" );
noapplyCustList = rs1.getString( "noapply_cust_list" );
applicableordtypes = rs1.getString( "order_type" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if( "NE".equalsIgnoreCase( orderType.trim() ) && ( applicableordtypes == null || applicableordtypes.trim().length() == 0 ) )
{
continue;
}
else if( applicableordtypes != null && applicableordtypes.trim().length() > 0 )
{
proceed = false;
token = applicableordtypes.split( "," ); // f_get_token(ls_applicableordtypes,',')
for( int tokenCtr = 0; tokenCtr < token.length; tokenCtr++ )
{
if( orderType.trim().equalsIgnoreCase( token[ tokenCtr ] ) )
{
proceed = true;
break;
}
}
if( !proceed )
{
break;
}
}
//applicable customer
prevscheme = schemeCode;
schemeCode = curscheme;
if( applyCustList != null && applyCustList.trim().length() > 0 )
{
schemeCode = null;
token = applyCustList.split( "," );
for( int tokenCtr = 0; tokenCtr < token.length; tokenCtr++ )
{
if( custCode.trim().equalsIgnoreCase( token[ tokenCtr ] ) )
{
schemeCode = curscheme;
custSchemeCode = curscheme;
break;
}
}
}
//non-applicable customer
token = noapplyCustList.split( "," );
for( int tokenCtr = 0; tokenCtr < token.length; tokenCtr++ )
{
if( custCode.trim().equalsIgnoreCase( token[ tokenCtr ] ) )
{
schemeCode = null;
break;
}
}
if( schemeCode != null && schemeCode.trim().length() > 0 )
{
llSchcnt++;
}
else if( llSchcnt == 1 )
{
schemeCode = prevscheme;
}
}
rs.close();
rs = null;
pstmt.close();
pstmt = null;
if( llSchcnt == 0 )
{
errCode = "VTFREEQTY"; //Scheme is not applicable for the entered item code
errString = getErrorString( childNodeName, errCode, userId );
break;
}
else if( llSchcnt > 1 )
{
errCode = "VTITEM10"; //Item cannot have more than one scheme applicable for same period.
errString = getErrorString( childNodeName, errCode, userId );
break;
}else if( custSchemeCode != null && custSchemeCode.trim().length() > 0 )
{
schemeCode = custSchemeCode;
}
sqlStr = "select app_from, valid_upto "//into :ldt_appfrom, :ldt_validupto
+" from scheme_applicability "
+" where scheme_code = ? "; //:ls_scheme_code ;
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, schemeCode );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
appfromDate = rs1.getTimestamp( "app_from" );
validuptoDate = rs1.getTimestamp( "valid_upto" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
//to find out total charge qty
sqlStr = "select ( case when tot_charge_qty is null then 0 else tot_charge_qty end ) tot_charge_qty, "
+" ( case when tot_free_qty is null then 0 else tot_free_qty end ) tot_free_qty "
+" from prd_scheme_trace "
+" where site_code= ? " //:ls_site_code
+" and cust_code = ? " //:ls_cust_code
+" and item_code = ? " //:ls_item_code__parent
+" and scheme_code= ? " //:ls_scheme_code
+" and ? between eff_from and valid_upto ";
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, siteCode );
pstmt1.setString( 2, custCode );
pstmt1.setString( 3, itemCodeParent );
pstmt1.setString( 4, schemeCode );
pstmt1.setTimestamp( 5, tranDateTs );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
totChargeQty = rs1.getDouble( "tot_charge_qty" );
totFreeQty = rs1.getDouble( "tot_free_qty" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
minqty = 0;
//tO find out UNconfirmed charge qty
sqlStr = " select sum(case when nature ='C' then (qty_1+qty_2+qty_3+qty_4+qty_5+qty_6+qty_7+qty_8+qty_9+qty_10+qty_11+qty_12) else 0 end) unconfirm_charge_qty, "
+" sum(case when nature ='F' then (qty_1+qty_2+qty_3+qty_4+qty_5+qty_6+qty_7+qty_8+qty_9+qty_10+qty_11+qty_12) else 0 end) unconfirm_free_qty "
//into :lc_unconfirm_charge_qty , :lc_unconfirm_free_qty
+" from sordform a, sordformdet b "
+" where a.tran_id = b.tran_id "
+" and a.tran_id <> ? " //:ls_tran_id "
+" and a.site_code = ? " //:ls_site_code "
+" and a.cust_code = ? " //:ls_cust_code "
+" and a.order_date between ? and ? " // :ldt_appfrom and :ldt_validupto
+" and b.item_code in (select item_code from item where item_code__parent = ? ) " //:ls_item_code__parent) "
+" and (case when a.status is null then 'N' else a.status end )= 'N' "
+" and b.nature in ('C' ,'F') ";;
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, tranId );
pstmt1.setString( 2, siteCode );
pstmt1.setString( 3, custCode );
pstmt1.setTimestamp( 4, appfromDate );
pstmt1.setTimestamp( 5, validuptoDate );
pstmt1.setString( 6, itemCodeParent );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
unconfirmChargeQty = rs1.getDouble( "unconfirm_charge_qty" );
unconfirmFreeQty = rs1.getDouble( "unconfirm_free_qty" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
//if isnull(lc_unconfirm_charge_qty) then lc_unconfirm_charge_qty = 0
//if isnull(lc_unconfirm_free_qty) then lc_unconfirm_free_qty = 0
//to find out charge qty in current transction
String curLinenoStr = getNumString( genericUtility.getColumnValue( "line_no", dom ) );
curLineno = Integer.parseInt( curLinenoStr );
prvChargeQty = 0;
prvFreeQty = 0;
NodeList detNodeList = dom2.getElementsByTagName("Detail2");
Node currNode = null;
int deNodeListLength = detNodeList.getLength();
for(int detCtr = 0; detCtr < deNodeListLength; detCtr++)
{
currNode = detNodeList.item( detCtr );
int lineNoCurr = Integer.parseInt( getNumString( genericUtility.getColumnValueFromNode("line_no", currNode) ) );
String nature = getAbsString( genericUtility.getColumnValueFromNode( "nature", currNode ) );
browItemCode = getAbsString( genericUtility.getColumnValueFromNode( "item_code", currNode ) );
if( curLineno != lineNoCurr )
{
llCnt = 0;
sqlStr = " select item_code__parent " //into :ls_item_code__parent_cur
+" from item "
+" where item_code = ? "; //:ls_brow_item_code ;
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, browItemCode );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
itemCodeParentCur = rs1.getString( "item_code__parent" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if( itemCodeParentCur != null && itemCodeParent != null && itemCodeParentCur.trim().equalsIgnoreCase( itemCodeParent.trim() ) )
{
double totalQty = 0;
String fldQtyStr = "0";
for( int fldCnt = 1; fldCnt <=12; fldCnt++ )
{
fldQtyStr = getNumString( genericUtility.getColumnValueFromNode( "qty_" + fldCnt, currNode ) );
totalQty = totalQty + Double.parseDouble( fldQtyStr );
}
if( "F".equalsIgnoreCase( nature ) )
{
prvFreeQty = totalQty;
}
else
{
prvChargeQty = totalQty;
}
}
}
} // end for
//Total cahrge qty = unconfiem charge qty + charge qty in current transaction + total charge qty in invoice
chargrQty = unconfirmChargeQty + prvChargeQty + totChargeQty;
//quantity slab
sqlStr = " Select count(1) ll_cnt " //into :ll_cnt
+" From bom "
+" Where bom_code = ? " //:ls_scheme_code
+" And ? between case when min_qty is null then 0 else min_qty end And "
+" case when max_qty is null then 0 else max_qty end ";
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, schemeCode );
pstmt1.setDouble( 2, chargrQty );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
llCnt = rs1.getInt( "ll_cnt" );
}
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
if( llCnt == 0 )
{
errCode = "VTFREEQTY2"; //Chargeable quantity of group of items not eligible for the free quantity
errString = getErrorString( childNodeName, errCode, userId );
break;
}
//Free quantity validation
sqlStr = " select bom.batch_qty lc_batqty, bomdet.qty_per lc_qtyper, "
+" bomdet.min_qty lc_minqty, bomdet.app_min_qty lc_app_min_qty, "
+" bomdet.app_max_qty lc_app_max_qty "
//into :lc_batqty , :lc_qtyper ,
// :lc_minqty , :lc_app_min_qty , :lc_app_max_qty
+" from bom, bomdet "
+" where bom.bom_code = bomdet.bom_code and "
+" bomdet.bom_code = ? "// :ls_scheme_code and
+" and bomdet.nature = 'F' ";
pstmt1 = conn.prepareStatement( sqlStr );
pstmt1.setString( 1, schemeCode );
rs1 = pstmt1.executeQuery();
if( rs1.next() )
{
batqty = rs1.getDouble( "lc_batqty" );
qtyper = rs1.getDouble( "lc_qtyper" );
minqty = rs1.getDouble( "lc_minqty" );
appMinQty = rs1.getDouble( "lc_app_min_qty" );
appMaxQty = rs1.getDouble( "lc_app_max_qty" );
}
else
{
rs1.close();
rs1 = null;
pstmt1.close();
pstmt1 = null;
errCode = "VTFREEQTY"; //Scheme is not applicable for the entered item code
errString = getErrorString( childNodeName, errCode, userId );
break;
}
if( rs1 != null )
rs1.close();
rs1 = null;
if( pstmt1 != null )
pstmt1.close();
pstmt1 = null;
if( chargrQty >= appMinQty && chargrQty <= appMaxQty )
{
freeQty = ( (int)( chargrQty / batqty) ) * qtyper; //Calculating free qty based on slab
}
else
{
freeQty = 0;
}
qtyVal = 0;
mqty = 0;
for( int fldCnt = 1; fldCnt <= 12; fldCnt++ )
{
colname = "qty_" + fldCnt;
qtyVal = Double.parseDouble( getNumString( genericUtility.getColumnValue( colname, dom ) ) );
mqty = mqty + qtyVal;
}
//(Entred free qty + total given free qty + unconfirmed free qty) > Eligible free qty
if( ( mqty + totFreeQty + unconfirmFreeQty + prvFreeQty ) > ( freeQty ) )
{
errCode = "VTFREEQTY1"; //Entered free quantity is greater than scheme's free quantity
errString = getErrorString( childNodeName, errCode, userId );
break;
}
}
}
//end
} //end qty_1
else if ( childNodeName.equalsIgnoreCase("totqty") )
{
......@@ -2420,6 +2947,8 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
valueXmlString.append("<tax_type protect =\"1\">").append("</tax_type>");
valueXmlString.append("<site_code__ship protect =\"1\">").append(siteCode).append("</site_code__ship>");
valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>");
System.out.println( "In itmDefault nature " );
valueXmlString.append( "<nature>" + "C" + "</nature>" );
//valueXmlString.append("<site_code protect =\"1\">").append(siteCode).append("</site_code>");
//valueXmlString.append("<site_descr>").append(siteDescr).append("</site_descr>");
} // end itm_default
......@@ -2429,7 +2958,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
noOfSchedule = NoOfSchedule(maxScheduleNo,dom,dom1);
//valueXmlString.append(getSchDatesString(maxScheduleNo, dom1));
//siteCode = genericUtility.getColumnValue("site_code",dom1);
siteCode = genericUtility.getColumnValue("site_code",dom1);
//valueXmlString.append("<site_code__ship protect =\"1\">").append(siteCode).append("</site_code__ship>");
//valueXmlString.append("<site_code protect =\"1\">").append("</site_code>");
//System.out.println("maxScheduleNo.."+maxScheduleNo);
......@@ -2670,6 +3199,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
*/
itemCode = genericUtility.getColumnValue("item_code",dom);
//System.out.println("itemCode......"+itemCode);
siteCode = genericUtility.getColumnValue("site_code",dom1);
custCode = genericUtility.getColumnValue("cust_code",dom1);
//System.out.println("custCode ......"+custCode );
orderDate = genericUtility.getColumnValue("order_date",dom1);
......@@ -2979,6 +3509,7 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
//ITEM_CODE
else if(currentColumn.trim().equalsIgnoreCase("item_code"))
{
String countCd = null;
PreparedStatement scmPStmt = null;
ResultSet scmRs = null;
itemCode = genericUtility.getColumnValue("item_code",dom);
......@@ -3153,13 +3684,14 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
valueXmlString.append("<curr_stk>").append("<![CDATA["+lcAvailStk+"]]>").append("</curr_stk>");
schemeCode = "";
custCd = genericUtility.getColumnValue("cust_code",dom1);
sql="select state_code from customer where cust_code = ? ";
sql="select state_code, count_code from customer where cust_code = ? ";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,custCd);
rs = pstmt.executeQuery();
if(rs.next())
{
stateCd = rs.getString("state_code") == null ? "" : rs.getString("state_code");
countCd = rs.getString("count_code") == null ? "" : rs.getString("count_code");
}
rs.close();
pstmt.close();
......@@ -3206,13 +3738,14 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
+" and a.app_from <= ? "
+" and a.valid_upto >= ? "
+" and (b.site_code = ?"
+" or b.state_code = ?)";
+" or b.state_code = ? or b.count_code = ? )";
pstmt= conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
pstmt.setTimestamp(2,tranDate);
pstmt.setTimestamp(3,tranDate);
pstmt.setString(4,siteCode);
pstmt.setString(5,stateCd);
pstmt.setString(6,countCd);
rs = pstmt.executeQuery();
while(rs.next())
{
......@@ -3966,6 +4499,56 @@ public class SOrderForm extends ValidatorEJB implements SOrderFormLocal, SOrderF
}
return listType;
}
private double getTotAmtForRep( Document dom ) throws Exception
{
NodeList parentNodeList=null;
NodeList childList = null;
Node parentNode=null;
Node childNode = null;
double totAmount = 0;
double quantity = 0;
String qtyStr = "";
String rateStr = "";
double rate = 0;
String retFlag = null;
try
{
GenericUtility genericUtility = GenericUtility.getInstance();
parentNodeList = dom.getElementsByTagName("Detail2");
int childNodeListLength = parentNodeList.getLength();
for(int ctr = 0; ctr < childNodeListLength; ctr++)
{
System.out.println("ctr ::"+ctr);
parentNode = parentNodeList.item(ctr);
qtyStr = genericUtility.getColumnValueFromNode("quantity", parentNode);
retFlag = genericUtility.getColumnValueFromNode("ret_rep_flag", parentNode);
quantity = Double.parseDouble( qtyStr == null || qtyStr.trim().length() == 0 || "null".equalsIgnoreCase( qtyStr ) ? "0" : qtyStr.trim() );
rateStr = genericUtility.getColumnValueFromNode("rate", parentNode);
rate = Double.parseDouble( rateStr == null || rateStr.trim().length() == 0 || "null".equalsIgnoreCase( rateStr ) ? "0" : rateStr.trim() );
if( retFlag != null && "P".equalsIgnoreCase( retFlag.trim() ) )
{
totAmount = totAmount + (quantity * rate);
}
} // end for
}//END TRY
catch(Exception e)
{
System.out.println("Exception ::"+e);
e.printStackTrace();
}
return totAmount;
}
private static String getAbsString( String str )
{
return ( str == null || str.trim().length() == 0 || "null".equalsIgnoreCase( str.trim() ) ? "" : str.trim() );
}
private static String getNumString( String iValStr )
{
return ( iValStr == null || iValStr.trim().length() == 0 || "null".equals( iValStr.trim() ) ? "0" : iValStr.trim() );
}
/*private String getSchDatesString(int maxScheduleNo, Document dom) throws Exception
{
String sch_[] = new String[maxScheduleNo + 1];
......
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