File indexing completed on 2024-04-28 16:30:12
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 SKGPAYEEOBJECT_H 0007 #define SKGPAYEEOBJECT_H 0008 /** @file 0009 * This file defines classes SKGPayeeObject. 0010 * 0011 * @author Stephane MANKOWSKI / Guillaume DE BURE 0012 */ 0013 0014 #include "skgbankmodeler_export.h" 0015 #include "skgnamedobject.h" 0016 class SKGDocumentBank; 0017 class SKGCategoryObject; 0018 0019 /** 0020 * This class manages payee object 0021 */ 0022 class SKGBANKMODELER_EXPORT SKGPayeeObject final : public SKGNamedObject 0023 { 0024 public: 0025 /** 0026 * Default constructor 0027 */ 0028 explicit SKGPayeeObject(); 0029 0030 /** 0031 * Constructor 0032 * @param iDocument the document containing the object 0033 * @param iID the identifier in @p iTable of the object 0034 */ 0035 explicit SKGPayeeObject(SKGDocument* iDocument, int iID = 0); 0036 0037 /** 0038 * Copy constructor 0039 * @param iObject the object to copy 0040 */ 0041 SKGPayeeObject(const SKGPayeeObject& iObject); 0042 0043 /** 0044 * Copy constructor 0045 * @param iObject the object to copy 0046 */ 0047 explicit SKGPayeeObject(const SKGObjectBase& iObject); 0048 0049 /** 0050 * Operator affectation 0051 * @param iObject the object to copy 0052 */ 0053 SKGPayeeObject& operator= (const SKGObjectBase& iObject); 0054 0055 /** 0056 * Operator affectation 0057 * @param iObject the object to copy 0058 */ 0059 SKGPayeeObject& operator= (const SKGPayeeObject& iObject); 0060 0061 /** 0062 * Destructor 0063 */ 0064 virtual ~SKGPayeeObject(); 0065 0066 /** 0067 * Create a payee if needed and return it 0068 * @param iDocument the document where to create 0069 * @param iName the name 0070 * @param oPayee the payee 0071 * @param iSendPopupMessageOnCreation to send a creation message if the payee is created 0072 * @return an object managing the error. 0073 * @see SKGError 0074 */ 0075 static SKGError createPayee(SKGDocumentBank* iDocument, 0076 const QString& iName, 0077 SKGPayeeObject& oPayee, 0078 bool iSendPopupMessageOnCreation = false); 0079 /** 0080 * Get all transactions of this payee 0081 * @param oOperations all transactions of this payee 0082 * @return an object managing the error 0083 * @see SKGError 0084 */ 0085 SKGError getOperations(SKGListSKGObjectBase& oOperations) const; 0086 0087 /** 0088 * Set the address of payee 0089 * @param iAddress the address 0090 * @return an object managing the error 0091 * @see SKGError 0092 */ 0093 SKGError setAddress(const QString& iAddress); 0094 0095 /** 0096 * Get the address of this payee 0097 * @return the address 0098 */ 0099 QString getAddress() const; 0100 0101 /** 0102 * To set the closed attribute of a payee 0103 * @param iClosed the closed attribute: true or false 0104 * @return an object managing the error 0105 * @see SKGError 0106 */ 0107 virtual SKGError setClosed(bool iClosed); 0108 0109 /** 0110 * To know if the payee has been closed or not 0111 * @return an object managing the error 0112 * @see SKGError 0113 */ 0114 virtual bool isClosed() const; 0115 0116 /** 0117 * To bookmark or not a payee 0118 * @param iBookmark the bookmark: true or false 0119 * @return an object managing the error 0120 * @see SKGError 0121 */ 0122 SKGError bookmark(bool iBookmark); 0123 0124 /** 0125 * To know if the payee is bookmarked 0126 * @return an object managing the error 0127 * @see SKGError 0128 */ 0129 bool isBookmarked() const; 0130 0131 /** 0132 * Set the category 0133 * @param iCategory the category 0134 * @return an object managing the error 0135 * @see SKGError 0136 */ 0137 SKGError setCategory(const SKGCategoryObject& iCategory); 0138 0139 /** 0140 * Get the category 0141 * @param oCategory the category 0142 * @return an object managing the error 0143 * @see SKGError 0144 */ 0145 SKGError getCategory(SKGCategoryObject& oCategory) const; 0146 0147 /** 0148 * Merge iPayee in current payee 0149 * @param iPayee the payee. All transactions will be transferred into this payee. The payee will be removed 0150 * @return an object managing the error 0151 * @see SKGError 0152 */ 0153 SKGError merge(const SKGPayeeObject& iPayee); 0154 }; 0155 /** 0156 * Declare the class 0157 */ 0158 Q_DECLARE_TYPEINFO(SKGPayeeObject, Q_MOVABLE_TYPE); 0159 0160 #endif