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,10 +468,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -468,10 +468,11 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
pstmt=null; pstmt=null;
if(invDateT!=null){ if(invDateT!=null){
SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat()); SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
invoiceDate = format.format(invDateT); invoiceDate = format.format(invDateT);
System.out.print("stkBillDate ------->>>>>>>>>>>["+billDate+"]"); System.out.print("stkBillDate 123------->>>>>>>>>>>["+billDate+"]");
System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]"); System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]");
sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual"; sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual";
...@@ -486,9 +487,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -486,9 +487,10 @@ 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+"]");
if(diffDays < 0) if(diffDays < 0)
{ {
errCode = "VTINDLSTD"; //Invoice date should not less than stockist date. errCode = "VTINDLSTD";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
if(diffDays <= 365) if(diffDays <= 365)
{ {
...@@ -843,9 +845,8 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -843,9 +845,8 @@ 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,25 +854,41 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -853,25 +854,41 @@ 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);
diffDate=Math.abs(d2.getTime() - d1.getTime()); System.out.print("stkBillDate ------->>>>>>>>>>>["+stkBillDate+"]");
long diffDays = diffDate / (24 * 60 * 60 * 1000); System.out.print("invoice confDate ------->>>>>>>>>>>["+invoiceDate+"]");
System.out.print("Difference in days ------->>>>>>>>>>>["+diffDays+"]");
sql="select to_date( ?,'dd-mm-yyyy') - to_date( ?,'dd-mm-yyyy') from dual";
pstmt=conn.prepareStatement(sql);
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>"); valueXmlString.append("<transit_day>").append("<![CDATA["+diffDays+"]]>").append("</transit_day>");
else
valueXmlString.append("<transit_day>").append("<![CDATA[]]>").append("</transit_day>");
} }
} }
......
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