dotliquid: Add Days but ignore saturday and sunday - filter

our ERP (JTL) allows us to create workflows using dotliquid.
For our production we need a workflow that adds a fix amount of working days to the creation date of an order. However it may not add Saturday and Sundays.
Is it possible to filter the days added so we don't have to manually convert working days to days?
{{ CREATIONDATE | AddDays:X | Datum:'yyyy-MM-dd'}}

Related

How can I prevent a CA7 job with two schedule IDs from conflicting when they run on the same day?

I have a single job with two schedule ID’s. One runs the job the last day of the month and the other schid runs the last Sunday of the month. The problem I’m trying to correct arises when the last day of the month falls on a Sunday which causes a conflict between the two schedules.
My first thought was to split the two schids into two separate job names, while making one job a requirement for the other so they can’t run at the same time. The problem is this scenario would only apply on the rare days they both run and on all other days the requirement wouldn’t be met.
I’m not extremely familiar with ca7 so thought I’d look for some input. Can a schid be created with a conditional statement?
I think two schids will be needed. The options assume a calendar that specifies all days as processing days.
Option 1
Schid=1 schedules the job on the last Sunday of the month UNLESS that Sunday falls on the last day of the month.
Schid=2 schedules the job on the last day of the month.
ID=001 ROLL=N INDEX=+000
SCAL= DOTM=2000 LEADTM=0010 STARTM=1950
MONTHLY DAY=SUN WEEK=-00 MONTH=ALL
MONTHLY NRDAY=-00 MONTH=ALL
ID=002 ROLL=N INDEX=+000
SCAL= DOTM=2000 LEADTM=0010 STARTM=1950
MONTHLY RDAY=-00 MONTH=ALL
Option 2
Schid=1 runs the last day of the month unless that day falls on a Sunday.
Schid=2 runs on the last Sunday of the month.
ID=001 ROLL=D INDEX=+000
SCAL= DOTM=1300 LEADTM=0030 STARTM=1230
MONTHLY NDAY=SUN WEEK=-00 MONTH=ALL
MONTHLY RDAY=-00 MONTH=ALL
ID=002 ROLL=D INDEX=+000
SCAL= DOTM=1300 LEADTM=0030 STARTM=1230
MONTHLY DAY=SUN WEEK=-00 MONTH=ALL
Another approach is to define a separate calendar with precisely the days I want the job to run so the schedule definition is pretty simple.

Laravel Carbon find same day of week in previous month

I am trying to find the same day of week from last month if today's date is Wednesday Oct 2nd 2019. I need to retrieve Wednesday Sept 4th 2019.
I am using Carbon and have tried subDays(30) and subMonth(1) but that obviously doesn't return the same week day.
SalesLogs::loadByDate(Carbon::now()->subMonth(1));
This code works as expected, however I am unable to work out how to make it find the same day of the week based on the prior month.
It's not super clear what you are trying to do, but I will take a shot at it. What about if you subtract a month, and then go to the next matching weekday?
$weekday = now()->dayOfWeek;
SalesLogs::loadByDate(now()->subMonth(1)->next($weekday));
Note: you can take advantage of Laravel's handy now() helper function, which is equal to Carbon::now(), but saves you from having to import Carbon.
Does that get you what you need?

How to configure Working Time in odoo?

I have been using the Timesheets module in odoo 10. For the Working Time it takes from monday to friday. But I want to add one saturday for every month. That is, each month should calculate 1st saturday along with the other working days. How can I achieve this without using the code?
You can define working hours from Employee's Contracts Form. In it, there is one field which is Working Schedule and set Working hours from there.
Hope it will helps you.
Thanks,

Complex Date Range

I'm working on the following query and cant figure out the final piece of it. I need my query to give me a result set between the previous business and the previous business day minus (-) 28 days. (e.g. date range between 10/28/2015 and 10/28/2015 -28) The query that I wrote so far is only giving me the -28th day (09/30/2015) and NOT a range in between the previous business day and the previous business day -28. My research shows a couple of different ways of doing it and so far none have worked for me.
SELECT SMBL, SUM(NET_FLOWS/1000000.00)
FROM HISTORY
WHERE DATE - 28 = DATE AND DATE = TO_DATE('10282015','MMDDYYYY')
AND SYMBOL IN ('AAA','BBB')
GROUP BY SMBL
First off, date ranges are easy using BETWEEN, so you do the quick solution:
WHERE DATE BETWEEN (SYSDATE-28) and (SYSDATE-1)
Then you realize your dates have time components, so to include all of yesterday and all of day-28 you need to:
WHERE DATE >= TRUNC(SYSDATE)-28
AND DATE < TRUNC(SYSDATE)
Then I look at your rule "previous BUSINESS day" and ask - what are your business days? On a Monday to go up to the previous Friday? Or Saturday? Or are you a 7-day-a-week business? How about statutory holidays? And is it 28 CALENDAR days back? Or 28 BUSINESS days?
Ahh business rules. The devil is always in those details....

Full Calendar weekly Mode

I am trying to build an application that displays a weekly Monday to Friday school schedule. I've decided to use the JQuery plugin fullcalendar. After looking through many options, I cannot find a way to display a weekly mode rather than actual days of the year. Agenda mode displays a given week of the year. This includes dates which I don't want.
I want events to begin on Friday at 2:00pm not April 5 at 2:00pm
Is there way to do this using the fullcalendar API?
Take a look at the columnFormat option. http://arshaw.com/fullcalendar/docs/text/columnFormat/
columnFormat: {
month: 'ddd',
week: 'ddd',
day: 'dddd M/d'
}
Let me know if this helps.

Resources