File indexing completed on 2024-04-28 16:30:14
0001 /*************************************************************************** 0002 * SPDX-FileCopyrightText: 2022 S. MANKOWSKI stephane@mankowski.fr 0003 * SPDX-FileCopyrightText: 2022 G. DE BURE support@mankowski.fr 0004 * SPDX-License-Identifier: GPL-3.0-or-later 0005 ***************************************************************************/ 0006 #ifndef SKGTRACKEROBJECT_H 0007 #define SKGTRACKEROBJECT_H 0008 /** @file 0009 * This file defines classes SKGTrackerObject. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 0014 #include "skgbankmodeler_export.h" 0015 #include "skgnamedobject.h" 0016 class SKGDocumentBank; 0017 0018 /** 0019 * This class manages tracker object 0020 */ 0021 class SKGBANKMODELER_EXPORT SKGTrackerObject final : public SKGNamedObject 0022 { 0023 public: 0024 /** 0025 * Default constructor 0026 */ 0027 explicit SKGTrackerObject(); 0028 0029 /** 0030 * Constructor 0031 * @param iDocument the document containing the object 0032 * @param iID the identifier in @p iTable of the object 0033 */ 0034 explicit SKGTrackerObject(SKGDocument* iDocument, int iID = 0); 0035 0036 /** 0037 * Copy constructor 0038 * @param iObject the object to copy 0039 */ 0040 SKGTrackerObject(const SKGTrackerObject& iObject); 0041 0042 /** 0043 * Copy constructor 0044 * @param iObject the object to copy 0045 */ 0046 explicit SKGTrackerObject(const SKGObjectBase& iObject); 0047 0048 /** 0049 * Operator affectation 0050 * @param iObject the object to copy 0051 */ 0052 SKGTrackerObject& operator= (const SKGObjectBase& iObject); 0053 0054 /** 0055 * Operator affectation 0056 * @param iObject the object to copy 0057 */ 0058 SKGTrackerObject& operator= (const SKGTrackerObject& iObject); 0059 0060 /** 0061 * Destructor 0062 */ 0063 virtual ~SKGTrackerObject(); 0064 0065 /** 0066 * Create a tracker if needed and return it 0067 * @param iDocument the document where to create 0068 * @param iName the name 0069 * @param oTracker the tracker 0070 * @param iSendPopupMessageOnCreation to send a creation message if the tracker is created 0071 * @return an object managing the error. 0072 * @see SKGError 0073 */ 0074 static SKGError createTracker(SKGDocumentBank* iDocument, 0075 const QString& iName, 0076 SKGTrackerObject& oTracker, 0077 bool iSendPopupMessageOnCreation = false); 0078 /** 0079 * Get all subtransactions of this tracker 0080 * @param oSubOperations all subtransactions of this transaction 0081 * @return an object managing the error 0082 * @see SKGError 0083 */ 0084 SKGError getSubOperations(SKGListSKGObjectBase& oSubOperations) const; 0085 0086 /** 0087 * Set the comment of tracker 0088 * @param iComment the comment 0089 * @return an object managing the error 0090 * @see SKGError 0091 */ 0092 SKGError setComment(const QString& iComment); 0093 0094 /** 0095 * Get the comment of this tracker 0096 * @return the comment 0097 */ 0098 QString getComment() const; 0099 0100 /** 0101 * To set the closed attribute of this tracker 0102 * @param iClosed the closed attribute: true or false 0103 * @return an object managing the error 0104 * @see SKGError 0105 */ 0106 SKGError setClosed(bool iClosed); 0107 0108 /** 0109 * To know if the tracker has been closed or not 0110 * @return an object managing the error 0111 * @see SKGError 0112 */ 0113 bool isClosed() const; 0114 0115 /** 0116 * Get the current amount 0117 * @return the current amount 0118 */ 0119 double getCurrentAmount() const; 0120 0121 /** 0122 * Merge iTracker in current tracker 0123 * @param iTracker the tracker. All transactions will be transferred into this tracker. The tracker will be removed 0124 * @return an object managing the error 0125 * @see SKGError 0126 */ 0127 SKGError merge(const SKGTrackerObject& iTracker); 0128 }; 0129 /** 0130 * Declare the class 0131 */ 0132 Q_DECLARE_TYPEINFO(SKGTrackerObject, Q_MOVABLE_TYPE); 0133 0134 #endif