You have pointed me in a good direction.
I'll look into this:
Seems that your validation only works for "Pizza" and "Pao de Alho".
And also this:
If I fill all 10 possible rows everything is fine.
I'll get back here to update my progress.
Thank you!
.
.
Anything beyond this point isn't really useful to anyone. And isn't important to this topic.
Just out of curiosity, I'll explain a little about my validation process:
All my products have 75 days of shelf life, except those that have "Pizza" and "Pão de Alho" in the name. They have 60 days.
My batch number is in Julian day format, meaning that is the continuous count of days since the beginning of the year.
So 1 = January 1st, and 365 = December 31th.
If a product was manufactured on January 1st, it will have a batch number of 1, and the expiration date will be calculated by:
Basic formula:
first day of the year + batch + shelf life - 1
I use those constants "290" and "March" to change the year in green above. Actually, just to go one year in the past (year-1).
This just because, since my products have 75 days maximum shelf life, all products that expire before March 17th were manufactured last year.
Since we are now at the start of the year, any product that has a batch number greater than 290 (365-75) must have been made last year.
Without those constraints, it would be impossible to register any product made last year.
So in your exemples:
301 Pao de Alho -> 26/12/2020
Batch: 301
Converted to date of manufacture (01/01/21 + 301): 29/10/21
Since is impossible that this product was made in the future, it must have been made last year. So (01/01/
20 + 301): 28/10/2020
Expiration date: 28/10/2020 + 60 days of shelf life - 1 =
26/12/20201 Bobina -> 17/3/2021
Batch: 1
Shelf life: 75
Expiration date = 01/01/21 + 1 + 75 - 1 = 17/03/21
As I said, this was just out of curiosity. If anyone wants to know more about the mechanics.
But in the scope of this forum, I don't think it'll be useful.