Commit 75f68fd4 authored by dpawar's avatar dpawar

added for sales return sql (confirmed)


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93588 ce508802-f39f-4f6c-b175-0d175dae99d5
parent a4c1a98b
......@@ -232,7 +232,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
PreparedStatement pstmt1=null;
ResultSet rs1=null;
System.out.println("invoice Id dom---->>"+str);
sreturnTranID=getNameOrDescrForCode(conn, "sreturn", "tran_id", "invoice_id", str);
sreturnTranID=getSalesReturnTranID(conn, "sreturn", "tran_id", "invoice_id", str);
sreturnTranID=sreturnTranID==null ? "" : sreturnTranID.trim();
System.out.println("sreturnTranID --------->>["+sreturnTranID+"]");
if(sreturnTranID.length() > 0)
......@@ -673,7 +673,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
private boolean isTotalAmountPodQtyGrt(Connection conn,String invID,double actualInvQty,double currentPODvalue)
{
System.out.println("---in method getTotalAmountPodQty ------invoice ID :["+invID+"]");
System.out.println("---in method getTotalAmountPodQty@@@@@@@ ------invoice ID :["+invID+"]");
PreparedStatement pstmt2 = null,pstmt1=null,pstmt3=null ;
ResultSet rs2 = null,rs1=null,rs3=null;
......@@ -681,7 +681,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
int lineNo=0,count=0;
double qtyInv=0.0,podQty=0.0,totalPodQty=0.0;
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and confirmed = ?";
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and confirmed = ? and wf_status <> 'R'";
try
{
pstmt2=conn.prepareStatement(sql1);
......@@ -710,12 +710,13 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
itemCode=rs1.getString(2);
qtyInv=rs1.getDouble(3);
podQty=rs1.getDouble(4);
System.out.println("Line no ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty);
System.out.println("Line no@@@ ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty);
sql1="";
sql1="select sum(quantity__resale) from spl_sales_por_det where item_code = ?";
sql1="select sum(quantity__resale) from spl_sales_por_det where item_code = ? and tran_id = ?";
pstmt3=conn.prepareStatement(sql1);
pstmt3.setString(1, itemCode);
pstmt3.setString(2, tranID);
rs3=pstmt3.executeQuery();
if(rs3.next())
{
......@@ -788,7 +789,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
double qtyInv=0.0,podQty=0.0,totalPodQty=0.0;
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? order by confirmed";
sql1="select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and wf_status <> 'R' order by confirmed";
try
{
pstmt2=conn.prepareStatement(sql1);
......@@ -1051,4 +1052,66 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
}
private String getSalesReturnTranID(Connection conn, String table_name, String tranID,String whrCondCol, String whrCondVal)
{
String descr = null;
if(conn!=null){
ResultSet rs=null;
PreparedStatement pstmt = null;
String sql="SELECT "+tranID+" FROM "+table_name+" WHERE "+whrCondCol+" = ? and confirmed = ?";
//select tran_id from sreturn where invoice_id = '10DS086300' and confirmed ='Y';
System.out.println("SQL in getNameOrDescrForCode method : "+sql);
try
{
pstmt = conn.prepareStatement(sql);
pstmt.setString(1,whrCondVal);
pstmt.setString(2,"Y");
rs = pstmt.executeQuery();
if(rs.next())
{
descr = rs.getString(tranID);
}
descr=descr==null ?"" :descr;
}
catch(SQLException e)
{
System.out.println("SQL Exception In getNameOrDescrForCode method of ProofOfDelivery Class : "+e.getMessage());
e.printStackTrace();
}
catch(Exception ex)
{
System.out.println("Exception In getNameOrDescrForCode method of ProofOfDelivery Class : "+ex.getMessage());
ex.printStackTrace();
}finally{
try{
if(pstmt!=null){
pstmt.close();
pstmt = null;
}
if(rs!=null){
rs.close();
rs = null;
}
}catch (SQLException se) {
se.printStackTrace();
}
}
}else{
try {
throw new SQLException("Connection passed to ProofOfDelivery.getNameOrDescrForCode() method is null");
} catch (SQLException e) {
e.printStackTrace();
}
}
return descr;
}
}
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