Compare commits
No commits in common. "master" and "alpha-0.0.2" have entirely different histories.
master
...
alpha-0.0.
|
@ -123,4 +123,3 @@ checks-parser
|
|||
|
||||
deploy/appimage/AppDir/usr/share/doc/
|
||||
deploy/appimage/AppDir/usr/share/
|
||||
*.deb
|
||||
|
|
102
CMakeLists.txt
102
CMakeLists.txt
|
@ -4,14 +4,14 @@ project(checks-parser VERSION 0.1 LANGUAGES CXX)
|
|||
|
||||
set(CMAKE_AUTOUIC ON)
|
||||
set(CMAKE_AUTOMOC ON)
|
||||
set(CMAKE_AUTORCC OFF)
|
||||
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 NAMES Qt6 Qt5 REQUIRED COMPONENTS Widgets LinguistTools)
|
||||
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets)
|
||||
find_package(Qt5 COMPONENTS LinguistTools)
|
||||
|
||||
|
@ -21,6 +21,43 @@ set(PROJECT_SOURCES
|
|||
mainwindow.h
|
||||
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
|
||||
check/check.h check/check.cpp
|
||||
parser/parser.h parser/parser.cpp
|
||||
|
@ -38,66 +75,18 @@ set(PROJECT_SOURCES
|
|||
image_redactor/imageredactor.h image_redactor/imageredactor.cpp
|
||||
solvecaptchadialog.h solvecaptchadialog.cpp solvecaptchadialog.ui
|
||||
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}
|
||||
# ${TS_FILES}
|
||||
translations.qrc
|
||||
${TRANSLATIONQRC}
|
||||
)
|
||||
# configure_file(translations.qrc ${CMAKE_BINARY_DIR} COPYONLY)
|
||||
# QT5_ADD_TRANSLATION(TRANSLATIONS ${CMAKE_SOURCE_DIR} translations/en_US.ts)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
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.
|
||||
# If you are developing for iOS or macOS you should consider setting an
|
||||
# explicit, fixed bundle identifier manually though.
|
||||
|
@ -123,11 +112,6 @@ if(QT_VERSION_MAJOR EQUAL 6)
|
|||
qt_finalize_executable(checks-parser)
|
||||
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)
|
||||
|
||||
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||
|
|
|
@ -0,0 +1,122 @@
|
|||
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} )
|
32
README.md
32
README.md
|
@ -1,19 +1,16 @@
|
|||
-->[Русская версия](https://git.foxarmy.org/leca/checks-parser/src/branch/master/README.ru.md)<--
|
||||
|
||||
# Checks parser
|
||||
checks parser is a program that help parsing different checks to csv.
|
||||
|
||||
!!!CURRENTLY SUPPORTED ONLY RUSSIAN CHECKS!!!
|
||||
To know why, see [this section](https://git.foxarmy.org/leca/checks-parser#checks-from-different-countries)
|
||||
To know why, see [this section](#Checks-from-different-countries)
|
||||
|
||||
# Usage
|
||||
For more detailed description, please, refer to [the wiki](https://git.foxarmy.org/leca/checks-parser/wiki/Description-%5BEN%5D)
|
||||
|
||||
### Input
|
||||
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.) OCR is not a magic wand :(
|
||||
* 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 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 QRCode on check (this method queries check content from OFD (ОФД, Оператор Фискальных Данных in Russian) (My program makes requests to ofd.ru)).
|
||||
* 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 (OFD (ОФД, Оператор Фискальных Данных in Russian)).
|
||||
|
||||
### 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.
|
||||
|
@ -34,12 +31,10 @@ 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!
|
||||
### Linux
|
||||
##### 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 ¯\\\_(ツ)\_/¯
|
||||
I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself /shrug
|
||||
```
|
||||
#Install dependencies
|
||||
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
|
||||
yay -S sudo cmake git coreutils base-devel eigen qt5-base mbedtls gtkglext opencv opencv2 zbar nlohmann-json tesseract tesseract-data-rus vtk
|
||||
#Clone and compile an app
|
||||
git clone https://git.foxarmy.org/leca/checks-parser
|
||||
cd checks-parser
|
||||
|
@ -69,20 +64,12 @@ sudo make install
|
|||
```
|
||||
|
||||
### Windows
|
||||
See [Precompiled binaries](https://git.foxarmy.org/leca/checks-parser#precompiled-binaries)
|
||||
Maybe
|
||||
### 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!
|
||||
|
||||
## Precompiled binaries
|
||||
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.
|
||||
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
|
||||
|
||||
# Contribution
|
||||
|
||||
|
@ -92,12 +79,11 @@ 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!
|
||||
## Issues and PRs
|
||||
|
||||
If you have found a bug, or want to suggest a feature - don't hesitate to open an issue / a PR!
|
||||
If you have found a bug, or want to suggest a feature - don't hesitate to open an issue / PR!
|
||||
|
||||
## 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!
|
||||
|
||||
## Donate
|
||||
|
||||
```XMR 45ZjyH5YWdRfKxLoKEBYaiHUTcP5Z8Gv64QQxmabbooPAa7KPBxZLmqft5ohKXn5VpHiVj1x9JKCcAcAjdu9jA8b5N8XqR7```
|
||||
|
|
104
README.ru.md
104
README.ru.md
|
@ -1,104 +0,0 @@
|
|||
-->[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```
|
|
@ -61,10 +61,10 @@
|
|||
<widget class="ImageRedactor" name="graphicsView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>5</x>
|
||||
<y>21</y>
|
||||
<width>801</width>
|
||||
<height>421</height>
|
||||
<x>15</x>
|
||||
<y>41</y>
|
||||
<width>791</width>
|
||||
<height>391</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
|
@ -77,7 +77,10 @@
|
|||
<customwidget>
|
||||
<class>ImageRedactor</class>
|
||||
<extends>QGraphicsView</extends>
|
||||
<header location="global">imageredactor.h</header>
|
||||
<header>../../image_redactor/imageredactor.h</header>
|
||||
<slots>
|
||||
<slot>slot1()</slot>
|
||||
</slots>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
|
|
|
@ -4,7 +4,10 @@ FROM archlinux
|
|||
RUN pacman --noconfirm -Sy
|
||||
|
||||
#Build dependencies
|
||||
RUN pacman --noconfirm -S sudo cmake git coreutils base-devel qt5-base
|
||||
RUN pacman --noconfirm -S sudo cmake git coreutils base-devel eigen
|
||||
|
||||
#Dependencies from repos
|
||||
RUN pacman --noconfirm -S qt5-base mbedtls
|
||||
|
||||
RUN echo "MAKEFLAGS=\"-j${nproc}\"" >> /etc/makepkg.conf
|
||||
|
||||
|
@ -21,13 +24,15 @@ RUN git clone https://aur.archlinux.org/yay.git && \
|
|||
makepkg -si --noconfirm && \
|
||||
cd .. && sudo rm -rf yay
|
||||
|
||||
RUN yay -S opencv zbar nlohmann-json tesseract tesseract-data-rus
|
||||
RUN yay -Sy --noconfirm gtkglext
|
||||
RUN yay -S --noconfirm cpr opencv opencv2 nlohmann-json tesseract tesseract-data-rus
|
||||
|
||||
#building
|
||||
WORKDIR /home/checks-parser
|
||||
RUN git clone https://git.foxarmy.org/leca/checks-parser && \
|
||||
cd checks-parser && \
|
||||
cmake . && \
|
||||
mkdir build && cd build && \
|
||||
cmake .. && \
|
||||
make -j ${nproc} && \
|
||||
sudo make install
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
# 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
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#!/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
|
|
@ -87,13 +87,6 @@ void MainWindow::on_parseButton_clicked() {
|
|||
infoDialog.setWindowTitle(tr("Captcha is incorrect"));
|
||||
infoDialog.exec();
|
||||
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")) {
|
||||
QMessageBox infoDialog;
|
||||
infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data."));
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>371</width>
|
||||
<width>111</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
@ -168,7 +168,7 @@
|
|||
<rect>
|
||||
<x>10</x>
|
||||
<y>90</y>
|
||||
<width>381</width>
|
||||
<width>111</width>
|
||||
<height>24</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
|
@ -118,7 +118,7 @@
|
|||
<location filename="../mainwindow.ui" line="333"/>
|
||||
<source>Funds income</source>
|
||||
<translatorcomment>Приход средств</translatorcomment>
|
||||
<translation>Funds income</translation>
|
||||
<translation>Funds incode</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="338"/>
|
||||
|
@ -160,47 +160,37 @@
|
|||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<translation>Check not found. Please, ensure correctness of entered data.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="101"/>
|
||||
<location filename="../mainwindow.cpp" line="94"/>
|
||||
<source>Check was not found</source>
|
||||
<translation></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="123"/>
|
||||
<location filename="../mainwindow.cpp" line="116"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="125"/>
|
||||
<location filename="../mainwindow.cpp" line="118"/>
|
||||
<source>Error in parsing</source>
|
||||
<translation>Error in parsing</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="156"/>
|
||||
<location filename="../mainwindow.cpp" line="149"/>
|
||||
<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>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="158"/>
|
||||
<location filename="../mainwindow.cpp" line="204"/>
|
||||
<location filename="../mainwindow.cpp" line="151"/>
|
||||
<location filename="../mainwindow.cpp" line="197"/>
|
||||
<source>Picture was not selected</source>
|
||||
<translation>Picture was not selected</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="202"/>
|
||||
<location filename="../mainwindow.cpp" line="195"/>
|
||||
<source>Please, select a picture to scan</source>
|
||||
<translation>Please, select a picture to scan</translation>
|
||||
</message>
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<location filename="../mainwindow.ui" line="108"/>
|
||||
<source>OCR</source>
|
||||
<translatorcomment>Оптическое Распознавание Символов</translatorcomment>
|
||||
<translation>ОРС</translation>
|
||||
<translation>ОСР</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.ui" line="120"/>
|
||||
|
@ -156,47 +156,37 @@
|
|||
</message>
|
||||
<message>
|
||||
<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>
|
||||
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="101"/>
|
||||
<location filename="../mainwindow.cpp" line="94"/>
|
||||
<source>Check was not found</source>
|
||||
<translation>Чек не найден</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="123"/>
|
||||
<location filename="../mainwindow.cpp" line="116"/>
|
||||
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
||||
<translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="125"/>
|
||||
<location filename="../mainwindow.cpp" line="118"/>
|
||||
<source>Error in parsing</source>
|
||||
<translation>Ошибка в парсинге</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="156"/>
|
||||
<location filename="../mainwindow.cpp" line="149"/>
|
||||
<source>Please, select a picture where QR code that contains info about check is present</source>
|
||||
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="158"/>
|
||||
<location filename="../mainwindow.cpp" line="204"/>
|
||||
<location filename="../mainwindow.cpp" line="151"/>
|
||||
<location filename="../mainwindow.cpp" line="197"/>
|
||||
<source>Picture was not selected</source>
|
||||
<translation>Изображение не было выбрано</translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../mainwindow.cpp" line="202"/>
|
||||
<location filename="../mainwindow.cpp" line="195"/>
|
||||
<source>Please, select a picture to scan</source>
|
||||
<translation>Пожалуйста, выберете изображение для сканирования</translation>
|
||||
</message>
|
||||
|
|
|
@ -124,8 +124,6 @@ Check parseOfdRuAnswer(std::string html) {
|
|||
if ((products.size() + amounts.size() + prices.size()) == 0) {
|
||||
if (html == "Bad Request4") { // Failed to solve a 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
|
||||
throw OfdRequestException("Does not exist");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue