Hi all! Leo is with you today, and I have been professionally digitizing videocassettes for more than 7 years.
The May holidays are coming soon, and the flow of customers is increasing. So much so that it became difficult to cope with them – 7-8 people can come a day, and try to remember them. Until this day, I used a self-written panel for accounting orders in PHP, and the Business Pack program for printing sales receipts. In general, they were enough. But when the flow of people began to exceed all conceivable norms, it was clear that something had to be done about it.
To resolve the issue, it was decided to transfer everything to a barcode system. I go to a well-known ad site and buy myself the cheapest scanner for 500 rubles.
This scanner works in keyboard emulation mode – point to the code, it recognizes and prints.
I added the panel in this way: at the bottom I placed the input fields that lead to add.php, inwork.php, etc., which perform a request to the database. Extremely simple, but it works.
To celebrate, I downloaded fonts for creating codes, printed them out on paper… And nothing! The scanner simply does not scan the code, or scans from 5-6 attempts.
… Printed on glossy paper – it works! As it turned out, it was in the standard – in Code128 it was necessary to add control characters at the beginning and end of the line. And if on glossy paper the scanner somehow, but understood the code with an error, then on matte paper it could no longer scan it.
The problem was solved by using the standard Code 39 – it is much easier to print from any text editor than other types of barcodes.
To do this, it is enough to encode the number in the format
*1234567890*. Without delving into the theory, simply put, the asterisks here are control characters.
We print, we scan the code… Everything works!
However, the scanner gives us a code of the form
T000001. As I understood after reading the documentation for the scanner – the symbol
T here it is formed from several bits of information that it gives to the software, which must understand that a scanner is being used.
You can, of course, reconfigure it, but we will simply cut out this symbol in PHP:
$num = htmlspecialchars($_POST["num"]);
$num = preg_replace('/[^0-9]/', '', $num);
echo "Номер заказа не может быть менее 3-х символов";
mysql_query ("UPDATE myloveclients SET `status` = 'open' WHERE `number` = '$num';");
We “pick” the scanner on the code, and our code is successfully in the database!
Now, with the help of barcodes, we can successfully change order numbers in the database, and even look at the client’s phone number 🙂
…But how can we print a bunch of codes on one sheet? Of course, you can use special software, but you don’t really want to drag 1.5 GB. Excel will help us with this!
…To do this, just download the font Code 39, and create 2 fields. One in the first field, two in the second.
…Then select these 2 cells and drag down this corner as far as it will go.
Now we have a lot of numbers. We add the character “*” to the end of the code to close the line, and select the font. Next, customize the columns and rows to taste. Hooray, we have a stack of printable barcodes!
Now you can attach a barcode to a customer order and update its status.
…Only here’s the problem again. We are stuck in the manual filling of goods in the program “Business Pack”. We need to somehow make it faster.
We take our socket as a basis, in the table
sales create several fields – automatic line id, line adding time, product id, receipt id. We make an interface tailored exclusively for the scanner.
As commodity items – ID. For example, 0001 = “VHS Digitization”, 0002 = “Video8 Digitization”, etc. We print them out to hang on the wall.
It’s time for ChatGPT. I had very little time, so I wrote the Hindu code in the form of if-else, and asked ChatGPT to optimize it. She is doing well!
…Please write another piece of code.
… In JS, she also “knows how”.
As a result, with ChatGPT in an hour we have collected such a sales receipt that can be sent for printing 🙂
There are also molds sharpened for a scanner.
In general, now our barcode scanner has “befriended” PHP, and the speed of order processing has increased several times. All the best 🙂