1-- ===================================================================
2-- Copyright (C) 2001-2004	Rodolphe Quiedeville <rodolphe@quiedeville.org>
3-- Copyright (C) 2004		Laurent Destailleur  <eldy@users.sourceforge.net>
4-- Copyright (C) 2012		Regis Houssin        <regis.houssin@inodbox.com>
5--
6-- This program is free software; you can redistribute it and/or modify
7-- it under the terms of the GNU General Public License as published by
8-- the Free Software Foundation; either version 3 of the License, or
9-- (at your option) any later version.
10--
11-- This program is distributed in the hope that it will be useful,
12-- but WITHOUT ANY WARRANTY; without even the implied warranty of
13-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14-- GNU General Public License for more details.
15--
16-- You should have received a copy of the GNU General Public License
17-- along with this program. If not, see <https://www.gnu.org/licenses/>.
18--
19-- ===================================================================
20
21create table llx_paiement
22(
23  rowid            integer AUTO_INCREMENT PRIMARY KEY,
24  ref              varchar(30) NULL,                    -- payment reference number
25  ref_ext          varchar(255) NULL,                    -- payment external reference
26  entity           integer   DEFAULT 1 NOT NULL,		-- Multi company id
27  datec            datetime,							-- date de creation
28  tms              timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
29  datep            datetime,							-- payment date
30  amount           double(24,8) DEFAULT 0,				-- amount paid in Dolibarr currency
31  multicurrency_amount double(24,8) DEFAULT 0,			-- amount paid in invoice currency
32  fk_paiement      integer NOT NULL,					-- type of payment in llx_c_paiement
33  num_paiement     varchar(50),
34  note             text,
35  ext_payment_id   varchar(128),						-- external id of payment (for example Stripe charge id)
36  ext_payment_site varchar(128),						-- name of external paymentmode (for example 'stripe')
37  fk_bank          integer NOT NULL DEFAULT 0,
38  fk_user_creat    integer,								-- utilisateur qui a cree l'info
39  fk_user_modif    integer,								-- utilisateur qui a modifie l'info
40  statut           smallint DEFAULT 0 NOT NULL,			-- Satut, 0 ou 1, 1 n'est plus supprimable
41  fk_export_compta integer DEFAULT 0 NOT NULL,			-- fk_export_compta 0 pas exporte
42  pos_change       double(24,8) DEFAULT 0  				-- Excess received in TakePOS cash payment
43)ENGINE=innodb;
44