-
Notifications
You must be signed in to change notification settings - Fork 0
/
barroc-it.sql
247 lines (205 loc) · 8.55 KB
/
barroc-it.sql
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
-- phpMyAdmin SQL Dump
-- version 4.1.12
-- http://www.phpmyadmin.net
--
-- Machine: 127.0.0.1
-- Gegenereerd op: 13 nov 2014 om 09:22
-- Serverversie: 5.6.16
-- PHP-versie: 5.5.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Databank: `barroc-it`
--
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `appointments`
--
CREATE TABLE IF NOT EXISTS `appointments` (
`AppointmentNR` int(10) NOT NULL AUTO_INCREMENT,
`CustomerNR` int(10) NOT NULL,
`AptDate` int(11) NOT NULL,
`Name` varchar(60) NOT NULL,
`Place` varchar(60) NOT NULL,
`Comments` varchar(255) NOT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`AppointmentNR`,`CustomerNR`),
KEY `Appointments-customers` (`CustomerNR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `comments`
--
CREATE TABLE IF NOT EXISTS `comments` (
`id` int(5) NOT NULL AUTO_INCREMENT,
`Date` int(12) NOT NULL,
`Subject` varchar(50) NOT NULL,
`Description` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=10 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `customers`
--
CREATE TABLE IF NOT EXISTS `customers` (
`CustomerNR` int(10) NOT NULL AUTO_INCREMENT,
`CompanyName` varchar(60) NOT NULL,
`Address` varchar(60) NOT NULL,
`Zipcode` varchar(60) NOT NULL,
`Residence` varchar(60) NOT NULL,
`ContactPerson` varchar(60) NOT NULL,
`Initials` varchar(11) NOT NULL,
`TelephoneNumber` varchar(60) NOT NULL,
`FaxNumber` varchar(50) NOT NULL,
`Email` varchar(60) NOT NULL,
`BankaccountNr` varchar(60) NOT NULL,
`Credit` varchar(20) NOT NULL DEFAULT '0',
`NumberOfInvoices` int(20) NOT NULL,
`RevenueAmount` varchar(60) NOT NULL,
`Limit` int(20) NOT NULL,
`LedgerAccount` varchar(60) NOT NULL,
`BKR` enum('Y','N') NOT NULL DEFAULT 'N',
`OfferNumbers` int(20) NOT NULL,
`OfferStatus` varchar(20) NOT NULL,
`Prospect` enum('Y','N') NOT NULL DEFAULT 'Y',
`DateOfAction` int(12) NOT NULL,
`LastContactDate` int(12) NOT NULL,
`NextAction` int(12) NOT NULL,
`SalePercentage` varchar(30) NOT NULL,
`CreditWorthy` enum('Y','N') NOT NULL DEFAULT 'N',
`OpenProjects` int(20) NOT NULL,
`Applications` varchar(60) NOT NULL,
`InternalContactPerson` varchar(60) NOT NULL,
PRIMARY KEY (`CustomerNR`,`CompanyName`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;
--
-- Gegevens worden geëxporteerd voor tabel `customers`
--
INSERT INTO `customers` (`CustomerNR`, `CompanyName`, `Address`, `Zipcode`, `Residence`, `ContactPerson`, `Initials`, `TelephoneNumber`, `FaxNumber`, `Email`, `BankaccountNr`, `Credit`, `NumberOfInvoices`, `RevenueAmount`, `Limit`, `LedgerAccount`, `BKR`, `OfferNumbers`, `OfferStatus`, `Prospect`, `DateOfAction`, `LastContactDate`, `NextAction`, `SalePercentage`, `CreditWorthy`, `OpenProjects`, `Applications`, `InternalContactPerson`) VALUES
(7, 'Google', 'Silicon Valley', '3480 AB', 'California', 'Mariana Christiansen', 'MC', '06 12344567', '3489 70134388', '[email protected]', '', '', 0, '', 0, '', 'N', 1, 'Done', 'Y', 2013, 2014, 2014, '20', 'N', 0, '', '');
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `invoices`
--
CREATE TABLE IF NOT EXISTS `invoices` (
`InvoiceNR` int(10) NOT NULL AUTO_INCREMENT,
`CustomerNR` int(10) NOT NULL DEFAULT '0',
`InvoiceDuration` date DEFAULT NULL,
`Quantity` varchar(60) DEFAULT NULL,
`Description` varchar(60) DEFAULT NULL,
`Price` int(10) DEFAULT NULL,
`BTW` int(10) NOT NULL DEFAULT '21',
`Amount` int(10) DEFAULT NULL,
`Status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`InvoiceNR`,`CustomerNR`),
KEY `Invoices-Customer` (`CustomerNR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=111 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `portfolios`
--
CREATE TABLE IF NOT EXISTS `portfolios` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` int(11) NOT NULL,
`type` varchar(255) NOT NULL,
`status` tinyint(1) NOT NULL DEFAULT '1',
`descr` text NOT NULL,
`begin_date` int(12) NOT NULL,
`end_date` int(12) NOT NULL,
`comments` text NOT NULL,
PRIMARY KEY (`id`),
KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ;
--
-- Gegevens worden geëxporteerd voor tabel `portfolios`
--
INSERT INTO `portfolios` (`id`, `uid`, `type`, `status`, `descr`, `begin_date`, `end_date`, `comments`) VALUES
(1, 29, 'Important Notice!', 1, 'This is a very important message everybody should see!', 1412978400, 1418252400, '');
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `projects`
--
CREATE TABLE IF NOT EXISTS `projects` (
`ProjectNR` int(20) NOT NULL AUTO_INCREMENT,
`CustomerNR` int(20) NOT NULL,
`ProjectName` varchar(60) NOT NULL,
`MaintenanceContract` enum('Y','N') NOT NULL DEFAULT 'N',
`Hardware` varchar(255) NOT NULL,
`Software` varchar(255) NOT NULL,
`StatusProject` enum('Active','Suspended','Done') NOT NULL,
PRIMARY KEY (`ProjectNR`,`CustomerNR`),
KEY `Projects-Customers` (`CustomerNR`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `roles`
--
CREATE TABLE IF NOT EXISTS `roles` (
`userrole` int(2) NOT NULL,
`department` varchar(255) NOT NULL,
`description` text NOT NULL,
PRIMARY KEY (`userrole`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Gegevens worden geëxporteerd voor tabel `roles`
--
INSERT INTO `roles` (`userrole`, `department`, `description`) VALUES
(1, 'admin', 'The admin for the website, any user with this role can access all departments.'),
(2, 'sales', 'The sales department. Users with this role can add and edit new users for the company.'),
(3, 'finance', 'Users with the finance role can add and edit invoices, as well as see financial data from the customer.'),
(4, 'development', 'The development department can add projects, and edit existing ones. They can also see all customer data.'),
(5, 'personnel', 'This department can add and edit portfolios for each user in the system.');
-- --------------------------------------------------------
--
-- Tabelstructuur voor tabel `users`
--
CREATE TABLE IF NOT EXISTS `users` (
`uid` int(11) NOT NULL AUTO_INCREMENT,
`username` varchar(20) NOT NULL,
`password` varchar(255) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1',
`userrole` int(1) NOT NULL,
PRIMARY KEY (`uid`),
KEY `uid` (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=36 ;
--
-- Gegevens worden geëxporteerd voor tabel `users`
--
INSERT INTO `users` (`uid`, `username`, `password`, `active`, `userrole`) VALUES
(29, 'admin', '$2y$10$9oWP3vKP/7aynBqj2VI/YeyMgFQk5PTgNdx.UumIu7EELDmNwDxIy', 1, 1),
(30, 'sales01', '$2y$10$xNndH2heyrmHJ4eE2QYd.uuIV2i8yH2pvq0ODPHCDfun9jZCa9vv.', 1, 2),
(31, 'sales02', '$2y$10$l7N4Qmi5mUHCYCAO/Tku3uSOTOAJbsvlf.PYM.F8T34BLkgpvUcXG', 1, 2),
(32, 'sales03', '$2y$10$WbopdptsA30LrteeI4Ee8.K2g40bqo0KrPT5BiPaVbDlu.EMojCAy', 1, 2),
(33, 'finance', '$2y$10$5sKfy3790Q15sqQF79YYC.NFU7pkcxt5SC7f7WcUe9/Gf8erQy0gu', 1, 3),
(34, 'development', '$2y$10$Y0lDQOGAF1SFrjr8mBnlzOs1DmvcDnFYMStz6qI2yGILWZQz0bTeu', 1, 4),
(35, 'personnel', '$2y$10$Tvt4/YnqWVejKhdNyh/OsucHJ5DWhf5GVccIT4SCnh87UprvStqxK', 1, 5);
--
-- Beperkingen voor geëxporteerde tabellen
--
--
-- Beperkingen voor tabel `appointments`
--
ALTER TABLE `appointments`
ADD CONSTRAINT `Appointments-customers` FOREIGN KEY (`CustomerNR`) REFERENCES `customers` (`CustomerNR`) ON UPDATE CASCADE;
--
-- Beperkingen voor tabel `invoices`
--
ALTER TABLE `invoices`
ADD CONSTRAINT `Invoices-Customer` FOREIGN KEY (`CustomerNR`) REFERENCES `customers` (`CustomerNR`) ON UPDATE CASCADE;
--
-- Beperkingen voor tabel `portfolios`
--
ALTER TABLE `portfolios`
ADD CONSTRAINT `portfolio-user` FOREIGN KEY (`uid`) REFERENCES `users` (`uid`) ON UPDATE CASCADE;
--
-- Beperkingen voor tabel `projects`
--
ALTER TABLE `projects`
ADD CONSTRAINT `Projects-Customers` FOREIGN KEY (`CustomerNR`) REFERENCES `customers` (`CustomerNR`) ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;