Fully implemented manual receipts printing

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

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

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

@ -425,6 +425,8 @@ void lc::MainWindow::on_PBPrintPaymentFileManually_clicked() {
manPrint->show();
connect( manPrint, SIGNAL( destroyed( QObject* ) ),
manPrint, SLOT( deleteLater() ) );
connect( manPrint, &ManualPrintingSetup::RequestReceiptsHandler,
this, &MainWindow::StartReceiptsHandler );
}
void lc::MainWindow::on_PBRunzLeaf_clicked() {
@ -673,6 +675,18 @@ void lc::MainWindow::StartLocalzLeaf( QString argzLeafName, QString argzLeafVers
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() {
for ( auto s : *valid_items ) {
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
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()'
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() ) {
ui->PBSelectFile->setStyleSheet( "" );
const QString tmpFileName{ fileDialog.selectedFiles().at( 0 ) };
const QString dateString{ tmpFileName.split( '/', QString::KeepEmptyParts,
dateString = tmpFileName.split( '/', QString::KeepEmptyParts,
Qt::CaseInsensitive ).last()
.split( '.', QString::KeepEmptyParts,
Qt::CaseInsensitive ).first() };
QString workPath{ tmpFileName };
Qt::CaseInsensitive ).first();
workPath = tmpFileName;
workPath.truncate( workPath.lastIndexOf( '/' ) );
}
}
@ -91,9 +91,9 @@ void lc::ManualPrintingSetup::on_PBPrint_clicked() {
anonymousReceiptsPlaceholder = ui->CBReplaceParticipantNames->currentText();
}
emit RequestReceiptsHandler( ui->ChBReceiptsForLocalClients->isChecked(),
emit RequestReceiptsHandler( workPath, ui->ChBReceiptsForLocalClients->isChecked(),
anonymousReceiptsPlaceholder,
ui->CBReceiptsHeader->currentText() );
ui->CBReceiptsHeader->currentText(), dateString );
this->deleteLater();
}

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

Loading…
Cancel
Save