Commit 9f582a9e authored by dpawar's avatar dpawar

added validation for partialy changes


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@93585 ce508802-f39f-4f6c-b175-0d175dae99d5
parent beeb109e
...@@ -251,10 +251,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -251,10 +251,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if(sreturnItemCode.trim().equalsIgnoreCase(itemCodeSret)) if(sreturnItemCode.trim().equalsIgnoreCase(itemCodeSret))
{ {
qtyInvD=qtyInvD - sreturnQuantity; qtyInvD=qtyInvD - sreturnQuantity;
qtyResalD=qtyResalD+getTotalAmountPodQty(conn,str); //qtyResalD=qtyResalD+isTotalAmountPodQtyGrt(conn,str,qtyInvD);
System.out.println("Total POD qty with new entry value---------->>"+qtyResalD); System.out.println("POD qty with new entry value---------->>"+qtyResalD);
System.out.println("Actual quantity after sales return---->>["+qtyInvD+"]"); System.out.println("Actual quantity after sales return---->>["+qtyInvD+"]");
if(qtyResalD > qtyInvD) //VTSLRETER if(isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResalD)) //VTSLRETER
{ {
//Invoice quantity for item(s) is returned.Please check sales return. //Invoice quantity for item(s) is returned.Please check sales return.
errCode = "VTSLRETER"; errCode = "VTSLRETER";
...@@ -262,26 +262,16 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -262,26 +262,16 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
errFields.add( childNodeName.toLowerCase()); errFields.add( childNodeName.toLowerCase());
} }
} }
} } //end while
} }
/*if(isPartialyInvoiceChk(conn,str))
{*/
System.out.println("in isPartialyInvoiceChk condition------------ "); System.out.println("in isPartialyInvoiceChk condition------------ ");
sql1="select tran_id from spl_sales_por_hdr where invoice_id = ?"; sql1="select tran_id from spl_sales_por_hdr where invoice_id = ?";
totalInvQty=getTotalAmountPodQty(conn,str); //totalInvQty=isTotalAmountPodQtyGrt(conn,str,qtyInvD);
//totalInvQty = totalInvQty+ qtyResalD;
//}
/*else
{
System.out.println("in isPartialyInvoiceChk [else] condition------------ ");
}*/
System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD); System.out.println("qtyInvD---->> "+qtyInvD+" qtyResaleD : "+qtyResaleD);
System.out.println("Final totalInvQty ----->"+totalInvQty ); System.out.println("Final totalInvQty ----->"+totalInvQty );
if ( totalInvQty > qtyInvD) if ( isTotalAmountPodQtyGrt(conn,str,qtyInvD,qtyResalD))
{ {
System.out.println("the total qty condition true---------"); System.out.println("the total qty condition true---------");
errCode = "VTPODGRT"; errCode = "VTPODGRT";
...@@ -681,14 +671,14 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -681,14 +671,14 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
private double getTotalAmountPodQty(Connection conn,String invID) 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 ;
ResultSet rs2 = null,rs1=null;
String sql1="",tranID="",confirmed="";
int lineNo=0,count=1;
PreparedStatement pstmt2 = null,pstmt1=null,pstmt3=null ;
ResultSet rs2 = null,rs1=null,rs3=null;
String sql1="",tranID="",confirmed="",itemCode="";
int lineNo=0,count=0;
double qtyInv=0.0,podQty=0.0,totalPodQty=0.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 = ?";
...@@ -707,33 +697,57 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -707,33 +697,57 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("tran id counter ------->"+count); System.out.println("tran id counter ------->"+count);
if(tranID.length() > 0 ) if(tranID.length() > 0 )
{ {
count++;
sql1=""; sql1="";
sql1="select line_no,item_code,quantity__inv,quantity__resale from spl_sales_por_det where tran_id = ?"; sql1="select line_no,item_code,quantity__inv,quantity__resale from spl_sales_por_det where tran_id = ?";
pstmt1=conn.prepareStatement(sql1); pstmt1=conn.prepareStatement(sql1);
pstmt1.setString(1, tranID); pstmt1.setString(1, tranID);
rs1=pstmt1.executeQuery(); rs1=pstmt1.executeQuery();
while(rs1.next()) while(rs1.next())
{ {
lineNo=rs1.getInt(1); lineNo=rs1.getInt(1);
itemCode=rs1.getString(2);
qtyInv=rs1.getDouble(3); qtyInv=rs1.getDouble(3);
podQty=rs1.getDouble(4); podQty=rs1.getDouble(4);
System.out.println("Line no ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty); System.out.println("Line no ---->"+lineNo+ " qtyInv-->>"+qtyInv+" podQty->>"+podQty);
totalPodQty=totalPodQty + podQty;
sql1="";
sql1="select sum(quantity__resale) from spl_sales_por_det where item_code = ?";
pstmt3=conn.prepareStatement(sql1);
pstmt3.setString(1, itemCode);
rs3=pstmt3.executeQuery();
if(rs3.next())
{
totalPodQty=rs3.getDouble(1);
}
System.out.println("sumation of total POD itemwise ------>>"+totalPodQty);
System.out.println("Current pod value ------>>"+currentPODvalue);
totalPodQty=totalPodQty + currentPODvalue;
System.out.println("Fina POD qty after adding current value ------>>"+totalPodQty);
if( totalPodQty > actualInvQty)
{
System.out.println("---------return true value from isTotalAmountPodQtyGrt");
return true;
}
rs3.close();rs3=null;
pstmt3.close();pstmt3=null;
//totalPodQty=totalPodQty + podQty;
/*if( podQty < qtyInv) /*if( podQty < qtyInv)
return true; */ return true; */
} }
System.out.println("Total POD quantity --------->>"+totalPodQty);
rs1.close();rs1=null; rs1.close();rs1=null;
pstmt1.close();pstmt1=null; pstmt1.close();pstmt1=null;
} }
} }
System.out.println("TranID in isPartialyInvoiceChk --->>["+tranID+"] confirmed -->["+confirmed+"]"); System.out.println("Total POD quantity $$$--------->>"+totalPodQty);
//System.out.println("TranID in getTotalAmountPodQty --->>["+tranID+"] TotalPODqty -->["+totalPodqty+"]");
/*if (confirmed.equalsIgnoreCase("Y")) /*if (confirmed.equalsIgnoreCase("Y"))
return false;*/ return false;*/
} }
catch(Exception e) catch(Exception e)
...@@ -761,8 +775,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -761,8 +775,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
} }
return totalPodQty; return false;
} }
private boolean isPartialyInvoiceChk(Connection conn,String invID) private boolean isPartialyInvoiceChk(Connection conn,String invID)
{ {
System.out.println("---in method isPartialyInvoiceChk ------invoice ID :["+invID+"]"); System.out.println("---in method isPartialyInvoiceChk ------invoice ID :["+invID+"]");
...@@ -966,8 +981,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -966,8 +981,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
/* This function check the partial invoice resell quantity if there is partial then return true
otherwise false. if any invoice not confirmed then return false */
private boolean isPartialyInvoiceChkHdr(Connection conn,String invID) private boolean isPartialyInvoiceChkHdr(Connection conn,String invID)
{ {
System.out.println("---in method isPartialyInvoiceChkHdr ------invoice ID :["+invID+"]"); System.out.println("---in method isPartialyInvoiceChkHdr ------invoice ID :["+invID+"]");
...@@ -1000,14 +1014,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -1000,14 +1014,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
if(confirmed.equalsIgnoreCase("N")) if(confirmed.equalsIgnoreCase("N"))
return true; return true;
System.out.println("tran id counter ------->"+count); System.out.println("tran id counter ------->"+count);
} }
System.out.println("TranID in isPartialyInvoiceChk --->>["+tranID+"] confirmed -->["+confirmed+"]"); System.out.println("TranID in isPartialyInvoiceChk --->>["+tranID+"] confirmed -->["+confirmed+"]");
/*if (confirmed.equalsIgnoreCase("Y"))
return false;*/
} }
catch(Exception e) catch(Exception e)
......
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