summaryrefslogtreecommitdiff
path: root/noncore/apps/checkbook/qcheckdetails.cpp
blob: 19a5e82f697fdf431aeaae455aff364a3d05e956 (plain)
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include "qcheckdetails.h"

QCheckDetails::QCheckDetails(int row, int col, const QStringList item)
	: QMainWindow(),
	m_view()
{
	m_view = new QCheckDetailsBase(this);
	setCentralWidget(m_view);

	m_row = row;
	m_col = col;

	QToolBar *bar = new QToolBar(this);
	bar->setHorizontalStretchable( TRUE );

	QPixmap newIcon = Resource::loadPixmap( "edit" );
	QPixmap trashIcon = Resource::loadPixmap( "trash" );
	QToolButton *nb1 = new QToolButton( newIcon, "Edit", QString::null, this, SLOT(editCheck()), bar, "edit transaction" );
	QToolButton *nb2 = new QToolButton( trashIcon, "Delete", QString::null, this, SLOT(deleteCheck()), bar, "delete transaction" );
	addToolBar(bar);

	QString text = "";
	if (item[0] == "true")
	{
		text.append("<b>Payment</b> to <b>");
		text.append(item[1]);
	}
	if (item[0] == "false")
	{
		text.append("<b>Deposit</b> from <b>");
		text.append(item[1]);
	}
	text.append("</b> on <b>");
	text.append(item[7]);
	text.append("</b> for <b>");
	text.append(QString("$" + item[5]));

	text.append("</b>, to make your balance <b>$");
	text.append(item[9]);
	text.append("</b>.");

	text.append("<br><br>");
	text.append("<b>Category: </b>");
	text.append(item[2]);
	text.append("<br>");
	text.append("<b>Type: </b>");

	QString type = "No Type";
	if (item[0] == "true")
	{
		if(item[3] == "0")
		{
			type = "Debit Charge";
		}
		if(item[3] == "1")
		{
			type = "Written Check";
		}
		if(item[3] == "2")
		{
			type = "Transfer";
		}
		if(item[3] == "3")
		{
			type = "Credit Card";
		}
	}

	if (item[0] == "false")
	{
		if(item[3] == "0")
		{
			type = "Written Check";
		}
		if(item[3] == "1")
		{
			type = "Automatic Payment";
		}
		if(item[3] == "2")
		{
			type = "Transfer";
		}
		if(item[3] == "3")
		{
			type = "Cash";
		}
	}

	text.append(type);
	text.append("<br>");
	if (item[4] != "0")
	{
		text.append("<b>Check Number: </b>");
		text.append(item[4]);
		text.append("<br>");
	}
	if (item[6] != ".00")
	{
		text.append("<b>Extra Fee: </b>");
		text.append(QString("$" + item[6]));
		m_view->checkDetails->setText(text);
	}
	if (item[8] != "")
	{
		text.append("<br><b>Additional Comments: </b>");
		text.append(item[8]);
	}
	m_view->checkDetails->setText(text);
}

void QCheckDetails::editCheck()
{
	emit editClicked(m_row, m_col);
}

void QCheckDetails::deleteCheck()
{
	emit deleteClicked(m_row, m_col);
}