@catalogicus-international/n8n-nodes-invoice-parser 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/nodes/InvoicePdfParser/parse.js +505 -22
- package/dist/nodes/InvoicePdfParser/parse.js.map +1 -1
- package/dist/nodes/InvoicePdfParser/profiles.d.ts +7 -0
- package/dist/nodes/InvoicePdfParser/profiles.js +362 -0
- package/dist/nodes/InvoicePdfParser/profiles.js.map +1 -1
- package/dist/package.json +1 -1
- package/package.json +72 -70
|
@@ -971,6 +971,368 @@ var require_profiles = __commonJS({
|
|
|
971
971
|
totalsPatterns: TOTALS_PAYABLE
|
|
972
972
|
};
|
|
973
973
|
exports2.PROFILES.push(exports2.MEGAPOLIS);
|
|
974
|
+
var ONEC_DOCUMENT_HEADER = {
|
|
975
|
+
labels: {
|
|
976
|
+
num: /^(?:№|N|No)$/u,
|
|
977
|
+
name: /^(?:Наименование(?:\s+товара)?|Товары?\s*\(работы,\s*услуги\)|Товар(?:\s*\(Услуга\))?|ТОВАР\s*\/\s*УСЛУГА|Название услуги)$/iu,
|
|
978
|
+
qty: /^(?:Кол-?во|Количество)$/iu,
|
|
979
|
+
unit: /^Ед\.?(?:\s*изм\.?)?$/iu,
|
|
980
|
+
price: /^Цена(?:,?\s*руб\.?)?(?:\s+с\s+НДС)?$/iu,
|
|
981
|
+
sum: /^Сумма(?:,?\s*руб\.?)?(?:\s+с\s+НДС)?$/iu
|
|
982
|
+
},
|
|
983
|
+
exclude: {
|
|
984
|
+
sum: /^Сумма(?:,?\s*руб\.?)?\s+(?:НДС|без)(?:\s|$)/iu
|
|
985
|
+
}
|
|
986
|
+
};
|
|
987
|
+
var ONEC_DOCUMENT_COLUMNS = [
|
|
988
|
+
{ key: "num", from: 0, to: 58 },
|
|
989
|
+
{ key: "name", from: 58, to: 330 },
|
|
990
|
+
{ key: "qty", from: 330, to: 380 },
|
|
991
|
+
{ key: "unit", from: 380, to: 420 },
|
|
992
|
+
{ key: "price", from: 420, to: 500 },
|
|
993
|
+
{ key: "sum", from: 500, to: 620 }
|
|
994
|
+
];
|
|
995
|
+
var PROFILE_NPD_PAVLYUCHENKO = {
|
|
996
|
+
id: "npd-pavlyuchenko",
|
|
997
|
+
layoutId: "onec-npd",
|
|
998
|
+
title: "\u0418\u041F \u041F\u0430\u0432\u043B\u044E\u0447\u0435\u043D\u043A\u043E \u0412. \u0412. (\u041D\u041F\u0414)",
|
|
999
|
+
detect: [/(?<!\d)611336211593(?!\d)/u],
|
|
1000
|
+
columns: ONEC_DOCUMENT_COLUMNS,
|
|
1001
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1002
|
+
rowPattern: { num: /^\d+$/ },
|
|
1003
|
+
stopPattern: /^итог/iu,
|
|
1004
|
+
totalsPatterns: { total: /^Итого к оплате/iu }
|
|
1005
|
+
};
|
|
1006
|
+
exports2.PROFILES.push(PROFILE_NPD_PAVLYUCHENKO);
|
|
1007
|
+
var PROFILE_NPD_ZABOLOTNY = {
|
|
1008
|
+
id: "npd-zabolotny",
|
|
1009
|
+
layoutId: "onec-npd",
|
|
1010
|
+
title: "\u0418\u041F \u0417\u0430\u0431\u043E\u043B\u043E\u0442\u043D\u044B\u0439 \u0410. \u041E. (\u041D\u041F\u0414)",
|
|
1011
|
+
detect: [/(?<!\d)151010902928(?!\d)/u],
|
|
1012
|
+
columns: ONEC_DOCUMENT_COLUMNS,
|
|
1013
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1014
|
+
rowPattern: { num: /^\d+$/ },
|
|
1015
|
+
stopPattern: /^итог/iu,
|
|
1016
|
+
totalsPatterns: { total: /^Итого к оплате/iu }
|
|
1017
|
+
};
|
|
1018
|
+
exports2.PROFILES.push(PROFILE_NPD_ZABOLOTNY);
|
|
1019
|
+
var PROFILE_TURDUGULOV = {
|
|
1020
|
+
id: "turdugulov",
|
|
1021
|
+
layoutId: "onec-contract",
|
|
1022
|
+
title: "\u0418\u041F \u0422\u0443\u0440\u0434\u0443\u0433\u0443\u043B\u043E\u0432 \u0410. \u0410.",
|
|
1023
|
+
detect: [/(?<!\d)773433196000(?!\d)/u],
|
|
1024
|
+
columns: [
|
|
1025
|
+
{ key: "num", from: 0, to: 58 },
|
|
1026
|
+
{ key: "name", from: 58, to: 385 },
|
|
1027
|
+
{ key: "price", from: 385, to: 450 },
|
|
1028
|
+
{ key: "qty", from: 450, to: 480 },
|
|
1029
|
+
{ key: "unit", from: 480, to: 505 },
|
|
1030
|
+
{ key: "sum", from: 505, to: 620 }
|
|
1031
|
+
],
|
|
1032
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1033
|
+
rowPattern: { num: /^\d+$/ },
|
|
1034
|
+
stopPattern: /^итог/iu,
|
|
1035
|
+
totalsPatterns: {
|
|
1036
|
+
sum: /^Итого:/iu,
|
|
1037
|
+
vat: /Сумма НДС/iu,
|
|
1038
|
+
total: /^Всего к оплате/iu
|
|
1039
|
+
}
|
|
1040
|
+
};
|
|
1041
|
+
exports2.PROFILES.push(PROFILE_TURDUGULOV);
|
|
1042
|
+
var PROFILE_PTK_MIRA = {
|
|
1043
|
+
id: "ptk-mira",
|
|
1044
|
+
layoutId: "onec-simple",
|
|
1045
|
+
title: "\u041E\u041E\u041E \xAB\u041F\u0422\u041A \xAB\u041C\u0418\u0420\u0410\xBB",
|
|
1046
|
+
detect: [/(?<!\d)7842073161(?!\d)/u],
|
|
1047
|
+
columns: ONEC_DOCUMENT_COLUMNS,
|
|
1048
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1049
|
+
rowPattern: { num: /^\d+$/ },
|
|
1050
|
+
stopPattern: /^итог/iu,
|
|
1051
|
+
totalsPatterns: { total: /^Всего к оплате/iu }
|
|
1052
|
+
};
|
|
1053
|
+
exports2.PROFILES.push(PROFILE_PTK_MIRA);
|
|
1054
|
+
var PROFILE_DELTSOVA = {
|
|
1055
|
+
id: "deltsova",
|
|
1056
|
+
layoutId: "onec-gross",
|
|
1057
|
+
title: "\u0418\u041F \u0414\u0435\u043B\u044C\u0446\u043E\u0432\u0430 \u041E. \u0415.",
|
|
1058
|
+
detect: [/(?<!\d)773700483641(?!\d)/u],
|
|
1059
|
+
pricesIncludeVat: true,
|
|
1060
|
+
vatRate: 22,
|
|
1061
|
+
columns: ONEC_DOCUMENT_COLUMNS,
|
|
1062
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1063
|
+
rowPattern: { num: /^\d+$/ },
|
|
1064
|
+
stopPattern: /^итог/iu,
|
|
1065
|
+
totalsPatterns: {
|
|
1066
|
+
vat: /В том числе НДС/iu,
|
|
1067
|
+
total: /^Всего к оплате/iu
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
exports2.PROFILES.push(PROFILE_DELTSOVA);
|
|
1071
|
+
var PROFILE_BRATOVA = {
|
|
1072
|
+
id: "bratova",
|
|
1073
|
+
layoutId: "onec-simple",
|
|
1074
|
+
title: "\u0418\u041F \u0411\u0440\u0430\u0442\u043E\u0432\u0430 \u041D. \u0421.",
|
|
1075
|
+
detect: [/(?<!\d)232018561037(?!\d)/u],
|
|
1076
|
+
columns: ONEC_DOCUMENT_COLUMNS,
|
|
1077
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1078
|
+
rowPattern: { num: /^\d+$/ },
|
|
1079
|
+
stopPattern: /^итог/iu,
|
|
1080
|
+
totalsPatterns: { total: /^Всего к оплате/iu }
|
|
1081
|
+
};
|
|
1082
|
+
exports2.PROFILES.push(PROFILE_BRATOVA);
|
|
1083
|
+
var PROFILE_LESKRAFT = {
|
|
1084
|
+
id: "leskraft",
|
|
1085
|
+
layoutId: "onec-code",
|
|
1086
|
+
title: "\u041E\u041E\u041E \xAB\u041B\u0415\u0421\u041A\u0420\u0410\u0424\u0422\xBB",
|
|
1087
|
+
detect: [/(?<!\d)2308205621(?!\d)/u],
|
|
1088
|
+
pricesIncludeVat: true,
|
|
1089
|
+
vatRate: 22,
|
|
1090
|
+
descriptionAbove: true,
|
|
1091
|
+
columns: [
|
|
1092
|
+
{ key: "num", from: 0, to: 55 },
|
|
1093
|
+
{ key: "code", from: 55, to: 100 },
|
|
1094
|
+
{ key: "name", from: 100, to: 390 },
|
|
1095
|
+
{ key: "qty", from: 390, to: 435 },
|
|
1096
|
+
{ key: "unit", from: 435, to: 480 },
|
|
1097
|
+
{ key: "price", from: 480, to: 525 },
|
|
1098
|
+
{ key: "sum", from: 525, to: 620 }
|
|
1099
|
+
],
|
|
1100
|
+
rowPattern: { num: /^\d+$/, code: /^УТ-?\d+$/iu },
|
|
1101
|
+
stopPattern: /^итог/iu,
|
|
1102
|
+
totalsPatterns: {
|
|
1103
|
+
vat: /В т\.ч\. НДС/iu,
|
|
1104
|
+
total: /^Итого с НДС/iu
|
|
1105
|
+
}
|
|
1106
|
+
};
|
|
1107
|
+
exports2.PROFILES.push(PROFILE_LESKRAFT);
|
|
1108
|
+
var PROFILE_MALINOVSKAYA = {
|
|
1109
|
+
id: "malinovskaya",
|
|
1110
|
+
layoutId: "onec-color",
|
|
1111
|
+
title: "\u0418\u041F \u041C\u0430\u043B\u0438\u043D\u043E\u0432\u0441\u043A\u0430\u044F \u0410. \u041F.",
|
|
1112
|
+
detect: [/(?<!\d)552503291108(?!\d)/u],
|
|
1113
|
+
columns: [
|
|
1114
|
+
{ key: "num", from: 0, to: 55 },
|
|
1115
|
+
{ key: "name", from: 55, to: 380 },
|
|
1116
|
+
{ key: "qty", from: 380, to: 415 },
|
|
1117
|
+
{ key: "unit", from: 415, to: 462 },
|
|
1118
|
+
{ key: "price", from: 462, to: 520 },
|
|
1119
|
+
{ key: "sum", from: 520, to: 620 }
|
|
1120
|
+
],
|
|
1121
|
+
rowPattern: { num: /^\d+$/ },
|
|
1122
|
+
stopPattern: /^итог/iu,
|
|
1123
|
+
totalsPatterns: {
|
|
1124
|
+
sum: /^Итого:/iu,
|
|
1125
|
+
vat: /Сумма НДС/iu,
|
|
1126
|
+
total: /^Всего к оплате/iu
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
exports2.PROFILES.push(PROFILE_MALINOVSKAYA);
|
|
1130
|
+
var PROFILE_KOROLEV = {
|
|
1131
|
+
id: "korneev",
|
|
1132
|
+
layoutId: "onec-term",
|
|
1133
|
+
title: "\u0418\u041F \u041A\u043E\u0440\u043D\u0435\u0435\u0432 \u041F. \u0410.",
|
|
1134
|
+
detect: [/(?<!\d)027716762358(?!\d)/u],
|
|
1135
|
+
columns: [
|
|
1136
|
+
{ key: "num", from: 0, to: 60 },
|
|
1137
|
+
{ key: "name", from: 60, to: 335 },
|
|
1138
|
+
{ key: "qty", from: 335, to: 382 },
|
|
1139
|
+
{ key: "unit", from: 382, to: 416 },
|
|
1140
|
+
{ key: "price", from: 455, to: 500 },
|
|
1141
|
+
{ key: "sum", from: 500, to: 620 }
|
|
1142
|
+
],
|
|
1143
|
+
rowPattern: { num: /^\d+$/ },
|
|
1144
|
+
stopPattern: /^итог/iu,
|
|
1145
|
+
totalsPatterns: { total: /ВСЕГО К ОПЛАТЕ/iu }
|
|
1146
|
+
};
|
|
1147
|
+
exports2.PROFILES.push(PROFILE_KOROLEV);
|
|
1148
|
+
var PROFILE_BASHKIROVA = {
|
|
1149
|
+
id: "bashkirova",
|
|
1150
|
+
layoutId: "onec-service-above",
|
|
1151
|
+
title: "\u0418\u041F \u0411\u0430\u0448\u043A\u0438\u0440\u043E\u0432\u0430 \u0412. \u0410.",
|
|
1152
|
+
detect: [/(?<!\d)561504764263(?!\d)/u],
|
|
1153
|
+
descriptionAbove: true,
|
|
1154
|
+
columns: [
|
|
1155
|
+
{ key: "num", from: 0, to: 35 },
|
|
1156
|
+
{ key: "name", from: 35, to: 218 },
|
|
1157
|
+
{ key: "qty", from: 218, to: 261 },
|
|
1158
|
+
{ key: "unit", from: 261, to: 328 },
|
|
1159
|
+
{ key: "price", from: 328, to: 526 },
|
|
1160
|
+
{ key: "sum", from: 526, to: 620 }
|
|
1161
|
+
],
|
|
1162
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1163
|
+
rowPattern: { num: /^\d+$/ },
|
|
1164
|
+
stopPattern: /^итог/iu,
|
|
1165
|
+
totalsPatterns: {
|
|
1166
|
+
sum: /^Итого:/iu,
|
|
1167
|
+
vat: /Сумма НДС/iu,
|
|
1168
|
+
total: /^Всего к оплате/iu
|
|
1169
|
+
}
|
|
1170
|
+
};
|
|
1171
|
+
exports2.PROFILES.push(PROFILE_BASHKIROVA);
|
|
1172
|
+
var PROFILE_SATURN_YUG = {
|
|
1173
|
+
id: "saturn-yug",
|
|
1174
|
+
layoutId: "onec-weight",
|
|
1175
|
+
title: "\u0410\u041E \xAB\u0421\u0410\u0422\u0423\u0420\u041D \u042E\u0413\xBB",
|
|
1176
|
+
detect: [/(?<!\d)2312254452(?!\d)/u],
|
|
1177
|
+
pricesIncludeVat: true,
|
|
1178
|
+
vatRate: 22,
|
|
1179
|
+
columns: [
|
|
1180
|
+
{ key: "num", from: 0, to: 60 },
|
|
1181
|
+
{ key: "code", from: 60, to: 105 },
|
|
1182
|
+
{ key: "name", from: 105, to: 330 },
|
|
1183
|
+
{ key: "qty", from: 330, to: 370 },
|
|
1184
|
+
{ key: "unit", from: 370, to: 400 },
|
|
1185
|
+
{ key: "price", from: 400, to: 460 },
|
|
1186
|
+
{ key: "sum", from: 460, to: 510 }
|
|
1187
|
+
],
|
|
1188
|
+
rowPattern: { num: /^\d+$/ },
|
|
1189
|
+
stopPattern: /^итог/iu,
|
|
1190
|
+
totalsPatterns: {
|
|
1191
|
+
vat: /В том числе НДС/iu,
|
|
1192
|
+
total: /^Итого\s*:/iu
|
|
1193
|
+
}
|
|
1194
|
+
};
|
|
1195
|
+
exports2.PROFILES.push(PROFILE_SATURN_YUG);
|
|
1196
|
+
var PROFILE_INVISIBLE = {
|
|
1197
|
+
id: "invisible",
|
|
1198
|
+
layoutId: "onec-price-before-qty",
|
|
1199
|
+
title: "\u041E\u041E\u041E \xAB\u0418\u041D\u0412\u0418\u0417\u0418\u0411\u041B-\u0414\u041E\u0420\u0421\xBB",
|
|
1200
|
+
detect: [/(?<!\d)9723136786(?!\d)/u],
|
|
1201
|
+
descriptionAbove: true,
|
|
1202
|
+
pricesIncludeVat: true,
|
|
1203
|
+
vatRate: 22,
|
|
1204
|
+
columns: [
|
|
1205
|
+
{ key: "num", from: 0, to: 60 },
|
|
1206
|
+
{ key: "name", from: 60, to: 350 },
|
|
1207
|
+
{ key: "price", from: 350, to: 400 },
|
|
1208
|
+
{ key: "qty", from: 400, to: 450 },
|
|
1209
|
+
{ key: "unit", from: 480, to: 500 },
|
|
1210
|
+
{ key: "sum", from: 500, to: 620 }
|
|
1211
|
+
],
|
|
1212
|
+
rowPattern: { num: /^\d+$/ },
|
|
1213
|
+
stopPattern: /^итог/iu,
|
|
1214
|
+
totalsPatterns: {
|
|
1215
|
+
vat: /В том числе НДС/iu,
|
|
1216
|
+
total: /^Итого\s*:/iu
|
|
1217
|
+
}
|
|
1218
|
+
};
|
|
1219
|
+
exports2.PROFILES.push(PROFILE_INVISIBLE);
|
|
1220
|
+
var PROFILE_BAKHAREVA = {
|
|
1221
|
+
id: "bakhareva",
|
|
1222
|
+
layoutId: "onec-packed",
|
|
1223
|
+
title: "\u0418\u041F \u0411\u0430\u0445\u0430\u0440\u0435\u0432\u0430 \u041A. \u0413.",
|
|
1224
|
+
detect: [/(?<!\d)232015903973(?!\d)/u],
|
|
1225
|
+
qtyPriceInOneColumn: true,
|
|
1226
|
+
columns: [
|
|
1227
|
+
{ key: "num", from: 0, to: 25 },
|
|
1228
|
+
{ key: "name", from: 25, to: 300 },
|
|
1229
|
+
{ key: "qty", from: 300, to: 415 },
|
|
1230
|
+
{ key: "vat", from: 415, to: 439 },
|
|
1231
|
+
{ key: "vatflag", from: 439, to: 495 },
|
|
1232
|
+
{ key: "sum", from: 495, to: 620 }
|
|
1233
|
+
],
|
|
1234
|
+
rowPattern: { num: /^\d+$/ },
|
|
1235
|
+
stopPattern: /^итог/iu,
|
|
1236
|
+
totalsPatterns: {
|
|
1237
|
+
sum: /^Итого:/iu,
|
|
1238
|
+
total: /^Итого:/iu
|
|
1239
|
+
}
|
|
1240
|
+
};
|
|
1241
|
+
exports2.PROFILES.push(PROFILE_BAKHAREVA);
|
|
1242
|
+
var PROFILE_BAS = {
|
|
1243
|
+
id: "bas-engineering",
|
|
1244
|
+
layoutId: "onec-number-above",
|
|
1245
|
+
title: "\u041E\u041E\u041E \xAB\u0411\u0410\u0421 \u0418\u041D\u0416\u0418\u041D\u0418\u0420\u0418\u041D\u0413 \u0413\u0420\u0423\u041F\u041F\xBB",
|
|
1246
|
+
detect: [/(?<!\d)2366050350(?!\d)/u],
|
|
1247
|
+
numberAbove: true,
|
|
1248
|
+
pricesIncludeVat: true,
|
|
1249
|
+
vatRate: 22,
|
|
1250
|
+
columns: [
|
|
1251
|
+
{ key: "num", from: 0, to: 68 },
|
|
1252
|
+
{ key: "name", from: 68, to: 335 },
|
|
1253
|
+
{ key: "price", from: 335, to: 371 },
|
|
1254
|
+
{ key: "qty", from: 371, to: 410 },
|
|
1255
|
+
{ key: "unit", from: 410, to: 467 },
|
|
1256
|
+
{ key: "sum", from: 467, to: 620 }
|
|
1257
|
+
],
|
|
1258
|
+
rowPattern: { num: /^\d+$/ },
|
|
1259
|
+
stopPattern: /^итог/iu,
|
|
1260
|
+
totalsPatterns: {
|
|
1261
|
+
vat: /В том числе НДС/iu,
|
|
1262
|
+
total: /^Итого\s*:/iu
|
|
1263
|
+
}
|
|
1264
|
+
};
|
|
1265
|
+
exports2.PROFILES.push(PROFILE_BAS);
|
|
1266
|
+
var ONEC_STANDARD_TABLE = [
|
|
1267
|
+
{ key: "num", from: 0, to: 58 },
|
|
1268
|
+
{ key: "name", from: 58, to: 305 },
|
|
1269
|
+
{ key: "qty", from: 305, to: 343 },
|
|
1270
|
+
{ key: "unit", from: 343, to: 370 },
|
|
1271
|
+
{ key: "price", from: 370, to: 450 },
|
|
1272
|
+
{ key: "sum", from: 450, to: 620 }
|
|
1273
|
+
];
|
|
1274
|
+
var onecStandard = (id, title, inn) => ({
|
|
1275
|
+
id,
|
|
1276
|
+
layoutId: "onec-standard",
|
|
1277
|
+
title,
|
|
1278
|
+
detect: [new RegExp(`(?<!\\d)${inn}(?!\\d)`, "u")],
|
|
1279
|
+
pricesIncludeVat: true,
|
|
1280
|
+
vatRate: 22,
|
|
1281
|
+
columns: ONEC_STANDARD_TABLE,
|
|
1282
|
+
headerColumns: ONEC_DOCUMENT_HEADER,
|
|
1283
|
+
rowPattern: { num: /^\d+$/ },
|
|
1284
|
+
stopPattern: /^итог/iu,
|
|
1285
|
+
totalsPatterns: TOTALS_PAYABLE
|
|
1286
|
+
});
|
|
1287
|
+
exports2.PROFILES.push(onecStandard("mir", "\u041E\u041E\u041E \xAB\u041C\u0438\u0420\xBB", "7735559983"));
|
|
1288
|
+
exports2.PROFILES.push(onecStandard("alpikastroy", "\u041E\u041E\u041E \xAB\u0410\u043B\u044C\u043F\u0438\u043A\u0430\u0441\u0442\u0440\u043E\u0439\u0441\u0435\u0440\u0432\u0438\u0441\xBB", "2319032882"));
|
|
1289
|
+
exports2.PROFILES.push(onecStandard("maradi", "\u041E\u041E\u041E \xAB\u041C\u0410\u0420\u0410\u0414\u0418\xBB", "2366045864"));
|
|
1290
|
+
var AKVADOOR_TABLE = [
|
|
1291
|
+
{ key: "num", from: 0, to: 58 },
|
|
1292
|
+
{ key: "name", from: 58, to: 208 },
|
|
1293
|
+
{ key: "code", from: 208, to: 256 },
|
|
1294
|
+
{ key: "qty", from: 256, to: 308 },
|
|
1295
|
+
{ key: "unit", from: 308, to: 352 },
|
|
1296
|
+
{ key: "price", from: 352, to: 420 },
|
|
1297
|
+
{ key: "sum", from: 420, to: 620 }
|
|
1298
|
+
];
|
|
1299
|
+
var PROFILE_AKVADOOR = {
|
|
1300
|
+
id: "akvadoor",
|
|
1301
|
+
layoutId: "onec-code-wide",
|
|
1302
|
+
title: "\u041E\u041E\u041E \xAB\u0410\u041A\u0412\u0410\u0414\u0412\u0415\u0420\u042C\xBB",
|
|
1303
|
+
detect: [/(?<!\d)6102075165(?!\d)/u],
|
|
1304
|
+
pricesIncludeVat: true,
|
|
1305
|
+
vatRate: 22,
|
|
1306
|
+
columns: AKVADOOR_TABLE,
|
|
1307
|
+
rowPattern: { num: /^\d+$/, code: /^НФ-?\d+$/iu },
|
|
1308
|
+
stopPattern: /^итог/iu,
|
|
1309
|
+
totalsPatterns: TOTALS_PAYABLE
|
|
1310
|
+
};
|
|
1311
|
+
exports2.PROFILES.push(PROFILE_AKVADOOR);
|
|
1312
|
+
var DELOVYE_LINII_TABLE = [
|
|
1313
|
+
{ key: "num", from: 0, to: 43 },
|
|
1314
|
+
{ key: "name", from: 43, to: 345 },
|
|
1315
|
+
{ key: "price", from: 345, to: 412 },
|
|
1316
|
+
{ key: "vat", from: 412, to: 440 },
|
|
1317
|
+
{ key: "vatsum", from: 440, to: 490 },
|
|
1318
|
+
{ key: "total", from: 490, to: 620 }
|
|
1319
|
+
];
|
|
1320
|
+
var PROFILE_DELOVYE_LINII = {
|
|
1321
|
+
id: "delovye-linii",
|
|
1322
|
+
layoutId: "delivery-services",
|
|
1323
|
+
title: "\u041E\u041E\u041E \xAB\u0414\u0435\u043B\u043E\u0432\u044B\u0435 \u041B\u0438\u043D\u0438\u0438\xBB",
|
|
1324
|
+
detect: [/(?<!\d)7826156685(?!\d)/u],
|
|
1325
|
+
serviceRows: true,
|
|
1326
|
+
extraCharges: [{ pattern: /^Страхование/iu }],
|
|
1327
|
+
columns: DELOVYE_LINII_TABLE,
|
|
1328
|
+
rowPattern: { num: /^\d+\.$/ },
|
|
1329
|
+
stopPattern: /^(?:итог|всего\s+к\s+оплате)/iu,
|
|
1330
|
+
totalsPatterns: {
|
|
1331
|
+
vat: /В том числе НДС/iu,
|
|
1332
|
+
total: /^Итог(?!о)/iu
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
exports2.PROFILES.push(PROFILE_DELOVYE_LINII);
|
|
974
1336
|
}
|
|
975
1337
|
});
|
|
976
1338
|
|
|
@@ -85710,6 +86072,9 @@ exports.parseRows = parseRows;
|
|
|
85710
86072
|
exports.parseInvoicePdf = parseInvoicePdf;
|
|
85711
86073
|
var node_path_1 = __importDefault(require("node:path"));
|
|
85712
86074
|
var profiles_1 = require_profiles();
|
|
86075
|
+
function itemWidth(item) {
|
|
86076
|
+
return item.w || item.str.length * 3.2;
|
|
86077
|
+
}
|
|
85713
86078
|
var number = (raw) => {
|
|
85714
86079
|
if (!raw)
|
|
85715
86080
|
return 0;
|
|
@@ -85747,7 +86112,7 @@ function rowText(row, gap = 1) {
|
|
|
85747
86112
|
for (const item of row.items) {
|
|
85748
86113
|
if (!item.str)
|
|
85749
86114
|
continue;
|
|
85750
|
-
const end = item.x + (item
|
|
86115
|
+
const end = item.x + itemWidth(item);
|
|
85751
86116
|
if (prevEnd !== void 0 && item.x - prevEnd > gap)
|
|
85752
86117
|
out += " ";
|
|
85753
86118
|
out += item.str;
|
|
@@ -85767,7 +86132,7 @@ function rowCells(row, profile, gap = 1) {
|
|
|
85767
86132
|
continue;
|
|
85768
86133
|
const lineBreak = prevY !== void 0 && Math.abs(prevY - item.y) > 2;
|
|
85769
86134
|
prevY = item.y;
|
|
85770
|
-
const width = item
|
|
86135
|
+
const width = itemWidth(item);
|
|
85771
86136
|
const charWidth = width / Math.max(item.str.length, 1);
|
|
85772
86137
|
const startColumn = profile.columns.find((column) => item.x + charWidth / 2 >= column.from && item.x + charWidth / 2 < column.to);
|
|
85773
86138
|
const startsInText = startColumn !== void 0 && TEXT_COLUMNS.has(startColumn.key);
|
|
@@ -85859,7 +86224,7 @@ function layoutScore(rows, profile) {
|
|
|
85859
86224
|
for (const item of row.items) {
|
|
85860
86225
|
if (!item.str.trim())
|
|
85861
86226
|
continue;
|
|
85862
|
-
const width = item
|
|
86227
|
+
const width = itemWidth(item);
|
|
85863
86228
|
const charWidth = width / Math.max(item.str.length, 1);
|
|
85864
86229
|
for (let i = 0; i < item.str.length; i++) {
|
|
85865
86230
|
const center = item.x + i * charWidth + charWidth / 2;
|
|
@@ -85896,10 +86261,10 @@ function headerCells(row) {
|
|
|
85896
86261
|
const gap = previous ? item.x - (previous.x + previous.w) : Number.POSITIVE_INFINITY;
|
|
85897
86262
|
if (previous && gap <= HEADER_CELL_GAP) {
|
|
85898
86263
|
previous.text += `${gap > 1 ? " " : ""}${text}`;
|
|
85899
|
-
previous.w = item.x + (item
|
|
86264
|
+
previous.w = item.x + itemWidth(item) - previous.x;
|
|
85900
86265
|
continue;
|
|
85901
86266
|
}
|
|
85902
|
-
cells.push({ x: item.x, w: item
|
|
86267
|
+
cells.push({ x: item.x, w: itemWidth(item), text });
|
|
85903
86268
|
}
|
|
85904
86269
|
return cells;
|
|
85905
86270
|
}
|
|
@@ -86022,11 +86387,43 @@ function isContinuation(prev, row) {
|
|
|
86022
86387
|
const lineHeight = Math.max(0, ...prev.items.map((item) => item.h)) || 10;
|
|
86023
86388
|
return prev.y - row.y <= lineHeight * 2.5;
|
|
86024
86389
|
}
|
|
86390
|
+
var LINE_BREAK_UNITS = /* @__PURE__ */ new Set(["\u043A\u0433", "\u043C2", "\u043C3", "\u043C\u043C", "\u0440\u0443\u0431", "\u0441\u043C", "\u0448\u0442"]);
|
|
86391
|
+
function nameLineIsFull(row, profile) {
|
|
86392
|
+
const column = profile.columns.find((entry) => entry.key === "name");
|
|
86393
|
+
if (!column)
|
|
86394
|
+
return false;
|
|
86395
|
+
let end = 0;
|
|
86396
|
+
for (const item of row.items) {
|
|
86397
|
+
const width = itemWidth(item);
|
|
86398
|
+
if (item.x >= column.to || item.x + width <= column.from)
|
|
86399
|
+
continue;
|
|
86400
|
+
end = Math.max(end, Math.min(item.x + width, column.to));
|
|
86401
|
+
}
|
|
86402
|
+
return end >= column.to - 8;
|
|
86403
|
+
}
|
|
86404
|
+
function shouldGlueLineBreak(prevName, nextName, prevRow, profile) {
|
|
86405
|
+
var _a, _b;
|
|
86406
|
+
if (/^-/u.test(nextName) || /-$/u.test(prevName))
|
|
86407
|
+
return true;
|
|
86408
|
+
if (!/^[a-zа-яё]/u.test(nextName))
|
|
86409
|
+
return false;
|
|
86410
|
+
if (!/[0-9A-Za-zА-Яа-яЁё]$/u.test(prevName))
|
|
86411
|
+
return false;
|
|
86412
|
+
if (/^[а-яё]{1,2}-/u.test(nextName))
|
|
86413
|
+
return false;
|
|
86414
|
+
const lastWord = (_b = (_a = /([A-Za-zА-Яа-яЁё0-9]+)$/u.exec(prevName)) === null || _a === void 0 ? void 0 : _a[1]) !== null && _b !== void 0 ? _b : "";
|
|
86415
|
+
if (LINE_BREAK_UNITS.has(lastWord.toLowerCase()))
|
|
86416
|
+
return false;
|
|
86417
|
+
if (/^[A-Z0-9]+$/u.test(lastWord))
|
|
86418
|
+
return false;
|
|
86419
|
+
return nameLineIsFull(prevRow, profile);
|
|
86420
|
+
}
|
|
86025
86421
|
function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
86026
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
|
|
86422
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
|
|
86027
86423
|
const lines = [];
|
|
86028
86424
|
const warnings = [];
|
|
86029
86425
|
const unparsedRows = [];
|
|
86426
|
+
const chargeLines = /* @__PURE__ */ new Set();
|
|
86030
86427
|
const headerExpected = Boolean(profile.headerColumns);
|
|
86031
86428
|
profile = resolveProfileColumns(rows, profile);
|
|
86032
86429
|
if (headerExpected && profile.headerColumns) {
|
|
@@ -86034,7 +86431,9 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86034
86431
|
}
|
|
86035
86432
|
let current;
|
|
86036
86433
|
let currentRow;
|
|
86434
|
+
let lastCharge;
|
|
86037
86435
|
let pending = [];
|
|
86436
|
+
let lastNumbered;
|
|
86038
86437
|
const flushPending = () => {
|
|
86039
86438
|
var _a2, _b2;
|
|
86040
86439
|
for (const entry of pending) {
|
|
@@ -86051,16 +86450,61 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86051
86450
|
}
|
|
86052
86451
|
pending = [];
|
|
86053
86452
|
};
|
|
86453
|
+
const flushLastNumbered = () => {
|
|
86454
|
+
if (!lastNumbered)
|
|
86455
|
+
return;
|
|
86456
|
+
for (const sourceRow of lastNumbered.rows)
|
|
86457
|
+
unparsedRows.push(rowText(sourceRow));
|
|
86458
|
+
lastNumbered = void 0;
|
|
86459
|
+
};
|
|
86054
86460
|
for (const row of rows) {
|
|
86055
86461
|
const text = rowText(row);
|
|
86056
86462
|
if (!text)
|
|
86057
86463
|
continue;
|
|
86058
86464
|
if (profile.stopPattern.test(text)) {
|
|
86059
86465
|
flushPending();
|
|
86466
|
+
flushLastNumbered();
|
|
86060
86467
|
current = void 0;
|
|
86468
|
+
lastCharge = void 0;
|
|
86061
86469
|
continue;
|
|
86062
86470
|
}
|
|
86063
86471
|
const cells = rowCells(row, profile);
|
|
86472
|
+
const charge = (_a = profile.extraCharges) === null || _a === void 0 ? void 0 : _a.find((entry) => entry.pattern.test(text));
|
|
86473
|
+
if (charge) {
|
|
86474
|
+
const amount = valueAfterLabel(text, charge.pattern);
|
|
86475
|
+
if (amount !== void 0 && amount > 0) {
|
|
86476
|
+
flushPending();
|
|
86477
|
+
flushLastNumbered();
|
|
86478
|
+
const line = {
|
|
86479
|
+
num: ((_c = (_b = lines[lines.length - 1]) === null || _b === void 0 ? void 0 : _b.num) !== null && _c !== void 0 ? _c : 0) + 1,
|
|
86480
|
+
code: "",
|
|
86481
|
+
name: (_f = (_e = (_d = charge.pattern.exec(text)) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.trim()) !== null && _f !== void 0 ? _f : text,
|
|
86482
|
+
article: "",
|
|
86483
|
+
productType: "",
|
|
86484
|
+
unit: "",
|
|
86485
|
+
vat: (_g = charge.vatRate) !== null && _g !== void 0 ? _g : 0,
|
|
86486
|
+
qty: 1,
|
|
86487
|
+
price: amount,
|
|
86488
|
+
sum: amount,
|
|
86489
|
+
total: amount,
|
|
86490
|
+
raw: cells
|
|
86491
|
+
};
|
|
86492
|
+
lines.push(line);
|
|
86493
|
+
chargeLines.add(line);
|
|
86494
|
+
current = void 0;
|
|
86495
|
+
currentRow = void 0;
|
|
86496
|
+
lastCharge = { line, row, x: (_j = (_h = row.items[0]) === null || _h === void 0 ? void 0 : _h.x) !== null && _j !== void 0 ? _j : 0 };
|
|
86497
|
+
continue;
|
|
86498
|
+
}
|
|
86499
|
+
}
|
|
86500
|
+
if (profile.qtyPriceInOneColumn && cells.qty) {
|
|
86501
|
+
const match = /^([\d\s.,]+)\s+([^\d\s].*?)\s+([\d\s.,]+)$/.exec(cells.qty.trim());
|
|
86502
|
+
if ((match === null || match === void 0 ? void 0 : match[1]) && match[2] && match[3]) {
|
|
86503
|
+
cells.qty = match[1].replace(/\s+/g, "");
|
|
86504
|
+
cells.unit = match[2].trim();
|
|
86505
|
+
cells.price = match[3];
|
|
86506
|
+
}
|
|
86507
|
+
}
|
|
86064
86508
|
if (profile.qtyUnitInOneColumn && cells.qty) {
|
|
86065
86509
|
const match = /^([\d\s.,]+)\s*([^\d\s].*)$/.exec(cells.qty.trim());
|
|
86066
86510
|
if ((match === null || match === void 0 ? void 0 : match[1]) && match[2]) {
|
|
@@ -86068,24 +86512,54 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86068
86512
|
cells.unit = match[2].trim();
|
|
86069
86513
|
}
|
|
86070
86514
|
}
|
|
86071
|
-
const { num, code } = cells;
|
|
86072
86515
|
const priceValue = number(cells.price);
|
|
86516
|
+
if (profile.serviceRows && priceValue > 0 && !cells.qty && !cells.sum) {
|
|
86517
|
+
cells.qty = "1";
|
|
86518
|
+
cells.sum = (_k = cells.price) !== null && _k !== void 0 ? _k : "";
|
|
86519
|
+
}
|
|
86073
86520
|
const hasQuantity = number(cells.qty) > 0;
|
|
86074
86521
|
const serviceLike = priceValue > 0 && Math.abs(priceValue - number(cells.sum)) < 5e-3;
|
|
86522
|
+
const numericRow = hasQuantity && priceValue > 0 && number(cells.sum) > 0;
|
|
86523
|
+
if (profile.numberAbove) {
|
|
86524
|
+
const previousNumbered = lastNumbered && lastNumbered.lastRow.page === row.page && lastNumbered.lastRow.y - row.y <= 25 ? lastNumbered : void 0;
|
|
86525
|
+
if (!cells.num && !numericRow && cells.name && previousNumbered) {
|
|
86526
|
+
previousNumbered.cells.name = `${(_l = previousNumbered.cells.name) !== null && _l !== void 0 ? _l : ""} ${(_m = cells.name) !== null && _m !== void 0 ? _m : ""}`.replace(/\s+/g, " ").trim();
|
|
86527
|
+
if (cells.code)
|
|
86528
|
+
previousNumbered.cells.code = cells.code;
|
|
86529
|
+
previousNumbered.rows.push(row);
|
|
86530
|
+
previousNumbered.lastRow = row;
|
|
86531
|
+
continue;
|
|
86532
|
+
}
|
|
86533
|
+
if (!cells.num && numericRow && previousNumbered) {
|
|
86534
|
+
cells.num = (_o = previousNumbered.cells.num) !== null && _o !== void 0 ? _o : "";
|
|
86535
|
+
cells.name = `${(_p = previousNumbered.cells.name) !== null && _p !== void 0 ? _p : ""} ${(_q = cells.name) !== null && _q !== void 0 ? _q : ""}`.replace(/\s+/g, " ").trim();
|
|
86536
|
+
lastNumbered = void 0;
|
|
86537
|
+
} else {
|
|
86538
|
+
flushLastNumbered();
|
|
86539
|
+
if (cells.num && !numericRow && !serviceLike) {
|
|
86540
|
+
lastNumbered = { rows: [row], cells, lastRow: row };
|
|
86541
|
+
continue;
|
|
86542
|
+
}
|
|
86543
|
+
}
|
|
86544
|
+
}
|
|
86545
|
+
const { num, code } = cells;
|
|
86075
86546
|
const codePattern = profile.rowPattern.code;
|
|
86547
|
+
const nameText = (_s = (_r = cells.name) === null || _r === void 0 ? void 0 : _r.trim()) !== null && _s !== void 0 ? _s : "";
|
|
86548
|
+
const numericName = /^[\d\s.,:;()-]+$/u.test(nameText);
|
|
86549
|
+
const hasUsableName = Boolean(nameText) && !numericName;
|
|
86076
86550
|
const pendingCode = profile.descriptionAbove ? pending.find((entry) => {
|
|
86077
86551
|
var _a2, _b2, _c2;
|
|
86078
86552
|
return entry.row.page === row.page && entry.row.y - row.y <= 20 && Boolean((_a2 = entry.cells.code) === null || _a2 === void 0 ? void 0 : _a2.trim()) && (!codePattern || codePattern.test((_c2 = (_b2 = entry.cells.code) === null || _b2 === void 0 ? void 0 : _b2.trim()) !== null && _c2 !== void 0 ? _c2 : ""));
|
|
86079
86553
|
}) : void 0;
|
|
86080
|
-
const isItem = Boolean(num) && Number.parseInt(num !== null && num !== void 0 ? num : "", 10) > 0 && profile.rowPattern.num.test(num !== null && num !== void 0 ? num : "") && (!codePattern || Boolean(code) && codePattern.test(code !== null && code !== void 0 ? code : "") || pendingCode !== void 0) && (Boolean(codePattern) ||
|
|
86554
|
+
const isItem = Boolean(num) && Number.parseInt(num !== null && num !== void 0 ? num : "", 10) > 0 && profile.rowPattern.num.test(num !== null && num !== void 0 ? num : "") && (!codePattern || Boolean(code) && codePattern.test(code !== null && code !== void 0 ? code : "") || pendingCode !== void 0) && (Boolean(codePattern) || hasUsableName || hasQuantity && !nameText) && (Boolean(codePattern) || hasQuantity || serviceLike);
|
|
86081
86555
|
if (isItem) {
|
|
86082
86556
|
if (profile.descriptionAbove && pending.length) {
|
|
86083
86557
|
const near = pending.filter((entry) => entry.row.page === row.page && entry.row.y - row.y <= 20);
|
|
86084
86558
|
for (const entry of [...near].reverse()) {
|
|
86085
|
-
const name = (
|
|
86086
|
-
const aboveCode = (
|
|
86559
|
+
const name = (_t = entry.cells.name) === null || _t === void 0 ? void 0 : _t.trim();
|
|
86560
|
+
const aboveCode = (_u = entry.cells.code) === null || _u === void 0 ? void 0 : _u.trim();
|
|
86087
86561
|
if (name)
|
|
86088
|
-
cells.name = `${name} ${(
|
|
86562
|
+
cells.name = `${name} ${(_v = cells.name) !== null && _v !== void 0 ? _v : ""}`.replace(/\s+/g, " ").trim();
|
|
86089
86563
|
if (aboveCode && !cells.code)
|
|
86090
86564
|
cells.code = aboveCode;
|
|
86091
86565
|
}
|
|
@@ -86094,11 +86568,11 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86094
86568
|
}
|
|
86095
86569
|
const line = {
|
|
86096
86570
|
num: Number.parseInt(num !== null && num !== void 0 ? num : "", 10),
|
|
86097
|
-
code: (
|
|
86098
|
-
name: (
|
|
86099
|
-
article: (profile.articleFromCode ? (
|
|
86100
|
-
productType: ((
|
|
86101
|
-
unit: (
|
|
86571
|
+
code: (_w = cells.code) !== null && _w !== void 0 ? _w : "",
|
|
86572
|
+
name: (_x = cells.name) !== null && _x !== void 0 ? _x : "",
|
|
86573
|
+
article: (profile.articleFromCode ? (_y = cells.code) !== null && _y !== void 0 ? _y : "" : (_z = cells.art) !== null && _z !== void 0 ? _z : "").replace(/^(?:[\d\s]+)$/, (value) => value.replace(/\s+/g, "")),
|
|
86574
|
+
productType: ((_0 = cells.type) !== null && _0 !== void 0 ? _0 : "").trim(),
|
|
86575
|
+
unit: (_1 = cells.unit) !== null && _1 !== void 0 ? _1 : "",
|
|
86102
86576
|
vat: number(cells.vat),
|
|
86103
86577
|
qty: number(cells.qty),
|
|
86104
86578
|
price: number(cells.price),
|
|
@@ -86115,6 +86589,7 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86115
86589
|
lines.push(line);
|
|
86116
86590
|
current = line;
|
|
86117
86591
|
currentRow = row;
|
|
86592
|
+
lastCharge = void 0;
|
|
86118
86593
|
continue;
|
|
86119
86594
|
}
|
|
86120
86595
|
if (profile.descriptionAbove && !num) {
|
|
@@ -86124,14 +86599,20 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86124
86599
|
if (current && currentRow && cells.name && !num && isContinuation(currentRow, row)) {
|
|
86125
86600
|
const prevName = current.name.trimEnd();
|
|
86126
86601
|
const nextName = cells.name.trimStart();
|
|
86127
|
-
const glued =
|
|
86602
|
+
const glued = shouldGlueLineBreak(prevName, nextName, currentRow, profile);
|
|
86128
86603
|
current.name = (glued ? prevName + nextName : `${prevName} ${nextName}`).replace(/\s+/g, " ").trim();
|
|
86129
86604
|
currentRow = row;
|
|
86130
86605
|
continue;
|
|
86131
86606
|
}
|
|
86607
|
+
if (lastCharge && isContinuation(lastCharge.row, row) && Math.abs(((_3 = (_2 = row.items[0]) === null || _2 === void 0 ? void 0 : _2.x) !== null && _3 !== void 0 ? _3 : Number.NEGATIVE_INFINITY) - lastCharge.x) <= 3 && !/\d/u.test(text) && !/НДС|итог|—/iu.test(text)) {
|
|
86608
|
+
lastCharge.line.name = `${lastCharge.line.name} ${text}`.replace(/\s+/g, " ").trim();
|
|
86609
|
+
lastCharge.row = row;
|
|
86610
|
+
continue;
|
|
86611
|
+
}
|
|
86132
86612
|
unparsedRows.push(text);
|
|
86133
86613
|
}
|
|
86134
86614
|
flushPending();
|
|
86615
|
+
flushLastNumbered();
|
|
86135
86616
|
if (profile.articleFromCode) {
|
|
86136
86617
|
for (const line of lines) {
|
|
86137
86618
|
line.article = line.code.replace(/^(?:[\d\s]+)$/, (value) => value.replace(/\s+/g, ""));
|
|
@@ -86143,7 +86624,7 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86143
86624
|
const text = rowText(row);
|
|
86144
86625
|
if (!profile.totalsRow.test(text))
|
|
86145
86626
|
continue;
|
|
86146
|
-
const numbers = (
|
|
86627
|
+
const numbers = (_4 = text.match(/[\d\s]+[.,]\d{2}/g)) !== null && _4 !== void 0 ? _4 : [];
|
|
86147
86628
|
const first = numbers[0];
|
|
86148
86629
|
const last = numbers[numbers.length - 1];
|
|
86149
86630
|
if (first && last) {
|
|
@@ -86190,6 +86671,8 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86190
86671
|
if (profile.pricesIncludeVat) {
|
|
86191
86672
|
const rate = vatRateFor(profile, documented, noVatPrinted);
|
|
86192
86673
|
for (const line of lines) {
|
|
86674
|
+
if (chargeLines.has(line))
|
|
86675
|
+
continue;
|
|
86193
86676
|
const lineRate = line.vat > 0 ? line.vat : rate;
|
|
86194
86677
|
const gross = line.sum;
|
|
86195
86678
|
line.total = gross;
|
|
@@ -86204,7 +86687,7 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86204
86687
|
}
|
|
86205
86688
|
}
|
|
86206
86689
|
const summed = lines.reduce((acc, line) => ({
|
|
86207
|
-
qty: acc.qty + line.qty,
|
|
86690
|
+
qty: acc.qty + (chargeLines.has(line) ? 0 : line.qty),
|
|
86208
86691
|
sum: acc.sum + line.sum,
|
|
86209
86692
|
vat: acc.vat + Math.max(0, line.total - line.sum),
|
|
86210
86693
|
total: acc.total + line.total
|
|
@@ -86219,9 +86702,9 @@ function parseRows(rows, profile, layoutScoreValue = 1, isUniversal = false) {
|
|
|
86219
86702
|
}
|
|
86220
86703
|
const totals = {
|
|
86221
86704
|
qty: summed.qty,
|
|
86222
|
-
sum: (
|
|
86223
|
-
vat: (
|
|
86224
|
-
total: (
|
|
86705
|
+
sum: (_5 = documented.sum) !== null && _5 !== void 0 ? _5 : summed.sum,
|
|
86706
|
+
vat: (_6 = documented.vat) !== null && _6 !== void 0 ? _6 : summed.vat,
|
|
86707
|
+
total: (_7 = documented.total) !== null && _7 !== void 0 ? _7 : summed.total
|
|
86225
86708
|
};
|
|
86226
86709
|
if (!isUniversal && layoutScoreValue < 0.85) {
|
|
86227
86710
|
warnings.push(`\u041C\u0430\u043A\u0435\u0442 \u043D\u0435 \u0441\u043E\u0432\u043F\u0430\u043B \u0441 \u043F\u0440\u043E\u0444\u0438\u043B\u0435\u043C ${profile.layoutId}: \u0441\u043E\u0432\u043F\u0430\u0434\u0435\u043D\u0438\u0435 ${(layoutScoreValue * 100).toFixed(1)}%, \u043F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u0432\u0451\u0440\u0441\u0442\u043A\u0443 \u0441\u0447\u0451\u0442\u0430`);
|