Commit 4396ab5b authored by dpawar's avatar dpawar

added validation for bill date


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94051 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 7285de7b
...@@ -514,19 +514,19 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -514,19 +514,19 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("Difference in days for validation--->>["+diffDays+"]"); System.out.println("Difference in days for validation--->>["+diffDays+"]");
editFlag=editFlag==null ? "" : editFlag.trim(); editFlag=editFlag==null ? "" : editFlag.trim();
String traniidd = genericUtility.getColumnValue("tran_id",dom1); String currTranId = genericUtility.getColumnValue("tran_id",dom1);
traniidd=traniidd==null ? "" : traniidd.trim(); currTranId=currTranId==null ? "" : currTranId.trim();
System.out.println("traniidd--->>["+traniidd+"]"); System.out.println("currTranId--->>["+currTranId+"]");
System.out.println("Edit flag133--->>["+editFlag+"]"); System.out.println("Edit flag133BD--->>["+editFlag+"]");
if(traniidd.length() <= 0){
if(isBillNoRepeatedInYear(conn,billNo,billDate,custCodeCurr)) if(isBillNoRepeatedInYear(conn,billNo,billDate,custCodeCurr,currTranId))
{ {
System.out.println("------bill and stockist and year matched-----------"); System.out.println("------bill and stockist and year matched-----------");
errCode = "VTBLBDNRP"; errCode = "VTBLBDNRP";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
}
if(diffDays < 0) if(diffDays < 0)
{ {
errCode = "VTINDLSTD"; errCode = "VTINDLSTD";
...@@ -629,7 +629,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -629,7 +629,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
private boolean isBillNoRepeatedInYear(Connection conn,String billNoL,String stockistDateL,String currCustCode) private boolean isBillNoRepeatedInYear(Connection conn,String billNoL,String stockistDateL,String currCustCode,String currTranIdL)
{ {
System.out.println("--------in isBillNoRepeated method-------"); System.out.println("--------in isBillNoRepeated method-------");
billNoL=billNoL==null ? "" :billNoL.trim(); billNoL=billNoL==null ? "" :billNoL.trim();
...@@ -637,7 +637,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -637,7 +637,7 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
ResultSet rs=null,rs1=null; ResultSet rs=null,rs1=null;
PreparedStatement pstmt=null,pstmt1=null; PreparedStatement pstmt=null,pstmt1=null;
int currStkYear=0,actStkYear=0; int currStkYear=0,actStkYear=0;
ArrayList <String> BillNo=new ArrayList<String>(); ArrayList <String> tranIDList=new ArrayList<String>();
String sql="",sql1="",billNo="",custCode="",tranId=""; String sql="",sql1="",billNo="",custCode="",tranId="";
Timestamp stockistDate=null; Timestamp stockistDate=null;
...@@ -651,10 +651,30 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -651,10 +651,30 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("Current stk Year------>>["+CurrYear+"]"); System.out.println("Current stk Year------>>["+CurrYear+"]");
currStkYear=Integer.parseInt(CurrYear); currStkYear=Integer.parseInt(CurrYear);
sql="select tran_id,cust_code from spl_sales_por_hdr"; sql="select tran_id,cust_code from spl_sales_por_hdr";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
while(rs.next())
{
tranId=rs.getString(1);
tranId=tranId==null ? "" :tranId.trim();
tranIDList.add(tranId);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("Tran ID--->>["+tranIDList+"]");
if(tranIDList.contains(currTranIdL))
{
tranIDList.remove(currTranIdL);
}
System.out.println("Tran ID after removeing--->>["+tranIDList+"]");
for(String tranIdL : tranIDList){
sql="select tran_id,cust_code from spl_sales_por_hdr where tran_id = ?";
pstmt=conn.prepareStatement(sql);
pstmt.setString(1,tranIdL);
rs=pstmt.executeQuery();
while(rs.next()){ while(rs.next()){
tranId=rs.getString(1); tranId=rs.getString(1);
custCode=rs.getString(2); custCode=rs.getString(2);
...@@ -692,10 +712,15 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -692,10 +712,15 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
}
if(rs!=null){
rs.close(); rs.close();
rs=null; rs=null;
}
if(pstmt!=null){
pstmt.close(); pstmt.close();
pstmt=null; pstmt=null;
}
} }
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