it_manager: автоинв. № EAN-13 и фиксация мм в печати шаблона.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-07 17:03:38 +03:00
parent f381d692dd
commit 22085219c3
6 changed files with 95 additions and 12 deletions
+21
View File
@@ -160,6 +160,27 @@ function itEquipmentOpenLabels() {
window.open(url, '_blank', 'noopener');
}
/** EAN-13 check digit + тело 200 + pk(9) — как на сервере. */
function itEquipmentEan13(pk) {
var body = '200' + String(pk).padStart(9, '0');
var sum = 0;
for (var i = 0; i < 12; i++) {
var d = parseInt(body.charAt(i), 10);
sum += (i % 2 === 0) ? d : d * 3;
}
var check = (10 - (sum % 10)) % 10;
return body + String(check);
}
function itFillInventoryEan(btn, pk) {
var input = document.getElementById('it-inv-' + pk);
var flag = document.getElementById('it-auto-inv-' + pk);
if (!input) return;
input.value = itEquipmentEan13(pk);
if (flag) flag.value = '1';
input.focus();
}
function itSetSearchableSelectValue(selectId, value) {
var select = document.getElementById(selectId);
if (!select) return;