Commit 34ec4f02 authored by dpawar's avatar dpawar

added date validation and item change


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94039 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 75057f1b
...@@ -468,32 +468,34 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -468,32 +468,34 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
pstmt=null; pstmt=null;
if(invDateT!=null){ if(invDateT!=null){
SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
invoiceDate = format.format(invDateT); SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
invoiceDate = format.format(invDateT);
System.out.print("stkBillDate ------->>>>>>>>>>>["+billDate+"]");
System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]"); System.out.print("stkBillDate 123------->>>>>>>>>>>["+billDate+"]");
System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]");
sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual";
pstmt=conn.prepareStatement(sql); sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual";
pstmt.setString(1, billDate); pstmt=conn.prepareStatement(sql);
pstmt.setString(2, invoiceDate); pstmt.setString(1, billDate);
rs=pstmt.executeQuery(); pstmt.setString(2, invoiceDate);
if(rs.next()) rs=pstmt.executeQuery();
{ if(rs.next())
diffDays=rs.getInt(1); {
} diffDays=rs.getInt(1);
System.out.println("Difference in days for validation--->>["+diffDays+"]"); }
if(diffDays < 0) System.out.println("Difference in days for validation--->>["+diffDays+"]");
{ if(diffDays < 0)
errCode = "VTINDLSTD"; //Invoice date should not less than stockist date. {
errList.add( errCode ); errCode = "VTINDLSTD";
errFields.add( childNodeName.toLowerCase() ); errList.add( errCode );
} errFields.add( childNodeName.toLowerCase() );
if(diffDays <= 365)
{ }
isDateAft=true; if(diffDays <= 365)
} {
isDateAft=true;
}
} }
if(billNo.length() > 0){ if(billNo.length() > 0){
if(isBilNoBilDtStkRepeted(conn,billNo,custCodeCurr,isDateAft)) if(isBilNoBilDtStkRepeted(conn,billNo,custCodeCurr,isDateAft))
...@@ -842,10 +844,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -842,10 +844,9 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
if (currentColumn.trim().equals("bil_date")) if (currentColumn.trim().equals("bil_date"))
{ {
String sql="",invoiceID="",stkBillDate="",invoiceDate=""; String sql="",invoiceID="",stkBillDate="",invoiceDate="";
Date d1=null,d2=null;
Timestamp invDateT=null; Timestamp invDateT=null;
long diffDate=0; int diffDays=0;
invoiceID = genericUtility.getColumnValue("invoice_id",dom1); invoiceID = genericUtility.getColumnValue("invoice_id",dom1);
stkBillDate=genericUtility.getColumnValue("bil_date",dom); stkBillDate=genericUtility.getColumnValue("bil_date",dom);
invoiceID=invoiceID==null ? "" :invoiceID.trim(); invoiceID=invoiceID==null ? "" :invoiceID.trim();
...@@ -853,28 +854,44 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -853,28 +854,44 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("Invoice Id in bill date item change ------>>["+invoiceID+"]"); System.out.println("Invoice Id in bill date item change ------>>["+invoiceID+"]");
System.out.println("Stockist bill date item change ------>>["+stkBillDate+"]"); System.out.println("Stockist bill date item change ------>>["+stkBillDate+"]");
if (invoiceID.length() > 0 && stkBillDate.length() > 0){ if (invoiceID.length() > 0 && stkBillDate.length() > 0){
sql="select tran_date from invoice where invoice_id = ?"; sql="select conf_date from invoice where invoice_id = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invoiceID); pstmt.setString(1, invoiceID);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()){ if(rs.next()){
invDateT=rs.getTimestamp(1); invDateT=rs.getTimestamp(1);
} }
System.out.println("rs date --->>["+invDateT+"]"); System.out.println("conf date invoice--->>["+invDateT+"]");
if(invDateT !=null){ if(invDateT !=null){
SimpleDateFormat format = new SimpleDateFormat("dd/mm/yy"); SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
invoiceDate = format.format(invDateT); invoiceDate = format.format(invDateT);
System.out.println("tranDate ------>>["+invoiceDate+"]"); System.out.println("confDate 139------>>["+invoiceDate+"]");
d1=format.parse(invoiceDate);
d2=format.parse(stkBillDate); System.out.print("stkBillDate ------->>>>>>>>>>>["+stkBillDate+"]");
System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]");
diffDate=Math.abs(d2.getTime() - d1.getTime());
long diffDays = diffDate / (24 * 60 * 60 * 1000); sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual";
System.out.print("Difference in days ------->>>>>>>>>>>["+diffDays+"]"); pstmt=conn.prepareStatement(sql);
valueXmlString.append("<transit_day>").append("<![CDATA["+diffDays+"]]>").append("</transit_day>"); pstmt.setString(1, stkBillDate);
pstmt.setString(2, invoiceDate);
rs=pstmt.executeQuery();
if(rs.next())
{
diffDays=rs.getInt(1);
}
rs.close();
rs=null;
pstmt.close();
pstmt=null;
System.out.println("Difference between ----->>["+diffDays+"]");
if(diffDays > 0)
valueXmlString.append("<transit_day>").append("<![CDATA["+diffDays+"]]>").append("</transit_day>");
else
valueXmlString.append("<transit_day>").append("<![CDATA[]]>").append("</transit_day>");
} }
} }
} }
valueXmlString.append("</Detail2>"); valueXmlString.append("</Detail2>");
......
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