After some time using shortage report, I came up with a few ideas of how to improve it. I’ll explain them in this post.
I sometimes get orders from factories that have multiple delivery destinations, has to be delivered at different times or multiple orders are sent in the same email, and if several of them have shortages, I now produce multiple shortage report tables in one email, as currently there is no way to combine multiple shortage reports into one. And now I want to work on this, as this would make generating shortage reports more efficient.
The basic idea to achieve this is to add an additional row to webpage with these HTML elements:
- Checkbox: by default it will be unmarked. If it is marked, it will not delete the previously generated short. Currently when generating new short, the previous one gets deleted automatically.
- Label for drop down menu.
- Drop down menu. Since most of the destinations or order names are repetitive, I will store the most common names in a drop down menu. However I will create an option for a user to customise the name.
- Label for custom name.
- Text input field for custom name. By default this field will be disabled.
- Button to insert name into the shortage report table. It will call a function that will col span 6 table cells, and place a destination or order name in the centre.
I’ve done an Excel example of how this row should look with all the labels and input fields and demonstrated it in the picture below:

If the location or order name is not in the dropdown menu, I want to enable the user to customise it. I will do that by adding a “Customed” option to the drop down menu. By default I will have the input field for custom name disabled, but if in the dropdown menu a custom location is selected it’s status will be changed to enabled, and then the value from this field will be used in the shortage report. An example of this approach is demonstrated in the image below:

The result I’m trying to achieve is demonstrated in the table below:
Product code | Product name | Shortage | Next delivery | Expected quantity | Enough to cover |
---|---|---|---|---|---|
LOCATION 1 | |||||
M001 | Carrot | 4 | Today | 10 | Yes |
M002 | Tomato | 5504 | Today | 5400 | No |
M003 | Courgettes | 10 | Today | 26 | Yes |
LOCATION 2 | |||||
M004 | Cucumber | 181.29 | Today | 2730 | Yes |
M005 | Chives | 1.25 | Tomorrow | 6 | Yes |
M010 | Mint | 22.16 | Tomorrow | 80 | Yes |
M011 | Tomato Pomodorino | 185.69 | Today | 210 | Yes |
This report does not take into account stock that is ONHOLD or on GIPOSR. |
Apart from adding this functionality to the shortage report website, I need to sort out last update time alert as it is not working properly. It should mark the last update time on the web app in red colour if there haven’t been an update for 3 hours or more, but it is not always working. I do have a feeling of what is causing this and how to fix it.
Another thing that needs to be done is prevention of SQL injections as current version has none of it. Will add htmlentities and mysqli_real_escape_string functions to PHP script.
And finally, I might have to rewrite the function that extracts product codes, product names and quantities from the text copied from shortage report. As I’m currently using Internet explorer mode on Edge, the text I copy is split using a /n character in JavaScript function. However if I opt to use regular edge or other browser, I have to first generate a pdf file, and only then print pick sheets. Text copied from explorer has product codes, names, quantities separated by /n character however, text copied from pdf pick sheets do not have multiple /n characters for the same product details, instead each products name, code and quantity is placed in one line.
To better understand what I’m talking about I’ll demonstrated the difference in the picture below:

To summarise this post, I made a list of work that will need to be done on shortage report:
- Create a feature to insert location or order names to shortage report.
- Fix last update message.
- Add SQL injection prevention.
- Rewrite the function that splits pasted shortage text.
I will probably start to work on it next week, as this week I’m occupied already 😉