Commit 799b9447 authored by vdhoble's avatar vdhoble

changes for purchase voucher generation


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@99100 ce508802-f39f-4f6c-b175-0d175dae99d5
parent e09b3ff5
...@@ -60,7 +60,7 @@ public class PorcpVouchCreateSch implements Schedule ...@@ -60,7 +60,7 @@ public class PorcpVouchCreateSch implements Schedule
String queryString=""; String queryString="";
String siteCode=""; String siteCode="";
String sql1 ="",tranidRcp = ""; String sql1 ="",tranidRcp = "";
String voucherId = ""; String voucherId = "",itemCode = "",lotNo = "";
ArrayList tranidBefore = new ArrayList(); ArrayList tranidBefore = new ArrayList();
String valuexmlString=""; String valuexmlString="";
String retString=""; String retString="";
...@@ -154,12 +154,29 @@ public class PorcpVouchCreateSch implements Schedule ...@@ -154,12 +154,29 @@ public class PorcpVouchCreateSch implements Schedule
qtyRejected=0; qtyRejected=0;
qtyReturned=0; qtyReturned=0;
qtyReceived=0; qtyReceived=0;
pstmt2=conn.prepareStatement("select a.item_code,a.lot_no ,case when a.quantity__stduom is null then 0 else a.quantity__stduom end as qtyRcvd "
+ " from porcpdet a, porcp b "
+ " where a.tran_id = b.tran_id "
+ " and b.tran_id = '"+tranidRcp+"' "
+ " and b.confirmed = 'Y'");
rs2=pstmt2.executeQuery();
while(rs2.next())
{
itemCode = rs2.getString("item_code");
lotNo = rs2.getString("lot_no");
qtyReceived=rs2.getDouble("qtyRcvd");
pstmt1=conn.prepareStatement("select sum((case when qty_passed is null" pstmt1=conn.prepareStatement("select sum((case when qty_passed is null"
+ " then 0 else qty_passed end ) +" + " then 0 else qty_passed end ) +"
+ " (case when qty_sample is null then 0 else qty_sample end )) qty_passed," + " (case when qty_sample is null then 0 else qty_sample end )) qty_passed,"
+ " sum(case when qty_rejected is null then 0 else qty_rejected end ) qty_rejected " + " sum(case when qty_rejected is null then 0 else qty_rejected end ) qty_rejected "
+ " from qc_order where porcp_no = ? "); + " from qc_order where porcp_no = ? and item_code = ? and lot_no = ? ");
pstmt1.setString(1,tranidRcp); pstmt1.setString(1,tranidRcp);
pstmt1.setString(2,itemCode);
pstmt1.setString(3,lotNo);
rs1=pstmt1.executeQuery(); rs1=pstmt1.executeQuery();
if(rs1.next()) if(rs1.next())
{ {
...@@ -169,37 +186,40 @@ public class PorcpVouchCreateSch implements Schedule ...@@ -169,37 +186,40 @@ public class PorcpVouchCreateSch implements Schedule
} }
rs1.close(); rs1.close();
pstmt1.close(); pstmt1.close();
pstmt2=conn.prepareStatement("select sum(case when a.quantity__stduom is null then"
+ " 0 else a.quantity__stduom end ) from porcpdet a, porcp b "
pstmt1=conn.prepareStatement("select case when a.quantity__stduom is null then"
+ " 0 else a.quantity__stduom end as qtyRetrn from porcpdet a, porcp b "
+ " where a.tran_id = b.tran_id " + " where a.tran_id = b.tran_id "
+ " and b.tran_ser = 'P-RET' " + " and b.tran_ser = 'P-RET' "
+ " and b.confirmed = 'Y' " + " and b.confirmed = 'Y' "
+ " and b.tran_id__ref = '"+tranidRcp+"'"); + " and b.tran_id__ref = '"+tranidRcp+"' and a.item_code = ? and a.lot_no = ? ");
rs2=pstmt2.executeQuery();
if(rs2.next()) pstmt1.setString(1,itemCode);
pstmt1.setString(2,lotNo);
rs1=pstmt1.executeQuery();
if(rs1.next())
{ {
qtyReturned=rs2.getDouble(1); qtyReturned=rs1.getDouble("qtyRetrn");
} }
rs2.close(); rs1.close();
pstmt2.close(); pstmt1.close();
pstmt2=conn.prepareStatement("select sum(case when a.quantity__stduom is null then 0 else a.quantity__stduom end)"
+ " from porcpdet a, porcp b "
+ " where a.tran_id = b.tran_id "
+ " and b.tran_id = '"+tranidRcp+"' "
+ " and b.confirmed = 'Y'");;
rs2=pstmt2.executeQuery();
if(rs2.next())
if(qtyPassed != 0)
{ {
qtyReceived=rs2.getDouble(1);
}
rs2.close();
pstmt2.close();
if ((qtyReceived - qtyReturned) != qtyPassed ) if ((qtyReceived - qtyReturned) != qtyPassed )
{ {
continue; continue;
} }
}
}
rs2.close();
pstmt2.close();
} }
...@@ -266,8 +286,8 @@ public class PorcpVouchCreateSch implements Schedule ...@@ -266,8 +286,8 @@ public class PorcpVouchCreateSch implements Schedule
conn.commit(); conn.commit();
conn.close(); conn.close();
conn=null; conn=null;
pstmt.close(); /*pstmt.close();
pstmt=null; pstmt=null;*/
} }
try try
{ {
......
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