-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallcompanyinvoices.cpp
48 lines (39 loc) · 1.48 KB
/
allcompanyinvoices.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "allcompanyinvoices.h"
#include "ui_allcompanyinvoices.h"
#include "customer.h"
AllCompanyInvoices::AllCompanyInvoices(QWidget *parent, MainWindow *mW, Customer *customer) :
QDialog(parent),
ui(new Ui::AllCompanyInvoices)
{
// Setup UI
ui->setupUi(this);
ui->label_cName->setText(customer->getCompanyName());
ui->label_fName->setText("Frist name: " + customer->getFirstName());
ui->label_lName->setText("Last name: " + customer->getLastName());
ui->label_pNumber->setText("Phone number: " + customer->getPhoneNumber());
// Set variables
_mainWindow = mW;
_customer = customer;
// Load customer invoices
loadCustomerInvoices();
}
AllCompanyInvoices::~AllCompanyInvoices()
{
delete ui;
}
void AllCompanyInvoices::on_pushButton_addInvoices_pressed()
{
// Add invoices to the database
QVector<Invoice> invoices;
}
void AllCompanyInvoices::loadCustomerInvoices() {
// Load all Invoice table
_invoiceModel = _mainWindow->_dbManager->loadCustomerInvoices(_customer);
if(_invoiceModel != NULL) {
ui->tableView->setModel(_invoiceModel);
_mainWindow->showStatus("Successfully loaded invoice table: " + _customer->getCompanyName());
} else {
QMessageBox::critical(this, tr("Database Error"), "The database could not load the invoice table: " + _customer->getCompanyName());
_mainWindow->showStatus("Database: Load invoice table for " + _customer->getCompanyName() + " unsuccessful");
}
}