-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExpenseTypes.cpp
100 lines (86 loc) · 2.33 KB
/
ExpenseTypes.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/******************************************************************************
** (C) Chris Oldwood
**
** MODULE: EXPENSETYPES.CPP
** COMPONENT: The Application.
** DESCRIPTION: CExpenseTypes class definition.
**
*******************************************************************************
*/
#include "Common.hpp"
#include "ExpenseTypes.hpp"
/******************************************************************************
** Method: Constructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CExpenseTypes::CExpenseTypes()
: CTable(TXT("ExpenseTypes"))
{
// Create the table schema.
AddColumn(TXT("ID"), MDCT_IDENTITY, 0, CColumn::IDENTITY);
AddColumn(TXT("Name"), MDCT_FXDSTR, NAME_LEN, CColumn::DEFAULTS);
AddColumn(TXT("Default"), MDCT_INT, 0, CColumn::DEFAULTS);
// Add the predfined types.
AddPredefined(TXT("Pitch Hire"), 0);
AddPredefined(TXT("Referees Fee"), 0);
AddPredefined(TXT("Clean Kit"), 0);
}
/******************************************************************************
** Method: Destructor.
**
** Description: .
**
** Parameters: None.
**
** Returns: Nothing.
**
*******************************************************************************
*/
CExpenseTypes::~CExpenseTypes()
{
}
/******************************************************************************
** Method: CreateRow()
**
** Description: Creates a new row and initialises it.
**
** Parameters: None.
**
** Returns: The new row.
**
*******************************************************************************
*/
CRow& CExpenseTypes::CreateRow()
{
CRow& oRow = CTable::CreateRow();
// oRow[ID] = 0;
oRow[NAME] = TXT("");
oRow[DEFAULT] = 0;
return oRow;
}
/******************************************************************************
** Method: AddPredefined()
**
** Description: Internal method to add a predefined expense type.
**
** Parameters: pszName The name of the expense.
** nDefault The default fee.
**
** Returns: The new row.
**
*******************************************************************************
*/
void CExpenseTypes::AddPredefined(const tchar* pszName, int nDefault)
{
CRow& oRow = CreateRow();
oRow[NAME] = pszName;
oRow[DEFAULT] = nDefault;
InsertRow(oRow, false);
}