clevic 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,106 @@
1
+ =begin
2
+ ** Form generated from reading ui file 'search_dialog.ui'
3
+ **
4
+ ** Created: Thu Jun 26 18:01:14 2008
5
+ ** by: Qt User Interface Compiler version 4.3.3
6
+ **
7
+ ** WARNING! All changes made in this file will be lost when recompiling ui file!
8
+ =end
9
+
10
+ class Ui_SearchDialog
11
+ attr_reader :button_box
12
+ attr_reader :selected_rows
13
+ attr_reader :selected_columns
14
+ attr_reader :search_label
15
+ attr_reader :search_combo
16
+ attr_reader :from_start
17
+ attr_reader :regex
18
+ attr_reader :whole_words
19
+ attr_reader :forwards
20
+ attr_reader :backwards
21
+
22
+ def setupUi(searchDialog)
23
+ if searchDialog.objectName.nil?
24
+ searchDialog.objectName = "searchDialog"
25
+ end
26
+ searchDialog.windowModality = Qt::WindowModal
27
+ searchDialog.resize(307, 400)
28
+ icon = Qt::Icon.new("../../hilfer/bin/hilfer-icon.png")
29
+ searchDialog.windowIcon = icon
30
+ @button_box = Qt::DialogButtonBox.new(searchDialog)
31
+ @button_box.objectName = "button_box"
32
+ @button_box.geometry = Qt::Rect.new(30, 240, 261, 32)
33
+ @button_box.orientation = Qt::Horizontal
34
+ @button_box.standardButtons = Qt::DialogButtonBox::Cancel|Qt::DialogButtonBox::NoButton|Qt::DialogButtonBox::Ok
35
+ @selected_rows = Qt::CheckBox.new(searchDialog)
36
+ @selected_rows.objectName = "selected_rows"
37
+ @selected_rows.enabled = false
38
+ @selected_rows.geometry = Qt::Rect.new(30, 280, 191, 21)
39
+ @selected_columns = Qt::CheckBox.new(searchDialog)
40
+ @selected_columns.objectName = "selected_columns"
41
+ @selected_columns.enabled = false
42
+ @selected_columns.geometry = Qt::Rect.new(30, 310, 191, 21)
43
+ @search_label = Qt::Label.new(searchDialog)
44
+ @search_label.objectName = "search_label"
45
+ @search_label.geometry = Qt::Rect.new(20, 10, 51, 21)
46
+ @search_label.textFormat = Qt::PlainText
47
+ @search_combo = Qt::ComboBox.new(searchDialog)
48
+ @search_combo.objectName = "search_combo"
49
+ @search_combo.geometry = Qt::Rect.new(90, 10, 201, 25)
50
+ @search_combo.focusPolicy = Qt::StrongFocus
51
+ @search_combo.editable = true
52
+ @from_start = Qt::CheckBox.new(searchDialog)
53
+ @from_start.objectName = "from_start"
54
+ @from_start.geometry = Qt::Rect.new(90, 50, 191, 21)
55
+ @regex = Qt::CheckBox.new(searchDialog)
56
+ @regex.objectName = "regex"
57
+ @regex.geometry = Qt::Rect.new(90, 80, 191, 21)
58
+ @whole_words = Qt::CheckBox.new(searchDialog)
59
+ @whole_words.objectName = "whole_words"
60
+ @whole_words.geometry = Qt::Rect.new(90, 110, 191, 21)
61
+ @forwards = Qt::RadioButton.new(searchDialog)
62
+ @forwards.objectName = "forwards"
63
+ @forwards.geometry = Qt::Rect.new(90, 140, 171, 26)
64
+ @forwards.checked = true
65
+ @backwards = Qt::RadioButton.new(searchDialog)
66
+ @backwards.objectName = "backwards"
67
+ @backwards.geometry = Qt::Rect.new(90, 170, 176, 26)
68
+ @search_label.buddy = @search_combo
69
+ Qt::Widget.setTabOrder(@search_combo, @selected_columns)
70
+ Qt::Widget.setTabOrder(@selected_columns, @selected_rows)
71
+ Qt::Widget.setTabOrder(@selected_rows, @button_box)
72
+
73
+ retranslateUi(searchDialog)
74
+ Qt::Object.connect(@button_box, SIGNAL('accepted()'), searchDialog, SLOT('accept()'))
75
+ Qt::Object.connect(@button_box, SIGNAL('rejected()'), searchDialog, SLOT('reject()'))
76
+
77
+ Qt::MetaObject.connectSlotsByName(searchDialog)
78
+ end # setupUi
79
+
80
+ def setup_ui(searchDialog)
81
+ setupUi(searchDialog)
82
+ end
83
+
84
+ def retranslateUi(searchDialog)
85
+ searchDialog.windowTitle = Qt::Application.translate("SearchDialog", "Search", nil, Qt::Application::UnicodeUTF8)
86
+ @selected_rows.text = Qt::Application.translate("SearchDialog", "Selected Rows", nil, Qt::Application::UnicodeUTF8)
87
+ @selected_columns.text = Qt::Application.translate("SearchDialog", "Selected Columns", nil, Qt::Application::UnicodeUTF8)
88
+ @search_label.text = Qt::Application.translate("SearchDialog", "Search", nil, Qt::Application::UnicodeUTF8)
89
+ @from_start.text = Qt::Application.translate("SearchDialog", "From &Start", nil, Qt::Application::UnicodeUTF8)
90
+ @regex.text = Qt::Application.translate("SearchDialog", "&Regular Expression", nil, Qt::Application::UnicodeUTF8)
91
+ @whole_words.text = Qt::Application.translate("SearchDialog", "&Whole Words", nil, Qt::Application::UnicodeUTF8)
92
+ @forwards.text = Qt::Application.translate("SearchDialog", "&Forwards", nil, Qt::Application::UnicodeUTF8)
93
+ @backwards.text = Qt::Application.translate("SearchDialog", "&Backwards", nil, Qt::Application::UnicodeUTF8)
94
+ end # retranslateUi
95
+
96
+ def retranslate_ui(searchDialog)
97
+ retranslateUi(searchDialog)
98
+ end
99
+
100
+ end
101
+
102
+ module Ui
103
+ class SearchDialog < Ui_SearchDialog
104
+ end
105
+ end # module Ui
106
+
data/sql/accounts.sql ADDED
@@ -0,0 +1,302 @@
1
+ --
2
+ -- PostgreSQL database dump
3
+ --
4
+
5
+ SET client_encoding = 'LATIN1';
6
+ SET check_function_bodies = false;
7
+ SET client_min_messages = warning;
8
+
9
+ --
10
+ -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
11
+ --
12
+
13
+ COMMENT ON SCHEMA public IS 'Standard public schema';
14
+
15
+
16
+ SET search_path = public, pg_catalog;
17
+
18
+ --
19
+ SET default_tablespace = '';
20
+
21
+ SET default_with_oids = true;
22
+
23
+ --
24
+ -- Name: accounts; Type: TABLE; Schema: public; Owner: panic; Tablespace:
25
+ --
26
+
27
+ CREATE TABLE accounts (
28
+ id integer DEFAULT nextval('accounts_id_seq'::text) NOT NULL,
29
+ name character varying(80) NOT NULL,
30
+ vat character varying(20) NOT NULL,
31
+ account_type character varying(80),
32
+ pastel_number character varying(8),
33
+ fringe double precision,
34
+ active boolean DEFAULT true NOT NULL
35
+ );
36
+
37
+
38
+ ALTER TABLE public.accounts OWNER TO panic;
39
+
40
+ --
41
+ -- Name: accounts_id_seq; Type: SEQUENCE; Schema: public; Owner: panic
42
+ --
43
+
44
+ CREATE SEQUENCE accounts_id_seq
45
+ INCREMENT BY 1
46
+ NO MAXVALUE
47
+ NO MINVALUE
48
+ CACHE 1;
49
+
50
+
51
+ ALTER TABLE public.accounts_id_seq OWNER TO panic;
52
+
53
+ --
54
+ -- Name: entries; Type: TABLE; Schema: public; Owner: panic; Tablespace:
55
+ --
56
+
57
+ CREATE TABLE entries (
58
+ id integer DEFAULT nextval('entries_id'::text) NOT NULL,
59
+ date date,
60
+ description text,
61
+ debit_id integer,
62
+ credit_id integer,
63
+ amount numeric(9,2),
64
+ cheque_number character varying(10),
65
+ active boolean DEFAULT true NOT NULL,
66
+ vat boolean DEFAULT true NOT NULL
67
+ );
68
+
69
+
70
+ ALTER TABLE public.entries OWNER TO panic;
71
+
72
+ --
73
+ -- Name: transactions; Type: VIEW; Schema: public; Owner: panic
74
+ --
75
+
76
+ CREATE VIEW transactions AS
77
+ SELECT entries.id, entries.date, entries.description, (SELECT accounts.name FROM accounts WHERE (accounts.id = entries.debit_id)) AS debit, (SELECT accounts.name FROM accounts WHERE (accounts.id = entries.credit_id)) AS credit, entries.amount, entries.cheque_number, entries.active, entries.vat FROM entries;
78
+
79
+
80
+ ALTER TABLE public.transactions OWNER TO panic;
81
+
82
+ --
83
+ -- Name: values; Type: VIEW; Schema: public; Owner: panic
84
+ --
85
+
86
+ CREATE VIEW "values" AS
87
+ SELECT transactions.amount AS pre_vat_amount, transactions.id, transactions.date, transactions.description, transactions.debit, transactions.credit, transactions.cheque_number, transactions.vat, CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('year'::text, transactions.date) + (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year, date_part('month'::text, transactions.date) AS "month" FROM transactions WHERE (transactions.active = true);
88
+
89
+
90
+ ALTER TABLE public."values" OWNER TO panic;
91
+
92
+ --
93
+ -- Name: pre_amounts; Type: VIEW; Schema: public; Owner: panic
94
+ --
95
+
96
+ CREATE VIEW pre_amounts AS
97
+ ((SELECT "values".financial_year, to_char(("values".date)::timestamp with time zone, 'mon'::text) AS "month", "values".date, "values".description, "values".debit AS account, accounts.account_type, accounts.fringe, accounts.vat, (- "values".pre_vat_amount) AS pre_vat_amount, CASE WHEN (((accounts.vat)::text = 'yes'::text) AND ("values".vat = true)) THEN (((- float8("values".pre_vat_amount)) * (100.0)::double precision) / (114.0)::double precision) WHEN (((accounts.vat)::text = 'no'::text) OR ("values".vat = false)) THEN ((- "values".pre_vat_amount))::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN (0)::double precision ELSE NULL::double precision END AS amount FROM "values", accounts WHERE (("values".debit)::text = (accounts.name)::text) UNION SELECT "values".financial_year, to_char(("values".date)::timestamp with time zone, 'mon'::text) AS "month", "values".date, "values".description, 'VAT' AS account, 'Tax' AS account_type, accounts.fringe, accounts.vat, (- "values".pre_vat_amount) AS pre_vat_amount, CASE WHEN (((accounts.vat)::text = 'yes'::text) AND ("values".vat = true)) THEN (((- float8("values".pre_vat_amount)) * (14.0)::double precision) / (114.0)::double precision) WHEN (((accounts.vat)::text = 'no'::text) OR ("values".vat = false)) THEN (0)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN ((- "values".pre_vat_amount))::double precision ELSE NULL::double precision END AS amount FROM "values", accounts WHERE (("values".debit)::text = (accounts.name)::text)) UNION SELECT "values".financial_year, to_char(("values".date)::timestamp with time zone, 'mon'::text) AS "month", "values".date, "values".description, "values".credit AS account, accounts.account_type, accounts.fringe, accounts.vat, "values".pre_vat_amount, CASE WHEN (((accounts.vat)::text = 'yes'::text) AND ("values".vat = true)) THEN ((float8("values".pre_vat_amount) * (100.0)::double precision) / (114.0)::double precision) WHEN (((accounts.vat)::text = 'no'::text) OR ("values".vat = false)) THEN ("values".pre_vat_amount)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN (0)::double precision ELSE NULL::double precision END AS amount FROM "values", accounts WHERE (("values".credit)::text = (accounts.name)::text)) UNION SELECT "values".financial_year, to_char(("values".date)::timestamp with time zone, 'mon'::text) AS "month", "values".date, "values".description, 'VAT' AS account, 'Tax' AS account_type, accounts.fringe, accounts.vat, "values".pre_vat_amount, CASE WHEN (((accounts.vat)::text = 'yes'::text) AND ("values".vat = true)) THEN ((float8("values".pre_vat_amount) * (14.0)::double precision) / (114.0)::double precision) WHEN (((accounts.vat)::text = 'no'::text) OR ("values".vat = false)) THEN (0)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN ("values".pre_vat_amount)::double precision ELSE NULL::double precision END AS amount FROM "values", accounts WHERE (("values".credit)::text = (accounts.name)::text);
98
+
99
+
100
+ ALTER TABLE public.pre_amounts OWNER TO panic;
101
+
102
+ --
103
+ -- Name: amounts; Type: VIEW; Schema: public; Owner: panic
104
+ --
105
+
106
+ CREATE VIEW amounts AS
107
+ SELECT pre_amounts.financial_year, pre_amounts."month", pre_amounts.date, pre_amounts.description, pre_amounts.account, pre_amounts.account_type, pre_amounts.fringe, pre_amounts.vat, pre_amounts.pre_vat_amount, pre_amounts.amount, (pre_amounts.fringe * pre_amounts.amount) AS fringeamount FROM pre_amounts WHERE (NOT (pre_amounts.amount = (0)::double precision));
108
+
109
+
110
+ ALTER TABLE public.amounts OWNER TO panic;
111
+
112
+ --
113
+ -- Name: bank_statement; Type: VIEW; Schema: public; Owner: panic
114
+ --
115
+
116
+ CREATE VIEW bank_statement AS
117
+ SELECT transactions.id, transactions.date, transactions.description, transactions.debit, transactions.credit, transactions.amount, transactions.cheque_number, transactions.active, transactions.vat, CASE WHEN ((transactions.debit)::text = 'Bank'::text) THEN (- transactions.amount) WHEN ((transactions.credit)::text = 'Bank'::text) THEN transactions.amount ELSE (0)::numeric END AS movement FROM transactions WHERE (((transactions.debit)::text = 'Bank'::text) OR ((transactions.credit)::text = 'Bank'::text)) ORDER BY transactions.date;
118
+
119
+
120
+ ALTER TABLE public.bank_statement OWNER TO panic;
121
+
122
+ --
123
+ -- Name: running_total; Type: VIEW; Schema: public; Owner: panic
124
+ --
125
+
126
+ CREATE VIEW running_total AS
127
+ SELECT transactions.date, sum(CASE WHEN ((transactions.debit)::text = 'Bank'::text) THEN (- transactions.amount) WHEN ((transactions.credit)::text = 'Bank'::text) THEN transactions.amount ELSE (0)::numeric END) AS balance, CASE WHEN (date_part('month'::text, transactions.date) <= (2)::double precision) THEN (date_part('year'::text, transactions.date) - (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year FROM transactions WHERE ((((transactions.debit)::text = 'Bank'::text) OR ((transactions.credit)::text = 'Bank'::text)) AND (transactions.active = true)) GROUP BY transactions.date;
128
+
129
+
130
+ ALTER TABLE public.running_total OWNER TO panic;
131
+
132
+ --
133
+ -- Name: daily_2006; Type: VIEW; Schema: public; Owner: panic
134
+ --
135
+
136
+ CREATE VIEW daily_2006 AS
137
+ SELECT running_total.date, (SELECT sum(running.balance) AS sum FROM running_total running WHERE ((running.date >= '2006-03-01'::date) AND (running.date <= running_total.date))) AS balance FROM running_total WHERE ((running_total.date >= '2006-03-01'::date) AND (running_total.date < '2007-03-01'::date)) ORDER BY running_total.date;
138
+
139
+
140
+ ALTER TABLE public.daily_2006 OWNER TO panic;
141
+
142
+ --
143
+ -- Name: daily_2007; Type: VIEW; Schema: public; Owner: panic
144
+ --
145
+
146
+ CREATE VIEW daily_2007 AS
147
+ SELECT running_total.date, (SELECT sum(running.balance) AS sum FROM running_total running WHERE ((running.date >= '2007-03-01'::date) AND (running.date <= running_total.date))) AS balance FROM running_total WHERE ((running_total.date >= '2007-03-01'::date) AND (running_total.date < '2008-03-01'::date)) ORDER BY running_total.date;
148
+
149
+
150
+ ALTER TABLE public.daily_2007 OWNER TO panic;
151
+
152
+ --
153
+ -- Name: daily_2008; Type: VIEW; Schema: public; Owner: panic
154
+ --
155
+
156
+ CREATE VIEW daily_2008 AS
157
+ SELECT running_total.date, (SELECT sum(running.balance) AS sum FROM running_total running WHERE ((running.date >= '2008-03-01'::date) AND (running.date <= running_total.date))) AS balance FROM running_total WHERE ((running_total.date >= '2008-03-01'::date) AND (running_total.date < '2009-03-01'::date)) ORDER BY running_total.date;
158
+
159
+
160
+ ALTER TABLE public.daily_2008 OWNER TO panic;
161
+
162
+ --
163
+ -- Name: daily_bank_balances; Type: VIEW; Schema: public; Owner: panic
164
+ --
165
+
166
+ CREATE VIEW daily_bank_balances AS
167
+ SELECT running_total.date, (SELECT sum(running.balance) AS sum FROM running_total running WHERE (running.date <= running_total.date)) AS balance FROM running_total ORDER BY running_total.date;
168
+
169
+
170
+ ALTER TABLE public.daily_bank_balances OWNER TO panic;
171
+
172
+ --
173
+ -- Name: entries_id; Type: SEQUENCE; Schema: public; Owner: panic
174
+ --
175
+
176
+ CREATE SEQUENCE entries_id
177
+ INCREMENT BY 1
178
+ MAXVALUE 2147483647
179
+ NO MINVALUE
180
+ CACHE 1;
181
+
182
+
183
+ ALTER TABLE public.entries_id OWNER TO panic;
184
+
185
+ --
186
+ -- Name: pastel_export; Type: VIEW; Schema: public; Owner: panic
187
+ --
188
+
189
+ CREATE VIEW pastel_export AS
190
+ ((SELECT CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('year'::text, transactions.date) + (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year, CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('month'::text, transactions.date) - (2)::double precision) ELSE (date_part('month'::text, transactions.date) + (10)::double precision) END AS period, transactions.date, 'G' AS gdc, accounts.pastel_number AS "Account Number", transactions.id AS reference, transactions.description, CASE WHEN ((accounts.vat)::text = 'yes'::text) THEN (((- float8(transactions.amount)) * (100.0)::double precision) / (114.0)::double precision) WHEN ((accounts.vat)::text = 'no'::text) THEN ((- transactions.amount))::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN (0)::double precision ELSE NULL::double precision END AS amount, 0 AS "Tax Type", 0 AS "Tax Amount", NULL::"unknown" AS "Open Item Type", NULL::"unknown" AS "Cost Code", NULL::"unknown" AS "Contra Account", 0.0 AS "Exchange Rate", 0.0 AS "Bank Exchange Rate", NULL::"unknown" AS "Batch ID", NULL::"unknown" AS "Discount Tax Type", NULL::"unknown" AS "Discount Amount", NULL::"unknown" AS "Home Amount", 'Debit Amount' AS debug FROM transactions, accounts WHERE ((((((accounts.name)::text = (transactions.debit)::text) AND ((accounts.account_type)::text <> 'Personal'::text)) AND (((SELECT accounts.account_type FROM accounts WHERE ((accounts.name)::text = (transactions.credit)::text)))::text <> 'Personal'::text)) AND (transactions.active = true)) AND (accounts.active = true)) UNION SELECT CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('year'::text, transactions.date) + (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year, CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('month'::text, transactions.date) - (2)::double precision) ELSE (date_part('month'::text, transactions.date) + (10)::double precision) END AS period, transactions.date, 'G' AS gdc, '9500000' AS "Account Number", transactions.id AS reference, transactions.description, CASE WHEN ((accounts.vat)::text = 'yes'::text) THEN (((- float8(transactions.amount)) * (14.0)::double precision) / (114.0)::double precision) WHEN ((accounts.vat)::text = 'no'::text) THEN (0)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN ((- transactions.amount))::double precision ELSE NULL::double precision END AS amount, 0 AS "Tax Type", 0 AS "Tax Amount", NULL::"unknown" AS "Open Item Type", NULL::"unknown" AS "Cost Code", NULL::"unknown" AS "Contra Account", 0.0 AS "Exchange Rate", 0.0 AS "Bank Exchange Rate", NULL::"unknown" AS "Batch ID", NULL::"unknown" AS "Discount Tax Type", NULL::"unknown" AS "Discount Amount", NULL::"unknown" AS "Home Amount", 'Debit VAT' AS debug FROM transactions, accounts WHERE ((((((accounts.name)::text = (transactions.debit)::text) AND ((accounts.account_type)::text <> 'Personal'::text)) AND (((SELECT accounts.account_type FROM accounts WHERE ((accounts.name)::text = (transactions.credit)::text)))::text <> 'Personal'::text)) AND (transactions.active = true)) AND (accounts.active = true))) UNION SELECT CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('year'::text, transactions.date) + (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year, CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('month'::text, transactions.date) - (2)::double precision) ELSE (date_part('month'::text, transactions.date) + (10)::double precision) END AS period, transactions.date, 'G' AS gdc, accounts.pastel_number AS "Account Number", transactions.id AS reference, transactions.description, CASE WHEN ((accounts.vat)::text = 'yes'::text) THEN ((float8(transactions.amount) * (100.0)::double precision) / (114.0)::double precision) WHEN ((accounts.vat)::text = 'no'::text) THEN (transactions.amount)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN (0)::double precision ELSE NULL::double precision END AS amount, 0 AS "Tax Type", 0 AS "Tax Amount", NULL::"unknown" AS "Open Item Type", NULL::"unknown" AS "Cost Code", NULL::"unknown" AS "Contra Account", 0.0 AS "Exchange Rate", 0.0 AS "Bank Exchange Rate", NULL::"unknown" AS "Batch ID", NULL::"unknown" AS "Discount Tax Type", NULL::"unknown" AS "Discount Amount", NULL::"unknown" AS "Home Amount", 'Credit Amount' AS debug FROM transactions, accounts WHERE ((((((accounts.name)::text = (transactions.credit)::text) AND ((accounts.account_type)::text <> 'Personal'::text)) AND (((SELECT accounts.account_type FROM accounts WHERE ((accounts.name)::text = (transactions.debit)::text)))::text <> 'Personal'::text)) AND (transactions.active = true)) AND (accounts.active = true))) UNION SELECT CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('year'::text, transactions.date) + (1)::double precision) ELSE date_part('year'::text, transactions.date) END AS financial_year, CASE WHEN (date_part('month'::text, transactions.date) > (2)::double precision) THEN (date_part('month'::text, transactions.date) - (2)::double precision) ELSE (date_part('month'::text, transactions.date) + (10)::double precision) END AS period, transactions.date, 'G' AS gdc, '9500000' AS "Account Number", transactions.id AS reference, transactions.description, CASE WHEN ((accounts.vat)::text = 'yes'::text) THEN ((float8(transactions.amount) * (14.0)::double precision) / (114.0)::double precision) WHEN ((accounts.vat)::text = 'no'::text) THEN (0)::double precision WHEN ((accounts.vat)::text = 'all'::text) THEN (transactions.amount)::double precision ELSE NULL::double precision END AS amount, 0 AS "Tax Type", 0 AS "Tax Amount", NULL::"unknown" AS "Open Item Type", NULL::"unknown" AS "Cost Code", NULL::"unknown" AS "Contra Account", 0.0 AS "Exchange Rate", 0.0 AS "Bank Exchange Rate", NULL::"unknown" AS "Batch ID", NULL::"unknown" AS "Discount Tax Type", NULL::"unknown" AS "Discount Amount", NULL::"unknown" AS "Home Amount", 'Credit VAT' AS debug FROM transactions, accounts WHERE ((((((accounts.name)::text = (transactions.credit)::text) AND ((accounts.account_type)::text <> 'Personal'::text)) AND (((SELECT accounts.account_type FROM accounts WHERE ((accounts.name)::text = (transactions.debit)::text)))::text <> 'Personal'::text)) AND (transactions.active = true)) AND (accounts.active = true));
191
+
192
+
193
+ ALTER TABLE public.pastel_export OWNER TO panic;
194
+
195
+ --
196
+ -- Name: pastel_2008; Type: VIEW; Schema: public; Owner: panic
197
+ --
198
+
199
+ CREATE VIEW pastel_2008 AS
200
+ SELECT pastel_export.period, pastel_export.date, pastel_export.gdc, pastel_export."Account Number", pastel_export.reference, pastel_export.description, pastel_export.amount, pastel_export."Tax Type", pastel_export."Tax Amount", pastel_export."Open Item Type", pastel_export."Cost Code", pastel_export."Contra Account", pastel_export."Exchange Rate", pastel_export."Bank Exchange Rate", pastel_export."Batch ID", pastel_export."Discount Tax Type", pastel_export."Discount Amount", pastel_export."Home Amount" FROM pastel_export WHERE ((pastel_export.financial_year = (2008)::double precision) AND (NOT (pastel_export.amount = float8(0.0))));
201
+
202
+
203
+ ALTER TABLE public.pastel_2008 OWNER TO panic;
204
+
205
+ --
206
+ -- Name: pastel_accounts; Type: TABLE; Schema: public; Owner: panic; Tablespace:
207
+ --
208
+
209
+ CREATE TABLE pastel_accounts (
210
+ account_number character varying(7),
211
+ description character varying(40),
212
+ financial_category character varying(3),
213
+ external_reference character varying(12),
214
+ tax_type character(1),
215
+ tax_method character(2)
216
+ );
217
+
218
+
219
+ ALTER TABLE public.pastel_accounts OWNER TO panic;
220
+
221
+ --
222
+ -- Name: transaction_description; Type: VIEW; Schema: public; Owner: panic
223
+ --
224
+
225
+ CREATE VIEW transaction_description AS
226
+ SELECT DISTINCT entries.description FROM entries ORDER BY entries.description;
227
+
228
+
229
+ ALTER TABLE public.transaction_description OWNER TO panic;
230
+
231
+ --
232
+ -- Name: vat_summary; Type: VIEW; Schema: public; Owner: panic
233
+ --
234
+
235
+ CREATE VIEW vat_summary AS
236
+ SELECT pre_amounts.financial_year, pre_amounts."month", pre_amounts.date, pre_amounts.description, pre_amounts.account, pre_amounts.account_type, pre_amounts.fringe, pre_amounts.vat, pre_amounts.pre_vat_amount, pre_amounts.amount, date_part('year'::text, pre_amounts.date) AS "year", CASE WHEN ((pre_amounts.vat)::text = 'yes'::text) THEN (float8(pre_amounts.pre_vat_amount) - pre_amounts.amount) WHEN ((pre_amounts.vat)::text = 'all'::text) THEN (pre_amounts.pre_vat_amount)::double precision ELSE (0)::double precision END AS vat_amount, CASE WHEN ((date_part('month'::text, pre_amounts.date) = (1)::double precision) OR (date_part('month'::text, pre_amounts.date) = (2)::double precision)) THEN '8 Jan - Feb'::text WHEN ((date_part('month'::text, pre_amounts.date) = (3)::double precision) OR (date_part('month'::text, pre_amounts.date) = (4)::double precision)) THEN '1 Mar - Apr'::text WHEN ((date_part('month'::text, pre_amounts.date) = (5)::double precision) OR (date_part('month'::text, pre_amounts.date) = (6)::double precision)) THEN '3 May - Jun'::text WHEN ((date_part('month'::text, pre_amounts.date) = (7)::double precision) OR (date_part('month'::text, pre_amounts.date) = (8)::double precision)) THEN '4 Jul - Aug'::text WHEN ((date_part('month'::text, pre_amounts.date) = (9)::double precision) OR (date_part('month'::text, pre_amounts.date) = (10)::double precision)) THEN '5 Sep - Oct'::text WHEN ((date_part('month'::text, pre_amounts.date) = (11)::double precision) OR (date_part('month'::text, pre_amounts.date) = (12)::double precision)) THEN '6 Nov - Dec'::text ELSE NULL::text END AS vat_period FROM pre_amounts WHERE (NOT ((pre_amounts.vat)::text = 'no'::text));
237
+
238
+
239
+ ALTER TABLE public.vat_summary OWNER TO panic;
240
+
241
+ --
242
+ -- Name: vat_totals; Type: VIEW; Schema: public; Owner: panic
243
+ --
244
+
245
+ CREATE VIEW vat_totals AS
246
+ SELECT vat_summary.financial_year, vat_summary.vat_period, vat_summary.account_type, sum(vat_summary.pre_vat_amount) AS pre_vat_amount, sum(vat_summary.vat_amount) AS vat_amount FROM vat_summary WHERE (((((vat_summary.account_type)::text = 'Assets'::text) OR ((vat_summary.account_type)::text = 'Expenses'::text)) OR ((vat_summary.account_type)::text = 'Income'::text)) OR ((vat_summary.account_type)::text = 'VAT'::text)) GROUP BY vat_summary.financial_year, vat_summary.vat_period, vat_summary.account_type ORDER BY vat_summary.financial_year, vat_summary.vat_period, vat_summary.account_type;
247
+
248
+
249
+ ALTER TABLE public.vat_totals OWNER TO panic;
250
+
251
+ --
252
+ -- Name: accounts_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
253
+ --
254
+
255
+ ALTER TABLE ONLY accounts
256
+ ADD CONSTRAINT accounts_pkey PRIMARY KEY (name);
257
+
258
+
259
+ ALTER INDEX public.accounts_pkey OWNER TO panic;
260
+
261
+ --
262
+ -- Name: entries_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
263
+ --
264
+
265
+ ALTER TABLE ONLY entries
266
+ ADD CONSTRAINT entries_pkey PRIMARY KEY (id);
267
+
268
+
269
+ ALTER INDEX public.entries_pkey OWNER TO panic;
270
+
271
+ --
272
+ -- Name: entries_date; Type: INDEX; Schema: public; Owner: panic; Tablespace:
273
+ --
274
+
275
+ CREATE INDEX entries_date ON entries USING btree (date);
276
+
277
+
278
+ ALTER INDEX public.entries_date OWNER TO panic;
279
+
280
+ --
281
+ -- Name: entries_description; Type: INDEX; Schema: public; Owner: panic; Tablespace:
282
+ --
283
+
284
+ CREATE INDEX entries_description ON entries USING btree (description);
285
+
286
+
287
+ ALTER INDEX public.entries_description OWNER TO panic;
288
+
289
+ --
290
+ -- Name: public; Type: ACL; Schema: -; Owner: postgres
291
+ --
292
+
293
+ REVOKE ALL ON SCHEMA public FROM PUBLIC;
294
+ REVOKE ALL ON SCHEMA public FROM postgres;
295
+ GRANT ALL ON SCHEMA public TO postgres;
296
+ GRANT ALL ON SCHEMA public TO PUBLIC;
297
+
298
+
299
+ --
300
+ -- PostgreSQL database dump complete
301
+ --
302
+
data/sql/times.sql ADDED
@@ -0,0 +1,197 @@
1
+ --
2
+ -- PostgreSQL database dump
3
+ --
4
+
5
+ SET client_encoding = 'LATIN1';
6
+ SET check_function_bodies = false;
7
+ SET client_min_messages = warning;
8
+
9
+ --
10
+ -- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
11
+ --
12
+
13
+ COMMENT ON SCHEMA public IS 'Standard public schema';
14
+
15
+
16
+ SET search_path = public, pg_catalog;
17
+
18
+ SET default_tablespace = '';
19
+
20
+ SET default_with_oids = true;
21
+
22
+ --
23
+ -- Name: activities; Type: TABLE; Schema: public; Owner: panic; Tablespace:
24
+ --
25
+
26
+ CREATE TABLE activities (
27
+ id bigint NOT NULL,
28
+ activity character varying(100),
29
+ active boolean DEFAULT true
30
+ );
31
+
32
+
33
+ ALTER TABLE public.activities OWNER TO panic;
34
+
35
+ --
36
+ -- Name: entries; Type: TABLE; Schema: public; Owner: panic; Tablespace:
37
+ --
38
+
39
+ CREATE TABLE entries (
40
+ id integer DEFAULT nextval('entries_id_seq'::text) NOT NULL,
41
+ invoice_id integer,
42
+ project_id integer,
43
+ activity_id integer,
44
+ date date,
45
+ "start" time without time zone,
46
+ "end" time without time zone,
47
+ description text,
48
+ person character varying(30) DEFAULT 'John'::character varying,
49
+ order_number character varying(40),
50
+ out_of_spec integer,
51
+ module character varying(100),
52
+ rate integer,
53
+ charge boolean DEFAULT true
54
+ );
55
+
56
+
57
+ ALTER TABLE public.entries OWNER TO panic;
58
+
59
+ --
60
+ -- Name: entries_id_seq; Type: SEQUENCE; Schema: public; Owner: panic
61
+ --
62
+
63
+ CREATE SEQUENCE entries_id_seq
64
+ INCREMENT BY 1
65
+ NO MAXVALUE
66
+ NO MINVALUE
67
+ CACHE 1;
68
+
69
+
70
+ ALTER TABLE public.entries_id_seq OWNER TO panic;
71
+
72
+ --
73
+ -- Name: invoices; Type: TABLE; Schema: public; Owner: panic; Tablespace:
74
+ --
75
+
76
+ CREATE TABLE invoices (
77
+ id integer DEFAULT nextval('invoices_id_seq'::text) NOT NULL,
78
+ date date,
79
+ client character varying(40),
80
+ invoice_number character varying(8),
81
+ status character varying(8),
82
+ billing character varying(15),
83
+ quote_date timestamp without time zone,
84
+ quote_amount money,
85
+ description character varying(100)
86
+ );
87
+
88
+
89
+ ALTER TABLE public.invoices OWNER TO panic;
90
+
91
+ --
92
+ -- Name: invoices_id_seq; Type: SEQUENCE; Schema: public; Owner: panic
93
+ --
94
+
95
+ CREATE SEQUENCE invoices_id_seq
96
+ INCREMENT BY 1
97
+ NO MAXVALUE
98
+ NO MINVALUE
99
+ CACHE 1;
100
+
101
+
102
+ ALTER TABLE public.invoices_id_seq OWNER TO panic;
103
+
104
+ --
105
+ -- Name: projects; Type: TABLE; Schema: public; Owner: panic; Tablespace:
106
+ --
107
+
108
+ CREATE TABLE projects (
109
+ id integer DEFAULT nextval('projects_id_seq'::text) NOT NULL,
110
+ project character varying(100),
111
+ description text,
112
+ order_number character varying(100),
113
+ client character varying(100),
114
+ rate integer,
115
+ active boolean
116
+ );
117
+
118
+
119
+ ALTER TABLE public.projects OWNER TO panic;
120
+
121
+ --
122
+ -- Name: nice_entries; Type: VIEW; Schema: public; Owner: panic
123
+ --
124
+
125
+ CREATE VIEW nice_entries AS
126
+ SELECT entries.id, invoices.invoice_number, invoices.status, projects.project, activities.activity, ((entries."end" - entries."start"))::time without time zone AS elapsed, entries.date, entries."start", entries."end", entries.description, entries.person, entries.order_number, entries.out_of_spec, entries.module, entries.rate, entries.charge FROM (((entries JOIN activities ON ((entries.activity_id = activities.id))) JOIN projects ON ((entries.project_id = projects.id))) JOIN invoices ON ((entries.invoice_id = invoices.id)));
127
+
128
+
129
+ ALTER TABLE public.nice_entries OWNER TO panic;
130
+
131
+ --
132
+ -- Name: projects_id_seq; Type: SEQUENCE; Schema: public; Owner: panic
133
+ --
134
+
135
+ CREATE SEQUENCE projects_id_seq
136
+ INCREMENT BY 1
137
+ NO MAXVALUE
138
+ NO MINVALUE
139
+ CACHE 1;
140
+
141
+
142
+ ALTER TABLE public.projects_id_seq OWNER TO panic;
143
+
144
+ --
145
+ -- Name: activities_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
146
+ --
147
+
148
+ ALTER TABLE ONLY activities
149
+ ADD CONSTRAINT activities_pkey PRIMARY KEY (id);
150
+
151
+
152
+ ALTER INDEX public.activities_pkey OWNER TO panic;
153
+
154
+ --
155
+ -- Name: entries_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
156
+ --
157
+
158
+ ALTER TABLE ONLY entries
159
+ ADD CONSTRAINT entries_pkey PRIMARY KEY (id);
160
+
161
+
162
+ ALTER INDEX public.entries_pkey OWNER TO panic;
163
+
164
+ --
165
+ -- Name: invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
166
+ --
167
+
168
+ ALTER TABLE ONLY invoices
169
+ ADD CONSTRAINT invoices_pkey PRIMARY KEY (id);
170
+
171
+
172
+ ALTER INDEX public.invoices_pkey OWNER TO panic;
173
+
174
+ --
175
+ -- Name: projects_pkey; Type: CONSTRAINT; Schema: public; Owner: panic; Tablespace:
176
+ --
177
+
178
+ ALTER TABLE ONLY projects
179
+ ADD CONSTRAINT projects_pkey PRIMARY KEY (id);
180
+
181
+
182
+ ALTER INDEX public.projects_pkey OWNER TO panic;
183
+
184
+ --
185
+ -- Name: public; Type: ACL; Schema: -; Owner: postgres
186
+ --
187
+
188
+ REVOKE ALL ON SCHEMA public FROM PUBLIC;
189
+ REVOKE ALL ON SCHEMA public FROM postgres;
190
+ GRANT ALL ON SCHEMA public TO postgres;
191
+ GRANT ALL ON SCHEMA public TO PUBLIC;
192
+
193
+
194
+ --
195
+ -- PostgreSQL database dump complete
196
+ --
197
+