GnuCashew ~ Web Application compatible with GnuCash sql data files.
GCW
Loading...
Searching...
No Matches
Dbo/BudgetAmounts/Item.h
Go to the documentation of this file.
1#line 2 "src/Dbo/Invoices/Item.h"
2
3#ifndef __DBO_INVOICES_ITEM_H___
4#define __DBO_INVOICES_ITEM_H___
5
6#include "../BaseItem.h"
7#include "Definition.h"
8
9/*
10** Predefine the Entries class that fixin to come up.
11**
12*/
13namespace GCW {
14 namespace Dbo {
15 namespace BudgetAmounts {
16 class Item;
17 }
18 }
19}
20
21/*
22** Define these dbo_traits to prevent the system from
23** automatically generating an ID field or a VERSION
24** field, and instead substitute the guid field
25** as the primary key.
26**
27*/
28template<> struct Wt::Dbo::dbo_traits< GCW::Dbo::Invoices::Item >
30{
31// using IdType = std::string;
32// static auto invalidId()-> IdType { return std::string(); }
33// static auto surrogateIdField()-> const char * { return nullptr; }
34 static auto versionField()-> const char * { return nullptr; }
35};
36
37template<> struct Wt::Dbo::dbo_traits< const GCW::Dbo::Invoices::Item > : Wt::Dbo::dbo_traits< GCW::Dbo::Invoices::Item > {};
38
39/*
40** Now we can start building our class!
41**
42*/
43namespace GCW {
44 namespace Dbo {
45 namespace BudgetAmounts {
46
47/*!
48** \brief BudgetAmounts Class
49**
50**
51*/
52class Item
53: public GCW::Dbo::BaseItem< Item >
54{
55 public:
56
57 /*!
58 ** \brief ctor
59 */
60 Item(){}
61
62 /*!
63 ** \brief ctor with guid
64 */
65 Item( const std::string & _guid ): m_guid( _guid ){}
66
67 template< class Action > auto
68 persist( Action & action )-> void
69 {
70 Wt::Dbo::id ( action, m_guid , GCW::Dbo::Invoices::Field::guid , 32 ); // text(32) PRIMARY KEY NOT NULL,
71 Wt::Dbo::field( action, m_id , GCW::Dbo::Invoices::Field::id , 2048 ); // text(2048) NOT NULL,
72 Wt::Dbo::field( action, m_date_opened , GCW::Dbo::Invoices::Field::date_opened , 19 ); // text(19),
73 Wt::Dbo::field( action, m_date_posted , GCW::Dbo::Invoices::Field::date_posted , 19 ); // text(19),
74 Wt::Dbo::field( action, m_notes , GCW::Dbo::Invoices::Field::notes , 2048 ); // text(2048) NOT NULL,
75 Wt::Dbo::field( action, m_active , GCW::Dbo::Invoices::Field::active ); // integer NOT NULL,
76 Wt::Dbo::field( action, m_currency , GCW::Dbo::Invoices::Field::currency , 32 ); // text(32) NOT NULL,
77 Wt::Dbo::field( action, m_owner_type , GCW::Dbo::Invoices::Field::owner_type ); // integer,
78 Wt::Dbo::field( action, m_owner_guid , GCW::Dbo::Invoices::Field::owner_guid , 32 ); // text(32),
79 Wt::Dbo::field( action, m_terms , GCW::Dbo::Invoices::Field::terms , 32 ); // text(32),
80 Wt::Dbo::field( action, m_billing_id , GCW::Dbo::Invoices::Field::billing_id , 2048 ); // text(2048),
81 Wt::Dbo::field( action, m_post_txn , GCW::Dbo::Invoices::Field::post_txn , 32 ); // text(32),
82 Wt::Dbo::field( action, m_post_lot , GCW::Dbo::Invoices::Field::post_lot , 32 ); // text(32),
83 Wt::Dbo::field( action, m_post_acc , GCW::Dbo::Invoices::Field::post_acc , 32 ); // text(32),
84 Wt::Dbo::field( action, m_billto_type , GCW::Dbo::Invoices::Field::billto_type ); // integer,
85 Wt::Dbo::field( action, m_billto_guid , GCW::Dbo::Invoices::Field::billto_guid , 32 ); // text(32),
86 Wt::Dbo::field( action, m_charge_amt_num , GCW::Dbo::Invoices::Field::charge_amt_num ); // bigint,
87 Wt::Dbo::field( action, m_charge_amt_denom , GCW::Dbo::Invoices::Field::charge_amt_denom ); // bigint
88
89 } // endpersist( Action & action )-> void
90
91 private:
92
93 std::string m_budget_guid ; // text(32) NOT NULL
94 std::string m_account_guid ; // text(32) NOT NULL
95 int m_period_num ; // integer NOT NULL
96 int m_amount_num ; // bigint NOT NULL
97 int m_amount_denom ; // bigint NOT NULL
98
99}; // endclass Item
100
101 } // endnamespace BudgetAmounts {
102 } // endnamespace Dbo {
103} // endnamespace GCW {
104
105#endif // __DBO_BUDGETAMOUNTS_ITEM_H___
106
Item(const std::string &_guid)
ctor with guid
auto persist(Action &action) -> void
void id(Action &action, V &value, const std::string &name="id", int size=-1)
void field(Action &action, V &value, const std::string &name, int size=-1)
const Wt::WFormModel::Field notes
const Wt::WFormModel::Field currency
const Wt::WFormModel::Field billing_id
const Wt::WFormModel::Field billto_guid
const Wt::WFormModel::Field date_posted
const Wt::WFormModel::Field active
const Wt::WFormModel::Field id
const Wt::WFormModel::Field post_lot
const Wt::WFormModel::Field billto_type
const Wt::WFormModel::Field post_acc
const Wt::WFormModel::Field owner_type
const Wt::WFormModel::Field date_opened
const Wt::WFormModel::Field charge_amt_num
const Wt::WFormModel::Field owner_guid
const Wt::WFormModel::Field post_txn
const Wt::WFormModel::Field guid
const Wt::WFormModel::Field charge_amt_denom
const Wt::WFormModel::Field terms
Definition App.h:18