Commit fa2c3a5d authored by skale's avatar skale

Changes done for inserting tax_chap field.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@91237 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c2533b91
......@@ -675,6 +675,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
String distOrder = "";
String tranType = "";
String priceList = "", retUpdt = "";
String taxChap = "";
int lineNo = 0;
boolean flag = false;
StringBuffer insDstordBuff = new StringBuffer();
......@@ -700,14 +701,14 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
String insertDtl = "Insert into distorder_det ( "
+" dist_order, line_no, item_code, qty_order, qty_confirm,"
+" qty_received, qty_shipped, due_date, tax_class, tax_env,"
+" unit"
+" unit, tax_chap"
// +" rate, qty_return, rate__clg, discount, tot_amt, tax_amt, net_amt, over_ship_perc, conv__qty__alt, qty_order__alt, quantity__fc "
+" ) Values("
+" ?, ?, ?, ?, ?,"
+" ?, ?, ?, ?, ?,"
// +" ?, ?, ?, ?, ?,"
// +" ?, ?, ?, ?, ?,"
+" ?)";
+" ?, ?)";
insertHdrPstmt = conn.prepareStatement( insertHdr );
insertDtlPstmt = conn.prepareStatement( insertDtl );
......@@ -805,6 +806,8 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
{
System.out.println("Inside distDemandType.equalsI.Inside if.....");
reqQty = Double.parseDouble(procData.destSiteQtyArr[j]);
if( reqQty > 0 )
{
destSite = siteArr[j];
sql = "select min(due_date) from dist_demand "
+" where site_code__source = ? "
......@@ -832,6 +835,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
taxEnv = dstCmn.setPlistTaxClassEnv(sourceCode, destSite, hdrItem, tranType, " ", "TAX_ENV", conn);
taxClass = dstCmn.setPlistTaxClassEnv(sourceCode, destSite, hdrItem, tranType, " ", "TAX_CLASS", conn);
distOrder = generateTranId("W_DIST_ORDER", getCurrdateInAppFormat(), loginSite, loginCode, tranType );
taxChap = getTaxChap( destSite, hdrItem, conn );
//distOrder = "00010000"+z;
//z++;
insertHdrPstmt.setString( 1, distOrder);
......@@ -871,6 +875,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
insertDtlPstmt.setString( 9, taxClass );
insertDtlPstmt.setString( 10, taxEnv );
insertDtlPstmt.setString( 11, unit );
insertDtlPstmt.setString( 12, taxChap );
insertDtlPstmt.addBatch();
......@@ -879,6 +884,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
}
}
}
}
insertHdrPstmt.executeBatch();
insertDtlPstmt.executeBatch();
}
......@@ -895,21 +901,32 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
if( procData.destSiteQtyArr[i] != null && procData.destSiteQtyArr[i].trim().length() > 0 )
{
reqQty = Double.parseDouble(procData.destSiteQtyArr[i]);
if( reqQty > 0 )
{
destSite = siteArr[i];
sourceCode = procData.srcCode;
lineNo = lineNo + 1;
System.out.println("destSite is ************==>["+destSite+"]");
System.out.println("hdrItem is ************==>["+hdrItem+"]");
if( distDemandType.equals("SF") )
{
taxEnv = dstCmn.setPlistTaxClassEnv(hdrItem, destSite, sourceCode, tranType, " ", "TAX_ENV", conn);
taxClass = dstCmn.setPlistTaxClassEnv(hdrItem, destSite, sourceCode, tranType, " ", "TAX_CLASS", conn);
taxChap = getTaxChap( hdrItem, sourceCode, conn );
}
else
{
taxEnv = dstCmn.setPlistTaxClassEnv(destSite, hdrItem, sourceCode, tranType, " ", "TAX_ENV", conn);
taxClass = dstCmn.setPlistTaxClassEnv(destSite, hdrItem, sourceCode, tranType, " ", "TAX_CLASS", conn);
taxChap = getTaxChap( destSite, sourceCode, conn );
}
System.out.println("taxEnv is ************==>["+taxEnv+"]");
if( distDemandType.equals("SF") )
/* if( distDemandType.equals("SF") )
taxClass = dstCmn.setPlistTaxClassEnv(hdrItem, destSite, sourceCode, tranType, " ", "TAX_CLASS", conn);
else
taxClass = dstCmn.setPlistTaxClassEnv(destSite, hdrItem, sourceCode, tranType, " ", "TAX_CLASS", conn);
taxClass = dstCmn.setPlistTaxClassEnv(destSite, hdrItem, sourceCode, tranType, " ", "TAX_CLASS", conn); */
System.out.println("taxClass is ************==>["+taxClass+"]");
System.out.println("taxChap is ************==>["+taxChap+"]");
sql = "select min(due_date) from dist_demand "
+" where site_code__source = ? "
+" and site_code = ? and"
......@@ -1005,6 +1022,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
insertDtlPstmt.setString( 9, taxClass );
insertDtlPstmt.setString( 10, taxEnv );
insertDtlPstmt.setString( 11, unit );
insertDtlPstmt.setString( 12, taxChap );
int t = insertDtlPstmt.executeUpdate();
//insertDtlPstmt.addBatch();
......@@ -1016,6 +1034,7 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
}
}
}
}
//insertHdrPstmt.executeBatch();
//insertDtlPstmt.executeBatch();
}
......@@ -1199,6 +1218,72 @@ public class DistDemandMatrixPrc extends ProcessEJB implements DistDemandMatrixP
}
return "";
}
private String getTaxChap( String siteCode, String itemCode, Connection conn ) throws RemoteException,ITMException
{
String sql = "";
ResultSet rs = null;
PreparedStatement pstmt = null;
String taxChap = "";
try
{
sql=" select tax_chap "
+" from siteitem "
+" where site_code = ? "
+" and item_code =? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,siteCode);
pstmt.setString(2,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
taxChap=rs.getString("tax_chap") != null ? rs.getString("tax_chap") :"";
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if(taxChap==null || taxChap.trim().length()==0)
{
sql="select tax_chap from item where item_code = ? ";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
taxChap=rs.getString("tax_chap") != null ? rs.getString("tax_chap") :"";
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
if(taxChap==null || taxChap.trim().length()==0)
{
sql="select tax_chap from itemser "
+" where item_ser IN (Select item_ser from item where item_code = ?)";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,itemCode);
rs = pstmt.executeQuery();
if(rs.next())
{
taxChap=rs.getString("tax_chap") != null ? rs.getString("tax_chap") :"";
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
}
}
}
catch( Exception e )
{
e.printStackTrace();
System.out.println("Exception ::" + e.getMessage());
throw new ITMException(e);
}
return taxChap;
}
private class getAllDataBean
{
public String itemCodeDb = "";
......
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