24 #ifndef GNC_TRANS_PROPS_HPP 25 #define GNC_TRANS_PROPS_HPP 32 #include <glib/gi18n.h> 42 #include <gnc-datetime.hpp> 43 #include <gnc-numeric.hpp> 49 enum class GncTransPropType {
58 TRANS_PROPS = VOID_REASON,
77 SPLIT_PROPS = TREC_DATE
80 #define IMAP_CAT_CSV "csv-account-map" 82 using StrVec = std::vector<std::string>;
83 using ErrMap = std::map<GncTransPropType, std::string>;
84 using ErrPair = std::pair<GncTransPropType, std::string>;
90 extern std::map<GncTransPropType, const char*> gnc_csv_col_type_strs;
98 bool operator()(
const std::pair<GncTransPropType, const char*>& v )
const 100 return !g_strcmp0(v.second, m_name);
109 bool is_multi_col_prop (GncTransPropType prop);
117 GncTransPropType sanitize_trans_prop (GncTransPropType prop,
bool multi_split);
120 gnc_commodity* parse_commodity (
const std::string& comm_str);
121 GncNumeric parse_monetary (
const std::string &str,
int currency_format);
143 std::optional<GncNumeric> m_price;
144 std::optional<std::string> m_taction;
145 std::optional<std::string> m_tmemo;
146 std::optional<GncNumeric> m_tamount;
147 std::optional<Account*> m_taccount;
148 std::optional<char> m_trec_state;
149 std::optional<GncDate> m_trec_date;
151 std::optional<std::string> void_reason;
158 : m_date_format{date_format}, m_multi_split{multi_split}, m_currency{
nullptr} {};
160 void set (GncTransPropType prop_type,
const std::string& value);
161 void set_date_format (
int date_format) { m_date_format = date_format ;}
162 void set_multi_split (
bool multi_split) { m_multi_split = multi_split ;}
163 void reset (GncTransPropType prop_type);
164 StrVec verify_essentials (
void);
165 std::shared_ptr<DraftTransaction> create_trans (QofBook* book, gnc_commodity* currency);
181 bool is_part_of (std::shared_ptr<GncPreTrans> parent);
182 std::optional<std::string> get_void_reason() {
return m_void_reason; }
185 void reset_cross_split_counters();
189 bool is_multi_currency();
195 std::optional<std::string> m_differ;
196 std::optional<GncDate> m_date;
197 std::optional<std::string> m_num;
198 std::optional<std::string> m_desc;
199 std::optional<std::string> m_notes;
200 gnc_commodity *m_currency;
201 std::optional<std::string> m_void_reason;
202 bool created =
false;
212 std::vector<gnc_commodity*> m_alt_currencies;
216 std::vector<gnc_commodity*> m_acct_commodities;
224 GncPreSplit (
int date_format,
int currency_format) : m_date_format{date_format},
225 m_currency_format{currency_format} {};
226 void set (GncTransPropType prop_type,
const std::string& value);
227 void reset (GncTransPropType prop_type);
228 void add (GncTransPropType prop_type,
const std::string& value);
229 void set_date_format (
int date_format) { m_date_format = date_format ;}
230 void set_currency_format (
int currency_format) { m_currency_format = currency_format; }
231 void set_pre_trans (std::shared_ptr<GncPreTrans> pre_trans) { m_pre_trans = pre_trans; }
232 std::shared_ptr<GncPreTrans> get_pre_trans (
void) {
return m_pre_trans; }
233 StrVec verify_essentials (
void);
234 void create_split(std::shared_ptr<DraftTransaction> draft_trans);
236 Account* get_account () {
if (m_account)
return *m_account;
else return nullptr; }
237 void set_account (
Account* acct);
241 void UpdateCrossSplitCounters ();
243 std::shared_ptr<GncPreTrans> m_pre_trans;
245 int m_currency_format;
246 std::optional<std::string> m_action;
247 std::optional<Account*> m_account;
248 std::optional<GncNumeric> m_amount;
249 std::optional<GncNumeric> m_amount_neg;
250 std::optional<GncNumeric> m_value;
251 std::optional<GncNumeric> m_value_neg;
252 std::optional<GncNumeric> m_price;
253 std::optional<std::string> m_memo;
254 std::optional<char> m_rec_state;
255 std::optional<GncDate> m_rec_date;
256 std::optional<std::string> m_taction;
257 std::optional<Account*> m_taccount;
258 std::optional<GncNumeric> m_tamount;
259 std::optional<GncNumeric> m_tamount_neg;
260 std::optional<std::string> m_tmemo;
261 std::optional<char> m_trec_state;
262 std::optional<GncDate> m_trec_date;
263 bool created =
false;
The primary numeric class for representing amounts and values.
void xaccTransDestroy(Transaction *trans)
Destroys a transaction.
Account handling public routines.
Functor to check if the above map has an element of which the value equals name.
The final form of a transaction to import before it is passed on to the generic importer.
bool is_part_of(std::shared_ptr< GncPreTrans > parent)
Check whether the harvested transaction properties for this instance match those of another one (the ...
API for Transactions and Splits (journal entries)
Commodity handling public routines.