multi-check system

This commit is contained in:
leca 2025-05-11 00:25:05 +03:00
parent 86a11faf70
commit 463edd3df9
13 changed files with 435 additions and 268 deletions

View File

@ -1,14 +1,19 @@
#include "check.h"
#include "../goods/goods.h"
#include <iostream>
Check::Check() {}
void Check::add_goods(Goods goods) { this->goods.push_back(goods); }
void Check::add_goods(Goods goods) {
this->goods.push_back(goods);
this->total = this->calculae_total_price();
}
void Check::add_goods(std::vector<Goods> &goods) {
for (auto g : goods) {
for (auto &g : goods) {
this->goods.push_back(g);
}
this->total = this->calculae_total_price();
}
double Check::calculae_total_price() {
@ -17,7 +22,6 @@ double Check::calculae_total_price() {
for (Goods &g : goods) {
total += g.calculate_total_price();
}
return total;
}
@ -25,6 +29,64 @@ std::vector<Goods>& Check::get_goods() {
return goods;
}
void Check::set_fn(std::string fn) {
this->fn = fn;
}
void Check::set_fd(std::string fd) {
this->fd = fd;
}
void Check::set_fi(std::string fi) {
this->fi = fi;
}
std::string Check::get_date() {
return date;
}
void Check::set_date(std::string date) {
this->date = date;
}
void Check::set_operation_type(OperationType t) {
this->operation_type = t;
}
double Check::get_total() {
return total;
}
bool Check::operator==(Check &c) {
// std::cout << "Comparing" << std::endl;
// std::cout << this->date << " <>" << c.date << std::endl;
// std::cout << this->fd << " <>" << c.fd << std::endl;
// std::cout << this->fi<< " <>" << c.fi << std::endl;
// std::cout << this->fn<< " <>" << c.fn << std::endl;
// std::cout << this->operation_type << " <>" << c.operation_type << std::endl;
// std::cout << this->total<< " <>" << c.total<< std::endl;
return
this->date == c.date &&
this->fd == c.fd &&
this->fi == c.fi &&
this->fn == c.fn &&
this->operation_type == c.operation_type &&
this->total == c.total;
}
bool Check::operator==(const Check &c) {
// std::cout << "Comparing" << std::endl;
// std::cout << this->date << " <>" << c.date << std::endl;
// std::cout << this->fd << " <>" << c.fd << std::endl;
// std::cout << this->fi<< " <>" << c.fi << std::endl;
// std::cout << this->fn<< " <>" << c.fn << std::endl;
// std::cout << this->operation_type << " <>" << c.operation_type << std::endl;
// std::cout << this->total<< " <>" << c.total<< std::endl;
return
this->date == c.date &&
this->fd == c.fd &&
this->fi == c.fi &&
this->fn == c.fn &&
this->operation_type == c.operation_type &&
this->total == c.total;
}

View File

@ -43,6 +43,9 @@ public:
std::string get_date();
OperationType get_operationType();
double get_total();
bool operator==(Check &);
bool operator==(const Check &);
};
#endif // CHECK_H

View File

@ -1,9 +1,9 @@
FROM ubuntu:18.04
FROM ubuntu:24.04
# Installing dependencies
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive apt install -y qtbase5-dev openssl libmbedtls-dev libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libqrencode-dev
RUN DEBIAN_FRONTEND=noninteractive apt install -y qt6-base-dev qt6-tools-dev openssl libmbedtls-dev libopencv-dev libzbar-dev nlohmann-json3-dev libcurl4-openssl-dev libqrencode-dev
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse libboost-regex-dev
WORKDIR /app
@ -21,6 +21,8 @@ COPY net ./net
COPY translations ./translations
COPY http_server ./http_server
COPY utils ./utils
COPY widgets ./widgets
COPY email_parser ./email_parser
COPY ./*.h ./*cpp ./*.ui ./*.qrc CMakeLists.txt .

View File

@ -33,11 +33,13 @@ MainWindow::MainWindow(QWidget *parent)
ui->stop_server_button->hide();
QVBoxLayout *layout = new QVBoxLayout;
ui->checks_scroll_area->setLayout(layout);
ui->scrollAreaWidgetContents->setLayout(layout);
QLabel a = QLabel("123");
layout->addWidget(&a);
// ui->checks_to_parse_label->hide();
// ui->checks_scroll_area->hide();
ui->checks_to_parse_label->hide();
ui->checks_scroll_area->hide();
connect(this, &MainWindow::deleteCheckFromList, this, &MainWindow::deleteCheckFromListHandler);
#ifdef BUILD_OFD_BINARYEYE_SCAN
QObject::connect(this, &MainWindow::httpErrorOccured, this, &MainWindow::notifyHttpServerFailure);
@ -97,7 +99,7 @@ void MainWindow::on_binary_eye_button_clicked() {
infoDialog.setText(QString::fromStdString(connectionString));
infoDialog.setIconPixmap(QPixmap(QString::fromStdString(get_path_relative_to_home(".local/share/checks_parser/binaryeye_connection.png"))).scaled(400, 400, Qt::KeepAspectRatio));
infoDialog.setWindowTitle(tr("QR code for binaryeye to connect"));
infoDialog.setButtonText(1, tr("I've scanned"));
infoDialog.addButton(tr("I've scanned"), QMessageBox::ButtonRole::AcceptRole);
infoDialog.exec();
}
@ -206,6 +208,30 @@ void MainWindow::on_parse_button_clicked() {
d.exec();
}
void MainWindow::deleteCheckFromListHandler(Check &check) {
for (unsigned int i = 0; i < ui->scrollAreaWidgetContents->layout()->count(); i ++) {
QLayoutItem *item = ui->scrollAreaWidgetContents->layout()->itemAt(i);
QObject *child = item->widget();
CheckListViewWidget *c = (CheckListViewWidget *)child;
if (c->get_check() == check) {
ui->scrollAreaWidgetContents->layout()->removeItem(item);
delete item;
delete child;
ui->scrollAreaWidgetContents->layout()->update();
ui->scrollAreaWidgetContents->update();
}
}
int position = std::find(checks.begin(), checks.end(), check) - checks.begin() - 1;
checks.erase(checks.begin() + position);
if (ui->scrollAreaWidgetContents->layout()->count() == 0) {
ui->checks_to_parse_label->hide();
ui->checks_scroll_area->hide();
}
}
void MainWindow::on_add_new_check_button_clicked() {
Check *new_check = parse_new_check();
if (new_check == nullptr) {
@ -214,10 +240,9 @@ void MainWindow::on_add_new_check_button_clicked() {
checks.push_back(*new_check);
CheckListViewWidget check_list_widget(this, *new_check);
CheckListViewWidget *check_list_widget = new CheckListViewWidget(this, *new_check);
auto a = QLabel("123");
ui->scrollAreaWidgetContents->layout()->addWidget(&a);
ui->scrollAreaWidgetContents->layout()->addWidget(check_list_widget);
delete new_check;
@ -250,6 +275,11 @@ Check *MainWindow::parse_new_check() {
solved_captcha);
(*check) = parseOfdRuAnswer(check_content);
check->set_date(ui->purchase_datetime_edit->dateTime().toString(Qt::ISODate).toStdString());
check->set_fn(ui->fn_line_edit->text().toStdString());
check->set_fd(ui->fd_line_edit->text().toStdString());
check->set_fi(ui->fi_line_edit->text().toStdString());
check->set_operation_type(OperationType(ui->operation_type_combo_box->currentIndex() + 1));
return check;
} catch(OfdRequestException e) {
if (!strcmp(e.what(), "Incorrect captcha")) {

View File

@ -22,6 +22,7 @@ public:
~MainWindow();
Check *parse_new_check();
#ifdef BUILD_OFD_BINARYEYE_SCAN
void startHttpServer();
#endif
@ -29,6 +30,7 @@ public:
signals:
void httpNewMessage(QString message);
void httpErrorOccured();
void deleteCheckFromList(Check&);
private slots:
#ifdef BUILD_OFD_LOCAL_QR_SCAN
@ -45,12 +47,12 @@ private slots:
void on_stop_server_button_clicked();
void httpNewMessageHandler(QString message);
void deleteCheckFromListHandler(Check&);
#endif
#ifdef BUILD_EMAIL_MODE
void on_parse_email_button_clicked();
#endif
void on_add_new_check_button_clicked();
private:
Ui::MainWindow *ui;
std::vector<Check> checks;

View File

@ -15,6 +15,12 @@ OutputDialog::OutputDialog(QWidget *parent, std::vector<Check> *checks)
ui->setupUi(this);
ui->tableWidget->resizeColumnsToContents();
ui->tableWidget->verticalHeader()->setSectionsMovable(true);
ui->tableWidget->verticalHeader()->setDragDropOverwriteMode(false);
ui->tableWidget->verticalHeader()->setDragEnabled(true);
ui->tableWidget->verticalHeader()->setDragDropMode(QAbstractItemView::InternalMove);
ui->tableWidget->item(0, 1)->setText(QString::fromStdString(settings.get_all_settings()["output_order"]["date"]["name"]));
ui->tableWidget->item(0, 0)->setText(QString::number((int)settings.get_all_settings()["output_order"]["date"]["position"]));
@ -79,7 +85,7 @@ void OutputDialog::on_buttonBox_accepted() {
for (auto &column : this->options.get_columns()) {
switch (column.type) {
case ColumnType::date:
if (i == 0) output_file << "date goes here";
if (i == 0) output_file << check.get_date();
break;
case ColumnType::goods_name:
output_file << it->get_name();

View File

@ -26,10 +26,10 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="3">
<widget class="QLabel" name="or_label_2">
<item row="1" column="1">
<widget class="QLabel" name="or_label_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -39,23 +39,10 @@
</property>
</widget>
</item>
<item row="9" column="2" colspan="2">
<widget class="QPushButton" name="add_new_check_button">
<item row="6" column="0">
<widget class="QLabel" name="datetime_label">
<property name="text">
<string>Add new check</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FN (Fiscal Number)</string>
<string>Date and time of purchase</string>
</property>
</widget>
</item>
@ -72,118 +59,6 @@
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QLineEdit" name="fi_line_edit"/>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="choose_image_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose image on your PC</string>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="stop_server_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stop server</string>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="fi_label">
<property name="text">
<string>FI (Fiscal Identifier)</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QPushButton" name="settings_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="total_label">
<property name="text">
<string>Total</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QLineEdit" name="fn_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="2" colspan="3">
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
</item>
<item row="9" column="0" colspan="2">
<widget class="QPushButton" name="clear_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="datetime_label">
<property name="text">
<string>Date and time of purchase</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLabel" name="or_label_1">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>or</string>
</property>
</widget>
</item>
<item row="7" column="0">
<widget class="QLabel" name="operation_type_label">
<property name="text">
<string>Operation type</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="3">
<widget class="QLineEdit" name="fd_line_edit"/>
</item>
<item row="8" column="2" colspan="3">
<widget class="QDoubleSpinBox" name="total_spin_box">
<property name="maximum">
@ -191,16 +66,20 @@
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="binary_eye_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<item row="0" column="5">
<widget class="QLabel" name="checks_to_parse_label">
<property name="text">
<string>Use your phone as a QR code scanner</string>
<string>Checks to parse</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="fi_label">
<property name="text">
<string>FI (Fiscal Identifier)</string>
</property>
</widget>
</item>
@ -217,8 +96,41 @@
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="parse_email_button">
<item row="0" column="0">
<widget class="QPushButton" name="settings_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Settings</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="fn_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>FN (Fiscal Number)</string>
</property>
</widget>
</item>
<item row="8" column="0">
<widget class="QLabel" name="total_label">
<property name="text">
<string>Total</string>
</property>
</widget>
</item>
<item row="1" column="4">
<widget class="QPushButton" name="binary_eye_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
@ -226,10 +138,49 @@
</sizepolicy>
</property>
<property name="text">
<string>Parse an E-Mail</string>
<string>Use your phone as a QR code scanner</string>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="or_label_2">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>or</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QPushButton" name="choose_image_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Choose image on your PC</string>
</property>
</widget>
</item>
<item row="3" column="2" colspan="3">
<widget class="QLineEdit" name="fn_line_edit">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="2" colspan="3">
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
</item>
<item row="2" column="0" colspan="5">
<widget class="QLabel" name="info_label">
<property name="sizePolicy">
@ -243,6 +194,19 @@
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QPushButton" name="stop_server_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Stop server</string>
</property>
</widget>
</item>
<item row="7" column="2" colspan="3">
<widget class="QComboBox" name="operation_type_combo_box">
<item>
@ -267,14 +231,54 @@
</item>
</widget>
</item>
<item row="1" column="5" rowspan="9">
<widget class="QScrollArea" name="checks_scroll_area">
<item row="7" column="0">
<widget class="QLabel" name="operation_type_label">
<property name="text">
<string>Operation type</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QPushButton" name="parse_email_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Parse an E-Mail</string>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QPushButton" name="clear_button">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Clear</string>
</property>
</widget>
</item>
<item row="5" column="2" colspan="3">
<widget class="QLineEdit" name="fi_line_edit"/>
</item>
<item row="9" column="2" colspan="2">
<widget class="QPushButton" name="add_new_check_button">
<property name="text">
<string>Add new check</string>
</property>
</widget>
</item>
<item row="4" column="2" colspan="3">
<widget class="QLineEdit" name="fd_line_edit"/>
</item>
<item row="1" column="5" rowspan="9">
<widget class="QScrollArea" name="checks_scroll_area">
<property name="widgetResizable">
<bool>true</bool>
</property>
@ -290,16 +294,6 @@
</widget>
</widget>
</item>
<item row="0" column="5">
<widget class="QLabel" name="checks_to_parse_label">
<property name="text">
<string>Checks to parse</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>

View File

@ -14,13 +14,10 @@
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
<item row="0" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path to export: </string>
</property>
</widget>
</item>
@ -45,15 +42,18 @@
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="pathLabel">
<property name="text">
<string>Path to export: </string>
<item row="4" column="2">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
</property>
</widget>
</item>
<item row="3" column="0" colspan="3">
<widget class="QTableWidget" name="tableWidget">
<widget class="TableWidgetMovable" name="tableWidget">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding">
<horstretch>0</horstretch>
@ -200,6 +200,13 @@
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>TableWidgetMovable</class>
<extends>QTableWidget</extends>
<header>widgets/tablewidgetmovable.hpp</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>

View File

@ -70,7 +70,7 @@
<translation type="vanished">Store type</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="216"/>
<location filename="../scenes/mainwindow.ui" line="95"/>
<source>Parse</source>
<translation>Parse</translation>
</message>
@ -113,13 +113,13 @@
<translation type="vanished">0000000000000000</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="58"/>
<location filename="../scenes/mainwindow.ui" line="121"/>
<source>FN (Fiscal Number)</source>
<translatorcomment>FN = Фискальный Номер</translatorcomment>
<translation>FN (Fiscal Number)</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="71"/>
<location filename="../scenes/mainwindow.ui" line="58"/>
<source>FD (Fiscal Document)</source>
<translatorcomment>FD = Фискальный Документ</translatorcomment>
<translation>FD (Fiscal Document)</translation>
@ -133,93 +133,93 @@
<translation type="obsolete">Back</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="100"/>
<location filename="../scenes/mainwindow.ui" line="206"/>
<source>Stop server</source>
<translation>Stop server</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="87"/>
<location filename="../scenes/mainwindow.ui" line="167"/>
<source>Choose image on your PC</source>
<translation>Choose image on your PC</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="38"/>
<location filename="../scenes/mainwindow.ui" line="173"/>
<location filename="../scenes/mainwindow.ui" line="154"/>
<source>or</source>
<translation>or</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="203"/>
<location filename="../scenes/mainwindow.ui" line="141"/>
<source>Use your phone as a QR code scanner</source>
<translation>Use your phone as a QR code scanner</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="107"/>
<location filename="../scenes/mainwindow.ui" line="82"/>
<source>FI (Fiscal Identifier)</source>
<translatorcomment>FI = Фискальный Признак</translatorcomment>
<translation>FI (Fiscal Identifier)</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="45"/>
<location filename="../scenes/mainwindow.ui" line="273"/>
<source>Add new check</source>
<translation>Add new check</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="153"/>
<location filename="../scenes/mainwindow.ui" line="263"/>
<source>Clear</source>
<translation>Clear</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="160"/>
<location filename="../scenes/mainwindow.ui" line="45"/>
<source>Date and time of purchase</source>
<translation>Date and time of purchase</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="180"/>
<location filename="../scenes/mainwindow.ui" line="237"/>
<source>Operation type</source>
<translation>Operation type</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="229"/>
<location filename="../scenes/mainwindow.ui" line="250"/>
<source>Parse an E-Mail</source>
<translation>Parse an E-Mail</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="250"/>
<location filename="../scenes/mainwindow.ui" line="214"/>
<source>Funds income</source>
<translatorcomment>Приход средств</translatorcomment>
<translation>Funds income</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="255"/>
<location filename="../scenes/mainwindow.ui" line="219"/>
<source>Funds return</source>
<translatorcomment>Возврат средств</translatorcomment>
<translation>Funds return</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="260"/>
<location filename="../scenes/mainwindow.ui" line="224"/>
<source>Funds spend</source>
<translatorcomment>Расход средств</translatorcomment>
<translation>Funds spend</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="265"/>
<location filename="../scenes/mainwindow.ui" line="229"/>
<source>Spends return</source>
<translatorcomment>Возврат расхода</translatorcomment>
<translation>Spends return</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="296"/>
<location filename="../scenes/mainwindow.ui" line="72"/>
<source>Checks to parse</source>
<translation>Checks to parse</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="120"/>
<location filename="../scenes/mainwindow.ui" line="108"/>
<source>Settings</source>
<translation>Settings</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="127"/>
<location filename="../scenes/mainwindow.ui" line="128"/>
<source>Total</source>
<translation>Total</translation>
</message>
@ -228,37 +228,37 @@
<translation type="vanished">checks parser</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="99"/>
<location filename="../mainwindow.cpp" line="101"/>
<source>QR code for binaryeye to connect</source>
<translation>QR code for binaryeye to connect</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="100"/>
<location filename="../mainwindow.cpp" line="102"/>
<source>I&apos;ve scanned</source>
<translation>I&apos;ve scanned</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="108"/>
<source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="108"/>
<location filename="../mainwindow.cpp" line="110"/>
<source>Could not start http server.</source>
<translation>Could not start http server.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="152"/>
<location filename="../mainwindow.cpp" line="154"/>
<source>Selected image: </source>
<translation>Selected image: </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="185"/>
<location filename="../mainwindow.cpp" line="187"/>
<source>This feature is under development. Wait it to appear in next updates.</source>
<translation>This feature is under development. Wait for it to appear in next updates.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="187"/>
<location filename="../mainwindow.cpp" line="189"/>
<source>Under development</source>
<translation>Under development</translation>
</message>
@ -271,32 +271,32 @@
<translation type="vanished">No checks to parse</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="257"/>
<location filename="../mainwindow.cpp" line="287"/>
<source>Captcha was not solved correctly!</source>
<translation>Captcha was not solved correctly!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="259"/>
<location filename="../mainwindow.cpp" line="289"/>
<source>Captcha is incorrect</source>
<translation>Captcha is incorrect</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="264"/>
<location filename="../mainwindow.cpp" line="294"/>
<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="266"/>
<location filename="../mainwindow.cpp" line="296"/>
<source>Internal server error</source>
<translation>Internal server error</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="271"/>
<location filename="../mainwindow.cpp" line="301"/>
<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="273"/>
<location filename="../mainwindow.cpp" line="303"/>
<source>Check was not found</source>
<translation>Check was not found</translation>
</message>
@ -309,12 +309,12 @@
<translation type="vanished">Error in parsing</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="145"/>
<location filename="../mainwindow.cpp" line="147"/>
<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="147"/>
<location filename="../mainwindow.cpp" line="149"/>
<source>Picture was not selected</source>
<translation>Picture was not selected</translation>
</message>
@ -522,17 +522,17 @@
<translation>Dialog</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="51"/>
<location filename="../scenes/outputdialog.ui" line="20"/>
<source>Path to export: </source>
<translation>Path to export: </translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="30"/>
<location filename="../scenes/outputdialog.ui" line="27"/>
<source>Choose</source>
<translation>Choose</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="37"/>
<location filename="../scenes/outputdialog.ui" line="34"/>
<source>Print header</source>
<translation>Print header</translation>
</message>
@ -633,7 +633,7 @@
<translation>Total price</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="44"/>
<location filename="../scenes/outputdialog.ui" line="41"/>
<source>Print total</source>
<translation>Print total</translation>
</message>

View File

@ -70,7 +70,7 @@
<translation type="vanished">Магазин</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="216"/>
<location filename="../scenes/mainwindow.ui" line="95"/>
<source>Parse</source>
<translation>Парсить</translation>
</message>
@ -113,13 +113,13 @@
<translation type="vanished">0000000000000000</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="58"/>
<location filename="../scenes/mainwindow.ui" line="121"/>
<source>FN (Fiscal Number)</source>
<translatorcomment>Фискальный Норма</translatorcomment>
<translation>ФН</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="71"/>
<location filename="../scenes/mainwindow.ui" line="58"/>
<source>FD (Fiscal Document)</source>
<translatorcomment>Фискальный Документ</translatorcomment>
<translation>ФД</translation>
@ -133,89 +133,89 @@
<translation type="obsolete">Назад</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="100"/>
<location filename="../scenes/mainwindow.ui" line="206"/>
<source>Stop server</source>
<translation>Остановить сервер</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="87"/>
<location filename="../scenes/mainwindow.ui" line="167"/>
<source>Choose image on your PC</source>
<translation>Выбрать изображение на компьютере</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="38"/>
<location filename="../scenes/mainwindow.ui" line="173"/>
<location filename="../scenes/mainwindow.ui" line="154"/>
<source>or</source>
<translation>или</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="203"/>
<location filename="../scenes/mainwindow.ui" line="141"/>
<source>Use your phone as a QR code scanner</source>
<translation>Использовать телефон как сканнер QR</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="107"/>
<location filename="../scenes/mainwindow.ui" line="82"/>
<source>FI (Fiscal Identifier)</source>
<translatorcomment>Фискальный Признак</translatorcomment>
<translation>ФП</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="45"/>
<location filename="../scenes/mainwindow.ui" line="273"/>
<source>Add new check</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="153"/>
<location filename="../scenes/mainwindow.ui" line="263"/>
<source>Clear</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="160"/>
<location filename="../scenes/mainwindow.ui" line="45"/>
<source>Date and time of purchase</source>
<translation>Дата и время покупки</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="180"/>
<location filename="../scenes/mainwindow.ui" line="237"/>
<source>Operation type</source>
<translation>Тип операции</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="229"/>
<location filename="../scenes/mainwindow.ui" line="250"/>
<source>Parse an E-Mail</source>
<translation>Парсить E-Mail</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="250"/>
<location filename="../scenes/mainwindow.ui" line="214"/>
<source>Funds income</source>
<translation>Приход средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="255"/>
<location filename="../scenes/mainwindow.ui" line="219"/>
<source>Funds return</source>
<translation>Возврат средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="260"/>
<location filename="../scenes/mainwindow.ui" line="224"/>
<source>Funds spend</source>
<translation>Расход средств</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="265"/>
<location filename="../scenes/mainwindow.ui" line="229"/>
<source>Spends return</source>
<translation>Возврат расхода</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="296"/>
<location filename="../scenes/mainwindow.ui" line="72"/>
<source>Checks to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="120"/>
<location filename="../scenes/mainwindow.ui" line="108"/>
<source>Settings</source>
<translation>Настройки</translation>
</message>
<message>
<location filename="../scenes/mainwindow.ui" line="127"/>
<location filename="../scenes/mainwindow.ui" line="128"/>
<source>Total</source>
<translation>Итого</translation>
</message>
@ -224,67 +224,67 @@
<translation type="vanished">Парсер чеков</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="99"/>
<location filename="../mainwindow.cpp" line="101"/>
<source>QR code for binaryeye to connect</source>
<translation>QR код для подключения BinaryEye</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="100"/>
<location filename="../mainwindow.cpp" line="102"/>
<source>I&apos;ve scanned</source>
<translation>Просканировал</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="106"/>
<location filename="../mainwindow.cpp" line="108"/>
<source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation>Не смог поднять HTTP сервер. 10 раз подряд случайно выбранный порт был занят. Либо Вам следует бежать за лоттерейным билетом, или в программе баг. Если лотерейный билет не был выигрышным, пожалуйста, сообщите разработчику.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="108"/>
<location filename="../mainwindow.cpp" line="110"/>
<source>Could not start http server.</source>
<translation>Не получилось запустить HTTP сервер.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="152"/>
<location filename="../mainwindow.cpp" line="154"/>
<source>Selected image: </source>
<translation>Выбранное изображение: </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="185"/>
<location filename="../mainwindow.cpp" line="187"/>
<source>This feature is under development. Wait it to appear in next updates.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="187"/>
<location filename="../mainwindow.cpp" line="189"/>
<source>Under development</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="257"/>
<location filename="../mainwindow.cpp" line="287"/>
<source>Captcha was not solved correctly!</source>
<translation>Капча была решена неверно!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="259"/>
<location filename="../mainwindow.cpp" line="289"/>
<source>Captcha is incorrect</source>
<translation>Капча введена неверно</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="264"/>
<location filename="../mainwindow.cpp" line="294"/>
<source>Internal server error. Please, try again later.</source>
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="266"/>
<location filename="../mainwindow.cpp" line="296"/>
<source>Internal server error</source>
<translation>Внутренняя ошибка сервера</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="271"/>
<location filename="../mainwindow.cpp" line="301"/>
<source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="273"/>
<location filename="../mainwindow.cpp" line="303"/>
<source>Check was not found</source>
<translation>Чек не найден</translation>
</message>
@ -297,12 +297,12 @@
<translation type="vanished">Ошибка в парсинге</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="145"/>
<location filename="../mainwindow.cpp" line="147"/>
<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="147"/>
<location filename="../mainwindow.cpp" line="149"/>
<source>Picture was not selected</source>
<translation>Изображение не было выбрано</translation>
</message>
@ -510,17 +510,17 @@
<translation>Диалог</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="51"/>
<location filename="../scenes/outputdialog.ui" line="20"/>
<source>Path to export: </source>
<translation>Путь для экспорта: </translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="30"/>
<location filename="../scenes/outputdialog.ui" line="27"/>
<source>Choose</source>
<translation>Выбрать</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="37"/>
<location filename="../scenes/outputdialog.ui" line="34"/>
<source>Print header</source>
<translation>Печатать заголовок</translation>
</message>
@ -621,7 +621,7 @@
<translation>Всего</translation>
</message>
<message>
<location filename="../scenes/outputdialog.ui" line="44"/>
<location filename="../scenes/outputdialog.ui" line="41"/>
<source>Print total</source>
<translation>Печатать Итого</translation>
</message>

View File

@ -7,23 +7,30 @@
#include <iostream>
CheckListViewWidget::CheckListViewWidget(QWidget *parent, Check check) : QWidget(parent), check(check) {
mw = (MainWindow*) parent;
std::cout << "I was created with check with date " << check.get_date() << std::endl;
QHBoxLayout *layout = new QHBoxLayout;
QLabel *label1 = new QLabel(QString::fromStdString(check.get_date()));
QLabel *label2 = new QLabel("Text 2");
QLabel *label3 = new QLabel("Text 3");
QLabel *date_label = new QLabel(QString::fromStdString(check.get_date()));
QLabel *summ_label = new QLabel(QString::number(check.get_total()));
QPushButton *deleteButton = new QPushButton(tr("Delete"));
deleteButton->connect(deleteButton, &QPushButton::clicked, this, &CheckListViewWidget::deleteButtonPressed);
deleteButton->connect(deleteButton, &QPushButton::clicked, this, &CheckListViewWidget::delete_button_pressed);
layout->addWidget(label1);
layout->addWidget(label2);
layout->addWidget(label3);
layout->addWidget(date_label);
layout->addWidget(summ_label);
layout->addSpacing(10);
layout->addWidget(deleteButton);
setLayout(layout);
}
Check &CheckListViewWidget::get_check(){
return check;
}
void CheckListViewWidget::delete_button_pressed() {
emit mw->deleteCheckFromList(this->check);
}

View File

@ -3,6 +3,7 @@
#include <QObject>
#include <QWidget>
#include <mainwindow.h>
#include <check/check.h>
@ -10,9 +11,12 @@ class CheckListViewWidget : public QWidget
{
Q_OBJECT
Check check;
MainWindow* mw;
public:
explicit CheckListViewWidget(QWidget *parent = nullptr, Check check = Check());
Check &get_check();
void delete_button_pressed();
signals:
Check deleteButtonPressed();
};

View File

@ -7,6 +7,56 @@
TableWidgetMovable::TableWidgetMovable(QWidget *parent) : QTableWidget(parent) { }
// void TableWidgetMovable::dropEvent(QDropEvent *event) {
// if (event->source() == this) {
// // Get the index of the row being dragged
// QModelIndex sourceIndex = currentIndex();
// if (!sourceIndex.isValid()) {
// return;
// }
// // Get the index of the target row
// QModelIndex targetIndex = indexAt(event->pos());
// if (!targetIndex.isValid()) {
// return;
// }
// int sourceRow = sourceIndex.row();
// int targetRow = targetIndex.row();
// // Swap rows
// if (sourceRow != targetRow) {
// // Store the data of the source row
// QList<QTableWidgetItem*> itemsSource;
// for (int col = 0; col < columnCount(); ++col) {
// itemsSource.append(takeItem(sourceRow, col));
// }
// QList<QTableWidgetItem*> itemsTarget;
// for (int col = 0; col < columnCount(); ++col) {
// itemsTarget.append(takeItem(targetRow, col));
// }
// // Insert the items into the target row
// for (int col = 0; col < columnCount(); ++col) {
// setItem(targetRow, col, itemsSource[col]);
// setItem(sourceRow, col, itemsTarget[col]);
// }
// // for (int col = 0; col < columnCount(); ++col) {
// // }
// // Remove the original row
// // removeRow(sourceRow < targetRow ? sourceRow : sourceRow + 1);
// }
// event->acceptProposedAction();
// } else {
// QTableWidget::dropEvent(event);
// }
// }
// TOOD: fix None of these works. WIP
// void TableWidgetMovable::dropEvent(QDropEvent *event) {