Fully implemented manual receipts printing

remotes/origin/HEAD
markuspg 10 years ago
parent e8af25467d
commit 6806ec53fb

@ -54,12 +54,12 @@ lc::ReceiptsHandler::ReceiptsHandler( const QString &argZTreeDataTargetPath,
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, const QString &argLatexHeaderName,
const QString * const argDateString, QObject *argParent ) : const QString &argDateString, QObject *argParent ) :
QObject{ argParent }, QObject{ argParent },
anonymousReceiptsPlaceholder{ argAnonymousReceiptsPlaceholder }, anonymousReceiptsPlaceholder{ argAnonymousReceiptsPlaceholder },
dateString{ *argDateString }, dateString{ argDateString },
expectedPaymentFileName{ *argDateString + ".pay" }, expectedPaymentFileName{ argDateString + ".pay" },
expectedPaymentFilePath{ argZTreeDataTargetPath + "/" + *argDateString + ".pay" }, expectedPaymentFilePath{ argZTreeDataTargetPath + "/" + argDateString + ".pay" },
latexHeaderName{ argLatexHeaderName }, latexHeaderName{ argLatexHeaderName },
paymentFile{ expectedPaymentFilePath }, paymentFile{ expectedPaymentFilePath },
printReceiptsForLocalClients{ argPrintReceiptsForLocalClients }, printReceiptsForLocalClients{ argPrintReceiptsForLocalClients },

@ -54,7 +54,7 @@ public:
bool argPrintReceiptsForLocalClients, bool argPrintReceiptsForLocalClients,
const QString &argAnonymousReceiptsPlaceholder, const QString &argAnonymousReceiptsPlaceholder,
const QString &argLatexHeaderName, const QString &argLatexHeaderName,
const QString * const argDateString, QObject *argParent = nullptr ); const QString &argDateString, QObject *argParent = nullptr );
signals: signals:
void PrintingFinished(); void PrintingFinished();

@ -425,6 +425,8 @@ void lc::MainWindow::on_PBPrintPaymentFileManually_clicked() {
manPrint->show(); manPrint->show();
connect( manPrint, SIGNAL( destroyed( QObject* ) ), connect( manPrint, SIGNAL( destroyed( QObject* ) ),
manPrint, SLOT( deleteLater() ) ); manPrint, SLOT( deleteLater() ) );
connect( manPrint, &ManualPrintingSetup::RequestReceiptsHandler,
this, &MainWindow::StartReceiptsHandler );
} }
void lc::MainWindow::on_PBRunzLeaf_clicked() { void lc::MainWindow::on_PBRunzLeaf_clicked() {
@ -673,6 +675,18 @@ void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVers
startProc.startDetached( settings->tasksetCmd, arguments ); startProc.startDetached( settings->tasksetCmd, arguments );
} }
void lc::MainWindow::StartReceiptsHandler( QString argzTreeDataTargetPath,
bool argReceiptsForLocalClients,
QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName, QString argDateString) {
ReceiptsHandler *recHand = new ReceiptsHandler{ argzTreeDataTargetPath,
argReceiptsForLocalClients,
argAnonymousReceiptsPlaceholder,
argLatexHeaderName, argDateString, this };
connect( recHand, &ReceiptsHandler::PrintingFinished,
recHand, &ReceiptsHandler::deleteLater );
}
void lc::MainWindow::UpdateClientsTableView() { void lc::MainWindow::UpdateClientsTableView() {
for ( auto s : *valid_items ) { for ( auto s : *valid_items ) {
state_t state = static_cast< Client* >( s->data( Qt::UserRole ).value<void *>() )->GetClientState(); state_t state = static_cast< Client* >( s->data( Qt::UserRole ).value<void *>() )->GetClientState();

@ -109,6 +109,13 @@ private:
QButtonGroup *userChooseButtonGroup = nullptr; //! Used to group the radio buttons choosing which user shall be used for administrative client actions QButtonGroup *userChooseButtonGroup = nullptr; //! Used to group the radio buttons choosing which user shall be used for administrative client actions
Ui::MainWindow *ui = nullptr; //! Pointer storing all GUI items Ui::MainWindow *ui = nullptr; //! Pointer storing all GUI items
QVector<QStandardItem *> *valid_items = nullptr; //! Stores all valid Client instances displayed by the table view, its main use is as iterable object for 'update_clients_table_view()' QVector<QStandardItem *> *valid_items = nullptr; //! Stores all valid Client instances displayed by the table view, its main use is as iterable object for 'update_clients_table_view()'
private slots:
void StartReceiptsHandler( QString argzTreeDataTargetPath,
bool argReceiptsForLocalClients,
QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName,
QString argDateString );
}; };
} }

@ -64,11 +64,11 @@ void lc::ManualPrintingSetup::on_PBSelectFile_clicked() {
if ( fileDialog.exec() ) { if ( fileDialog.exec() ) {
ui->PBSelectFile->setStyleSheet( "" ); ui->PBSelectFile->setStyleSheet( "" );
const QString tmpFileName{ fileDialog.selectedFiles().at( 0 ) }; const QString tmpFileName{ fileDialog.selectedFiles().at( 0 ) };
const QString dateString{ tmpFileName.split( '/', QString::KeepEmptyParts, dateString = tmpFileName.split( '/', QString::KeepEmptyParts,
Qt::CaseInsensitive ).last() Qt::CaseInsensitive ).last()
.split( '.', QString::KeepEmptyParts, .split( '.', QString::KeepEmptyParts,
Qt::CaseInsensitive ).first() }; Qt::CaseInsensitive ).first();
QString workPath{ tmpFileName }; workPath = tmpFileName;
workPath.truncate( workPath.lastIndexOf( '/' ) ); workPath.truncate( workPath.lastIndexOf( '/' ) );
} }
} }
@ -91,9 +91,9 @@ void lc::ManualPrintingSetup::on_PBPrint_clicked() {
anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText(); anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText();
} }
emit RequestReceiptsHandler( ui->ChBReceiptsForLocalClients->isChecked(), emit RequestReceiptsHandler( workPath, ui->ChBReceiptsForLocalClients->isChecked(),
anonymousReceiptsPlaceholder, anonymousReceiptsPlaceholder,
ui->CBReceiptsHeader->currentText() ); ui->CBReceiptsHeader->currentText(), dateString );
this->deleteLater(); this->deleteLater();
} }

@ -36,13 +36,16 @@ public:
~ManualPrintingSetup(); ~ManualPrintingSetup();
signals: signals:
void RequestReceiptsHandler( bool argReceiptsForLocalClients, void RequestReceiptsHandler( QString argzTreeDataTargetPath,
bool argReceiptsForLocalClients,
QString argAnonymousReceiptsPlaceholder, QString argAnonymousReceiptsPlaceholder,
QString argLatexHeaderName ); QString argLatexHeaderName,
QString argDateString );
private: private:
QString filePath; QString dateString;
Ui::ManualPrintingSetup *ui = nullptr; Ui::ManualPrintingSetup *ui = nullptr;
QString workPath;
private slots: private slots:
void on_CBReceiptsHeader_activated( int argIndex ); void on_CBReceiptsHeader_activated( int argIndex );

Loading…
Cancel
Save