1-- ========================================================================
2-- Copyright (C) 2014		Alexandre Spangaro   <aspangaro@open-dsi.fr>
3-- Copyright (C) 2015       Frederic France      <frederic.france@free.fr>
4--
5-- This program is free software; you can redistribute it and/or modify
6-- it under the terms of the GNU General Public License as published by
7-- the Free Software Foundation; either version 3 of the License, or
8-- (at your option) any later version.
9--
10-- This program is distributed in the hope that it will be useful,
11-- but WITHOUT ANY WARRANTY; without even the implied warranty of
12-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13-- GNU General Public License for more details.
14--
15-- You should have received a copy of the GNU General Public License
16-- along with this program. If not, see <https://www.gnu.org/licenses/>.
17--
18-- ========================================================================
19
20create table llx_loan
21(
22  rowid							integer AUTO_INCREMENT PRIMARY KEY,
23  entity						integer DEFAULT 1 NOT NULL,
24  datec							datetime,
25  tms							timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
26
27  label							varchar(80) NOT NULL,
28  fk_bank						integer,
29
30  capital						double(24,8) DEFAULT 0 NOT NULL,
31  insurance_amount				double(24,8) DEFAULT 0,
32
33  datestart						date,
34  dateend						date,
35  nbterm						real,
36  rate							double  NOT NULL,
37
38  note_private					text,
39  note_public					text,
40
41  capital_position				double(24,8) DEFAULT 0,		-- If not a new loan, just have the position of capital
42  date_position					date,
43
44  paid							smallint default 0 NOT NULL,
45
46  accountancy_account_capital	varchar(32),
47  accountancy_account_insurance	varchar(32),
48  accountancy_account_interest	varchar(32),
49
50  fk_projet						integer DEFAULT NULL,
51
52  fk_user_author				integer DEFAULT NULL,
53  fk_user_modif					integer DEFAULT NULL,
54  active						tinyint DEFAULT 1  NOT NULL
55)ENGINE=innodb;
56