Commit 9fa059ca authored by manohar's avatar manohar

Bug fixing - Partial POD checking logic changed, in case POD not exists for...

Bug fixing - Partial POD checking logic changed, in case POD not exists for all the invoice_trace then consider ads partial, also if in POD detail for any of the line the resale quantity less than invoice_trace quantity then consider as partial


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@97279 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 701d1703
......@@ -1578,13 +1578,84 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
PreparedStatement pstmt2 = null, pstmt1 = null;
ResultSet rs2 = null, rs1 = null;
String sql1 = "", tranID = "", confirmed = "";
int lineNoTraceL = 0, count = 1;
int lineNoTraceL = 0, count = 1,invTraceCount = 0, podCount = 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 wf_status <> ?";
//sql1 = "select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and wf_status <> ?"; // 12/02/15 manoharan commented and moved below
try
{
// 12/02/15 manoharan check whether all invoice_trace line are not existing is pod
sql1 = "select count(1) from invoice_trace where invoice_id = ?";
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
invTraceCount = rs2.getInt(1);
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
sql1 = "select count( distinct d.line_no__trace) from spl_sales_por_det d, spl_sales_por_hdr h "
+ " where h.tran_id = d.tran_id "
+ " and h.invoice_id = ?";
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
rs2 = pstmt2.executeQuery();
if (rs2.next())
{
podCount = rs2.getInt(1);
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
System.out.println("IN isPartialyInvoiceChk invTraceCount [" + invTraceCount + "] podCount [" + podCount + "]");
if (podCount < invTraceCount)
{
return true; // Pod for all invoice_trace is not entered
}
sql1 = "select d.line_no__trace, d.quantity__inv,sum(d.quantity__resale) from spl_sales_por_det d, spl_sales_por_hdr h "
+ " where h.tran_id = d.tran_id "
+ " and h.invoice_id = ? "
+ " group by d.line_no__trace, d.quantity__inv" ;
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
rs2 = pstmt2.executeQuery();
invTraceCount = 0;
while (rs2.next())
{
if (rs2.getDouble(2) > rs2.getDouble(3))
{
invTraceCount++;
break;
}
}
rs2.close();
rs2 = null;
pstmt2.close();
pstmt2 = null;
if (invTraceCount > 0)
{
return true; // pod quantity is < invoice quantity for some existing POD
}
System.out.println("IN isPartialyInvoiceChk invTraceCount [" + invTraceCount + "] podCount [" + podCount + "]");
if (podCount < invTraceCount)
{
return true; // Pod for all invoice_trace is not entered
}
// end 12/02/15 manoharan check whether all invoice_trace line are not existing is pod
// 12/02/15 manoharan moved from above
sql1 = "select tran_id,confirmed from spl_sales_por_hdr where invoice_id = ? and wf_status <> ?";
pstmt2 = conn.prepareStatement(sql1);
pstmt2.setString(1, invID);
pstmt2.setString(2, "R");
......@@ -1596,7 +1667,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
tranID = tranID == null ? "" : tranID.trim();
confirmed = confirmed == null ? "" : confirmed.trim();
System.out.println("tran id counter ------->" + count);
System.out.println("In isPartialyInvoiceChk tran id counter ------->" + count);
if (tranID.length() > 0 && confirmed.equalsIgnoreCase("Y"))
{
count++;
......@@ -1611,7 +1682,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
lineNoTraceL = rs1.getInt(1);
qtyInv = rs1.getDouble(3);
podQty = rs1.getDouble(4);
System.out.println("Line no ---->" + lineNoTraceL + " qtyInv-->>" + qtyInv + " podQty->>" + podQty);
System.out.println("IN isPartialyInvoiceChk lineNoTraceL [" + lineNoTraceL + "] qtyInv [" + qtyInv + "] podQty [" + podQty + "]");
totalPodQty = totalPodQty + podQty;
if (podQty < qtyInv)
{
......@@ -1619,10 +1690,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
actaulInvQty = qtyInv;
lineNoTrace = lineNoTraceL;
remainQty = actaulInvQty - partialQty;
System.out.println("partialQty--->>[" + partialQty + "]");
System.out.println("actaulInvQty--->>[" + actaulInvQty + "]");
System.out.println("remainQty--->>[" + remainQty + "]");
System.out.println("lineNoTrace--->>[" + lineNoTrace + "]");
System.out.println("In isPartialyInvoiceChk partialQty [" + partialQty + "] actaulInvQty [" + actaulInvQty +"] remainQty [" + remainQty + "] lineNoTrace [" + lineNoTrace + "]");
return true;
}
}
......
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