Commit 5a63a4ca authored by ngadkari's avatar ngadkari

changes for scheme item where quantity will split invoice trace wise

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@205419 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 57bd48e5
......@@ -799,8 +799,8 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
{
Connection conn = null;
Statement stmt = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
PreparedStatement pstmt = null,pstmt2 = null;
ResultSet rs = null,rs2 = null;
String sql = "";
String errCode = "";
String errString = "";
......@@ -830,9 +830,9 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
java.sql.Date expDate = null;
java.sql.Date mfgDate = null;
int minShelfLife = 0;
int detCnt =0,cnt=0;
int detCnt =0,cnt=0,lotCnt=0;
double totStk =0.0;
double inputQty = 0.0;
double inputQty = 0.0,lotQty=0;
double qty =0;
double qtyStk = 0,invoiceQty=0,adjQty=0,rate=0;
DistCommon distCommon = null;
......@@ -915,7 +915,7 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
docKey = checkNull(rs.getString("DOC_KEY"));
rate = rs.getDouble("EFF_COST");
cnt=0;
if (docKey.trim().length() > 0) {
/*if (docKey.trim().length() > 0) {
String[] docKeyStr = docKey.split(",");
......@@ -927,8 +927,69 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
}
}
System.out.println( "cnt :: " + cnt );
if(cnt==5)
if(cnt==5)*/
//ADDED BY NANDKUMAR GADKARI ON 14/08/19----------------------START-------------------
System.out.println( " docKey.indexOf(invoiceId)" + docKey.indexOf(invoiceId) );
if( docKey.indexOf(invoiceId) != -1)
{
sql = "select count(*) from invoice_trace where invoice_id = ? and item_code = ? and lot_no = ? ";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, invoiceId);
pstmt2.setString(2, itemCode);
pstmt2.setString(3, lotNo);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
lotCnt = rs2.getInt(1);
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
if(lotCnt > 1 && adjQty == 0)
{
sql = "select quantity from invoice_trace where invoice_id = ? and item_code = ? and lot_no = ? ";
pstmt2 = conn.prepareStatement(sql);
pstmt2.setString(1, invoiceId);
pstmt2.setString(2, itemCode);
pstmt2.setString(3, lotNo);
rs2 = pstmt2.executeQuery();
while (rs2.next())
{
lotQty = rs2.getDouble(1);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(itemCode).append("]]>").append("</item_code>\r\n");
if(qty > lotQty)
{
valueXmlString.append("<quantity>").append("<![CDATA[").append(lotQty).append("]]>").append("</quantity>\r\n");
}
else {
valueXmlString.append("<quantity>").append("<![CDATA[").append(qty).append("]]>").append("</quantity>\r\n");
}
valueXmlString.append("<lot_no>").append("<![CDATA[").append(lotNo).append("]]>").append("</lot_no>\r\n");
valueXmlString.append("<invoice_ref>").append("<![CDATA[").append(invoiceId).append("]]>").append("</invoice_ref>\r\n");
valueXmlString.append("</Detail>\r\n");
qty=qty-lotQty;
if(qty <= 0)
{
break;
}
}
pstmt2.close();
pstmt2 = null;
rs2.close();
rs2 = null;
}
else
{
//ADDED BY NANDKUMAR GADKARI ON 14/08/19-----------------------END--------------------
inputQty=invoiceQty-adjQty;
System.out.println( "inputQty :: " + inputQty);System.out.println( "qty :: " + qty);
if(inputQty > 0)
......@@ -948,6 +1009,7 @@ public class SalesReturnAct extends ActionHandlerEJB implements SalesReturnActLo
qty=qty-inputQty;
}
}
}
if(qty <= 0)
{
break;
......
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