diff --git a/RepairCafeCureApp/CClosedWorkOrderDetailsTab.cpp b/RepairCafeCureApp/CClosedWorkOrderDetailsTab.cpp
new file mode 100644
index 0000000..5eec359
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkOrderDetailsTab.cpp
@@ -0,0 +1,32 @@
+// CClosedWordorderDetailsTab.cpp : implementation file
+//
+
+#include "pch.h"
+#include "RepairCafeCureApp.h"
+#include "afxdialogex.h"
+#include "CClosedWorkOrderDetailsTab.h"
+
+IMPLEMENT_DYNAMIC(CClosedWorkOrderDetailsTab, CDialogEx)
+
+CClosedWorkOrderDetailsTab::CClosedWorkOrderDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent)
+ : CDialogEx(IDD_CLOSED_WORKORDER_DETAILS_TAB, pParent)
+ , m_pTabControl{ pTabControl }
+ , m_unWorkorderID{ unID }
+{
+
+}
+
+CClosedWorkOrderDetailsTab::~CClosedWorkOrderDetailsTab()
+{
+}
+
+void CClosedWorkOrderDetailsTab::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CClosedWorkOrderDetailsTab, CDialogEx)
+END_MESSAGE_MAP()
+
+
diff --git a/RepairCafeCureApp/CClosedWorkOrderDetailsTab.h b/RepairCafeCureApp/CClosedWorkOrderDetailsTab.h
new file mode 100644
index 0000000..05c05fa
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkOrderDetailsTab.h
@@ -0,0 +1,26 @@
+#pragma once
+#include "CClosedWorkorderDetailsTabCtrl.h"
+
+
+using namespace artvabas::rcc::ui::controls;
+
+class CClosedWorkOrderDetailsTab : public CDialogEx
+{
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_CLOSED_WORKORDER_DETAILS_TAB };
+#endif
+ DECLARE_DYNAMIC(CClosedWorkOrderDetailsTab)
+
+private:
+ CClosedWorkorderDetailsTabCtrl* m_pTabControl;
+ unsigned int m_unWorkorderID;
+
+public:
+ CClosedWorkOrderDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent = nullptr); // standard constructor
+ virtual ~CClosedWorkOrderDetailsTab();
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.cpp b/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.cpp
new file mode 100644
index 0000000..db18de1
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.cpp
@@ -0,0 +1,37 @@
+// CClosedWorkorderAssetDetailsTab.cpp : implementation file
+//
+
+#include "pch.h"
+#include "RepairCafeCureApp.h"
+#include "afxdialogex.h"
+#include "CClosedWorkorderAssetDetailsTab.h"
+
+
+// CClosedWorkorderAssetDetailsTab dialog
+
+IMPLEMENT_DYNAMIC(CClosedWorkorderAssetDetailsTab, CDialogEx)
+
+CClosedWorkorderAssetDetailsTab::CClosedWorkorderAssetDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_CLOSED_WORKORDER_ASSET_DETAILS_TAB, pParent)
+ , m_pTabControl{ pTabControl }
+ , m_unAssetID{ unID }
+
+{
+
+}
+
+CClosedWorkorderAssetDetailsTab::~CClosedWorkorderAssetDetailsTab()
+{
+}
+
+void CClosedWorkorderAssetDetailsTab::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CClosedWorkorderAssetDetailsTab, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CClosedWorkorderAssetDetailsTab message handlers
diff --git a/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.h b/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.h
new file mode 100644
index 0000000..943f63e
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderAssetDetailsTab.h
@@ -0,0 +1,28 @@
+#pragma once
+#include "CClosedWorkorderDetailsTabCtrl.h"
+
+
+using namespace artvabas::rcc::ui::controls;
+
+class CClosedWorkorderAssetDetailsTab : public CDialogEx
+{
+ DECLARE_DYNAMIC(CClosedWorkorderAssetDetailsTab)
+
+private:
+ CClosedWorkorderDetailsTabCtrl* m_pTabControl;
+ unsigned int m_unAssetID;
+
+public:
+ CClosedWorkorderAssetDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent = nullptr); // standard constructor
+ virtual ~CClosedWorkorderAssetDetailsTab();
+
+// Dialog Data
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_CLOSED_WORKORDER_ASSET_DETAILS_TAB };
+#endif
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.cpp b/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.cpp
new file mode 100644
index 0000000..23a3dbb
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.cpp
@@ -0,0 +1,36 @@
+// CClosedWorkorderCustomerDetailsTab.cpp : implementation file
+//
+
+#include "pch.h"
+#include "RepairCafeCureApp.h"
+#include "afxdialogex.h"
+#include "CClosedWorkorderCustomerDetailsTab.h"
+
+
+// CClosedWorkorderCustomerDetailsTab dialog
+
+IMPLEMENT_DYNAMIC(CClosedWorkorderCustomerDetailsTab, CDialogEx)
+
+CClosedWorkorderCustomerDetailsTab::CClosedWorkorderCustomerDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent /*=nullptr*/)
+ : CDialogEx{ IDD_CLOSED_WORKORDER_CUSTOMER_DETAILS_TAB, pParent }
+ , m_pTabControl{ pTabControl }
+ , m_unCustomerID{ unID }
+{
+
+}
+
+CClosedWorkorderCustomerDetailsTab::~CClosedWorkorderCustomerDetailsTab()
+{
+}
+
+void CClosedWorkorderCustomerDetailsTab::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CClosedWorkorderCustomerDetailsTab, CDialogEx)
+END_MESSAGE_MAP()
+
+
+// CClosedWorkorderCustomerDetailsTab message handlers
diff --git a/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.h b/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.h
new file mode 100644
index 0000000..5ff9dc6
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderCustomerDetailsTab.h
@@ -0,0 +1,26 @@
+#pragma once
+#include "CClosedWorkorderDetailsTabCtrl.h"
+
+using namespace artvabas::rcc::ui::controls;
+
+class CClosedWorkorderCustomerDetailsTab : public CDialogEx
+{
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_CLOSED_WORKORDER_CUSTOMER_DETAILS_TAB };
+#endif
+ DECLARE_DYNAMIC(CClosedWorkorderCustomerDetailsTab)
+
+private:
+ CClosedWorkorderDetailsTabCtrl* m_pTabControl;
+ unsigned int m_unCustomerID;
+
+public:
+ CClosedWorkorderCustomerDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent = nullptr); // standard constructor
+ virtual ~CClosedWorkorderCustomerDetailsTab();
+
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/RepairCafeCureApp/CClosedWorkorderDetails.cpp b/RepairCafeCureApp/CClosedWorkorderDetails.cpp
new file mode 100644
index 0000000..d6cd9f9
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderDetails.cpp
@@ -0,0 +1,82 @@
+/*
+ Copyright (C) 2023 artvabas
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+
+ To see the license for this source code, please visit:
+
+
+ For more information, please visit:
+
+
+
+ For contacts, please use the contact form at:
+
+*/
+
+/*
+* This file is part of RepairCafeCureApp.
+* File: CClosedWorkorderDetails.cpp, implements of the class CClosedWorkorderDetails
+*
+* This class is the dialog of the closed workorder tab control
+* it is the placeholder for the CClosedWorkorderDetailsTabCtrl class,
+* which is the view of the CListCtrl created on the closed workorder details dialog
+*
+* Target: Windows 10/11 64bit
+* Version: 1.0.0.2 (Alpha)
+* Created: 17-06-2024, (dd-mm-yyyy)
+* Updated: 18-06-2024, (dd-mm-yyyy)
+* Creator: artvabasDev / artvabas
+*
+* Description: Database connection class
+* License: GPLv3
+*/
+#include "pch.h"
+#include "RepairCafeCureApp.h"
+#include "afxdialogex.h"
+#include "CClosedWorkorderDetails.h"
+
+using namespace artvabas::rcc::ui::dialogs;
+
+IMPLEMENT_DYNAMIC(CClosedWorkorderDetails, CDialogEx)
+
+CClosedWorkorderDetails::CClosedWorkorderDetails(unsigned int& unCustomerID, unsigned int& unAssetID,
+ unsigned int& unWorkorderID, unsigned int& unInvoiceID, CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_CLOSED_WORKORDER_DIALOG, pParent),
+ m_ctrTabClosedWorkorderDetails(unCustomerID, unAssetID, unWorkorderID, unInvoiceID)
+{}
+
+CClosedWorkorderDetails::~CClosedWorkorderDetails()
+{}
+
+// DoDataExchange mothod is used for binding ID's with their controls
+// - pDx
+void CClosedWorkorderDetails::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+ DDX_Control(pDX, IDC_CLOSED_WORKORDER_DETAILS_TAB_CONTROL, m_ctrTabClosedWorkorderDetails);
+}
+
+// OnInitDialog method is called by the framework when dialog is buid and needs to be initialized
+BOOL CClosedWorkorderDetails::OnInitDialog()
+{
+ CDialogEx::OnInitDialog();
+ m_ctrTabClosedWorkorderDetails.Init();
+ return TRUE;
+}
+
+// Message maps, for handling app messages, int this case pass the message through to the Tab Control class
+BEGIN_MESSAGE_MAP(CClosedWorkorderDetails, CDialogEx)
+ ON_NOTIFY(TCN_SELCHANGE, IDC_CLOSED_WORKORDER_DETAILS_TAB_CONTROL, &CClosedWorkorderDetailsTabCtrl::OnTcnSelChange)
+END_MESSAGE_MAP()
diff --git a/RepairCafeCureApp/CClosedWorkorderDetails.h b/RepairCafeCureApp/CClosedWorkorderDetails.h
new file mode 100644
index 0000000..8ccbad6
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderDetails.h
@@ -0,0 +1,72 @@
+/*
+ Copyright (C) 2023 artvabas
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+
+ To see the license for this source code, please visit:
+
+
+ For more information, please visit:
+
+
+
+ For contacts, please use the contact form at:
+
+
+*/
+
+/*
+* This file is part of RepairCafeCureApp.
+* File: CClosedWorkorderDetails.cpp, definition of the class CClosedWorkorderDetails
+*
+* This class is the dialog of the closed workorder tab control
+* it is the placeholder for the CClosedWorkorderDetailsTabCtrl class,
+* which is the view of the CListCtrl created on the closed workorder details dialog
+*
+* Target: Windows 10/11 64bit
+* Version: 1.0.0.2 (Alpha)
+* Created: 17-06-2024, (dd-mm-yyyy)
+* Updated: 18-06-2024, (dd-mm-yyyy)
+* Creator: artvabasDev / artvabas
+*
+* Description: Database connection class
+* License: GPLv3
+*/
+#pragma once
+#include "CClosedWorkorderDetailsTabCtrl.h"
+
+namespace artvabas::rcc::ui::dialogs {
+
+ using namespace artvabas::rcc::ui::controls;
+
+ class CClosedWorkorderDetails : public CDialogEx
+ {
+ DECLARE_DYNAMIC(CClosedWorkorderDetails)
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_CLOSED_WORKORDER_DIALOG };
+#endif
+ private:
+ CClosedWorkorderDetailsTabCtrl m_ctrTabClosedWorkorderDetails;
+
+ public:
+ CClosedWorkorderDetails(unsigned int& unCustomerID, unsigned int& unAssetID,
+ unsigned int& unWorkorderID, unsigned int& unInvoiceID, CWnd* pParent = nullptr);
+ virtual ~CClosedWorkorderDetails();
+
+ private:
+ void DoDataExchange(CDataExchange* pDX) override;
+ BOOL OnInitDialog() override;
+ DECLARE_MESSAGE_MAP()
+ };
+}
\ No newline at end of file
diff --git a/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.cpp b/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.cpp
index bcae601..144de1f 100644
--- a/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.cpp
+++ b/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.cpp
@@ -1,30 +1,147 @@
-// CClosedWorkorderDetailsTabCtrl.cpp : implementation file
-//
+/*
+ Copyright (C) 2023 artvabas
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+
+ To see the license for this source code, please visit:
+
+
+ For more information, please visit:
+
+
+
+ For contacts, please use the contact form at:
+
+
+*/
+
+/*
+* This file is part of RepairCafeCureApp.
+* File: CTabCtrlAssetWorkorder.h, defines the CTabCtrlAssetWorkorder class
+* This class is the CTabCtrl derived class what interact with the tab-control in the CClosedWorkorderDetails dialog class
+*
+* This class is a tab control with two tabs.
+* The first tab is the asset details tab, the second tab is the workorder tab.
+* The asset details tab contains the asset details form, the workorder tab contains the workorder form.
+*
+* Target: Windows 10/11 64bit
+* Version: 1.0.0.2 (Alpha)
+* Created: 17-06-2024, (dd-mm-yyyy)
+* Updated: 17-06-2024, (dd-mm-yyyy)
+* Creator: artvabasDev / artvabas
+*
+* Description: Database connection class
+* License: GPLv3
+*/
#include "pch.h"
#include "RepairCafeCureApp.h"
#include "CClosedWorkorderDetailsTabCtrl.h"
+#include "CClosedWorkOrderDetailsTab.h"
+#include "CClosedWorkorderAssetDetailsTab.h"
+#include "CClosedWorkorderInvoiceDetailsTab.h"
+#include "CClosedWorkorderCustomerDetailsTab.h"
-
-// CClosedWorkorderDetailsTabCtrl
+using namespace artvabas::rcc::ui::controls;
IMPLEMENT_DYNAMIC(CClosedWorkorderDetailsTabCtrl, CTabCtrl)
-CClosedWorkorderDetailsTabCtrl::CClosedWorkorderDetailsTabCtrl()
+CClosedWorkorderDetailsTabCtrl::CClosedWorkorderDetailsTabCtrl(unsigned int& unCustomerID,
+ unsigned int& unAssetID, unsigned int& unWorkorderID, unsigned int& unInvoiceID)
+ : m_nNumberOfTabs{ 4 }
+ , m_tabCurrent{ 0 }
{
-
+ try {
+ m_tabPages[0] = new CClosedWorkOrderDetailsTab(this, unWorkorderID);
+ m_tabPages[1] = new CClosedWorkorderAssetDetailsTab(this, unAssetID);
+ m_tabPages[2] = new CClosedWorkorderInvoiceDetailsTab(this, unInvoiceID);
+ m_tabPages[3] = new CClosedWorkorderCustomerDetailsTab(this, unCustomerID);
+ }
+ catch (std::bad_alloc& e) {
+ AfxMessageBox(static_cast(e.what()));
+ for (auto nCount = 0; nCount < m_nNumberOfTabs; nCount++) {
+ if (m_tabPages[nCount] != nullptr) {
+ delete m_tabPages[nCount];
+ m_tabPages[nCount] = nullptr;
+ }
+ }
+ exit(1);
+ }
}
CClosedWorkorderDetailsTabCtrl::~CClosedWorkorderDetailsTabCtrl()
{
+ for (auto nCount = 0; nCount < m_nNumberOfTabs; nCount++) {
+ if (m_tabPages[nCount] != nullptr )
+ delete m_tabPages[nCount];
+ }
}
-
BEGIN_MESSAGE_MAP(CClosedWorkorderDetailsTabCtrl, CTabCtrl)
+ ON_NOTIFY_REFLECT(TCN_SELCHANGE, &CClosedWorkorderDetailsTabCtrl::OnTcnSelChange)
END_MESSAGE_MAP()
+// OnTcnSelChange method is used for handling the tab control selection change
+// and is triggerd by the framework when user click on a tab
+void CClosedWorkorderDetailsTabCtrl::OnTcnSelChange(NMHDR* pNMHDR, LRESULT* pResult) noexcept
+{
+ ChangeTabView(GetCurSel());
+ *pResult = 0;
+}
+
+// Init method is used for initializing the tab control
+void CClosedWorkorderDetailsTabCtrl::Init() noexcept
+{
+ m_tabPages[0]->Create(IDD_CLOSED_WORKORDER_DETAILS_TAB, this);
+ m_tabPages[1]->Create(IDD_CLOSED_WORKORDER_ASSET_DETAILS_TAB, this);
+ m_tabPages[2]->Create(IDD_CLOSED_WORKORDER_INVOICE_DETAILS_TAB, this);
+ m_tabPages[3]->Create(IDD_CLOSED_WORKORDER_CUSTOMER_DETAILS_TAB, this);
+
+ InsertItem(0, _T("Workorder"));
+ InsertItem(1, _T("Asset"));
+ InsertItem(2, _T("Invoice"));
+ InsertItem(3, _T("Customer"));
+ SetRectangle();
+}
+
+// ChangeTabView method is used for changing the tab view
+void CClosedWorkorderDetailsTabCtrl::ChangeTabView(int nTab) noexcept
+{
+ m_tabPages[m_tabCurrent]->ShowWindow(SW_HIDE);
+ m_tabPages[nTab]->ShowWindow(SW_SHOW);
+ m_tabCurrent = nTab;
+ SetCurSel(m_tabCurrent);
+}
+
+// SetRectangle method is used for getting the size of the tab control
+// for deciding the size and postion fo the tab dialogs which will be place in the tab control.
+void CClosedWorkorderDetailsTabCtrl::SetRectangle() noexcept
+{
+ CRect tabRect, itemRect;
+ int nX, nY, nXc, nYc;
-// CClosedWorkorderDetailsTabCtrl message handlers
+ GetClientRect(&tabRect);
+ GetItemRect(0, &itemRect);
+ nX = itemRect.left;
+ nY = itemRect.bottom + 1;
+ nXc = tabRect.right - itemRect.left - 1;
+ nYc = tabRect.bottom - nY - 1;
+ m_tabPages[0]->SetWindowPos(&CWnd::wndTop, nX, nY, nXc, nYc, SWP_SHOWWINDOW);
+ m_tabPages[1]->SetWindowPos(&CWnd::wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
+ m_tabPages[2]->SetWindowPos(&CWnd::wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
+ m_tabPages[3]->SetWindowPos(&CWnd::wndTop, nX, nY, nXc, nYc, SWP_HIDEWINDOW);
+}
\ No newline at end of file
diff --git a/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.h b/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.h
index c9ecb88..24f7571 100644
--- a/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.h
+++ b/RepairCafeCureApp/CClosedWorkorderDetailsTabCtrl.h
@@ -1,18 +1,84 @@
+/*
+ Copyright (C) 2023 artvabas
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see
+
+ To see the license for this source code, please visit:
+
+
+ For more information, please visit:
+
+
+
+ For contacts, please use the contact form at:
+
+
+*/
+
+/*
+* This file is part of RepairCafeCureApp.
+* File:ClosedWorkorderDetailsTabCtrl.h, defines the ClosedWorkorderDetailsTabCtrl class
+* This class is the CTabCtrl derived class what interact with the tab-control in the CClosedWorkorderDetails dialog class
+*
+* This class is a tab control with the details of the closed workorder.
+* These details are separated into tabs.
+* The first tab is the workorder details tab, the second tab is the asset details tab,
+* the third tab is the customer details tab and the fourth tab is the invoice details tab.
+*
+* Target: Windows 10/11 64bit
+* Version: 0.0.1.0 (Alpha)
+* Created: 04-11-2023, (dd-mm-yyyy)
+* Updated: 28-04-2024, (dd-mm-yyyy)
+* Creator: artvabasDev / artvabas
+*
+* Description: Database connection class
+* License: GPLv3
+*/
#pragma once
+namespace artvabas::rcc::ui::controls {
-// CClosedWorkorderDetailsTabCtrl
+ struct ClosedWorkorderDetailsIDs {
+ unsigned int m_nWorkorderID;
+ unsigned int m_nCustomerID;
+ unsigned int m_nAssetID;
+ unsigned int m_nInvoiceID;
+ };
-class CClosedWorkorderDetailsTabCtrl : public CTabCtrl
-{
- DECLARE_DYNAMIC(CClosedWorkorderDetailsTabCtrl)
+ class CClosedWorkorderDetailsTabCtrl : public CTabCtrl
+ {
+ DECLARE_DYNAMIC(CClosedWorkorderDetailsTabCtrl)
-public:
- CClosedWorkorderDetailsTabCtrl();
- virtual ~CClosedWorkorderDetailsTabCtrl();
+ private:
+ CDialog* m_tabPages[4];
+ int m_tabCurrent;
+ int m_nNumberOfTabs;
-protected:
- DECLARE_MESSAGE_MAP()
-};
+ public:
+ CClosedWorkorderDetailsTabCtrl(unsigned int& unCustomerID, unsigned int& unAssetID,
+ unsigned int& unWorkorderID, unsigned int& unInvoiceID);
+ virtual ~CClosedWorkorderDetailsTabCtrl();
+ private:
+ DECLARE_MESSAGE_MAP()
+ public:
+ afx_msg void OnTcnSelChange(NMHDR* pNMHDR, LRESULT* pResult) noexcept;
+ public:
+ void Init() noexcept;
+ private:
+ void ChangeTabView(int nTab) noexcept;
+ void SetRectangle() noexcept;
+ };
+}
\ No newline at end of file
diff --git a/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.cpp b/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.cpp
new file mode 100644
index 0000000..b065b50
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.cpp
@@ -0,0 +1,32 @@
+// CClosedWorkorderInvoiceDetailsTab.cpp : implementation file
+//
+
+#include "pch.h"
+#include "RepairCafeCureApp.h"
+#include "afxdialogex.h"
+#include "CClosedWorkorderInvoiceDetailsTab.h"
+
+IMPLEMENT_DYNAMIC(CClosedWorkorderInvoiceDetailsTab, CDialogEx)
+
+CClosedWorkorderInvoiceDetailsTab::CClosedWorkorderInvoiceDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent /*=nullptr*/)
+ : CDialogEx(IDD_CLOSED_WORKORDER_INVOICE_DETAILS_TAB, pParent)
+ , m_pTabControl{ pTabControl }
+ , m_unInvoiceID{ unID }
+{
+
+}
+
+CClosedWorkorderInvoiceDetailsTab::~CClosedWorkorderInvoiceDetailsTab()
+{
+}
+
+void CClosedWorkorderInvoiceDetailsTab::DoDataExchange(CDataExchange* pDX)
+{
+ CDialogEx::DoDataExchange(pDX);
+}
+
+
+BEGIN_MESSAGE_MAP(CClosedWorkorderInvoiceDetailsTab, CDialogEx)
+END_MESSAGE_MAP()
+
+
diff --git a/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.h b/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.h
new file mode 100644
index 0000000..a2d1614
--- /dev/null
+++ b/RepairCafeCureApp/CClosedWorkorderInvoiceDetailsTab.h
@@ -0,0 +1,25 @@
+#pragma once
+#include "CClosedWorkorderDetailsTabCtrl.h"
+
+using namespace artvabas::rcc::ui::controls;
+
+class CClosedWorkorderInvoiceDetailsTab : public CDialogEx
+{
+#ifdef AFX_DESIGN_TIME
+ enum { IDD = IDD_CLOSED_WORKORDER_INVOICE_DETAILS_TAB };
+#endif
+ DECLARE_DYNAMIC(CClosedWorkorderInvoiceDetailsTab)
+
+private:
+ CClosedWorkorderDetailsTabCtrl* m_pTabControl;
+ unsigned int m_unInvoiceID;
+
+public:
+ CClosedWorkorderInvoiceDetailsTab(CClosedWorkorderDetailsTabCtrl* pTabControl, unsigned int unID, CWnd* pParent = nullptr); // standard constructor
+ virtual ~CClosedWorkorderInvoiceDetailsTab();
+
+protected:
+ virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
+
+ DECLARE_MESSAGE_MAP()
+};
diff --git a/RepairCafeCureApp/CPrintWorkorder.cpp b/RepairCafeCureApp/CPrintWorkorder.cpp
index dcf8ccd..2114c06 100644
--- a/RepairCafeCureApp/CPrintWorkorder.cpp
+++ b/RepairCafeCureApp/CPrintWorkorder.cpp
@@ -299,13 +299,13 @@ void CPrintWorkorder::PrintCombi(CDC* pDC) const noexcept
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- De reparateurs behouden zich het recht voor om bepaalde voorwerpen niet te repareren."));
//pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(1), _T("kapotte voorwerpen die niet konden worden gerepareerd."));
- pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- De reparateurs zijn niet verplicht om gemonteerde apparaten die niet gerepareerd kunnen worden"));
+ pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- De reparateurs zijn niet verplicht om gedemonteerde apparaten die niet gerepareerd kunnen worden"));
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(1), _T(" weer in elkaar te zetten."));
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- De bezoekers van NME-Repair zijn zelf verantwoordelijk voor het netjes afvoeren van kapotte"));
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(1), _T(" voorwerpen die niet kunnen worden gerepareerd."));
- pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- Gezien de hoge bankkosten zijn wij genoodzaakt bij het afrekenen van gebruikte materialen"));
+ pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("- Gezien de hoge bankkosten zijn wij genoodzaakt bij het afrekenen van bestelde materialen"));
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(1), _T(" € 1,00 administratiekosten in rekening te brengen"));
pDC->TextOutW(nPosX1, nPosY1 += BodyTextLineDown(2), _T("Een vrijwillige bijdrage wordt op prijs gesteld."));
diff --git a/RepairCafeCureApp/CReportWorkorderClosedView.cpp b/RepairCafeCureApp/CReportWorkorderClosedView.cpp
index 50d66fd..2d03089 100644
--- a/RepairCafeCureApp/CReportWorkorderClosedView.cpp
+++ b/RepairCafeCureApp/CReportWorkorderClosedView.cpp
@@ -49,8 +49,10 @@
#include "CReportWorkorderClosedView.h"
#include "CSqlNativeAVB.h"
#include "DatabaseTables.h"
+#include "CClosedWorkorderDetails.h"
using namespace artvabas::sql;
+using namespace artvabas::rcc::ui::dialogs;
using namespace artvabas::database::tables::closedworkorders;
IMPLEMENT_DYNCREATE(CReportWorkorderClosedView, CFormView)
@@ -125,9 +127,220 @@ void CReportWorkorderClosedView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
CFormView::OnEndPrinting(pDC, pInfo);
}
+//
void CReportWorkorderClosedView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
- // Code here
+ typedef unsigned int pixel;
+ const pixel pixMargin = 100; // 1 inch margin
+ const pixel pixFontHeightHeader = 120;
+ const pixel pixFontHeightBody = 80;
+
+ const wchar_t* wzsMonth[] = { L"januari", L"februari", L"maart", L"april", L"mei", L"juni",
+ L"juli", L"augustus", L"september", L"oktober", L"november", L"december" };
+
+ CFont fontBoldHeader;
+ VERIFY(fontBoldHeader.CreateFont(
+ pixFontHeightHeader, // nHeight
+ 0, // nWidth
+ 0, // nEscapement
+ 0, // nOrientation
+ FW_BOLD, // nWeight
+ FALSE, // bItalic
+ FALSE, // bUnderline
+ 0, // cStrikeOut
+ ANSI_CHARSET, // nCharSet
+ OUT_DEFAULT_PRECIS, // nOutPrecision
+ CLIP_DEFAULT_PRECIS, // nClipPrecision
+ DEFAULT_QUALITY, // nQuality
+ DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
+ _T("Cascadia Mono"))); // lpszFacename
+
+ CFont fontPlainBody;
+ VERIFY(fontPlainBody.CreateFont(
+ pixFontHeightBody, // nHeight
+ 0, // nWidth
+ 0, // nEscapement
+ 0, // nOrientation
+ FW_NORMAL, // nWeight
+ FALSE, // bItalic
+ FALSE, // bUnderline
+ 0, // cStrikeOut
+ ANSI_CHARSET, // nCharSet
+ OUT_DEFAULT_PRECIS, // nOutPrecision
+ CLIP_DEFAULT_PRECIS, // nClipPrecision
+ DEFAULT_QUALITY, // nQuality
+ DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
+ _T("Cascadia Mono"))); // lpszFacename
+
+ CFont fontBoldBody;
+ VERIFY(fontBoldBody.CreateFont(
+ pixFontHeightBody, // nHeight
+ 0, // nWidth
+ 0, // nEscapement
+ 0, // nOrientation
+ FW_BOLD, // nWeight
+ FALSE, // bItalic
+ FALSE, // bUnderline
+ 0, // cStrikeOut
+ ANSI_CHARSET, // nCharSet
+ OUT_DEFAULT_PRECIS, // nOutPrecision
+ CLIP_DEFAULT_PRECIS, // nClipPrecision
+ DEFAULT_QUALITY, // nQuality
+ DEFAULT_PITCH | FF_SWISS, // nPitchAndFamily
+ _T("Cascadia Mono"))); // lpszFacename
+
+ // Lambda functions for calculating pixels movements
+ auto TotalTabInPixels = [pixMargin](unsigned int nTotalTabs) -> pixel {
+ return pixMargin * nTotalTabs;
+ };
+
+ auto HeaderTextLineDown = [pixFontHeightHeader](unsigned int nTotalLines) -> pixel {
+ return pixFontHeightHeader * nTotalLines;
+ };
+
+ auto BodyTextLineDown = [pixFontHeightBody](unsigned int nTotalLines) -> pixel {
+ return pixFontHeightBody * nTotalLines;
+ };
+
+ // Get printer device resolutions
+ const int nHorRes = pDC->GetDeviceCaps(HORZRES); // get printable width
+ const int nVerRes = pDC->GetDeviceCaps(VERTRES); // get printable height
+ const int nLogPixelsX = pDC->GetDeviceCaps(LOGPIXELSX); // get device resolution along X
+ const int nLogPixelsY = pDC->GetDeviceCaps(LOGPIXELSY); // get device resolution along Y
+
+ CImage imgLogo;
+ imgLogo.Load(_T("logo.bmp"));
+ CFont* pFont = nullptr;
+ unsigned long middleDocBody = 0UL;
+
+ pDC->m_bPrinting = TRUE;
+ pDC->StartPage();
+
+ // Print border
+ CRect rctBorder(0, 0, nHorRes, nVerRes);
+ rctBorder.DeflateRect(nLogPixelsX / 2, nLogPixelsY / 2);
+ pDC->Draw3dRect(rctBorder, RGB(0, 0, 0), RGB(0, 0, 0));
+
+ /* Common print jobs */
+
+ // Set print start position
+ int nPosX = rctBorder.TopLeft().x + 10;
+ int nPosY = rctBorder.TopLeft().y + 10;
+
+ // Print logo
+ imgLogo.StretchBlt(pDC->m_hDC, nPosX, nPosY, static_cast(imgLogo.GetWidth() * 6.8), static_cast(imgLogo.GetHeight() * 6.8), 0, 0, imgLogo.GetWidth(), imgLogo.GetHeight(), SRCCOPY);
+
+ // Calculate new start print position
+ nPosY += static_cast(imgLogo.GetHeight() * 6.8) + 10;
+
+ // Print header
+ pFont = &fontBoldHeader;
+
+ // Print Header rectangle
+ CRect rctHeader(nPosX + 60, nPosY, nPosX + static_cast(imgLogo.GetWidth() * 6.8) - 60, nPosY + HeaderTextLineDown(2));
+ pDC->FillRect(rctHeader, &CBrush(RGB(0, 102, 255)));
+ pDC->Draw3dRect(rctHeader, RGB(0, 102, 255), RGB(0, 102, 255));
+
+ // Print header text
+ pDC->SelectObject(pFont);
+ pDC->SetTextColor(RGB(255, 255, 255));
+
+
+ pDC->DrawText(_T("Overzicht gesloten werkorders"), rctHeader, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
+
+ // calculate new start print position
+ nPosY += HeaderTextLineDown(3);
+
+ /*
+ * [WORKORDER_ID], [WORKORDER_DESCRIPTION], [WORKORDER_RESPONSIBLE], [WORKORDER_CLOSED_DATE], [WORKORDER_STATUS], ")
+ _T("[WORKORDER_ASSET_ID], [ASSET_DESCRIPTION], [WORKORDER_CUSTOMER_ID], [WORKORDER_INVOICE_ID]
+ */
+
+ CRect rctWorkorderID(nPosX, nPosY, nPosX + TotalTabInPixels(4), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctWorkorderID, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ CRect rctWorkorderDescription(rctWorkorderID.right, nPosY, rctWorkorderID.right + TotalTabInPixels(14), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctWorkorderDescription, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ CRect rctWorkorderResponsible(rctWorkorderDescription.right, nPosY, rctWorkorderDescription.right + TotalTabInPixels(5), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctWorkorderResponsible, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ CRect rctWorkorderCloseDate(rctWorkorderResponsible.right, nPosY, rctWorkorderResponsible.right + TotalTabInPixels(5), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctWorkorderCloseDate, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ CRect rctWorkorderStatus(rctWorkorderCloseDate.right, nPosY, rctWorkorderCloseDate.right + TotalTabInPixels(4), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctWorkorderStatus, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ CRect rctAssetDescription(rctWorkorderStatus.right, nPosY, rctWorkorderStatus.right + TotalTabInPixels(10), nPosY + BodyTextLineDown(20));
+ pDC->Draw3dRect(rctAssetDescription, RGB(255, 255, 255), RGB(255, 255, 255));
+
+ // Print Table Header
+ pFont = &fontBoldBody;
+ pDC->SelectObject(pFont);
+
+ // print work comment area
+ pFont = &fontBoldBody;
+ pDC->SelectObject(pFont);
+
+ pDC->SetTextColor(RGB(0, 0, 0));
+ pDC->DrawText(_T("Werkorder:"), rctWorkorderID, DT_LEFT | DT_TABSTOP);
+ pDC->DrawText(_T("Defect:"), rctWorkorderDescription, DT_LEFT | DT_TABSTOP);
+ pDC->DrawText(_T("Technicus:"), rctWorkorderResponsible, DT_LEFT | DT_TABSTOP);
+ pDC->DrawText(_T("Datum:"), rctWorkorderCloseDate, DT_LEFT | DT_TABSTOP);
+ pDC->DrawText(_T("Status:"), rctWorkorderStatus, DT_LEFT | DT_TABSTOP);
+ pDC->DrawText(_T("Apparaat:"), rctAssetDescription, DT_LEFT | DT_TABSTOP);
+
+ // Print Table Body
+ pFont = &fontPlainBody;
+ pDC->SelectObject(pFont);
+
+ // Print body text
+ nPosY += BodyTextLineDown(1);
+
+ // Print table body
+ for (int i = 0; i < m_lstWorkorderClosedReport.GetItemCount(); i++) {
+ CString strWorkorderID = m_lstWorkorderClosedReport.GetItemText(i, 0);
+ CString strWorkorderDescription = m_lstWorkorderClosedReport.GetItemText(i, 1);
+ CString strWorkorderResponsible = m_lstWorkorderClosedReport.GetItemText(i, 2);
+ CString strWorkorderCloseDate = m_lstWorkorderClosedReport.GetItemText(i, 3);
+ CString strWorkorderStatus = m_lstWorkorderClosedReport.GetItemText(i, 4);
+ CString strAssetDescription = m_lstWorkorderClosedReport.GetItemText(i, 6);
+
+ CRect rctWorkorderID(nPosX, nPosY, nPosX + TotalTabInPixels(4), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strWorkorderID, rctWorkorderID, DT_LEFT | DT_TABSTOP);
+
+ CRect rctWorkorderDescription(rctWorkorderID.right, nPosY, rctWorkorderID.right + TotalTabInPixels(14), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strWorkorderDescription, rctWorkorderDescription, DT_LEFT | DT_TABSTOP);
+
+ CRect rctWorkorderResponsible(rctWorkorderDescription.right, nPosY, rctWorkorderDescription.right + TotalTabInPixels(5), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strWorkorderResponsible, rctWorkorderResponsible, DT_LEFT | DT_TABSTOP);
+
+ CRect rctWorkorderCloseDate(rctWorkorderResponsible.right, nPosY, rctWorkorderResponsible.right + TotalTabInPixels(5), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strWorkorderCloseDate, rctWorkorderCloseDate, DT_LEFT | DT_TABSTOP);
+
+ CRect rctWorkorderStatus(rctWorkorderCloseDate.right, nPosY, rctWorkorderCloseDate.right + TotalTabInPixels(4), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strWorkorderStatus, rctWorkorderStatus, DT_LEFT | DT_TABSTOP);
+
+ CRect rctAssetDescription(rctWorkorderStatus.right, nPosY, rctWorkorderStatus.right + TotalTabInPixels(10), nPosY + BodyTextLineDown(1));
+ pDC->DrawText(strAssetDescription, rctAssetDescription, DT_LEFT | DT_TABSTOP);
+
+ nPosY += BodyTextLineDown(1);
+ }
+
+ // Print footer
+ nPosY += BodyTextLineDown(1);
+ pFont = &fontPlainBody;
+ pDC->SelectObject(pFont);
+ COleDateTime cdtNow = COleDateTime::GetCurrentTime();
+
+ pDC->TextOutW(nPosX, nPosY, _T("Dit overzicht is gegenereerd door Repair Cafe CureApp op ") + cdtNow.Format(_T("%d-%m-%Y")));
+
+ // Destroy image
+ imgLogo.Destroy();
+ fontBoldHeader.DeleteObject();
+ fontPlainBody.DeleteObject();
+ fontBoldBody.DeleteObject();
+
CFormView::OnPrint(pDC, pInfo);
}
@@ -243,6 +456,12 @@ void CReportWorkorderClosedView::OnNMDoubleClickWorkorderClosedReport(NMHDR* pNM
{
LPNMITEMACTIVATE pNMItemActivate = reinterpret_cast(pNMHDR);
// TODO: Add your control notification handler code here
+ unsigned int nWorkorderID = _ttoi(m_lstWorkorderClosedReport.GetItemText(pNMItemActivate->iItem, 0));
+ unsigned int nAssetID = _ttoi(m_lstWorkorderClosedReport.GetItemText(pNMItemActivate->iItem, 5));
+ unsigned int nCustomerID = _ttoi(m_lstWorkorderClosedReport.GetItemText(pNMItemActivate->iItem, 7));
+ unsigned int nInvoiceID = _ttoi(m_lstWorkorderClosedReport.GetItemText(pNMItemActivate->iItem, 8));
+ CClosedWorkorderDetails dlg(nWorkorderID, nAssetID, nCustomerID, nInvoiceID);
+ dlg.DoModal();
*pResult = 0;
}
/* Member methods */
diff --git a/RepairCafeCureApp/CTabCtrlAssetWorkorder.cpp b/RepairCafeCureApp/CTabCtrlAssetWorkorder.cpp
index 2f373ab..a3d05ea 100644
--- a/RepairCafeCureApp/CTabCtrlAssetWorkorder.cpp
+++ b/RepairCafeCureApp/CTabCtrlAssetWorkorder.cpp
@@ -40,9 +40,9 @@
* THis class is also responsible for the communication between the two forms.
*
* Target: Windows 10/11 64bit
-* Version: 0.0.1.0 (Alpha)
+* Version: 1.0.0.2 (Alpha)
* Created: 04-11-2023, (dd-mm-yyyy)
-* Updated: 28-04-2024, (dd-mm-yyyy)
+* Updated: 18-06-2024, (dd-mm-yyyy)
* Creator: artvabasDev / artvabas
*
* Description: Database connection class
@@ -58,8 +58,6 @@ using namespace artvabas::rcc::ui::dialogs;
IMPLEMENT_DYNAMIC(CTabCtrlAssetWorkorder, CTabCtrl)
-/* Con-deconstructs */
-
CTabCtrlAssetWorkorder::CTabCtrlAssetWorkorder(CString& strCustomerSurname, CString& strCustomerName, unsigned int& nCustomerID)
: m_nNumberOfTabs{ 2 }
, m_tabCurrent{ 0 }
@@ -92,8 +90,9 @@ CTabCtrlAssetWorkorder::CTabCtrlAssetWorkorder(CString& strCustomerSurname, CStr
CTabCtrlAssetWorkorder::~CTabCtrlAssetWorkorder()
{
- for ( auto nCount = 0; nCount < m_nNumberOfTabs; nCount++) {
- delete m_tabPages[nCount];
+ for ( auto nCount = 0; nCount < m_nNumberOfTabs; nCount++ ) {
+ if ( m_tabPages[nCount] != nullptr )
+ delete m_tabPages[nCount];
}
}
@@ -147,9 +146,6 @@ void CTabCtrlAssetWorkorder::Init() noexcept
m_tabPages[0]->Create(IDD_ASSET_TAB, this);
m_tabPages[1]->Create(IDD_WORKORDER_TAB, this);
- m_tabPages[0]->ShowWindow(SW_SHOW);
- m_tabPages[1]->ShowWindow(SW_HIDE);
-
InsertItem(0, _T("Asset"));
InsertItem(1, _T("Workorder"));
diff --git a/RepairCafeCureApp/CTabCtrlAssetWorkorder.h b/RepairCafeCureApp/CTabCtrlAssetWorkorder.h
index 608a5ac..f2080be 100644
--- a/RepairCafeCureApp/CTabCtrlAssetWorkorder.h
+++ b/RepairCafeCureApp/CTabCtrlAssetWorkorder.h
@@ -41,7 +41,7 @@
* This class is also responsible for the communication between the two forms/tabs.
*
* Target: Windows 10/11 64bit
-* Version: 0.0.1.0 (Alpha)
+* Version: 1.0.0.1 (Alpha)
* Created: 04-11-2023, (dd-mm-yyyy)
* Updated: 28-04-2024, (dd-mm-yyyy)
* Creator: artvabasDev / artvabas
@@ -56,8 +56,8 @@ namespace artvabas::rcc::ui::controls {
// Struct for shared data between the two tabs (Asset Details and Workorder)
struct AssetDetailsRecords
{
- unsigned int m_nAssetID;
- unsigned int m_nAssetCustomerID;
+ unsigned int m_nAssetID{ 0 };
+ unsigned int m_nAssetCustomerID{ 0 };
CString m_strCustomerSurname;
CString m_strCustomerName;
diff --git a/RepairCafeCureApp/CWorkorderView.cpp b/RepairCafeCureApp/CWorkorderView.cpp
index f85b9a6..9d8da2b 100644
--- a/RepairCafeCureApp/CWorkorderView.cpp
+++ b/RepairCafeCureApp/CWorkorderView.cpp
@@ -36,9 +36,9 @@
* Controls are enabled and disabled depending on the state of the form.
*
* Target: Windows 10/11 64bit
-* Version: 1.0.0.1 (alpha)
+* Version: 1.0.0.2 (alpha)
* Created: 18-10-2023, (dd-mm-yyyy)
-* Updated: 11-06-2024, (dd-mm-yyyy)
+* Updated: 17-06-2024, (dd-mm-yyyy)
* Creator: artvabasDev / artvabas
*
* License: GPLv3
@@ -72,7 +72,7 @@ CWorkorderView::CWorkorderView() noexcept
, m_bPrintCombi{ false }
, m_bPrintInvoice{ false }
, m_bPinTransaction{ false }
- , m_ePrinterOrientation{ PrinterOrientation::LANDSCAPE }
+ , m_ePrinterOrientation{ LANDSCAPE }
, m_unWorkorderId{ 0 }
, m_strCustomerSurname{ _T("") }
, m_strCustomerName{ _T("") }
@@ -109,12 +109,20 @@ BEGIN_MESSAGE_MAP(CWorkorderView, CFormView)
&CWorkorderView::OnBnClickedWorkorderViewUpdate)
ON_EN_CHANGE(IDC_WORKORDERVIEW_LOG,
&CWorkorderView::OnEnChangeWorkorderViewLog)
+ ON_EN_CHANGE(IDC_WORKORDERVIEW_ASSET_DESCRIPTION,
+ &CWorkorderView::OnEnChangeWorkorderViewAsset)
+ ON_EN_CHANGE(IDC_WORKORDERVIEW_ASSET_MODEL_NUMBER,
+ &CWorkorderView::OnEnChangeWorkorderViewAsset)
+ ON_EN_CHANGE(IDC_WORKORDERVIEW_ASSET_BRAND,
+ &CWorkorderView::OnEnChangeWorkorderViewAsset)
ON_BN_CLICKED(IDC_WORKORDERVIEW_CUSTOMER_CONTACTED_CUSTOMER,
&CWorkorderView::OnBnClickedWorkorderVewCustomerContactedCustomer)
ON_BN_CLICKED(IDC_WORKORDERVIEW_FINISHED,
&CWorkorderView::OnBnClickedWorkorderViewFinished)
ON_BN_CLICKED(IDC_WORKORDERVIEW_ASSET_DISPOSED,
&CWorkorderView::OnBnClickedWorkorderViewAssetDisposed)
+ ON_BN_CLICKED(IDC_WORKORDERVIEW_ASSETDETAILS_UPDATE,
+ &CWorkorderView::OnBnClickedWorkorderViewAssetDetailsUpdate)
ON_BN_CLICKED(IDC_WORKORDERVIEW_PARTS,
&CWorkorderView::OnBnClickedWorkorderViewParts)
ON_COMMAND(ID_FILE_PRINT,
@@ -164,6 +172,10 @@ void CWorkorderView::DoDataExchange(CDataExchange* pDX)
DDX_Control(pDX, IDC_WORKORDERVIEW_LOG, m_edtWorkorderNewLog);
DDX_Text(pDX, IDC_WORKORDERVIEW_TOTAL_PRICE, m_strWorkorderTotalPartsPrice);
DDX_Control(pDX, IDC_WORKORDERVIEW_CLOSE, m_btnWorkorderClose);
+ DDX_Control(pDX, IDC_WORKORDERVIEW_ASSETDETAILS_UPDATE, m_btnWorkorderAssetUpdate);
+ DDX_Control(pDX, IDC_WORKORDERVIEW_ASSET_DESCRIPTION, m_edcAssetDescription);
+ DDX_Control(pDX, IDC_WORKORDERVIEW_ASSET_MODEL_NUMBER, m_edcAssetModelNumber);
+ DDX_Control(pDX, IDC_WORKORDERVIEW_ASSET_BRAND, m_edcAssetBrand);
}
// OnInitialUpdate is called by the framework when the view is first activated.
@@ -179,7 +191,7 @@ void CWorkorderView::OnInitialUpdate()
m_lscWorkorderExisting.InsertColumn(4, _T("CREATION DATE"), LVCFMT_LEFT, 100);
m_lscWorkorderExisting.InsertColumn(5, _T("CREATED BY"), LVCFMT_LEFT, 0);
m_lscWorkorderExisting.InsertColumn(6, _T("DESCRIPTION"), LVCFMT_LEFT, 200);
- m_lscWorkorderExisting.InsertColumn(7, _T("RESPOSIBLE"), LVCFMT_LEFT, 200);
+ m_lscWorkorderExisting.InsertColumn(7, _T("RESPONSIBLE"), LVCFMT_LEFT, 200);
m_lscWorkorderExisting.InsertColumn(8, _T("STATUS"), LVCFMT_LEFT, 100);
m_lscWorkorderExisting.InsertColumn(9, _T("CLOSED DATE"), LVCFMT_LEFT, 0);
m_lscWorkorderExisting.InsertColumn(10, _T("HISTORY"), LVCFMT_LEFT, 0);
@@ -325,6 +337,7 @@ void CWorkorderView::Dump(CDumpContext& dc) const { CFormView::Dump(dc); }
// OnFilePrintPreview is called by the framework when the user clicks on the print preview button.
void CWorkorderView::OnFilePrintPreview() noexcept
{
+ m_ePrinterOrientation = LANDSCAPE;
AFXPrintPreview(this);
}
@@ -410,6 +423,10 @@ void CWorkorderView::OnNMDoubleClickWorkorderViewExisting(NMHDR* pNMHDR, LRESULT
break;
case VIEW_WORKORDER_PROGRESS:
m_edtWorkorderNewLog.EnableWindow(TRUE);
+ m_edcAssetDescription.SetReadOnly(FALSE);
+ m_edcAssetModelNumber.SetReadOnly(FALSE);
+ m_edcAssetBrand.SetReadOnly(FALSE);
+ m_btnWorkorderAssetUpdate.EnableWindow(FALSE);
m_btnWorkorderParts.EnableWindow(TRUE);
m_chbWorkorderAssetDisposed.EnableWindow(TRUE);
m_chbWorkorderContactedCustomer.EnableWindow(TRUE);
@@ -510,6 +527,27 @@ void CWorkorderView::OnEnChangeWorkorderViewLog() noexcept
UpdateData(FALSE);
}
+// OnEnChangeWorkorderViewAsset is called by the framework when the user changes the asset description edit control.
+// This method is used to enable and disable controls depending on the state of the form.
+void CWorkorderView::OnEnChangeWorkorderViewAsset() noexcept
+{
+ UpdateData(TRUE);
+ m_edtWorkorderNewLog.EnableWindow(FALSE);
+ m_btnWorkorderParts.EnableWindow(FALSE);
+ m_chbWorkorderAssetDisposed.EnableWindow(FALSE);
+ m_chbWorkorderContactedCustomer.EnableWindow(FALSE);
+ m_btnWorkorderUpdate.EnableWindow(FALSE);
+ m_cbxWorkorderEmployeeResponsible.EnableWindow(FALSE);
+ m_lscWorkorderExisting.EnableWindow(FALSE);
+ m_lscWorkorderSpareParts.EnableWindow(FALSE);
+
+ if (m_strAssetDescription.IsEmpty()) m_btnWorkorderAssetUpdate.EnableWindow(FALSE);
+ else {
+ m_btnWorkorderAssetUpdate.EnableWindow(TRUE);
+ SetCustomFocusButton(&m_btnWorkorderAssetUpdate, RED, false);
+ }
+}
+
// OnBnClickedWorkorderViewAssetDisposed is called by the framework when the user clicks on the asset disposed check box.
// This method is used to enable and disable controls depending on the state of the form.
void CWorkorderView::OnBnClickedWorkorderViewAssetDisposed() noexcept
@@ -517,6 +555,56 @@ void CWorkorderView::OnBnClickedWorkorderViewAssetDisposed() noexcept
SetControlsAfterChangeContactedOrDisposed();
}
+// OnBnClickedWorkorderViewAssetDetailsUpdate is called by the framework when the user clicks on the asset details update button.
+// This method is used to update the asset information in the database.
+void CWorkorderView::OnBnClickedWorkorderViewAssetDetailsUpdate() noexcept
+{
+ UpdateData(TRUE);
+ CString strQuery;
+ auto nAssetID = _wtoi(m_lscWorkorderExisting.GetItemText(m_lscWorkorderExisting.GetSelectionMark(), 1));
+
+ auto buildFieldValue = [](CString str) -> CString {
+ CString strResult;
+ if (str.IsEmpty()) return _T("NULL");
+ strResult.Format(_T("N\'%s\'"), static_cast(str));
+ return strResult;
+ };
+
+ strQuery.Format(_T("UPDATE ASSET SET ASSET_DESCRIPTION = %s, ASSET_MODEL_NUMBER = %s,")
+ _T("ASSET_BRAND = %s WHERE ASSET_ID = %d"),
+ static_cast(buildFieldValue(m_strAssetDescription)),
+ static_cast(buildFieldValue(m_strAssetModelNumber)),
+ static_cast(buildFieldValue(m_strAssetBrand)),
+ nAssetID);
+
+ theApp.SetStatusBarText(IDS_STATUSBAR_LOADING);
+ theApp.BeginWaitCursor();
+
+ CSqlNativeAVB sql{ theApp.GetDatabaseConnection()->ConnectionString() };
+
+ if (sql.CreateSQLConnection()) {
+
+ if (!sql.ExecuteQuery(strQuery.GetBuffer()))
+ theApp.SetStatusBarText(IDS_STATUSBAR_UPDATE_FAIL);
+ else {
+ m_edtWorkorderNewLog.EnableWindow(TRUE);
+ m_btnWorkorderParts.EnableWindow(TRUE);
+ m_chbWorkorderAssetDisposed.EnableWindow(TRUE);
+ m_chbWorkorderContactedCustomer.EnableWindow(TRUE);
+ m_btnWorkorderAssetUpdate.EnableWindow(FALSE);
+ m_cbxWorkorderEmployeeResponsible.EnableWindow(TRUE);
+ m_lscWorkorderExisting.EnableWindow(TRUE);
+ m_lscWorkorderSpareParts.EnableWindow(TRUE);
+ OnEnChangeWorkorderViewLog();
+ theApp.SetStatusBarText(IDS_STATUSBAR_UPDATE_OK);
+ }
+ strQuery.ReleaseBuffer();
+ }
+
+ sql.CloseConnection();
+ theApp.EndWaitCursor();
+}
+
// OnBnClickedWorkorderVewCustomerContactedCustomer is called by the framework when the user clicks on the contacted customer check box.
// This method is used to enable and disable controls depending on the state of the form.
void CWorkorderView::OnBnClickedWorkorderVewCustomerContactedCustomer() noexcept
@@ -579,7 +667,7 @@ void CWorkorderView::OnBnClickedWorkorderViewClose() {
auto buildFieldValue = [](CString str) -> CString {
CString strResult;
- if (str.IsEmpty()) return static_cast(_T("NULL"));
+ if (str.IsEmpty()) return _T("NULL");
strResult.Format(_T("N\'%s\'"), static_cast(str));
return strResult;
};
@@ -592,7 +680,7 @@ void CWorkorderView::OnBnClickedWorkorderViewClose() {
_T("[CONTRIBUTION_CREATEDATE], [CONTRIBUTION_AMOUNT]) VALUES(%d, %d, %s, %f)"),
invoiceData.unCustomerID,
invoiceData.unWorkOrderID,
- buildFieldValue(strCurDate),
+ static_cast(buildFieldValue(strCurDate)),
contributionData.dContribution);
theApp.SetStatusBarText(IDS_STATUSBAR_LOADING);
@@ -611,7 +699,7 @@ void CWorkorderView::OnBnClickedWorkorderViewClose() {
invoiceData.unCustomerID,
invoiceData.unAssetID,
invoiceData.unWorkOrderID,
- buildFieldValue(strCurDate),
+ static_cast(buildFieldValue(strCurDate)),
contributionData.bPaymentWithPin ? 1 : 0,
dTotal);
theApp.SetStatusBarText(IDS_STATUSBAR_LOADING);
@@ -1193,17 +1281,17 @@ void CWorkorderView::PerformWorkorderUpdate() {
auto buildFieldValue = [](CString str) -> CString {
CString strResult;
- if (str.IsEmpty()) return static_cast(_T("NULL"));
+ if (str.IsEmpty()) return _T("NULL");
strResult.Format(_T("N\'%s\'"), static_cast(str));
return strResult;
};
strQuery.Format(_T("UPDATE WORKORDER SET WORKORDER_RESPONSIBLE = %s, WORKORDER_STATUS = %s,")
_T("WORKORDER_CLOSED_DATE = %s, WORKORDER_HISTORY = %s WHERE WORKORDER_ID = %d"),
- buildFieldValue(strEmployee),
- buildFieldValue(m_strWorkorderStatus),
- buildFieldValue(m_strWorkorderClosedDate),
- buildFieldValue(m_strWorkorderHistoryLog),
+ static_cast(buildFieldValue(strEmployee)),
+ static_cast(buildFieldValue(m_strWorkorderStatus)),
+ static_cast(buildFieldValue(m_strWorkorderClosedDate)),
+ static_cast(buildFieldValue(m_strWorkorderHistoryLog)),
m_unWorkorderId);
theApp.SetStatusBarText(IDS_STATUSBAR_LOADING);
@@ -1281,9 +1369,14 @@ void CWorkorderView::ResetAllControls() noexcept
m_btnWorkorderFinished.EnableWindow(FALSE);
m_btnWorkorderClose.EnableWindow(FALSE);
m_btnWorkorderParts.EnableWindow(FALSE);
+ m_btnWorkorderAssetUpdate.EnableWindow(FALSE);
m_chbWorkorderAssetDisposed.EnableWindow(FALSE);
m_chbWorkorderContactedCustomer.EnableWindow(FALSE);
+ m_edcAssetDescription.SetReadOnly(TRUE);
+ m_edcAssetModelNumber.SetReadOnly(TRUE);
+ m_edcAssetBrand.SetReadOnly(TRUE);
+
UpdateData(FALSE);
InitWorkorderExistingList();
}
diff --git a/RepairCafeCureApp/CWorkorderView.h b/RepairCafeCureApp/CWorkorderView.h
index 14dff4b..bb2234e 100644
--- a/RepairCafeCureApp/CWorkorderView.h
+++ b/RepairCafeCureApp/CWorkorderView.h
@@ -36,17 +36,17 @@
* Controls are enabled and disabled depending on the state of the form.
*
* Target: Windows 10/11 64bit
-* Version: 1.0.0.1 (alpha)
+* Version: 1.0.0.2 (alpha)
* Created: 18-10-2023, (dd-mm-yyyy)
-* Updated: 11-06-2024, (dd-mm-yyyy)
+* Updated: 17-06-2024, (dd-mm-yyyy)
* Creator: artvabasDev / artvabas
*
* License: GPLv3
*/
#pragma once
-namespace artvabas::rcc::ui
-{
+//namespace artvabas::rcc::ui
+//{
class CWorkorderView : public CFormView
{
DECLARE_DYNCREATE(CWorkorderView)
@@ -86,14 +86,18 @@ namespace artvabas::rcc::ui
CString m_strWorkorderTotalPartsPrice;
CEdit m_edtWorkorderNewLog;
+ CEdit m_edcAssetDescription;
+ CEdit m_edcAssetModelNumber;
+ CEdit m_edcAssetBrand;
CButton m_chbWorkorderAssetDisposed;
CButton m_chbWorkorderContactedCustomer;
-
+
CMFCButton m_btnWorkorderUpdate;
CMFCButton m_btnWorkorderFinished;
CMFCButton m_btnWorkorderClose;
CMFCButton m_btnWorkorderParts;
+ CMFCButton m_btnWorkorderAssetUpdate;
CComboBox m_cbxWorkorderEmployeeResponsible;
@@ -124,11 +128,13 @@ namespace artvabas::rcc::ui
afx_msg void OnNMDoubleClickWorkorderViewExisting(NMHDR* pNMHDR, LRESULT* pResult) noexcept;
afx_msg void OnCbnSelectChangeWorkorderViewResponsible() noexcept;
afx_msg void OnEnChangeWorkorderViewLog() noexcept;
+ afx_msg void OnEnChangeWorkorderViewAsset() noexcept;
afx_msg void OnBnClickedWorkorderViewUpdate() noexcept;
afx_msg void OnBnClickedWorkorderVewCustomerContactedCustomer() noexcept;
afx_msg void OnBnClickedWorkorderViewFinished() noexcept;
afx_msg void OnBnClickedWorkorderViewClose();
afx_msg void OnBnClickedWorkorderViewAssetDisposed() noexcept;
+ afx_msg void OnBnClickedWorkorderViewAssetDetailsUpdate() noexcept;
afx_msg void OnBnClickedWorkorderViewParts() noexcept;
afx_msg void OnFilePrintPreview() noexcept;
afx_msg void OnWorkorderExtraCombi() noexcept;
@@ -146,5 +152,5 @@ namespace artvabas::rcc::ui
void SetCustomFocusButton(CMFCButton* pButton, ColorButton Color, bool bFocus) noexcept;
public:
bool SetPrinterOrientation(HANDLE h, CDC* dc = NULL);
- };
-}
\ No newline at end of file
+};
+//}
\ No newline at end of file
diff --git a/RepairCafeCureApp/RepairCafeCureApp.cpp b/RepairCafeCureApp/RepairCafeCureApp.cpp
index c98c323..7edcdf0 100644
--- a/RepairCafeCureApp/RepairCafeCureApp.cpp
+++ b/RepairCafeCureApp/RepairCafeCureApp.cpp
@@ -77,7 +77,7 @@ static void __stdcall TimerCallback(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWOR
auto dwTimeNow = GetTickCount64();
auto dwTimeIdle = dwTimeNow - lii.dwTime;
- if (dwTimeIdle > static_cast(1000 * 60) * 1 && !theApp.m_bIsIdle) {
+ if (dwTimeIdle > static_cast(1000 * 60) * 2 && !theApp.m_bIsIdle) {
theApp.IsIdle();
//isIdle = true;
auto result = MessageBoxW(theApp.m_pMainWnd->m_hWnd, _T("Automatically Locked the app!"), _T("Repair Cafe Cure App is Idle"), MB_OK);
@@ -96,7 +96,7 @@ CRepairCafeCureApp::CRepairCafeCureApp() noexcept
, m_bIsIdle{ true }
, m_bIsPrintPreview{ false }
{
- SetAppID(_T("RepairCafeCureApp.AppID.1.0.0.1"));
+ SetAppID(_T("RepairCafeCureApp.AppID.1.0.0.2"));
SetTimer(NULL, 1, (1000 * 60), TimerCallback);
}
diff --git a/RepairCafeCureApp/RepairCafeCureApp.rc b/RepairCafeCureApp/RepairCafeCureApp.rc
index b29e1e7..91749c5 100644
Binary files a/RepairCafeCureApp/RepairCafeCureApp.rc and b/RepairCafeCureApp/RepairCafeCureApp.rc differ
diff --git a/RepairCafeCureApp/RepairCafeCureApp.vcxproj b/RepairCafeCureApp/RepairCafeCureApp.vcxproj
index 1c7499a..f35ddb1 100644
--- a/RepairCafeCureApp/RepairCafeCureApp.vcxproj
+++ b/RepairCafeCureApp/RepairCafeCureApp.vcxproj
@@ -193,7 +193,12 @@
+
+
+
+
+
@@ -220,7 +225,12 @@
+
+
+
+
+
diff --git a/RepairCafeCureApp/RepairCafeCureApp.vcxproj.filters b/RepairCafeCureApp/RepairCafeCureApp.vcxproj.filters
index 74e7865..91fea35 100644
--- a/RepairCafeCureApp/RepairCafeCureApp.vcxproj.filters
+++ b/RepairCafeCureApp/RepairCafeCureApp.vcxproj.filters
@@ -153,8 +153,23 @@
Header Files
+
+ Header Files\artvabas\rcc\ui\dialogs
+
- Header Files
+ Header Files\artvabas\rcc\ui\controls
+
+
+ Header Files\artvabas\rcc\ui\dialogs
+
+
+ Header Files\artvabas\rcc\ui\dialogs
+
+
+ Header Files\artvabas\rcc\ui\dialogs
+
+
+ Header Files\artvabas\rcc\ui\dialogs
@@ -215,8 +230,23 @@
Source Files
+
+ Source Files\artvabas\rcc\ui\dialog
+
- Source Files
+ Source Files\artvabas\rcc\ui\controls
+
+
+ Source Files\artvabas\rcc\ui\dialog
+
+
+ Source Files\artvabas\rcc\ui\dialog
+
+
+ Source Files\artvabas\rcc\ui\dialog
+
+
+ Source Files\artvabas\rcc\ui\dialog
diff --git a/RepairCafeCureApp/Resource.h b/RepairCafeCureApp/Resource.h
index c2f0bcc..cf417ad 100644
--- a/RepairCafeCureApp/Resource.h
+++ b/RepairCafeCureApp/Resource.h
@@ -70,6 +70,11 @@
#define IDB_REPORTSMALL 346
#define IDB_REPORTCONTRIBUTION 348
#define IDB_HISTORYSEARCH 349
+#define IDD_CLOSED_WORKORDER_DIALOG 351
+#define IDD_CLOSED_WORKORDER_DETAILS_TAB 354
+#define IDD_CLOSED_WORKORDER_ASSET_DETAILS_TAB 356
+#define IDD_CLOSED_WORKORDER_INVOICE_DETAILS_TAB 358
+#define IDD_CLOSED_WORKORDER_CUSTOMER_DETAILS_TAB 360
#define IDC_CUSTVIEW_EDITBOX_SURNAME_SEARCH 1001
#define IDC_CUSTVIEW_BUTTON_SEARCH 1002
#define IDC_CUSTVIEW_BUTTON_ADD_NEW_CUSTOMER 1003
@@ -171,9 +176,11 @@
#define IDC_REPORT_TAX_PERIOD_CREATE 1108
#define IDC_REPORT_TAX_PERIOD_RESULT 1109
#define IDC_REPORT_TAX_PERIOD_TOTAL_AMOUNT 1111
-#define IDC_LIST1 1112
#define IDC_WORKORDER_CLOSED_REPORT 1112
#define IDC_REPORT_TAX_PERIOD_KIND 1113
+#define IDC_WORKORDERVIEW_ASSETDETAILS_UPDATE 1114
+#define IDC_CLOSED_WORKORDER_DETAILS_TAB_CONTROL 1115
+#define IDC_MFCMENUBUTTON1 1117
#define ID_WRITE_PASTEASHYPERLINK 32770
#define ID_CUSTOMER_VIEW 32773
#define ID_APP_VIEW 32775
@@ -192,9 +199,9 @@
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
-#define _APS_NEXT_RESOURCE_VALUE 351
+#define _APS_NEXT_RESOURCE_VALUE 362
#define _APS_NEXT_COMMAND_VALUE 32793
-#define _APS_NEXT_CONTROL_VALUE 1114
+#define _APS_NEXT_CONTROL_VALUE 1118
#define _APS_NEXT_SYMED_VALUE 318
#endif
#endif