Commit 418d3926 authored by kshinde's avatar kshinde

Bug fix

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@183340 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 6b0e5d7f
......@@ -17,9 +17,10 @@ import ibase.webitm.ejb.sys.UtilMethods;
import java.rmi.RemoteException;
import java.sql.*;
import java.text.SimpleDateFormat;
import java.time.LocalDate;
//import java.time.LocalDate;
import java.time.Period;
import java.util.*;
import java.util.Date;
import javax.ejb.Stateless;
import javax.naming.InitialContext;
......@@ -292,11 +293,11 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
ldDiscountDt = calcDiscountDate(pCrTerm,(sdf.format(refDate)),(sdf.format(effDate)),(sdf.format(billDate)),conn);
System.out.println("Test"+ldDiscountDt);
int liDateDiff=dayDiff(ldDiscountDt,today);
long liDateDiff=dayDiff(ldDiscountDt,today);
sql = "select fin_chg from crtermfc where ? between min_day and max_day and cr_term = ? and trim(line_no) = '1'";
pstmt = conn.prepareStatement(sql);
pstmt.setInt(1, liDateDiff);
pstmt.setLong(1, liDateDiff);
pstmt.setString(2, pCrTerm);
rs = pstmt.executeQuery();
......@@ -715,13 +716,14 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
return ldDuedate;
}
public int dayDiff(Timestamp discountDt,Timestamp paymentDt) throws ITMException
public long dayDiff(Timestamp discountDt,Timestamp paymentDt) throws ITMException
{
int difference=0;
long datediff=0;
try
{
SimpleDateFormat sdf1=new SimpleDateFormat("dd-MM-yyyy");
/*SimpleDateFormat sdf1=new SimpleDateFormat("dd-MM-yyyy");
String [] a1=(sdf1.format(discountDt)).split("-");
String [] a2=(sdf1.format(paymentDt)).split("-");
......@@ -731,14 +733,23 @@ public class VouchPayAct extends ActionHandlerEJB implements VouchPayActLocal, V
LocalDate payDate = LocalDate.of(Integer.parseInt(a2[2]), Integer.parseInt(a2[1]), Integer.parseInt(a2[0]));
Period diff = Period.between(discDate, payDate);
difference=diff.getDays();
System.out.printf("Difference is %d years, %d months and %d days old",diff.getYears(), diff.getMonths(), diff.getDays());
System.out.printf("Difference is %d years, %d months and %d days old",diff.getYears(), diff.getMonths(), diff.getDays());*/
SimpleDateFormat sdf = new SimpleDateFormat(genericUtility.getApplDateFormat());
Date discdt = sdf.parse(sdf.format(discountDt));
Date mPayDate = sdf.parse(sdf.format(paymentDt));
System.out.println("mPayDate============" + mPayDate);
long dif1f = discdt.getTime() - mPayDate.getTime();
datediff = dif1f / 86400000L;
}
catch(Exception e)
{
e.printStackTrace();
throw new ITMException(e);
}
return difference;
return datediff;
}
public String getStanDraw(String sundryType, String sundryCode, Connection conn)
......
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