src/InventorySuppliers.cpp

changeset 10
8aa2bd9ba9e8
parent 9
85656dc48131
child 11
c9cdc15d3caf
--- a/src/InventorySuppliers.cpp	Sun Feb 13 20:24:33 2022 +0100
+++ b/src/InventorySuppliers.cpp	Mon Feb 14 20:58:07 2022 +0100
@@ -15,8 +15,10 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "InventorySuppliers.h"
+#include "EditSupplier.h"
 #include "../ui/ui_InventorySuppliers.h"
 #include "config.h"
+#include "bmsapp.h"
 
 #include <QDebug>
 #include <QtSql>
@@ -24,12 +26,22 @@
 #include <QTableWidget>
 
 
+
+
+
 InventorySuppliers::InventorySuppliers(QWidget *parent) : QDialog(parent), ui(new Ui::InventorySuppliers)
 {
     qDebug() << Q_FUNC_INFO;
 
     ui->setupUi(this);
+    InventorySuppliers::loadTable();
 
+    setWindowTitle( QString("BMSapp - %1 - Inventory Suppliers").arg(VERSIONSTRING) );
+}
+
+
+void InventorySuppliers::loadTable(void)
+{
     ui->tableSuppliers = new QTableWidget(ui->tableSuppliers);
     QSqlQuery query("SELECT * FROM inventory_suppliers ORDER BY name");
     const QStringList labels({tr("Record"), tr("Name"), tr("Address"), tr("City"), tr("Country"), tr("Phone"), tr("Edit")});
@@ -85,21 +97,32 @@
 }
 
 
+bool InventorySuppliers::edit(int recno)
+{
+    qDebug() << Q_FUNC_INFO << recno;
+
+    EditSupplier dialog(recno, this);
+    dialog.setModal(true);
+    int rc = dialog.exec();	/* rc 0 == cancel, rc 1 == ok */
+
+    qDebug() << Q_FUNC_INFO << recno << rc;
+    return false;
+}
+
+
 void InventorySuppliers::on_editButton_clicked()
 {
     QPushButton *pb = qobject_cast<QPushButton *>(QObject::sender());
     int recno = pb->objectName().toInt();
     qDebug() << Q_FUNC_INFO << recno;
-
-    // Call editor with recno
+    edit(recno);
 }
 
 
 void InventorySuppliers::on_insertButton_clicked()
 {
     qDebug() << Q_FUNC_INFO;
-
-    // Call editor with -1
+    edit(-1);
 }
 
 

mercurial