The post has been translated automatically. Original language: Russian
Delivery notes are often photographed on a phone: the sheet lies crooked, there is a shadow across it, and some of the columns are in Kazakh, others in Russian. We built a service that reads such photos and returns ready fields you can load into 1C, a CRM or a spreadsheet. An AI model does the reading, and ordinary code checks it.
What happens to the photo
- We straighten the sheet and remove the tilt and the shadow (OpenCV).
- The model reads the document and fills in a strict schema: parties, number, date, lines, total, VAT.
- The code checks the arithmetic and marks the fields a person should look at.
Checking a BIN without a database lookup
BIN and IIN, the Kazakhstan business and personal ID numbers, have 12 digits, and the last one is calculated from the first eleven. Multiply each digit by its position, from 1 to 11, add everything up and take the remainder after dividing by 11. If the remainder is 10, repeat with the weights 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2.
In the delivery note below, the BIN of the recipient does not match the formula: the last digit should be 7, but the document says 1. So the number contains an error, and the accountant learns about it before posting the document.

What else the code checks
- quantity times price in every line;
- the sum of the lines and the total;
- VAT at the rate in force on the document date: the standard rate is 16% from 2026 and was 12% before that.
What the test showed
On 32 test documents the service read 256 out of 256 key fields correctly. A typical delivery note takes about 7 seconds.
Rules for forming BIN and IIN (in Russian)
Накладную часто фотографируют на телефон: лист лежит криво, сверху тень, часть граф на казахском, часть на русском. Мы сделали сервис, который читает такие снимки и отдаёт готовые поля, их можно загрузить в 1С, CRM или таблицу. Читает ИИ-модель, а проверяет её обычный код.
Что происходит со снимком
- Выравниваем лист, убираем наклон и тень (OpenCV).
- Модель читает документ и заполняет строгую схему: стороны, номер, дата, строки, итог, НДС.
- Код сверяет арифметику и отмечает поля, которые должен посмотреть человек.
Проверка БИН без запроса в базу
В БИН и ИИН 12 цифр, и последняя считается из первых одиннадцати. Каждую цифру умножаем на её номер по порядку, от 1 до 11, складываем и берём остаток от деления на 11. Если вышло 10, повторяем с весами 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 2.
На накладной ниже БИН получателя не сходится с формулой: последняя цифра должна быть 7, а в документе 1. Значит, в номере ошибка, и бухгалтер узнает о ней до проводки.

Что ещё считает код
- количество на цену в каждой строке;
- сумму строк и итог;
- НДС по ставке на дату документа: базовая с 2026 года 16%, до этого 12%.
Что показала проверка
На 32 тестовых документах сервис верно прочитал 256 из 256 ключевых полей. На обычную накладную уходит около 7 секунд.
Правила формирования БИН и ИИН
Comments 0
Newest Popular