Skip to content

Commit

Permalink
Добавлена вкладка просмотра и печати актов технического состояния обо…
Browse files Browse the repository at this point in the history
…рудовния (редактор еще не реализован).
  • Loading branch information
solderercb committed Jan 7, 2024
1 parent 32c2647 commit 72c7c15
Show file tree
Hide file tree
Showing 38 changed files with 2,345 additions and 162 deletions.
2 changes: 1 addition & 1 deletion appver.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define APP_MAJOR 0
#define APP_MINOR 0
#define APP_PATCH 0
#define APP_COMMIT 284
#define APP_COMMIT 285

#define FILE_VER APP_MAJOR,APP_MINOR,APP_PATCH,APP_COMMIT // обязательно запятые!
#define PRODUCT_VER FILE_VER
Expand Down
1 change: 1 addition & 0 deletions global.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ namespace Global
invoice1 = 17, invoice2 = 18, invoice3 = 19, vatinvoice0 = 20, p_list0 = 21, w_list0 = 22,
new_cartridge = 23, sticker_cartridge = 24, issue_cartridge = 25, slip = 27, move = 28, buyout = 29,
repairs = 30, cartridges = 31,
tech_report,
not_impl = 256};
Q_ENUM_NS(Reports)
enum ThrowType {Debug = 0, QueryError = 1, TimeError = 2, IntegrityError = 253, ConditionsError = 254, UserCanceled = 255};
Expand Down
503 changes: 353 additions & 150 deletions lang/snap_ru_RU.ts

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "tabcashmoveexch.h"
#include "tabsettings.h"
#include "tabsalary.h"
#include "tabtechreports.h"
#include "widgets/slineedit.h"
#include "com_sql_queries.h"

Expand Down Expand Up @@ -165,6 +166,11 @@ void MainWindow::createMenu()
workshop_editor->setEnabled(false);
// workshop_editor->setVisible(permissions->) // TODO

QAction *techReports = new QAction(tr("Акты технического состояния"), this);
workshop_menu->addAction(techReports);
techReports->setVisible(permissions->workWithTechReports);
connect(techReports, &QAction::triggered, this, &MainWindow::createTabTechReports);

QToolButton* workshop_button = new QToolButton();
workshop_button->setMenu(workshop_menu);
workshop_button->setPopupMode(QToolButton::MenuButtonPopup);
Expand Down Expand Up @@ -685,6 +691,18 @@ void MainWindow::switchToLastUsedTab()
ui->tabWidget->setCurrentWidget(tabList.last());
}

void MainWindow::createTabTechReports()
{
tabTechReports *subwindow = tabTechReports::getInstance(this);
if (ui->tabWidget->indexOf(subwindow) == -1) // Если такой вкладки еще нет, то добавляем
ui->tabWidget->addTab(subwindow, subwindow->tabTitle());

// QObject::connect(subwindow, &tabRepairs::doubleClickRepair, this, &MainWindow::createTabRepair);

ui->tabWidget->setCurrentWidget(subwindow);
// subwindow->setFocusSearchField();
}

void MainWindow::createTabSale(int doc_id)
{
if(!permissions->saleGoods)
Expand Down
2 changes: 1 addition & 1 deletion mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public slots:
void createTabSparePart(int);
void createTabSparePartReserve(int);
void switchToLastUsedTab();

void createTabTechReports();
private slots:
void reactivateCallerTab(QWidget *);
void reactivateTabRepairNew(int);
Expand Down
2 changes: 1 addition & 1 deletion models/slocalsettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class SLocalSettings : public QObject
EmployeesReportGrid, VisitSourceGrid, StatusChecksGrid, EmployeeActivityGrid, FFRSalaryGrid,
TasksGrid,
CartridgeMaterialsGrid,
ClientsMatchGrid, RepairsMatchGrid};
ClientsMatchGrid, RepairsMatchGrid, TechReportsGrid};
Q_ENUM(SettingsVariant)
enum Operation {SaveFile = 0, ReadFile};
static QString appSettingsPath();
Expand Down
2 changes: 2 additions & 0 deletions models/spermissions.h
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class SPermissions : public QStandardItemModel, public SDatabaseAuxiliary
PROPSTRUCT_FIELD(int, viewClientBankData, dummy)
PROPSTRUCT_FIELD(int, editPaymentSystemInCommittedCashRegisters, dummy)
PROPSTRUCT_FIELD(int, viewEmployeesSalary, dummy)
PROPSTRUCT_FIELD(int, workWithTechReports, dummy)
public:
explicit SPermissions();
QStringList list();
Expand Down Expand Up @@ -391,6 +392,7 @@ inline void SPermissions::translateNames()
tr("viewClientBankData");
tr("editPaymentSystemInCommittedCashRegisters");
tr("viewEmployeesSalary");
tr("workWithTechReports");
}

#endif // SPERMISSIONS_H
5 changes: 5 additions & 0 deletions models/stablemodelscommonmethods.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ QString STableModelsCommonMethods::dataLocalizedFromDouble(const QModelIndex &it
return sysLocale.toString(derivedModel->data(item, Qt::DisplayRole | 0x0100).toDouble(), 'f', comSettings->classicKassa?2:0);
}

QString STableModelsCommonMethods::companyFromId(const QModelIndex &item) const
{
return companiesModel->getDisplayRole(derivedModel->data(item, Qt::DisplayRole | 0x0100).toInt());
}

QString STableModelsCommonMethods::userFromId(const QModelIndex &item) const
{
return usersModel->getDisplayRole(derivedModel->data(item, Qt::DisplayRole | 0x0100).toInt());
Expand Down
1 change: 1 addition & 0 deletions models/stablemodelscommonmethods.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ class STableModelsCommonMethods
QDateTime timestampLocal(const QModelIndex &index) const;
double total(int column, int sign = 0);
QString dataLocalizedFromDouble(const QModelIndex &item) const;
QString companyFromId(const QModelIndex &item) const;
QString userFromId(const QModelIndex &item) const;
QString warrantyFromId(const QModelIndex &item) const;
QVariant data(const int row, const int column, int role = Qt::DisplayRole) const;
Expand Down
21 changes: 21 additions & 0 deletions models/stabletechreportsmodel.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "stabletechreportsmodel.h"

STableTechReportsModel::STableTechReportsModel(QObject *parent) : STableBaseModel(parent)
{

}

QVariant STableTechReportsModel::data(const QModelIndex &index, int role) const
{
if(role == Qt::DisplayRole)
{
switch(index.column())
{
case Columns::Company: return companyFromId(index);
case Columns::User: return userFromId(index);
case Columns::Created: return timestampLocal(index);
default: break;
}
}
return STableBaseModel::data(index, role);
}
21 changes: 21 additions & 0 deletions models/stabletechreportsmodel.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#ifndef STABLETECHREPORTSMODEL_H
#define STABLETECHREPORTSMODEL_H

#include <QObject>
#include "models/stablebasemodel.h"
#include "global.h"

class STableTechReportsModel : public STableBaseModel
{
Q_OBJECT
public:
enum Columns{Id = 0, Num, Created, User, Company, Client, Device, InvNumber, SerialNumber, ProductionData, PurchaseDate, InitCost, ResidualCost, Fault, DiagResult, Conclusion, Notes};
explicit STableTechReportsModel(QObject *parent = nullptr);
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
// Qt::ItemFlags flags(const QModelIndex& index) const override;
private:
QVariant clientName(const QModelIndex &index) const;
QVariant dateTime(const QModelIndex &index) const;
};

#endif // STABLETECHREPORTSMODEL_H
Loading

0 comments on commit 72c7c15

Please sign in to comment.