Hardcore data problem

I’m currently creating a system for parents to buy and manage meals in a school cafeteria.

But I have a hard problem at hand.
As you can see in the image, I’m giving to the user the ability to hire a meal plan. Therefore, for each day he hires the meal, he is linked to a voucher on the database.
Obs: the vouchers are eligible for utilization only for the day you bought.

I already have in a separate table the dates, and the weekday’s name, month too, on which the cafeteria is opened, and the voucher table have this day’s linked as the days to use the vouchers.

The Problem: If the user is doing a plan selection Mondays and Wednesday for example, for an annual plan, how can I get the dates from the opening days, and record individual vouchers for Mondays and Wednesday°

Can anyone suggest me a structure for this?

I think the simple solution is:

condition 1
[start date] current date [end date]

condition 2
as long as you are within those dates then you can check if TODAY is the day you can use the voucher, If Current Day Time extract Day (which is 1-7) IS voucher day

I think Monday = 1 and Sunday = 7 but you can just test that real quick and then make the right connection for Monday/Wednesday

1 Like