Compare commits

...

8 Commits

Author SHA1 Message Date
leca e60aafd653 separated translations as a new make target 2024-12-12 00:58:36 +03:00
leca a10271e595 added debian package 2024-12-09 19:30:48 +03:00
leca 3a2901b49c added PKGBUILD 2024-12-09 19:06:49 +03:00
leca 22922aecaa added handler on internal server error 2024-12-09 17:34:36 +03:00
leca baa8ae6e65 added russian readme 2024-12-09 17:06:35 +03:00
leca 2ebcf68838 fix UI and translations 2024-12-09 16:27:30 +03:00
leca b135f8a94d readme changes 2024-12-07 02:18:03 +03:00
leca 7290769750 readme update 2024-12-05 16:04:55 +03:00
14 changed files with 298 additions and 198 deletions

1
.gitignore vendored
View File

@ -123,3 +123,4 @@ checks-parser
deploy/appimage/AppDir/usr/share/doc/ deploy/appimage/AppDir/usr/share/doc/
deploy/appimage/AppDir/usr/share/ deploy/appimage/AppDir/usr/share/
*.deb

View File

@ -4,14 +4,14 @@ project(checks-parser VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON) set(CMAKE_AUTORCC OFF)
set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS Designer) set(CMAKE_AUTOUIC_SEARCH_PATHS Designer)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
find_package(Qt5 COMPONENTS LinguistTools) find_package(Qt5 COMPONENTS LinguistTools)
@ -21,43 +21,6 @@ set(PROJECT_SOURCES
mainwindow.h mainwindow.h
mainwindow.ui mainwindow.ui
# Add other source files here that contain translatable strings
)
# Specify the UI files and source files for translation
set(TRANSLATION_SOURCES
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
outputdialog.cpp outputdialog.h outputdialog.ui
settingsdialog.cpp settingsdialog.h settingsdialog.ui
solvecaptchadialog.cpp solvecaptchadialog.h solvecaptchadialog.ui
adjustpicturedialog.cpp adjustpicturedialog.h adjustpicturedialog.ui
# Add other .cpp or .ui files that need translation here
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(checks-parser
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
# Generate translation files for Qt 6
qt_add_translation(TRANSLATIONS "${TRANSLATION_SOURCES}")
else()
if(ANDROID)
add_library(checks-parser SHARED
${PROJECT_SOURCES}
)
else()
# Generate translation files for Qt 5
# QT5_ADD_TRANSLATION()
qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" translations/en_US.ts translations/ru_RU.ts)
qt5_add_resources(TRANSLATIONQRC translations.qrc)
add_executable(checks-parser
${PROJECT_SOURCES}
goods/goods.h goods/goods.cpp goods/goods.h goods/goods.cpp
check/check.h check/check.cpp check/check.h check/check.cpp
parser/parser.h parser/parser.cpp parser/parser.h parser/parser.cpp
@ -75,18 +38,66 @@ else()
image_redactor/imageredactor.h image_redactor/imageredactor.cpp image_redactor/imageredactor.h image_redactor/imageredactor.cpp
solvecaptchadialog.h solvecaptchadialog.cpp solvecaptchadialog.ui solvecaptchadialog.h solvecaptchadialog.cpp solvecaptchadialog.ui
exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp
)
# Specify the UI files and source files for translation
set(TRANSLATION_SOURCES
main.cpp
mainwindow.cpp mainwindow.h mainwindow.ui
outputdialog.cpp outputdialog.h outputdialog.ui
settingsdialog.cpp settingsdialog.h settingsdialog.ui
solvecaptchadialog.cpp solvecaptchadialog.h solvecaptchadialog.ui
adjustpicturedialog.cpp adjustpicturedialog.h adjustpicturedialog.ui
)
set(TRANSLATION_FILES translations/en_US.ts translations/ru_RU.ts)
# set(QM_FILES "")
# qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" translations/en_US.ts translations/ru_RU.ts)
# foreach(TS_FILE IN LISTS "${TRANSLATION_FILES}")
# qt5_create_translation(QM_FILE "${TRANSLATION_SOURCES}" TS_FILE)
# set(QM_FILE "${CMAKE_CURRENT_BINARY_DIR}/${QM_FILE}")
# set(QM_FILES "${QM_FILES};${QM_FILE}")
# endforeach()
qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" translations/en_US.ts translations/ru_RU.ts)
# message(STATUS ${CMAKE_CURRENT_BINARY_DIR})
qt5_add_resources(TRANSLATIONQRC translations.qrc OPTIONS --root ${CMAKE_CURRENT_BINARY_DIR})
add_custom_target(translations
DEPENDS ${QM_FILES}
DEPENDS ${TRANSLATIONQRC}
VERBATIM
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(checks-parser
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
else()
if(ANDROID)
add_library(checks-parser SHARED
${PROJECT_SOURCES}
)
else()
add_executable(checks-parser
${PROJECT_SOURCES}
# ${QM_FILES} # ${QM_FILES}
# ${TS_FILES}
translations.qrc
${TRANSLATIONQRC} ${TRANSLATIONQRC}
) )
# configure_file(translations.qrc ${CMAKE_BINARY_DIR} COPYONLY)
# QT5_ADD_TRANSLATION(TRANSLATIONS ${CMAKE_SOURCE_DIR} translations/en_US.ts)
endif() endif()
endif() endif()
target_link_libraries(checks-parser PRIVATE Qt${QT_VERSION_MAJOR}::Widgets) target_link_libraries(checks-parser PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1. # Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an # If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though. # explicit, fixed bundle identifier manually though.
@ -112,6 +123,11 @@ if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(checks-parser) qt_finalize_executable(checks-parser)
endif() endif()
if(WIN32)
# set(OPENCV_MAP_IMPORTED_CONFIG "")
set(OpenCV_DIR /usr/local/lib/cmake/opencv4)
# set (OpenCV_DIR /usr/lib/x86_64-linux-gnu/cmake/opencv4)
endif()
find_package(OpenCV REQUIRED) find_package(OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories( ${OpenCV_INCLUDE_DIRS} )

View File

@ -1,122 +0,0 @@
cmake_minimum_required(VERSION 3.16)
project(checks-parser VERSION 0.1 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC_SEARCH_PATHS Designer)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
set(PROJECT_SOURCES
main.cpp
mainwindow.cpp
mainwindow.h
mainwindow.ui
)
if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
qt_add_executable(checks-parser
MANUAL_FINALIZATION
${PROJECT_SOURCES}
)
SET (LANGUAGES rus eng)
SET (TRANSLATIONS_PATH "./translations")
foreach (LANGUAGE ${LANGUAGES})
set (TS ${TRANSLATIONS_PATH}/${LANGUAGE}.ts)
set (QM ${TRANSLATIONS_PATH}/${LANGUAGE}.qm)
set (TRANSLATIONS ${TRANSLATIONS} ${TS})
set (TRANSLATIONS_BINARY ${TRANSLATIONS_BINARY} ${QM})
add_custom_command(
OUTPUT ${QM}
COMMAND ${QT_LRELEASE_EXECUTABLE} ${TS}
MAIN_DEPENDENCY ${TS}
)
endforeach()
qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} translations/english.ts)
# Define target properties for Android with Qt 6 as:
# set_property(TARGET checks-parser APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
# ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
if(ANDROID)
add_library(checks-parser SHARED
${PROJECT_SOURCES}
)
# Define properties for Android with Qt 5 after find_package() calls as:
# set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
else()
add_executable(checks-parser
${PROJECT_SOURCES}
goods/goods.h goods/goods.cpp
check/check.h check/check.cpp
parser/parser.h parser/parser.cpp
parser/module.h parser/module.cpp
outputdialog.h outputdialog.cpp outputdialog.ui
output/output_options.h output/output_options.cpp
utils/utils.h utils/utils.cpp
image/checkimage.h image/checkimage.cpp
net/net.h net/net.cpp
settings/settings.h settings/settings.cpp
settingsdialog.h settingsdialog.cpp settingsdialog.ui
adjustpicturedialog.h adjustpicturedialog.cpp adjustpicturedialog.ui
imageview/imageview.h imageview/imageview.cpp
image_redactor/imageredactor.h image_redactor/imageredactor.cpp
solvecaptchadialog.h solvecaptchadialog.cpp solvecaptchadialog.ui
exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp
${TRANSLATIONS}
${QM_FILES}
${QM}
${TS}
)
endif()
endif()
add_custom_target(translations DEPENDS ${QM_FILES})
add_dependencies(checks-parser translations)
target_link_libraries(checks-parser PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
# Qt for iOS sets MACOSX_BUNDLE_GUI_IDENTIFIER automatically since Qt 6.1.
# If you are developing for iOS or macOS you should consider setting an
# explicit, fixed bundle identifier manually though.
if(${QT_VERSION} VERSION_LESS 6.1.0)
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER com.example.checks-parser)
endif()
set_target_properties(checks-parser PROPERTIES
${BUNDLE_ID_OPTION}
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE TRUE
WIN32_EXECUTABLE TRUE
)
include(GNUInstallDirs)
install(TARGETS checks-parser
BUNDLE DESTINATION .
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(QT_VERSION_MAJOR EQUAL 6)
qt_finalize_executable(checks-parser)
endif()
find_package(OpenCV REQUIRED)
include_directories( ${OpenCV_INCLUDE_DIRS} )
target_link_libraries(checks-parser PRIVATE -lzbar)
target_link_libraries(checks-parser PRIVATE -ltesseract)
target_link_libraries(checks-parser PRIVATE -lcurl)
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS} )

View File

@ -1,16 +1,19 @@
-->[Русская версия](https://git.foxarmy.org/leca/checks-parser/src/branch/master/README.ru.md)<--
# Checks parser # Checks parser
checks parser is a program that help parsing different checks to csv. checks parser is a program that help parsing different checks to csv.
!!!CURRENTLY SUPPORTED ONLY RUSSIAN CHECKS!!! !!!CURRENTLY SUPPORTED ONLY RUSSIAN CHECKS!!!
To know why, see [this section](#Checks-from-different-countries) To know why, see [this section](https://git.foxarmy.org/leca/checks-parser#checks-from-different-countries)
# Usage # Usage
For more detailed description, please, refer to [the wiki](https://git.foxarmy.org/leca/checks-parser/wiki/Description-%5BEN%5D)
### Input ### Input
Ways you can input a check to this programm: Ways you can input a check to this programm:
* Via image (it uses OCR(Optical Character Recognition) to parse check content. The picture of a check must be contrast and well-lined (text must be perpendicular to right and left borders of an image) enough in order to be parsed well.) * Via image (it uses OCR(Optical Character Recognition) to parse check content. The picture of a check must be contrast and well-lined (text must be perpendicular to right and left borders of an image) enough in order to be parsed well.) OCR is not a magic wand :(
* Via plaintext, copied from an E-Mail. Just copy&paste text from your email, pick a correct store type (autodetect is in my plans!) and parse. * Via plaintext, copied from an E-Mail. Just copy&paste text from your email, pick a correct store type (autodetect is in my plans!) and parse.
* Via a picture of a check. Be sure to make the image straight and sharp. OCR is not a magic wand :( * Via QRCode on check (this method queries check content from OFD (ОФД, Оператор Фискальных Данных in Russian) (My program makes requests to ofd.ru)).
* Via QrCode on check (OFD (ОФД, Оператор Фискальных Данных in Russian)).
### Output ### Output
At the start of writing this program, I considered 3 or more output formats: csv, xlsx and ods. But throught the development I understood that most of modern table processor (i.e. electronic tables) can import csv much better than I'd be writing a shitty export module, adding more dependencies and shitty code to the codebase. So I decided that there's no need to use anything other than csv format. At the start of writing this program, I considered 3 or more output formats: csv, xlsx and ods. But throught the development I understood that most of modern table processor (i.e. electronic tables) can import csv much better than I'd be writing a shitty export module, adding more dependencies and shitty code to the codebase. So I decided that there's no need to use anything other than csv format.
@ -31,10 +34,12 @@ In general, you need to install following dependencies in order to build that ap
Please, do not hesitate to open an issue if you cannot build that. I will help and if you are building on a distro that is not listed there, we can append that list as soon as we will solve your problem! Please, do not hesitate to open an issue if you cannot build that. I will help and if you are building on a distro that is not listed there, we can append that list as soon as we will solve your problem!
### Linux ### Linux
##### Arch Linux-based ##### Arch Linux-based
I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself /shrug I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself ¯\\\_(ツ)\_/¯
``` ```
#Install dependencies #Install dependencies
yay -S sudo cmake git coreutils base-devel eigen qt5-base mbedtls gtkglext opencv opencv2 zbar nlohmann-json tesseract tesseract-data-rus vtk yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract
#Install a language package for OCR. Replace ``LANG` to your language. For example, ``tesseract-data-rus`` for russian language
yay -S tesseract-data-LANG
#Clone and compile an app #Clone and compile an app
git clone https://git.foxarmy.org/leca/checks-parser git clone https://git.foxarmy.org/leca/checks-parser
cd checks-parser cd checks-parser
@ -64,12 +69,20 @@ sudo make install
``` ```
### Windows ### Windows
Maybe See [Precompiled binaries](https://git.foxarmy.org/leca/checks-parser#precompiled-binaries)
### Mac OS ### Mac OS
Probably not, I do not have nor desire or time. But if you can maintain that program on Mac, I'd be grateful! Please, contact me, if you can! Probably not, I do not have nor desire or time. But if you can maintain that program on Mac, I'd be grateful! Please, contact me, if you can!
## Precompiled binaries ## Precompiled binaries
I plan to make precompiled binaries for Linux and Windows. Maybe I will put it on AUR. I also think that I will be making an AppImage Currently I have published the program to the [AUR](https://aur.archlinux.org/packages/checks-parser-git).
Every new release will certainly contain AppImage and tarball. I am working towards binaries for Windows and deb packets. Expect them to appear in next releases!
# Special thanks
HyperFlint (@hyperflint:foxarmy.org) - for the great idea to use OFD and a huge help in release preparations!
https://check.ofd.ru - for providing a way to request data from FNS.
# Contribution # Contribution
@ -79,11 +92,12 @@ If you want to contribute to the project, you can do it by some of the following
I live in Russia and only know how Russian state checks system works. If you live in another country and want to help me with adding support to checks from your country - feel free to contact me! I live in Russia and only know how Russian state checks system works. If you live in another country and want to help me with adding support to checks from your country - feel free to contact me!
## Issues and PRs ## Issues and PRs
If you have found a bug, or want to suggest a feature - don't hesitate to open an issue / PR! If you have found a bug, or want to suggest a feature - don't hesitate to open an issue / a PR!
## Tell friends ## Tell friends
You can help me by distributing that program. If you know people that are in search of such program, please let them know about its existance! You can help me by distributing that program. If you know people that are in search of such program, please let them know about its existance!
## Donate ## Donate
```XMR 45ZjyH5YWdRfKxLoKEBYaiHUTcP5Z8Gv64QQxmabbooPAa7KPBxZLmqft5ohKXn5VpHiVj1x9JKCcAcAjdu9jA8b5N8XqR7``` ```XMR 45ZjyH5YWdRfKxLoKEBYaiHUTcP5Z8Gv64QQxmabbooPAa7KPBxZLmqft5ohKXn5VpHiVj1x9JKCcAcAjdu9jA8b5N8XqR7```

104
README.ru.md Normal file
View File

@ -0,0 +1,104 @@
-->[English version](https://git.foxarmy.org/leca/checks-parser/src/branch/master/README.md)<--
# Чек парсер
Чек парсер - это приложение, позволяющее доставать содержимое чека и переводить его в .csv файлы.
!!!НА ДАННЫЙ МОМЕНТ ПОДДЕРЖИВАЮТСЯ ТОЛЬКО РУССКИЕ ЧЕКИ!!!
Чтобы узнать, почему [смотрите здесь](https://git.foxarmy.org/leca/checks-parser/src/branch/master/README.ru.md#checks-from-different-countries)
# Пользование
Для более детального описания, пожалуйста, обратитесь к [вики](https://git.foxarmy.org/leca/checks-parser/wiki/Description-%5BRU%5D)
### Ввод данных
Доступны следующие способы ввода данных:
* Через изображениие (используется OCR(Optical Character Recognition, Оптическое распознавание символов) чтобы прочитать содержимое чека. Изображение чека должно быть контрастным и выровненным (текст обязан быть перпендикулярным к границам изображения) хорошо, чтобы нормально прочитаться.) OCR - не волшебная палочка :(
* Через просто текст, скопированный из эл. письма. Просто скопируйте и вставьте текст с вашего письма, выберите подходящий магазин (автодетект в планах!) и парсите.
* Через QRCode на чеке (этот метод запрашивает данные у ОФД (Оператор Фискальных Данных) (В данном конкретном случае, к ofd.ru)).
### Вывод данных
На начальном этапе разработки программы, Я задумывался о 3 или более форматов вывода: csv, xlsx и ods. Но по мере разработки, я понял, что большинство современных табличных процессоров (электронных таблиц) способны импортировать в себя csv гораздо лучше, чем смог бы написать я сам. Так что я решил не делать вывод во все остальные форматы, кроме csv.
Чтобы экспортировать, вам нужно указать путь до файла, если вы желаете, вы можете изменить порядок и/или переименовать (алиасы) столбцы, выбрать печатать или не печатать заголовок (алиасы столбцов) и "итого"
# Установка
## Сборка из исходников
В целом, вам нужно установить следующие зависимости чтобы собрать приложение (я предполагаю, что вы уже имеете на системе базовые пакеты вроде cmake, make, gcc, git и так далее):
* tesseract (также вам нужно будет установить языковой пакет для него, например tesseract-data-rus на Arch Linux или tesseract-ocr-rus на Debian Linux.)
* opencv
* zbar
* curl
* nlohmann-json
* qt5
* vtk
Пожалуйста, не стесняйтесь и открывайте issue, если вы не можете собрать приложение. Я помогу вам, и если вы собираете приложение на дистрибутиве, который здесь не перечислен, как только мы решим вашу проблему, я добавлю новый дистрибутив в этот список!
### Linux
##### Arch Linux и ответвления
Я рекомендую использовать помощник для АУРа (я использую yay) чтобы установить зависимости. Или, если вы мазохист, можете собрать все зависимости ручками ¯\\\_(ツ)\_/¯
```
#Установка зависимостей
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract
#Установка языкового пакета для OCR. Замените ``LANG` на желаемый язык. Например, ``tesseract-data-rus`` для русского языка
yay -S tesseract-data-LANG
#Загрузка исходгого кода и сборка приложения
git clone https://git.foxarmy.org/leca/checks-parser
cd checks-parser
cmake .
make -j{nproc}
#Если вы хотите скопировать запускной файл в свою систему, исполните:
sudo make install
```
##### Debian и ответвления
В debian и ответвлениях большинство, но не все, имена пакетов одинаковы.
Установка зависимостей для различных debian дистрибутивов:
###### Ubuntu 18.04
```apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libtesseract-dev```
###### Ubuntu 20.04, LMDE (проверил только 6), Debian (проверил только 12)
```apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json3-dev libcurl4-openssl-dev libtesseract-dev```
Следующие шаги идеинтичны для всех дистрибутивов, основанных на debian:
```
#Загрузка исходного кода и сборка приложения
git clone https://git.foxarmy.org/leca/checks-parser
cd checks-parser
cmake .
make -j{nproc}
#Если вы хотите скопировать запускной файл в свою систему, исполните:
sudo make install
```
### Windows
Смотрите [бинарники](https://git.foxarmy.org/leca/checks-parser/src/branch/master/README.ru.md#бинарники)
### Mac OS
Скорее всего нет, у меня нет ни времени, ни желания, ни устройства. Но если вы можете собирать программу на Mac OS, я буду рад, если вы поможете. Пожалуйста, свяжитесь со мной, если можете!
## Бинарники
На текущий момент я опубликовал программу в [АУР](https://aur.archlinux.org/packages/checks-parser-git).
Каждый релиз будет содержать AppImage и арчёвский tarball. Я работаю над бинарниками для Windows и .deb пакетами. Ожидайте их в следующих релизах!
# Особое спасибо
HyperFlint (@hyperflint:foxarmy.org) - за гениальную идею использовать ОФД и огромную помощь в подготовке проекта к релизу!
https://check.ofd.ru - за способ вытаскивать данные о чеках из ФНС.
# Помощь
Если вы хотите помочь проекту, вы можете сделать это следующими способами:
## Чеки из других стран
Я живу в России и знаком только с местной системой чеков. Если вы живёте в другой стране и хотите помочь мне с поддержкой чеков из Вашей страны - свяжитесь со мной!
## Issues и PRs
Если вы нашли баг или хотите предложить что-то в программу - не стесняйтесь и открывайте issue или PR!
## Рассказать друзьями
Вы можете помочь проекту, распространяя программу. Если вы знаете людей, которые ищут подобную программу, пожалуйста, дайте им знать о существовании таковой!
## Пожертвования
```XMR 45ZjyH5YWdRfKxLoKEBYaiHUTcP5Z8Gv64QQxmabbooPAa7KPBxZLmqft5ohKXn5VpHiVj1x9JKCcAcAjdu9jA8b5N8XqR7```

View File

@ -61,10 +61,10 @@
<widget class="ImageRedactor" name="graphicsView"> <widget class="ImageRedactor" name="graphicsView">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>15</x> <x>5</x>
<y>41</y> <y>21</y>
<width>791</width> <width>801</width>
<height>391</height> <height>421</height>
</rect> </rect>
</property> </property>
</widget> </widget>
@ -77,10 +77,7 @@
<customwidget> <customwidget>
<class>ImageRedactor</class> <class>ImageRedactor</class>
<extends>QGraphicsView</extends> <extends>QGraphicsView</extends>
<header>../../image_redactor/imageredactor.h</header> <header location="global">imageredactor.h</header>
<slots>
<slot>slot1()</slot>
</slots>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<resources/> <resources/>

View File

@ -4,10 +4,7 @@ FROM archlinux
RUN pacman --noconfirm -Sy RUN pacman --noconfirm -Sy
#Build dependencies #Build dependencies
RUN pacman --noconfirm -S sudo cmake git coreutils base-devel eigen RUN pacman --noconfirm -S sudo cmake git coreutils base-devel qt5-base
#Dependencies from repos
RUN pacman --noconfirm -S qt5-base mbedtls
RUN echo "MAKEFLAGS=\"-j${nproc}\"" >> /etc/makepkg.conf RUN echo "MAKEFLAGS=\"-j${nproc}\"" >> /etc/makepkg.conf
@ -24,15 +21,13 @@ RUN git clone https://aur.archlinux.org/yay.git && \
makepkg -si --noconfirm && \ makepkg -si --noconfirm && \
cd .. && sudo rm -rf yay cd .. && sudo rm -rf yay
RUN yay -Sy --noconfirm gtkglext RUN yay -S opencv zbar nlohmann-json tesseract tesseract-data-rus
RUN yay -S --noconfirm cpr opencv opencv2 nlohmann-json tesseract tesseract-data-rus
#building #building
WORKDIR /home/checks-parser WORKDIR /home/checks-parser
RUN git clone https://git.foxarmy.org/leca/checks-parser && \ RUN git clone https://git.foxarmy.org/leca/checks-parser && \
cd checks-parser && \ cd checks-parser && \
mkdir build && cd build && \ cmake . && \
cmake .. && \
make -j ${nproc} && \ make -j ${nproc} && \
sudo make install sudo make install

36
deploy/archlinux/PKGBUILD Normal file
View File

@ -0,0 +1,36 @@
# Maintainer: Leca <leca@foxarmy.org>
pkgname=checks-parser-git
pkgver=alpha_0.0.2
pkgrel=1
epoch=
pkgdesc="Utility for parsing checks(receipts) to csv"
arch=('x86_64')
url="https://git.foxarmy.org/leca/checks-parser"
license=('GPL-3.0-or-later')
groups=()
depends=('qt5-base' 'opencv' 'zbar' 'nlohmann-json' 'tesseract')
makedepends=('cmake' 'make' 'gcc' 'git' 'qt5-tools')
checkdepends=()
optdepends=('tesseract-data-rus: scan russian checks with OCR')
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=("checks-parser-git::git+$url")
noextract=()
sha256sums=('SKIP')
build() {
cd "$pkgname"
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
make -j ${nproc}
}
package() {
cd "$pkgname"
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
make DESTDIR="$pkgdir/" PREFIX="/usr" install
}

30
deploy/debian/package.sh Executable file
View File

@ -0,0 +1,30 @@
#!/usr/bin/env bash
pkgname="checks-parser"
pkgver="3.0"
revision="1"
pkg=${pkgname}_$pkgver-$revision
mkdir $pkg
mkdir -p $pkg/usr/bin
cp ../../checks-parser $pkg/usr/bin
mkdir $pkg/DEBIAN
echo \
"Package: $pkgname
Version: $pkgver-$revision
Section: utils
Priority: optional
Architecture: amd64
Homepage: https://git.foxarmy.org/checks-parser
Depends: libc, qtbase5-dev, openssl, libmbedtls-dev, tesseract-ocr, tesseract-ocr-rus, libopencv-dev, libzbar-dev, qttools5-dev, nlohmann-json3-dev, libcurl4-openssl-dev, libtesseract-dev
Maintainer: Leca <leca@foxarmy.org>
Description: Utility for parsing checks(receipts) to csv
Utility for extraction of content of a check(receipt) using plaintext, OCR or request to FTS (Federal Taxation Service)"\
> $pkg/DEBIAN/control
dpkg-deb --build $pkg
rm -rf $pkg

View File

@ -87,6 +87,13 @@ void MainWindow::on_parseButton_clicked() {
infoDialog.setWindowTitle(tr("Captcha is incorrect")); infoDialog.setWindowTitle(tr("Captcha is incorrect"));
infoDialog.exec(); infoDialog.exec();
break; break;
} else if (!strcmp(e.what(), "Internal server error")) {
QMessageBox infoDialog;
infoDialog.setText(tr("Internal server error. Please, try again later."));
infoDialog.setIcon(QMessageBox::Critical);
infoDialog.setWindowTitle(tr("Internal server error"));
infoDialog.exec();
return;
} else if (!strcmp(e.what(), "Does not exist")) { } else if (!strcmp(e.what(), "Does not exist")) {
QMessageBox infoDialog; QMessageBox infoDialog;
infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data.")); infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data."));

View File

@ -60,7 +60,7 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>50</y> <y>50</y>
<width>111</width> <width>371</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>
@ -168,7 +168,7 @@
<rect> <rect>
<x>10</x> <x>10</x>
<y>90</y> <y>90</y>
<width>111</width> <width>381</width>
<height>24</height> <height>24</height>
</rect> </rect>
</property> </property>

View File

@ -118,7 +118,7 @@
<location filename="../mainwindow.ui" line="333"/> <location filename="../mainwindow.ui" line="333"/>
<source>Funds income</source> <source>Funds income</source>
<translatorcomment>Приход средств</translatorcomment> <translatorcomment>Приход средств</translatorcomment>
<translation>Funds incode</translation> <translation>Funds income</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="338"/> <location filename="../mainwindow.ui" line="338"/>
@ -160,37 +160,47 @@
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="92"/> <location filename="../mainwindow.cpp" line="92"/>
<source>Internal server error. Please, try again later.</source>
<translation>Internal server error. Please, try again later.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="94"/>
<source>Internal server error</source>
<translation>Internal server error</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="99"/>
<source>Check not found. Please, ensure correctness of entered data.</source> <source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Check not found. Please, ensure correctness of entered data.</translation> <translation>Check not found. Please, ensure correctness of entered data.</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="94"/> <location filename="../mainwindow.cpp" line="101"/>
<source>Check was not found</source> <source>Check was not found</source>
<translation></translation> <translation></translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="116"/> <location filename="../mainwindow.cpp" line="123"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation> <translation>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="118"/> <location filename="../mainwindow.cpp" line="125"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation>Error in parsing</translation> <translation>Error in parsing</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="149"/> <location filename="../mainwindow.cpp" line="156"/>
<source>Please, select a picture where QR code that contains info about check is present</source> <source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Please, select a picture where QR code that contains info about check is present</translation> <translation>Please, select a picture where QR code that contains info about check is present</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="151"/> <location filename="../mainwindow.cpp" line="158"/>
<location filename="../mainwindow.cpp" line="197"/> <location filename="../mainwindow.cpp" line="204"/>
<source>Picture was not selected</source> <source>Picture was not selected</source>
<translation>Picture was not selected</translation> <translation>Picture was not selected</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="195"/> <location filename="../mainwindow.cpp" line="202"/>
<source>Please, select a picture to scan</source> <source>Please, select a picture to scan</source>
<translation>Please, select a picture to scan</translation> <translation>Please, select a picture to scan</translation>
</message> </message>

View File

@ -60,7 +60,7 @@
<location filename="../mainwindow.ui" line="108"/> <location filename="../mainwindow.ui" line="108"/>
<source>OCR</source> <source>OCR</source>
<translatorcomment>Оптическое Распознавание Символов</translatorcomment> <translatorcomment>Оптическое Распознавание Символов</translatorcomment>
<translation>ОСР</translation> <translation>ОРС</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.ui" line="120"/> <location filename="../mainwindow.ui" line="120"/>
@ -156,37 +156,47 @@
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="92"/> <location filename="../mainwindow.cpp" line="92"/>
<source>Internal server error. Please, try again later.</source>
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="94"/>
<source>Internal server error</source>
<translation>Внутренняя ошибка сервера</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="99"/>
<source>Check not found. Please, ensure correctness of entered data.</source> <source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation> <translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="94"/> <location filename="../mainwindow.cpp" line="101"/>
<source>Check was not found</source> <source>Check was not found</source>
<translation>Чек не найден</translation> <translation>Чек не найден</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="116"/> <location filename="../mainwindow.cpp" line="123"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation> <translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="118"/> <location filename="../mainwindow.cpp" line="125"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation>Ошибка в парсинге</translation> <translation>Ошибка в парсинге</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="149"/> <location filename="../mainwindow.cpp" line="156"/>
<source>Please, select a picture where QR code that contains info about check is present</source> <source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation> <translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="151"/> <location filename="../mainwindow.cpp" line="158"/>
<location filename="../mainwindow.cpp" line="197"/> <location filename="../mainwindow.cpp" line="204"/>
<source>Picture was not selected</source> <source>Picture was not selected</source>
<translation>Изображение не было выбрано</translation> <translation>Изображение не было выбрано</translation>
</message> </message>
<message> <message>
<location filename="../mainwindow.cpp" line="195"/> <location filename="../mainwindow.cpp" line="202"/>
<source>Please, select a picture to scan</source> <source>Please, select a picture to scan</source>
<translation>Пожалуйста, выберете изображение для сканирования</translation> <translation>Пожалуйста, выберете изображение для сканирования</translation>
</message> </message>

View File

@ -124,6 +124,8 @@ Check parseOfdRuAnswer(std::string html) {
if ((products.size() + amounts.size() + prices.size()) == 0) { if ((products.size() + amounts.size() + prices.size()) == 0) {
if (html == "Bad Request4") { // Failed to solve a captcha if (html == "Bad Request4") { // Failed to solve a captcha
throw OfdRequestException("Incorrect captcha"); throw OfdRequestException("Incorrect captcha");
} else if (html.find("500 - Internal server error.") != std::string::npos) {
throw OfdRequestException("Internal server error");
} else { // Most likely that the check does not exist } else { // Most likely that the check does not exist
throw OfdRequestException("Does not exist"); throw OfdRequestException("Does not exist");
} }