Solved

Is there a way to use only business days when calculating a field in GI?

  • 3 February 2023
  • 2 replies
  • 326 views

Userlevel 5
Badge

In our production process, we have the following dates (simplified view):

  • Production Start Date: Feb. 3
  • Build Date: Feb. 10
  • Production End Date: Feb.20

 

The build date is always 5 business days after production start date.

 

I’m trying to build a GI that will list out these dates but I don’t seem able to create a formula that does AmProdItem.StartDate + 5 Working Days.

 

I can do AmProdItem.StarDate + 5,but it will include weekends. Is there anyway to do this but exclude weekends? Or anyway to incorporate one of the work calendars into this calculation?

icon

Best answer by aaghaei 3 February 2023, 23:54

View original

2 replies

Userlevel 7
Badge +8

Depending on how accurate you want your BuildDate, you can proceed with any of the below options:

 

If you just want Sat and Sun to be excluded:

Assuming your week is from Sun to Sat, then you can set up a conditional formula using DayOfWeek to get the BuildDate something like (you will need to play with the formula just I am giving the idea):

=DayOfWeek([AMProdItem.StartDate]) this formula gives you the day of the week a number between 1-7

Now if you are starting Monday then logically you expect to finish on Friday and if you start any other day you will have an additional Sat and Sun. So you can set up your BuildDate formula something like this:

1: Sun (Depends on your Calendar configuration)

2: Mon

7: Sat

=IIf(DayOfWeek([AMProdItem.StartDate])=1, DateAdd([AMProdItem.StartDate], 'Day', 6), IIf(DayOfWeek([AMProdItem.StartDate])=2, DateAdd([AMProdItem.StartDate], 'Day', 5), DateAdd([AMProdItem.StartDate], 'Day', 7)))

 

If you need to exclude Stat holidays other than Sat and Sun as well then you will customization as follows: 

Add a custom field to AMProdItem let's say UsrBuildDate

You will need to set up your Work/Manufacturing Calendar and identify the stat holidays.

In FieldSelecting Event Handler of your custom field, you will apply the Additional days logics and you will get the accurate date and return it.

Userlevel 1
Badge

Does the Product owner reading this chart? 
There is a lot of cases when business need to count only work day. Do we realy need this customization project ?  
Is it so hard to create (develop) a calendar in Acumatica? 
Who can make this decision? I will pray for him.

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved