get a date according to sunday and non business days

130 views
Skip to first unread message

Nicolas Micoud

unread,
Jun 18, 2014, 11:21:44 AM6/18/14
to idem...@googlegroups.com
Hi,

Is there a method somewhere which returns a date
 - from a a start date (as a parameter)
 - add days (but not sundays and non business days)

I find nothing in TimeUtil.

Any idea ?

Thanks,

Nicolas


Carlos Antonio Ruiz Gomez

unread,
Jun 18, 2014, 6:00:21 PM6/18/14
to idem...@googlegroups.com
Hi Nicolas, pl/sql or pl/pgsql functions nextbusinessday

Nicolas Micoud

unread,
Jun 19, 2014, 7:36:16 AM6/19/14
to idem...@googlegroups.com
Thanks for the hint Carlos.

For my purpose, if i want to get a date that will result of start date + 45 business days (means no saturday, no sunday and no non business day), i will have to make a loop and call the 'nextbusinessday' function 45 times ?

Or is there another way to achieve it ?

Thanks,

Nicolas

Nicolas Micoud

unread,
Jun 19, 2014, 7:37:52 AM6/19/14
to idem...@googlegroups.com
And BTW, wondering if that could deserve a jira ticket as it seems a common requirement ? 
I've seen that there is a checkbox 'IsNextBusinessDay' on payment terms that is not used.
And i guess it could also be used for production

WDYT ?

Lucas Buglio

unread,
Jul 6, 2015, 10:10:20 AM7/6/15
to idem...@googlegroups.com
Hi everyone,

I attached a patch to https://idempiere.atlassian.net/browse/IDEMPIERE-2705, for MOrderPaySchedule e MInvoicePaySchedule are created considering "IsNextBusinessDay" flag and a new flag "IsPreviousBusinessDay" are checked.

Thanks.

Alejandro Guerra

unread,
Jan 3, 2018, 9:13:58 AM1/3/18
to iDempiere
Hi Micoud,
Did you find the way ?? i am looking for get the saturday or sunday between dates?
Regards,

Luis Amesty

unread,
Jan 4, 2018, 9:04:04 AM1/4/18
to iDempiere
Hi Nicolas
I have done a class containing several Business and NonBusiness Days methods.
Take a look to the attached class file MAMN_NonBusinessDay.java
Maybe you make some changes on a method for the calculation you need.

regards 
Luis Amesty
MAMN_NonBusinessDay.java

Nicolas Micoud

unread,
Jan 8, 2018, 2:41:51 AM1/8/18
to iDempiere
Hi,
I haven't tested them, but I think the methods you added deserve to be integrated in trunk - espacially sqlGetNonWeekEndDaysBetween (which doesn't read the content of the C_BusinessDay table).
You should create a patch and attach it to a jira ticket.
But beware of the postgresql syntax - which cannot be integrated in trunk as it should also be executed by Oracle (see sql from sqlGetHolliDaysBetween and sqlGetBusinessDaysBetween).

Regards,

Nicolas
Reply all
Reply to author
Forward
0 new messages