Patch #1664402 Non Business Day implemetation
This commit is contained in:
parent
1eecb3f138
commit
94032c52ed
|
@ -411,7 +411,7 @@ public class Adempiere implements Serializable
|
||||||
* @param day day
|
* @param day day
|
||||||
* @return next business dat if day is "off"
|
* @return next business dat if day is "off"
|
||||||
*/
|
*/
|
||||||
static public Timestamp nextBusinessDay (Timestamp day)
|
static public Timestamp nextBusinessDay (Timestamp day) throws SQLException
|
||||||
{
|
{
|
||||||
if (day == null)
|
if (day == null)
|
||||||
day = new Timestamp(System.currentTimeMillis());
|
day = new Timestamp(System.currentTimeMillis());
|
||||||
|
@ -423,11 +423,32 @@ public class Adempiere implements Serializable
|
||||||
cal.set(Calendar.SECOND, 0);
|
cal.set(Calendar.SECOND, 0);
|
||||||
cal.set(Calendar.MILLISECOND, 0);
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
//
|
//
|
||||||
int dow = cal.get(Calendar.DAY_OF_WEEK);
|
//begin Goodwill (www.goodwill.co.id)
|
||||||
if (dow == Calendar.SATURDAY)
|
// get Holiday
|
||||||
cal.add(Calendar.DAY_OF_YEAR, 2);
|
boolean isHoliday = true;
|
||||||
else if (dow == Calendar.SUNDAY)
|
do
|
||||||
cal.add(Calendar.DAY_OF_YEAR, 1);
|
{
|
||||||
|
int dow = cal.get(Calendar.DAY_OF_WEEK);
|
||||||
|
if (dow == Calendar.SATURDAY)
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, 2);
|
||||||
|
else if (dow == Calendar.SUNDAY)
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR, 1);
|
||||||
|
java.util.Date temp = cal.getTime();
|
||||||
|
String sql = "SELECT Date1 FROM C_NonBusinessDay WHERE IsActive ='Y' AND Date1=?";
|
||||||
|
PreparedStatement pstmt = Adempiere.prepareStatement(sql);
|
||||||
|
pstmt.setTimestamp(1,new Timestamp(temp.getTime()));
|
||||||
|
ResultSet rs = pstmt.executeQuery();
|
||||||
|
if (rs.next())
|
||||||
|
{
|
||||||
|
cal = new GregorianCalendar();
|
||||||
|
cal.setTime(temp);
|
||||||
|
cal.add(Calendar.DAY_OF_YEAR,1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
isHoliday = false;
|
||||||
|
}
|
||||||
|
while (isHoliday);
|
||||||
|
// end Goodwill
|
||||||
//
|
//
|
||||||
java.util.Date temp = cal.getTime();
|
java.util.Date temp = cal.getTime();
|
||||||
return new Timestamp (temp.getTime());
|
return new Timestamp (temp.getTime());
|
||||||
|
|
Loading…
Reference in New Issue