Commit 76845bf2 authored by dpawar's avatar dpawar

added validation for arrv rate greater


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@94035 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 3ed3f5bc
...@@ -175,30 +175,49 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -175,30 +175,49 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
if (childNodeName.equalsIgnoreCase("site_code")) if (childNodeName.equalsIgnoreCase("site_code"))
{ {
String siteCode=""; String siteCode="",invId="",invSite="";
int count=0; int count=0;
siteCode = genericUtility.getColumnValue("site_code",dom); siteCode = genericUtility.getColumnValue("site_code",dom);
invId = genericUtility.getColumnValue("invoice_id",dom);
siteCode=siteCode==null ? "" : siteCode.trim(); siteCode=siteCode==null ? "" : siteCode.trim();
invId=invId==null ? "" : invId.trim();
if(siteCode.length()== 0){ if(siteCode.length()== 0){
errCode = "VTSITECNE"; errCode = "VTSITECNE";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
}else{ }
else{
System.out.println("----in else part of site_code-----------");
count=getDBRowCount(conn,"site","site_code",siteCode); count=getDBRowCount(conn,"site","site_code",siteCode);
if(count==0){ if(count==0){
errCode = "VTSITENEX"; errCode = "VTSITENEX";
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
//check if entered site code not in invoice
invSite=getColumnDescr(conn,"site_code","invoice","invoice_id",invId);
invSite=invSite==null ? "" : invSite.trim();
System.out.println("Site_code ----->>["+siteCode+"]");
System.out.println("Site_code invID TRUE----->>["+invSite+"]");
if(!(invSite.equalsIgnoreCase(siteCode)))
{
errCode = "VTSITENEI"; //site code not match in invoice;
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
} }
} }
if (childNodeName.equalsIgnoreCase("cust_code")) if (childNodeName.equalsIgnoreCase("cust_code"))
{ {
String custCode=""; String custCode="",invId="",custCodeInv="";
int count=0; int count=0;
custCode = genericUtility.getColumnValue("cust_code",dom); custCode = genericUtility.getColumnValue("cust_code",dom);
invId = genericUtility.getColumnValue("invoice_id",dom);
custCode=custCode==null ? "" : custCode.trim(); custCode=custCode==null ? "" : custCode.trim();
invId=invId==null ? "" : invId.trim();
if(custCode.length()== 0){ if(custCode.length()== 0){
errCode = "VTCUSTCNE"; errCode = "VTCUSTCNE";
errList.add( errCode ); errList.add( errCode );
...@@ -210,6 +229,17 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -210,6 +229,17 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
//check if entered customer code not in invoice
custCodeInv=getColumnDescr(conn,"cust_code","invoice","invoice_id",invId);
custCodeInv=custCodeInv==null ? "" : custCodeInv.trim();
System.out.println("cust_code invID----->>["+custCodeInv+"]");
if(!(custCodeInv.equalsIgnoreCase(custCode)))
{
errCode = "VTCUSTNEI"; //Customer code not match in invoice;
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
} }
} }
...@@ -381,12 +411,24 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -381,12 +411,24 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
if(childNodeName.equalsIgnoreCase("aprv_rate")) if(childNodeName.equalsIgnoreCase("aprv_rate"))
{ {
String apprvRate=""; String apprvRate="",rateResale="";
double aprvRateD=0; double aprvRateD=0,rateResaleD=0;
apprvRate=genericUtility.getColumnValue("aprv_rate", dom); apprvRate=genericUtility.getColumnValue("aprv_rate", dom);
rateResale=genericUtility.getColumnValue("rate__resale", dom);
apprvRate=apprvRate==null ? "0" :apprvRate.trim(); apprvRate=apprvRate==null ? "0" :apprvRate.trim();
System.out.println("Approve rate---->>>["+apprvRate+"]"); rateResale=rateResale==null ? "0" :rateResale.trim();
aprvRateD=Double.parseDouble(apprvRate); aprvRateD=Double.parseDouble(apprvRate);
rateResaleD=Double.parseDouble(rateResale);
System.out.println("Approve rate---->>>["+aprvRateD+"]");
System.out.println("Approve rate---->>>["+rateResaleD+"]");
if(aprvRateD > rateResaleD)
{
errCode = "VTAPRNGRR"; // approved rate should not be greater than End sale rate.
errList.add( errCode );
errFields.add( childNodeName.toLowerCase() );
}
if(aprvRateD <= 0){ if(aprvRateD <= 0){
errCode = "VTAPRRIDN"; //Approved rate not available.Please check errCode = "VTAPRRIDN"; //Approved rate not available.Please check
...@@ -397,10 +439,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -397,10 +439,10 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
} }
if(childNodeName.equalsIgnoreCase("bil_date")) if(childNodeName.equalsIgnoreCase("bil_date"))
{ {
String billDate="",billNo="",sql="",invID="",custCodeCurr="",orgDate1="",tranId=""; String billDate="",billNo="",sql="",invID="",custCodeCurr="",invoiceDate="",tranId="";
boolean isDateAft=false; boolean isDateAft=false;
Timestamp orgDate=null; Timestamp invDateT=null;
Date d1=null,d2=null; int diffDays=0;
invID = genericUtility.getColumnValue("invoice_id",dom1); invID = genericUtility.getColumnValue("invoice_id",dom1);
custCodeCurr = genericUtility.getColumnValue("cust_code",dom1); custCodeCurr = genericUtility.getColumnValue("cust_code",dom1);
billDate=genericUtility.getColumnValue("bil_date", dom); billDate=genericUtility.getColumnValue("bil_date", dom);
...@@ -412,57 +454,60 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca ...@@ -412,57 +454,60 @@ public class ProofOfDelivery extends ValidatorEJB implements ProofOfDeliveryLoca
System.out.println("customer Code Current--------->>["+custCodeCurr+"]"); System.out.println("customer Code Current--------->>["+custCodeCurr+"]");
/*sql="select cust_code__bil,tran_date from invoice where invoice_id = ?"; if(invID.length() > 0 && billDate.length() > 0){
sql="select conf_date from invoice where invoice_id = ?";
pstmt=conn.prepareStatement(sql); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invID); pstmt.setString(1, invoiceID);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next()){
{ invDateT=rs.getTimestamp(1);
custCodeBil=rs.getString(1);
orgDate=rs.getTimestamp(2);
} }
rs.close(); rs.close();
rs=null; rs=null;
pstmt.close(); pstmt.close();
pstmt=null;*/ pstmt=null;
if(invDateT!=null){
SimpleDateFormat format = new SimpleDateFormat(genericUtility.getApplDateFormat());
invoiceDate = format.format(invDateT);
sql="select cust_code__bil,tran_date from invoice where invoice_id = ?"; System.out.print("stkBillDate ------->>>>>>>>>>>["+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); pstmt=conn.prepareStatement(sql);
pstmt.setString(1, invID); pstmt.setString(1, billDate);
pstmt.setString(2, invoiceDate);
rs=pstmt.executeQuery(); rs=pstmt.executeQuery();
if(rs.next()) if(rs.next())
{ {
//custCodeBil=rs.getString(1); diffDays=rs.getInt(1);
orgDate=rs.getTimestamp(2);
} }
rs.close(); System.out.println("Difference in days for validation--->>["+diffDays+"]");
rs=null; if(diffDays < 0)
pstmt.close(); {
pstmt=null; errCode = "VTINDLSTD"; //Invoice date should not less than stockist date.
errList.add( errCode );
if(billDate.length() > 0 && orgDate !=null){ errFields.add( childNodeName.toLowerCase() );
SimpleDateFormat sdf = new SimpleDateFormat("dd/mm/yy"); }
orgDate1=sdf.format(orgDate); if(diffDays <= 365)
d1=sdf.parse(orgDate1);
d2=sdf.parse(billDate);
long diffDate=Math.abs(d2.getTime() - d1.getTime());
long diffDays = diffDate / (24 * 60 * 60 * 1000);
System.out.println("Difference in days--------->>["+diffDays+"]");
if(diffDays < 365)
{ {
isDateAft=true; isDateAft=true;
} }
}
if(billNo.length() > 0){
if(isBilNoBilDtStkRepeted(conn,billNo,custCodeCurr,isDateAft)) if(isBilNoBilDtStkRepeted(conn,billNo,custCodeCurr,isDateAft))
{ {
errCode = "VTBLBDNRP"; //Bill no., bill date can not be repeated for this invoice errCode = "VTBLBDNRP"; //Bill no., bill date can not be repeated for this invoice
errList.add( errCode ); errList.add( errCode );
errFields.add( childNodeName.toLowerCase() ); errFields.add( childNodeName.toLowerCase() );
} }
}
} }
} }
} }
......
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