Recurrent Invoices: fixed buggy call to non existing function and payment terms type...
[fa-stable.git] / sql / en_US-demo.sql
index b62e9675d6319bf1270d7fe6a92117d6e4776734..03aff5703f9597b9abd443853fe18a1c652e8114 100644 (file)
@@ -149,6 +149,7 @@ CREATE TABLE `0_bank_trans` (
   `ref` varchar(40) DEFAULT NULL,
   `trans_date` date NOT NULL DEFAULT '0000-00-00',
   `amount` double DEFAULT NULL,
+  `charge` double DEFAULT NULL,
   `dimension_id` int(11) NOT NULL DEFAULT '0',
   `dimension2_id` int(11) NOT NULL DEFAULT '0',
   `person_type_id` int(11) NOT NULL DEFAULT '0',
@@ -164,11 +165,11 @@ CREATE TABLE `0_bank_trans` (
 -- Data of table `0_bank_trans` --
 
 INSERT INTO `0_bank_trans` VALUES
-('1', '12', '1', '2', '001/2018', '2018-05-10', '6240', '0', '0', '2', '1', NULL),
-('2', '12', '2', '2', '002/2018', '2018-05-07', '300', '0', '0', '2', '1', NULL),
-('3', '12', '3', '2', '003/2018', '2018-05-07', '0', '0', '0', '2', '1', NULL),
-('4', '1', '1', '1', '001/2018', '2018-05-07', '-5', '0', '0', '0', 'Goods received', NULL),
-('5', '12', '4', '2', '001/2019', '2019-01-21', '1250', '0', '0', '2', '1', NULL);
+('1', '12', '1', '2', '001/2018', '2018-05-10', '6240', '0', '0', '0', '2', '1', NULL),
+('2', '12', '2', '2', '002/2018', '2018-05-07', '300', '0', '0', '0', '2', '1', NULL),
+('3', '12', '3', '2', '003/2018', '2018-05-07', '0', '0', '0', '0', '2', '1', NULL),
+('4', '1', '1', '1', '001/2018', '2018-05-07', '-5', '0', '0', '0', '0', 'Goods received', NULL),
+('5', '12', '4', '2', '001/2019', '2019-01-21', '1250', '0', '0', '0', '2', '1', NULL);
 
 -- Structure of table `0_bom` --
 
@@ -524,6 +525,7 @@ CREATE TABLE `0_cust_allocations` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `person_id` int(11) DEFAULT NULL,
   `amt` double unsigned DEFAULT NULL,
+  `discount` double unsigned DEFAULT '0',
   `date_alloc` date NOT NULL DEFAULT '0000-00-00',
   `trans_no_from` int(11) DEFAULT NULL,
   `trans_type_from` int(11) DEFAULT NULL,
@@ -538,10 +540,10 @@ CREATE TABLE `0_cust_allocations` (
 -- Data of table `0_cust_allocations` --
 
 INSERT INTO `0_cust_allocations` VALUES
-('1', '1', '6240', '2018-05-10', '1', '12', '1', '10'),
-('2', '1', '300', '2018-05-07', '2', '12', '2', '10'),
-('3', '1', '0', '2018-05-07', '3', '12', '4', '10'),
-('4', '1', '1250', '2019-01-21', '4', '12', '5', '10');
+('1', '1', '6240', '0', '2018-05-10', '1', '12', '1', '10'),
+('2', '1', '300', '0', '2018-05-07', '2', '12', '2', '10'),
+('3', '1', '0', '0', '2018-05-07', '3', '12', '4', '10'),
+('4', '1', '1250', '0', '2019-01-21', '4', '12', '5', '10');
 
 -- Structure of table `0_cust_branch` --
 
@@ -698,7 +700,6 @@ CREATE TABLE `0_debtors_master` (
   `credit_status` int(11) NOT NULL DEFAULT '0',
   `payment_terms` int(11) DEFAULT NULL,
   `discount` double NOT NULL DEFAULT '0',
-  `pymt_discount` double NOT NULL DEFAULT '0',
   `credit_limit` float NOT NULL DEFAULT '1000',
   `notes` tinytext NOT NULL,
   `inactive` tinyint(1) NOT NULL DEFAULT '0',
@@ -710,8 +711,8 @@ CREATE TABLE `0_debtors_master` (
 -- Data of table `0_debtors_master` --
 
 INSERT INTO `0_debtors_master` VALUES
-('1', 'Donald Easter LLC', 'Donald Easter', 'N/A', '123456789', 'USD', '1', '0', '0', '1', '4', '0', '0', '1000', '', '0'),
-('2', 'MoneyMaker Ltd.', 'MoneyMaker', 'N/A', '54354333', 'EUR', '1', '1', '0', '1', '1', '0', '0', '1000', '', '0');
+('1', 'Donald Easter LLC', 'Donald Easter', 'N/A', '123456789', 'USD', '1', '0', '0', '1', '4', '0', '1000', '', '0'),
+('2', 'MoneyMaker Ltd.', 'MoneyMaker', 'N/A', '54354333', 'EUR', '1', '1', '0', '1', '1', '0', '1000', '', '0');
 
 -- Structure of table `0_dimensions` --
 
@@ -1079,23 +1080,25 @@ INSERT INTO `0_locations` VALUES
 DROP TABLE IF EXISTS `0_payment_terms`;
 
 CREATE TABLE `0_payment_terms` (
-  `terms_indicator` int(11) NOT NULL AUTO_INCREMENT,
+  `id` int(11) NOT NULL AUTO_INCREMENT,
   `terms` char(80) NOT NULL DEFAULT '',
-  `days_before_due` smallint(6) NOT NULL DEFAULT '0',
-  `day_in_following_month` smallint(6) NOT NULL DEFAULT '0',
+  `type` tinyint(1) NOT NULL DEFAULT '1'
+  `days` int(11) NOT NULL DEFAULT '0'
+  `early_discount` double NOT NULL DEFAULT '0'
+  `early_days` double NOT NULL DEFAULT '0',
   `inactive` tinyint(1) NOT NULL DEFAULT '0',
-  PRIMARY KEY (`terms_indicator`),
+  PRIMARY KEY (`id`),
   UNIQUE KEY `terms` (`terms`)
 ) ENGINE=InnoDB AUTO_INCREMENT=6 ;
 
 -- Data of table `0_payment_terms` --
 
 INSERT INTO `0_payment_terms` VALUES
-('1', 'Due 15th Of the Following Month', '0', '17', '0'),
-('2', 'Due By End Of The Following Month', '0', '30', '0'),
-('3', 'Payment due within 10 days', '10', '0', '0'),
-('4', 'Cash Only', '0', '0', '0'),
-('5', 'Prepaid', '-1', '0', '0');
+('1', 'Due 15th Of the Following Month', '4', '17', '0', '0', '0'),
+('2', 'Due By End Of The Following Month', '4', '31', '0', '0', '0'),
+('3', 'Payment due within 10 days', '10', '3', '0', '0', '0', '0'),
+('4', 'Cash Only', '2', '0', '0', '0', '0'),
+('5', 'Prepaid', '1',  '0', '0', '0', '0');
 
 -- Structure of table `0_prices` --
 
@@ -1473,7 +1476,7 @@ INSERT INTO `0_sales_orders` VALUES
 ('3', '30', '0', '0', '1', '1', '001/2018', '', NULL, '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'Donald Easter LLC', '0', 'DEF', '2018-05-08', '4', '300', '0', '0'),
 ('4', '30', '0', '0', '2', '2', '002/2018', '', NULL, '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'MoneyMaker Ltd.', '0', 'DEF', '2018-05-08', '1', '267.14', '0', '0'),
 ('5', '30', '1', '0', '2', '2', 'auto', '', NULL, '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'MoneyMaker Ltd.', '0', 'DEF', '2018-06-17', '1', '267.14', '0', '0'),
-('6', '30', '0', '1', '1', '1', '003/2018', '', NULL, '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'Donald Easter LLC', '0', 'DEF', '2018-05-08', '4', '450', '0', '0'),
+('6', '30', '0', '1', '1', '1', '003/2018', '', NULL, '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'Donald Easter LLC', '0', 'DEF', '2018-05-08', '3', '450', '0', '0'),
 ('7', '30', '1', '0', '1', '1', 'auto', '', 'Recurrent Invoice covers period 04/01/2018 - 04/07/2018.', '2018-05-07', '1', 'post-std', 'N/A', NULL, NULL, 'Donald Easter LLC', '0', 'DEF', '2018-05-07', '4', '0', '0', '0'),
 ('8', '30', '1', '0', '1', '1', 'auto', '', NULL, '2019-01-21', '1', 'post-std', 'N/A', NULL, NULL, 'Donald Easter LLC', '0', 'DEF', '2019-01-21', '4', '1250', '0', '0');
 
@@ -1739,6 +1742,7 @@ CREATE TABLE `0_supp_allocations` (
   `id` int(11) NOT NULL AUTO_INCREMENT,
   `person_id` int(11) DEFAULT NULL,
   `amt` double unsigned DEFAULT NULL,
+  `discount` double unsigned DEFAULT '0',
   `date_alloc` date NOT NULL DEFAULT '0000-00-00',
   `trans_no_from` int(11) DEFAULT NULL,
   `trans_type_from` int(11) DEFAULT NULL,