System preferences moved form company to new sys_prefs table
[fa-stable.git] / sql / en_US-demo.sql
index fa2d5c792a13b6df4a4e39967a7e234f355ffd39..1e9d9255874d1f2f094efe11621be3d04aa800fa 100644 (file)
@@ -59,7 +59,8 @@ CREATE TABLE `0_audit_trail` (
   `gl_date` date NOT NULL default '0000-00-00',
   `gl_seq` int(11) unsigned default NULL,
    PRIMARY KEY (`id`),
-  KEY (`fiscal_year`, `gl_seq`)
+  KEY `Seq` (`fiscal_year`, `gl_date`, `gl_seq`),
+  KEY `Type_and_Number` (`type`,`trans_no`)
 ) TYPE=InnoDB  ;
 
 ### Data of table `0_audit_trail` ###
@@ -80,20 +81,22 @@ CREATE TABLE `0_bank_accounts` (
   `bank_name` varchar(60) NOT NULL default '',
   `bank_address` tinytext,
   `bank_curr_code` char(3) NOT NULL default '',
+  `dflt_curr_act` TINYINT(1) NOT NULL default '0',
   `id` smallint(6) NOT NULL auto_increment,
   `last_reconciled_date` timestamp NOT NULL default '0000-00-00 00:00:00',
   `ending_reconcile_balance` double NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   KEY `bank_account_name` (`bank_account_name`),
-  KEY `bank_account_number` (`bank_account_number`)
+  KEY `bank_account_number` (`bank_account_number`),
+  KEY (`account_code`)
 ) TYPE=MyISAM AUTO_INCREMENT=3 ;
 
 
 ### Data of table `0_bank_accounts` ###
 
-INSERT INTO `0_bank_accounts` VALUES ('1060', '0', 'Current account', '9999999999', 'Wachovia Bank', '', 'USD', '1', '0000-00-00 00:00:00', '0', '0');
-INSERT INTO `0_bank_accounts` VALUES ('1065', '3', 'Petty Cash account', 'N/A', 'N/A', '', 'USD', '2', '0000-00-00 00:00:00', '0', '0');
+INSERT INTO `0_bank_accounts` VALUES ('1060', '0', 'Current account', '9999999999', 'Wachovia Bank', '', 'USD', '1', '1', '0000-00-00 00:00:00', '0', '0');
+INSERT INTO `0_bank_accounts` VALUES ('1065', '3', 'Petty Cash account', 'N/A', 'N/A', '', 'USD', '0', '2', '0000-00-00 00:00:00', '0', '0');
 
 
 ### Structure of table `0_bank_trans` ###
@@ -107,7 +110,6 @@ CREATE TABLE `0_bank_trans` (
   `bank_act` varchar(11) default NULL,
   `ref` varchar(40) default NULL,
   `trans_date` date NOT NULL default '0000-00-00',
-  `bank_trans_type_id` int(10) unsigned default NULL,
   `amount` double default NULL,
   `dimension_id` int(11) NOT NULL default '0',
   `dimension2_id` int(11) NOT NULL default '0',
@@ -116,23 +118,25 @@ CREATE TABLE `0_bank_trans` (
   `reconciled` date default NULL,
   PRIMARY KEY  (`id`),
   KEY `bank_act` (`bank_act`,`ref`),
-  KEY `type` (`type`,`trans_no`)
+  KEY `type` (`type`,`trans_no`),
+  KEY (`bank_act`,`reconciled`),
+  KEY (`bank_act`,`trans_date`)
 ) TYPE=InnoDB AUTO_INCREMENT=12 ;
 
 
 ### Data of table `0_bank_trans` ###
 
-INSERT INTO `0_bank_trans` VALUES ('1', '22', '4', '1', '1', '2009-06-21', '', '-3465', '0', '0', '3', '2', '');
-INSERT INTO `0_bank_trans` VALUES ('2', '26', '1', '1', '', '2009-06-21', '', '-10', '0', '0', '1', '1', '');
-INSERT INTO `0_bank_trans` VALUES ('3', '26', '1', '1', '', '2009-06-21', '', '-20', '0', '0', '1', '0', '');
-INSERT INTO `0_bank_trans` VALUES ('4', '0', '18', '1', '1', '2009-02-20', '', '1000', '0', '0', '0', '', '');
-INSERT INTO `0_bank_trans` VALUES ('5', '0', '19', '1', '2', '2009-02-21', '', '4000', '0', '0', '0', '', '');
-INSERT INTO `0_bank_trans` VALUES ('6', '2', '5', '1', '1', '2009-06-21', '', '100', '0', '0', '4', '3', '');
-INSERT INTO `0_bank_trans` VALUES ('7', '1', '8', '1', '1', '2009-06-21', '', '-50', '0', '0', '4', '1', '');
-INSERT INTO `0_bank_trans` VALUES ('8', '26', '5', '1', '', '2009-06-21', '', '-10', '0', '0', '1', '1', '');
-INSERT INTO `0_bank_trans` VALUES ('9', '26', '5', '1', '', '2009-06-21', '', '-20', '0', '0', '1', '0', '');
-INSERT INTO `0_bank_trans` VALUES ('10', '26', '7', '1', '', '2009-06-21', '', '-10', '0', '0', '1', '1', '');
-INSERT INTO `0_bank_trans` VALUES ('11', '26', '7', '1', '', '2009-06-21', '', '-20', '0', '0', '1', '0', '');
+INSERT INTO `0_bank_trans` VALUES ('1', '22', '4', '1', '1', '2009-06-21', '-3465', '0', '0', '3', '2', NULL);
+INSERT INTO `0_bank_trans` VALUES ('2', '26', '1', '1', '', '2009-06-21', '-10', '0', '0', '1', '1', NULL);
+INSERT INTO `0_bank_trans` VALUES ('3', '26', '1', '1', '', '2009-06-21', '-20', '0', '0', '1', '0', NULL);
+INSERT INTO `0_bank_trans` VALUES ('4', '0', '18', '1', '1', '2009-02-20', '1000', '0', '0', '0', '', NULL);
+INSERT INTO `0_bank_trans` VALUES ('5', '0', '19', '1', '2', '2009-02-21', '4000', '0', '0', '0', '', NULL);
+INSERT INTO `0_bank_trans` VALUES ('6', '2', '5', '1', '1', '2009-06-21', '100', '0', '0', '4', '3', NULL);
+INSERT INTO `0_bank_trans` VALUES ('7', '1', '8', '1', '1', '2009-06-21', '-50', '0', '0', '4', '1', NULL);
+INSERT INTO `0_bank_trans` VALUES ('8', '26', '5', '1', '', '2009-06-21', '-10', '0', '0', '1', '1', NULL);
+INSERT INTO `0_bank_trans` VALUES ('9', '26', '5', '1', '', '2009-06-21', '-20', '0', '0', '1', '0', NULL);
+INSERT INTO `0_bank_trans` VALUES ('10', '26', '7', '1', '', '2009-06-21', '-10', '0', '0', '1', '1', NULL);
+INSERT INTO `0_bank_trans` VALUES ('11', '26', '7', '1', '', '2009-06-21', '-20', '0', '0', '1', '0', NULL);
 
 
 ### Structure of table `0_bom` ###
@@ -151,7 +155,6 @@ CREATE TABLE `0_bom` (
   KEY `id` (`id`),
   KEY `loc_code` (`loc_code`),
   KEY `parent` (`parent`,`loc_code`),
-  KEY `Parent_2` (`parent`),
   KEY `workcentre_added` (`workcentre_added`)
 ) TYPE=MyISAM AUTO_INCREMENT=4 ;
 
@@ -180,7 +183,8 @@ CREATE TABLE `0_budget_trans` (
   `person_type_id` int(11) default NULL,
   `person_id` tinyblob,
   PRIMARY KEY  (`counter`),
-  KEY `Type_and_Number` (`type`,`type_no`)
+  KEY `Type_and_Number` (`type`,`type_no`),
+  KEY `Account` (`account`, `tran_date`, `dimension_id`, `dimension2_id`)
 ) TYPE=InnoDB  AUTO_INCREMENT=1 ;
 
 
@@ -220,8 +224,8 @@ CREATE TABLE `0_chart_master` (
   `account_type` int(11) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`account_code`),
-  KEY `account_code` (`account_code`),
-  KEY `account_name` (`account_name`)
+  KEY `account_name` (`account_name`),
+  KEY `accounts_by_type` (`account_type`, `account_code`)
 ) TYPE=MyISAM  ;
 
 
@@ -317,6 +321,7 @@ CREATE TABLE `0_chart_types` (
   `parent` int(11) NOT NULL default '-1',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
+  KEY  (`class_id`),
   KEY `name` (`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=13 ;
 
@@ -345,7 +350,8 @@ CREATE TABLE `0_comments` (
   `type` int(11) NOT NULL default '0',
   `id` int(11) NOT NULL default '0',
   `date_` date default '0000-00-00',
-  `memo_` tinytext
+  `memo_` tinytext,
+  KEY `type_and_id` (`type`, `id`)
 ) TYPE=InnoDB  ;
 
 
@@ -474,7 +480,9 @@ CREATE TABLE `0_cust_allocations` (
   `trans_type_from` int(11) default NULL,
   `trans_no_to` int(11) default NULL,
   `trans_type_to` int(11) default NULL,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `From` (`trans_type_from`, `trans_no_from`),
+  KEY `To` (`trans_type_to`, `trans_no_to`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
@@ -496,6 +504,7 @@ CREATE TABLE `0_cust_branch` (
   `area` int(11) default NULL,
   `salesman` int(11) NOT NULL default '0',
   `phone` varchar(30) NOT NULL default '',
+  `phone2` varchar(30) NOT NULL default '',
   `fax` varchar(30) NOT NULL default '',
   `contact_name` varchar(60) NOT NULL default '',
   `email` varchar(100) NOT NULL default '',
@@ -509,18 +518,20 @@ CREATE TABLE `0_cust_branch` (
   `disable_trans` tinyint(4) NOT NULL default '0',
   `br_post_address` tinytext NOT NULL,
   `group_no` int(11) NOT NULL default '0',
+  `notes` tinytext NOT NULL,
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`branch_code`,`debtor_no`),
   KEY `branch_code` (`branch_code`),
-  KEY `br_name` (`br_name`)
+  KEY (`branch_ref`),
+  KEY (`group_no`)
 ) TYPE=MyISAM AUTO_INCREMENT=4 ;
 
 
 ### Data of table `0_cust_branch` ###
 
-INSERT INTO `0_cust_branch` VALUES ('1', '1', 'Beefeater Ltd.', 'Beefeater', '', '1', '1', '', '', 'Main Branch', '', 'DEF', '2', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '0');
-INSERT INTO `0_cust_branch` VALUES ('2', '2', 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\r\nAddress 2\r\nAddress 3', '1', '1', '', '', 'Main Branch', '', 'DEF', '1', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '0');
-INSERT INTO `0_cust_branch` VALUES ('3', '3', 'Brezan', 'Brezan', 'Address 1\r\nAddress 2\r\nAddress 3', '1', '1', '', '', 'Main Branch', '', 'DEF', '1', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '0');
+INSERT INTO `0_cust_branch` VALUES ('1', '1', 'Beefeater Ltd.', 'Beefeater', '', '1', '1', '', '', '', 'Main Branch', '', 'DEF', '2', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '', '0');
+INSERT INTO `0_cust_branch` VALUES ('2', '2', 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\r\nAddress 2\r\nAddress 3', '1', '1', '', '', '', 'Main Branch', '', 'DEF', '1', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '', '0');
+INSERT INTO `0_cust_branch` VALUES ('3', '3', 'Brezan', 'Brezan', 'Address 1\r\nAddress 2\r\nAddress 3', '1', '1', '', '', '', 'Main Branch', '', 'DEF', '1', '', '4510', '1200', '4500', '1', '0', 'Address 1\r\nAddress 2\r\nAddress 3', '0', '', '0');
 
 
 ### Structure of table `0_debtor_trans` ###
@@ -549,8 +560,9 @@ CREATE TABLE `0_debtor_trans` (
   `trans_link` int(11) NOT NULL default '0',
   `dimension_id` int(11) NOT NULL default '0',
   `dimension2_id` int(11) NOT NULL default '0',
-  PRIMARY KEY  (`trans_no`,`type`),
-  KEY `debtor_no` (`debtor_no`,`branch_code`)
+  PRIMARY KEY  (`type`, `trans_no`),
+  KEY `debtor_no` (`debtor_no`,`branch_code`),
+  KEY (`tran_date`)
 ) TYPE=InnoDB  ;
 
 
@@ -582,7 +594,8 @@ CREATE TABLE `0_debtor_trans_details` (
   `discount_percent` double NOT NULL default '0',
   `standard_cost` double NOT NULL default '0',
   `qty_done` double NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `Transaction` (`debtor_trans_type`, `debtor_trans_no`)
 ) TYPE=InnoDB AUTO_INCREMENT=9 ;
 
 
@@ -604,7 +617,7 @@ DROP TABLE IF EXISTS `0_debtors_master`;
 
 CREATE TABLE `0_debtors_master` (
   `debtor_no` int(11) NOT NULL auto_increment,
-  `name` varchar(80) NOT NULL default '',
+  `name` varchar(100) NOT NULL default '',
   `debtor_ref` varchar(30) NOT NULL,
   `address` tinytext,
   `email` varchar(100) NOT NULL default '',
@@ -618,17 +631,19 @@ CREATE TABLE `0_debtors_master` (
   `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',
   PRIMARY KEY  (`debtor_no`),
-  UNIQUE KEY `name` (`name`)
+  UNIQUE KEY `name` (`name`),
+  KEY (`debtor_ref`)
 ) TYPE=MyISAM AUTO_INCREMENT=4 ;
 
 
 ### Data of table `0_debtors_master` ###
 
-INSERT INTO `0_debtors_master` VALUES ('1', 'Beefeater Ltd.', 'Beefeater', 'Addr 1\r\nAddr 2\r\nAddr 3', '', '345678', 'GBP', '2', '0', '0', '1', '3', '0', '0', '1000', '0');
-INSERT INTO `0_debtors_master` VALUES ('2', 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\r\nAddress 2\r\nAddress 3', '', '2222222', 'USD', '1', '0', '0', '1', '4', '0', '0', '1000', '0');
-INSERT INTO `0_debtors_master` VALUES ('3', 'Brezan', 'Brezan', 'Address 1\r\nAddress 2\r\nAddress 3', '', '7777777', 'EUR', '2', '0', '0', '1', '3', '0', '0', '1000', '0');
+INSERT INTO `0_debtors_master` VALUES ('1', 'Beefeater Ltd.', 'Beefeater', 'Addr 1\r\nAddr 2\r\nAddr 3', '', '345678', 'GBP', '2', '0', '0', '1', '3', '0', '0', '1000', '', '0');
+INSERT INTO `0_debtors_master` VALUES ('2', 'Ghostbusters Corp.', 'Ghostbusters', 'Address 1\r\nAddress 2\r\nAddress 3', '', '2222222', 'USD', '1', '0', '0', '1', '4', '0', '0', '1000', '', '0');
+INSERT INTO `0_debtors_master` VALUES ('3', 'Brezan', 'Brezan', 'Address 1\r\nAddress 2\r\nAddress 3', '', '7777777', 'EUR', '2', '0', '0', '1', '3', '0', '0', '1000', '', '0');
 
 
 ### Structure of table `0_dimensions` ###
@@ -644,7 +659,10 @@ CREATE TABLE `0_dimensions` (
   `date_` date NOT NULL default '0000-00-00',
   `due_date` date NOT NULL default '0000-00-00',
   PRIMARY KEY  (`id`),
-  UNIQUE KEY `reference` (`reference`)
+  UNIQUE KEY `reference` (`reference`),
+  KEY (`date_`),
+  KEY (`due_date`),
+  KEY (`type_`)
 ) TYPE=InnoDB AUTO_INCREMENT=3 ;
 
 
@@ -685,7 +703,9 @@ CREATE TABLE `0_fiscal_year` (
   `begin` date default '0000-00-00',
   `end` date default '0000-00-00',
   `closed` tinyint(1) NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY(`begin`),
+  UNIQUE KEY(`end`)
 ) TYPE=InnoDB AUTO_INCREMENT=3 ;
 
 
@@ -712,7 +732,11 @@ CREATE TABLE `0_gl_trans` (
   `person_type_id` int(11) default NULL,
   `person_id` tinyblob,
   PRIMARY KEY  (`counter`),
-  KEY `Type_and_Number` (`type`,`type_no`)
+  KEY `Type_and_Number` (`type`,`type_no`),
+  KEY (`dimension_id`),
+  KEY (`dimension2_id`),
+  KEY (`tran_date`),
+  KEY `account_and_tran_date` (`account`, `tran_date`)
 ) TYPE=InnoDB AUTO_INCREMENT=84 ;
 
 
@@ -725,14 +749,14 @@ INSERT INTO `0_gl_trans` VALUES ('4', '20', '7', '2009-06-21', '1510', '', '1200
 INSERT INTO `0_gl_trans` VALUES ('5', '20', '7', '2009-06-21', '2150', '', '165', '0', '0', '3', '2');
 INSERT INTO `0_gl_trans` VALUES ('6', '22', '4', '2009-06-21', '2100', '', '3465', '0', '0', '3', '2');
 INSERT INTO `0_gl_trans` VALUES ('7', '22', '4', '2009-06-21', '1060', '', '-3465', '0', '0', '3', '2');
-INSERT INTO `0_gl_trans` VALUES ('8', '26', '1', '2009-06-21', '1510', '', '-100', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('9', '26', '1', '2009-06-21', '1510', '', '-110', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('10', '26', '1', '2009-06-21', '1510', '', '-120', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('8', '26', '1', '2009-06-21', '1510', '', '-100', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('9', '26', '1', '2009-06-21', '1510', '', '-110', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('10', '26', '1', '2009-06-21', '1510', '', '-120', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('11', '26', '1', '2009-06-21', '1060', 'Overhead Cost', '-10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('12', '26', '1', '2009-06-21', '1530', 'Overhead Cost', '10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('13', '26', '1', '2009-06-21', '1060', 'Labour Cost', '-20', '0', '0', '1', '0');
 INSERT INTO `0_gl_trans` VALUES ('14', '26', '1', '2009-06-21', '1530', 'Labour Cost', '20', '0', '0', '1', '0');
-INSERT INTO `0_gl_trans` VALUES ('15', '26', '1', '2009-06-21', '1510', '', '330', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('15', '26', '1', '2009-06-21', '1510', '', '330', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('16', '13', '2', '2009-06-21', '5010', '', '20', '0', '0', '2', '1');
 INSERT INTO `0_gl_trans` VALUES ('17', '13', '2', '2009-06-21', '1510', '', '-20', '0', '0', '2', '1');
 INSERT INTO `0_gl_trans` VALUES ('18', '13', '3', '2009-06-21', '5010', '', '10', '0', '0', '2', '2');
@@ -745,14 +769,14 @@ INSERT INTO `0_gl_trans` VALUES ('24', '13', '4', '2009-06-21', '1510', '', '-10
 INSERT INTO `0_gl_trans` VALUES ('25', '10', '18', '2009-06-21', '4010', '', '-50', '2', '0', '2', '3');
 INSERT INTO `0_gl_trans` VALUES ('26', '10', '18', '2009-06-21', '1200', '', '52.5', '0', '0', '2', '3');
 INSERT INTO `0_gl_trans` VALUES ('27', '10', '18', '2009-06-21', '2150', '', '-2.5', '0', '0', '2', '3');
-INSERT INTO `0_gl_trans` VALUES ('28', '0', '18', '2009-02-20', '1060', '', '1000', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('29', '0', '18', '2009-02-20', '3350', '', '-1000', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('30', '0', '19', '2009-02-21', '1060', '', '4000', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('31', '0', '19', '2009-02-21', '3350', '', '-4000', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('32', '26', '3', '2009-06-21', '1510', '', '-20', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('33', '26', '3', '2009-06-21', '1510', '', '-22', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('34', '26', '3', '2009-06-21', '1510', '', '-24', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('35', '26', '3', '2009-06-21', '1540', '', '66', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('28', '0', '18', '2009-02-20', '1060', '', '1000', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('29', '0', '18', '2009-02-20', '3350', '', '-1000', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('30', '0', '19', '2009-02-21', '1060', '', '4000', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('31', '0', '19', '2009-02-21', '3350', '', '-4000', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('32', '26', '3', '2009-06-21', '1510', '', '-20', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('33', '26', '3', '2009-06-21', '1510', '', '-22', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('34', '26', '3', '2009-06-21', '1510', '', '-24', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('35', '26', '3', '2009-06-21', '1540', '', '66', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('36', '2', '5', '2009-06-21', '2150', 'Cash Sales', '-4.76', '0', '0', '4', '3');
 INSERT INTO `0_gl_trans` VALUES ('37', '2', '5', '2009-06-21', '4010', 'Cash Sales', '-95.24', '0', '0', '4', '3');
 INSERT INTO `0_gl_trans` VALUES ('38', '2', '5', '2009-06-21', '1060', '', '100', '0', '0', '4', '3');
@@ -762,34 +786,34 @@ INSERT INTO `0_gl_trans` VALUES ('41', '1', '8', '2009-06-21', '1060', '', '-50'
 INSERT INTO `0_gl_trans` VALUES ('42', '20', '8', '2009-06-21', '2100', '', '-20', '0', '0', '3', '2');
 INSERT INTO `0_gl_trans` VALUES ('43', '20', '8', '2009-06-21', '2150', '', '0.95', '0', '0', '3', '2');
 INSERT INTO `0_gl_trans` VALUES ('44', '20', '8', '2009-06-21', '5780', '', '19.05', '0', '0', '3', '2');
-INSERT INTO `0_gl_trans` VALUES ('45', '26', '4', '2009-06-21', '1510', '', '-40', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('46', '26', '4', '2009-06-21', '1510', '', '-44', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('47', '26', '4', '2009-06-21', '1510', '', '-48', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('48', '26', '4', '2009-06-21', '1540', '', '132', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('49', '26', '2', '2009-06-21', '1510', '', '-20', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('50', '26', '2', '2009-06-21', '1510', '', '-22', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('51', '26', '2', '2009-06-21', '1510', '', '-24', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('52', '26', '2', '2009-06-21', '1540', '', '66', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('53', '26', '5', '2009-06-21', '1510', '', '-50', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('54', '26', '5', '2009-06-21', '1510', '', '-55', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('55', '26', '5', '2009-06-21', '1510', '', '-60', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('45', '26', '4', '2009-06-21', '1510', '', '-40', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('46', '26', '4', '2009-06-21', '1510', '', '-44', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('47', '26', '4', '2009-06-21', '1510', '', '-48', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('48', '26', '4', '2009-06-21', '1540', '', '132', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('49', '26', '2', '2009-06-21', '1510', '', '-20', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('50', '26', '2', '2009-06-21', '1510', '', '-22', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('51', '26', '2', '2009-06-21', '1510', '', '-24', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('52', '26', '2', '2009-06-21', '1540', '', '66', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('53', '26', '5', '2009-06-21', '1510', '', '-50', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('54', '26', '5', '2009-06-21', '1510', '', '-55', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('55', '26', '5', '2009-06-21', '1510', '', '-60', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('56', '26', '5', '2009-06-21', '1060', 'Overhead Cost', '-10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('57', '26', '5', '2009-06-21', '1530', 'Overhead Cost', '10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('58', '26', '5', '2009-06-21', '1060', 'Labour Cost', '-20', '0', '0', '1', '0');
 INSERT INTO `0_gl_trans` VALUES ('59', '26', '5', '2009-06-21', '1530', 'Labour Cost', '20', '0', '0', '1', '0');
-INSERT INTO `0_gl_trans` VALUES ('60', '26', '5', '2009-06-21', '1540', '', '165', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('61', '26', '6', '2009-06-21', '1510', '', '50', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('62', '26', '6', '2009-06-21', '1510', '', '55', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('63', '26', '6', '2009-06-21', '1510', '', '60', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('64', '26', '6', '2009-06-21', '1540', '', '-165', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('65', '26', '7', '2009-06-21', '1510', '', '20', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('66', '26', '7', '2009-06-21', '1510', '', '22', '0', '0', '', '');
-INSERT INTO `0_gl_trans` VALUES ('67', '26', '7', '2009-06-21', '1510', '', '24', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('60', '26', '5', '2009-06-21', '1540', '', '165', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('61', '26', '6', '2009-06-21', '1510', '', '50', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('62', '26', '6', '2009-06-21', '1510', '', '55', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('63', '26', '6', '2009-06-21', '1510', '', '60', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('64', '26', '6', '2009-06-21', '1540', '', '-165', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('65', '26', '7', '2009-06-21', '1510', '', '20', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('66', '26', '7', '2009-06-21', '1510', '', '22', '0', '0', NULL, '');
+INSERT INTO `0_gl_trans` VALUES ('67', '26', '7', '2009-06-21', '1510', '', '24', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('68', '26', '7', '2009-06-21', '1060', 'Overhead Cost', '-10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('69', '26', '7', '2009-06-21', '1530', 'Overhead Cost', '10', '0', '0', '1', '1');
 INSERT INTO `0_gl_trans` VALUES ('70', '26', '7', '2009-06-21', '1060', 'Labour Cost', '-20', '0', '0', '1', '0');
 INSERT INTO `0_gl_trans` VALUES ('71', '26', '7', '2009-06-21', '1530', 'Labour Cost', '20', '0', '0', '1', '0');
-INSERT INTO `0_gl_trans` VALUES ('72', '26', '7', '2009-06-21', '1540', '', '-66', '0', '0', '', '');
+INSERT INTO `0_gl_trans` VALUES ('72', '26', '7', '2009-06-21', '1540', '', '-66', '0', '0', NULL, '');
 INSERT INTO `0_gl_trans` VALUES ('73', '13', '5', '2009-06-21', '5010', '', '10', '0', '0', '2', '2');
 INSERT INTO `0_gl_trans` VALUES ('74', '13', '5', '2009-06-21', '1510', '', '-10', '0', '0', '2', '2');
 INSERT INTO `0_gl_trans` VALUES ('75', '10', '19', '2009-06-21', '4010', '', '-47.62', '0', '0', '2', '2');
@@ -814,7 +838,9 @@ CREATE TABLE `0_grn_batch` (
   `reference` varchar(60) NOT NULL default '',
   `delivery_date` date NOT NULL default '0000-00-00',
   `loc_code` varchar(5) default NULL,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY(`delivery_date`),
+  KEY(`purch_order_no`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
@@ -835,7 +861,8 @@ CREATE TABLE `0_grn_items` (
   `description` tinytext,
   `qty_recd` double NOT NULL default '0',
   `quantity_inv` double NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY (`grn_batch_id`)
 ) TYPE=InnoDB AUTO_INCREMENT=4 ;
 
 
@@ -880,7 +907,8 @@ CREATE TABLE `0_item_codes` (
   `is_foreign` tinyint(1) NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
-  UNIQUE KEY `stock_id` (`stock_id`,`item_code`)
+  UNIQUE KEY `stock_id` (`stock_id`,`item_code`),
+  KEY (`item_code`)
 ) TYPE=MyISAM AUTO_INCREMENT=6 ;
 
 
@@ -977,6 +1005,7 @@ CREATE TABLE `0_locations` (
   `location_name` varchar(60) NOT NULL default '',
   `delivery_address` tinytext NOT NULL,
   `phone` varchar(30) NOT NULL default '',
+  `phone2` varchar(30) NOT NULL default '',
   `fax` varchar(30) NOT NULL default '',
   `email` varchar(100) NOT NULL default '',
   `contact` varchar(30) NOT NULL default '',
@@ -987,7 +1016,7 @@ CREATE TABLE `0_locations` (
 
 ### Data of table `0_locations` ###
 
-INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'Delivery 1\r\nDelivery 2\r\nDelivery 3', '', '', '', '', '0');
+INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'Delivery 1\r\nDelivery 2\r\nDelivery 3', '', '', '', '', '', '0');
 
 
 ### Structure of table `0_movement_types` ###
@@ -1143,7 +1172,8 @@ CREATE TABLE `0_purch_order_details` (
   `std_cost_unit` double NOT NULL default '0',
   `quantity_ordered` double NOT NULL default '0',
   `quantity_received` double NOT NULL default '0',
-  PRIMARY KEY  (`po_detail_item`)
+  PRIMARY KEY  (`po_detail_item`),
+  KEY `order` (`order_no`, `po_detail_item`)
 ) TYPE=InnoDB AUTO_INCREMENT=6 ;
 
 
@@ -1169,7 +1199,8 @@ CREATE TABLE `0_purch_orders` (
   `requisition_no` tinytext,
   `into_stock_location` varchar(5) NOT NULL default '',
   `delivery_address` tinytext NOT NULL,
-  PRIMARY KEY  (`order_no`)
+  PRIMARY KEY  (`order_no`),
+  KEY (`ord_date`)
 ) TYPE=InnoDB AUTO_INCREMENT=3 ;
 
 
@@ -1189,6 +1220,7 @@ CREATE TABLE `0_quick_entries` (
   `description` varchar(60) NOT NULL,
   `base_amount` double NOT NULL default '0',
   `base_desc` varchar(60) default NULL,
+  `bal_type` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   KEY `description` (`description`)
 ) TYPE=MyISAM AUTO_INCREMENT=4 ;
@@ -1196,9 +1228,9 @@ CREATE TABLE `0_quick_entries` (
 
 ### Data of table `0_quick_entries` ###
 
-INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount');
-INSERT INTO `0_quick_entries` VALUES ('2', '4', 'Phone', '0', 'Amount');
-INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount', '0');
+INSERT INTO `0_quick_entries` VALUES ('2', '4', 'Phone', '0', 'Amount', '0');
+INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount', '0');
 
 
 ### Structure of table `0_quick_entry_lines` ###
@@ -1260,7 +1292,8 @@ CREATE TABLE `0_refs` (
   `id` int(11) NOT NULL default '0',
   `type` int(11) NOT NULL default '0',
   `reference` varchar(100) NOT NULL default '',
-  PRIMARY KEY  (`id`,`type`)
+  PRIMARY KEY  (`id`,`type`),
+  KEY `Type_and_Reference` (`type`,`reference`)
 ) TYPE=InnoDB  ;
 
 
@@ -1277,23 +1310,25 @@ DROP TABLE IF EXISTS `0_sales_order_details`;
 CREATE TABLE `0_sales_order_details` (
   `id` int(11) NOT NULL auto_increment,
   `order_no` int(11) NOT NULL default '0',
+  `trans_type` smallint(6) NOT NULL default '30',
   `stk_code` varchar(20) NOT NULL default '',
   `description` tinytext,
   `qty_sent` double NOT NULL default '0',
   `unit_price` double NOT NULL default '0',
   `quantity` double NOT NULL default '0',
   `discount_percent` double NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `sorder` (`trans_type`, `order_no`)
 ) TYPE=InnoDB AUTO_INCREMENT=6 ;
 
 
 ### Data of table `0_sales_order_details` ###
 
-INSERT INTO `0_sales_order_details` VALUES ('1', '1', '102', '17inch VGA Monitor', '2', '30.4', '2', '0');
-INSERT INTO `0_sales_order_details` VALUES ('2', '2', '102', '17inch VGA Monitor', '1', '50', '1', '0');
-INSERT INTO `0_sales_order_details` VALUES ('3', '3', '102', '17inch VGA Monitor', '1', '35.89', '1', '0');
-INSERT INTO `0_sales_order_details` VALUES ('4', '4', '102', '17inch VGA Monitor', '0', '21.28', '2', '0');
-INSERT INTO `0_sales_order_details` VALUES ('5', '5', '102', '17inch VGA Monitor', '1', '50', '1', '0');
+INSERT INTO `0_sales_order_details` VALUES ('1', '1', '30', '102', '17inch VGA Monitor', '2', '30.4', '2', '0');
+INSERT INTO `0_sales_order_details` VALUES ('2', '2', '30', '102', '17inch VGA Monitor', '1', '50', '1', '0');
+INSERT INTO `0_sales_order_details` VALUES ('3', '3', '30', '102', '17inch VGA Monitor', '1', '35.89', '1', '0');
+INSERT INTO `0_sales_order_details` VALUES ('4', '4', '30', '102', '17inch VGA Monitor', '0', '21.28', '2', '0');
+INSERT INTO `0_sales_order_details` VALUES ('5', '5', '30', '102', '17inch VGA Monitor', '1', '50', '1', '0');
 
 
 ### Structure of table `0_sales_orders` ###
@@ -1301,11 +1336,13 @@ INSERT INTO `0_sales_order_details` VALUES ('5', '5', '102', '17inch VGA Monitor
 DROP TABLE IF EXISTS `0_sales_orders`;
 
 CREATE TABLE `0_sales_orders` (
-  `order_no` int(11) NOT NULL auto_increment,
+  `order_no` int(11) NOT NULL,
+  `trans_type` smallint(6) NOT NULL default '30',
   `version` tinyint(1) unsigned NOT NULL default '0',
   `type` tinyint(1) NOT NULL default '0',
   `debtor_no` int(11) NOT NULL default '0',
   `branch_code` int(11) NOT NULL default '0',
+  `reference` varchar(100) NOT NULL default '',
   `customer_ref` tinytext NOT NULL,
   `comments` tinytext,
   `ord_date` date NOT NULL default '0000-00-00',
@@ -1318,17 +1355,16 @@ CREATE TABLE `0_sales_orders` (
   `freight_cost` double NOT NULL default '0',
   `from_stk_loc` varchar(5) NOT NULL default '',
   `delivery_date` date NOT NULL default '0000-00-00',
-  PRIMARY KEY  (`order_no`)
-) TYPE=InnoDB AUTO_INCREMENT=6 ;
-
+  PRIMARY KEY  (`trans_type`, `order_no`)
+) TYPE=InnoDB;
 
 ### Data of table `0_sales_orders` ###
 
-INSERT INTO `0_sales_orders` VALUES ('1', '1', '0', '1', '1', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Beefeater Ltd.', '10', 'DEF', '2009-06-22');
-INSERT INTO `0_sales_orders` VALUES ('2', '1', '0', '2', '2', '', '', '2009-06-21', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Ghostbusters Corp.', '0', 'DEF', '2009-06-22');
-INSERT INTO `0_sales_orders` VALUES ('3', '1', '0', '3', '3', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Brezan', '0', 'DEF', '2009-07-01');
-INSERT INTO `0_sales_orders` VALUES ('4', '0', '0', '1', '1', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Beefeater Ltd.', '0', 'DEF', '2009-06-22');
-INSERT INTO `0_sales_orders` VALUES ('5', '1', '0', '2', '2', '', '', '2009-06-21', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Ghostbusters Corp.', '5', 'DEF', '2009-06-22');
+INSERT INTO `0_sales_orders` VALUES ('1', '30', '1', '0', '1', '1', '1', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Beefeater Ltd.', '10', 'DEF', '2009-06-22');
+INSERT INTO `0_sales_orders` VALUES ('2', '30', '1', '0', '2', '2', '2', '', '', '2009-06-21', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Ghostbusters Corp.', '0', 'DEF', '2009-06-22');
+INSERT INTO `0_sales_orders` VALUES ('3', '30', '1', '0', '3', '3', '3', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Brezan', '0', 'DEF', '2009-07-01');
+INSERT INTO `0_sales_orders` VALUES ('4', '30', '0', '0', '1', '1', '4', '', '', '2009-06-21', '2', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Beefeater Ltd.', '0', 'DEF', '2009-06-22');
+INSERT INTO `0_sales_orders` VALUES ('5', '30', '1', '0', '2', '2', '5', '', '', '2009-06-21', '1', '1', 'Address 1\r\nAddress 2\r\nAddress 3', '', '', 'Ghostbusters Corp.', '5', 'DEF', '2009-06-22');
 
 
 ### Structure of table `0_sales_pos` ###
@@ -1397,6 +1433,34 @@ CREATE TABLE `0_salesman` (
 
 INSERT INTO `0_salesman` VALUES ('1', 'Sales Person', '', '', '', '5', '1000', '4', '0');
 
+### Structure of table `0_security_roles` ###
+
+DROP TABLE IF EXISTS `0_security_roles`;
+CREATE TABLE IF NOT EXISTS `0_security_roles` (
+  `id` int(11) NOT NULL auto_increment,
+  `role` varchar(30) NOT NULL,
+  `description` varchar(50) default NULL,
+  `sections` text,
+  `areas` text,
+  `inactive` tinyint(1) NOT NULL default '0',
+  PRIMARY KEY  (`id`),
+  UNIQUE KEY `role` (`role`)
+) TYPE=MyISAM  AUTO_INCREMENT=11 ;
+
+--
+-- Data of table `0_security_roles`
+--
+
+INSERT INTO `0_security_roles` VALUES (1, 'Inquiries', 'Inquiries', '768;2816;3072;3328;5632;5888;8192;8448;10752;11008;13312;15872;16128', '257;258;259;260;513;514;515;516;517;518;519;520;521;522;523;524;525;773;774;2822;3073;3075;3076;3077;3329;3330;3331;3332;3333;3334;3335;5377;5633;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8450;8451;10497;10753;11009;11010;11012;13313;13315;15617;15618;15619;15620;15621;15622;15623;15624;15625;15626;15873;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (2, 'System Administrator', 'System Administrator', '256;512;768;2816;3072;3328;5376;5632;5888;7936;8192;8448;10496;10752;11008;13056;13312;15616;15872;16128', '257;258;259;260;513;514;515;516;517;518;519;520;521;522;523;524;525;769;770;771;772;773;774;2817;2818;2819;2820;2821;2822;2823;3073;3074;3082;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5636;5637;5641;5638;5639;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8195;8196;8197;8449;8450;8451;10497;10753;10754;10755;10756;10757;11009;11010;11012;13057;13313;13314;13315;15617;15618;15619;15620;15621;15622;15623;15624;15625;15626;15627;15873;15874;15875;15876;15877;15878;15879;15880;15883;15881;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (3, 'Salesman', 'Salesman', '768;3072;5632;8192;15872', '773;774;3073;3075;3081;5633;8194;15873', 0);
+INSERT INTO `0_security_roles` VALUES (4, 'Stock Manager', 'Stock Manager', '2816;3072;3328;5632;5888;8192;8448;10752;11008;13312;15872;16128', '2818;2822;3073;3076;3077;3329;3330;3330;3330;3331;3331;3332;3333;3334;3335;5633;5640;5889;5890;5891;8193;8194;8450;8451;10753;11009;11010;11012;13313;13315;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (5, 'Production Manager', 'Production Manager', '512;2816;3072;3328;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '521;523;524;2818;2819;2820;2821;2822;2823;3073;3074;3076;3077;3078;3079;3080;3081;3329;3330;3330;3330;3331;3331;3332;3333;3334;3335;5633;5640;5640;5889;5890;5891;8193;8194;8196;8197;8450;8451;10753;10755;11009;11010;11012;13313;13315;15617;15619;15620;15621;15624;15624;15876;15877;15880;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (6, 'Purchase Officer', 'Purchase Officer', '512;2816;3072;3328;5376;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '521;523;524;2818;2819;2820;2821;2822;2823;3073;3074;3076;3077;3078;3079;3080;3081;3329;3330;3330;3330;3331;3331;3332;3333;3334;3335;5377;5633;5635;5640;5640;5889;5890;5891;8193;8194;8196;8197;8449;8450;8451;10753;10755;11009;11010;11012;13313;13315;15617;15619;15620;15621;15624;15624;15876;15877;15880;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (7, 'AR Officer', 'AR Officer', '512;768;2816;3072;3328;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '521;523;524;771;773;774;2818;2819;2820;2821;2822;2823;3073;3073;3074;3075;3076;3077;3078;3079;3080;3081;3081;3329;3330;3330;3330;3331;3331;3332;3333;3334;3335;5633;5633;5634;5637;5638;5639;5640;5640;5889;5890;5891;8193;8194;8194;8196;8197;8450;8451;10753;10755;11009;11010;11012;13313;13315;15617;15619;15620;15621;15624;15624;15873;15876;15877;15878;15880;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (8, 'AP Officer', 'AP Officer', '512;2816;3072;3328;5376;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '257;258;259;260;521;523;524;769;770;771;772;773;774;2818;2819;2820;2821;2822;2823;3073;3074;3082;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5635;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8196;8197;8449;8450;8451;10497;10753;10755;11009;11010;11012;13057;13313;13315;15617;15619;15620;15621;15624;15876;15877;15880;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (9, 'Accountant', 'New Accountant', '512;768;2816;3072;3328;5376;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '257;258;259;260;521;523;524;771;772;773;774;2818;2819;2820;2821;2822;2823;3073;3074;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5637;5638;5639;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8196;8197;8449;8450;8451;10497;10753;10755;11009;11010;11012;13313;13315;15617;15618;15619;15620;15621;15624;15873;15876;15877;15878;15880;15882;16129;16130;16131;16132', 0);
+INSERT INTO `0_security_roles` VALUES (10, 'Sub Admin', 'Sub Admin', '512;768;2816;3072;3328;5376;5632;5888;8192;8448;10752;11008;13312;15616;15872;16128', '257;258;259;260;521;523;524;771;772;773;774;2818;2819;2820;2821;2822;2823;3073;3074;3082;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5637;5638;5639;5640;5889;5890;5891;7937;7938;7939;7940;8193;8194;8196;8197;8449;8450;8451;10497;10753;10755;11009;11010;11012;13057;13313;13315;15617;15619;15620;15621;15624;15873;15874;15876;15877;15878;15879;15880;15882;16129;16130;16131;16132', 0);
 
 ### Structure of table `0_shippers` ###
 
@@ -1406,6 +1470,7 @@ CREATE TABLE `0_shippers` (
   `shipper_id` int(11) NOT NULL auto_increment,
   `shipper_name` varchar(60) NOT NULL default '',
   `phone` varchar(30) NOT NULL default '',
+  `phone2` varchar(30) NOT NULL default '',
   `contact` tinytext NOT NULL,
   `address` tinytext NOT NULL,
   `inactive` tinyint(1) NOT NULL default '0',
@@ -1416,7 +1481,7 @@ CREATE TABLE `0_shippers` (
 
 ### Data of table `0_shippers` ###
 
-INSERT INTO `0_shippers` VALUES ('1', 'Default', '', '', '', '0');
+INSERT INTO `0_shippers` VALUES ('1', 'Default', '', '', '', '', '0');
 
 
 ### Structure of table `0_sql_trail` ###
@@ -1525,7 +1590,8 @@ CREATE TABLE `0_stock_moves` (
   `standard_cost` double NOT NULL default '0',
   `visible` tinyint(1) NOT NULL default '1',
   PRIMARY KEY  (`trans_id`),
-  KEY `type` (`type`,`trans_no`)
+  KEY `type` (`type`,`trans_no`),
+  KEY `Move` (`stock_id`,`loc_code`, `tran_date`)
 ) TYPE=InnoDB AUTO_INCREMENT=37 ;
 
 
@@ -1581,7 +1647,9 @@ CREATE TABLE `0_supp_allocations` (
   `trans_type_from` int(11) default NULL,
   `trans_no_to` int(11) default NULL,
   `trans_type_to` int(11) default NULL,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `From` (`trans_type_from`, `trans_no_from`),
+  KEY `To` (`trans_type_to`, `trans_no_to`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
@@ -1607,7 +1675,8 @@ CREATE TABLE `0_supp_invoice_items` (
   `unit_price` double NOT NULL default '0',
   `unit_tax` double NOT NULL default '0',
   `memo_` tinytext,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `Transaction` (`supp_trans_type`, `supp_trans_no`, `stock_id`)
 ) TYPE=InnoDB AUTO_INCREMENT=6 ;
 
 
@@ -1637,10 +1706,11 @@ CREATE TABLE `0_supp_trans` (
   `ov_gst` double NOT NULL default '0',
   `rate` double NOT NULL default '1',
   `alloc` double NOT NULL default '0',
-  PRIMARY KEY  (`trans_no`,`type`),
+  PRIMARY KEY  (`type`, `trans_no`),
   KEY `supplier_id` (`supplier_id`),
   KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
-  KEY `type` (`type`)
+  KEY `type` (`type`),
+  KEY (`tran_date`)
 ) TYPE=InnoDB  ;
 
 
@@ -1662,6 +1732,7 @@ CREATE TABLE `0_suppliers` (
   `address` tinytext NOT NULL,
   `supp_address` tinytext NOT NULL,
   `phone` varchar(30) NOT NULL default '',
+  `phone2` varchar(30) NOT NULL default '',
   `fax` varchar(30) NOT NULL default '',
   `gst_no` varchar(25) NOT NULL default '',
   `contact` varchar(60) NOT NULL default '',
@@ -1680,15 +1751,84 @@ CREATE TABLE `0_suppliers` (
   `payment_discount_account` varchar(11) default NULL,
   `notes` tinytext NOT NULL,
   `inactive` tinyint(1) NOT NULL default '0',
-  PRIMARY KEY  (`supplier_id`)
+  PRIMARY KEY  (`supplier_id`),
+  KEY (`supp_ref`)
 ) TYPE=MyISAM AUTO_INCREMENT=4 ;
 
 
 ### Data of table `0_suppliers` ###
 
-INSERT INTO `0_suppliers` VALUES ('1', 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '+45 55667788', '', '123456', 'Contact', '111', '', '', '', 'DKK', '3', '1', '0', '2', '1', '5010', '2100', '5060', 'A supplier with junk beers.', '0');
-INSERT INTO `0_suppliers` VALUES ('2', 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '(111) 222.333.444', '', '654321', 'Luke', '333', '', '', '', 'USD', '3', '0', '0', '1', '1', '5010', '2100', '5060', '', '0');
-INSERT INTO `0_suppliers` VALUES ('3', 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '+44 444 555 666', '', '987654', 'Makers', '222', '', '', '', 'GBP', '3', '0', '0', '2', '1', '5010', '2100', '5060', '', '0');
+INSERT INTO `0_suppliers` VALUES ('1', 'Junk Beer ApS', 'Junk Beer', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '+45 55667788', '', '', '123456', 'Contact', '111', '', '', '', 'DKK', '3', '1', '0', '2', '1', '5010', '2100', '5060', 'A supplier with junk beers.', '0');
+INSERT INTO `0_suppliers` VALUES ('2', 'Lucky Luke Inc.', 'Lucky Luke', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '(111) 222.333.444', '', '', '654321', 'Luke', '333', '', '', '', 'USD', '3', '0', '0', '1', '1', '5010', '2100', '5060', '', '0');
+INSERT INTO `0_suppliers` VALUES ('3', 'Money Makers Ltd.', 'Money Makers', 'Mailing 1\r\nMailing 2\r\nMailing 3', 'Address 1\r\nAddress 2\r\nAddress 3', '+44 444 555 666', '', '', '987654', 'Makers', '222', '', '', '', 'GBP', '3', '0', '0', '2', '1', '5010', '2100', '5060', '', '0');
+
+### Structure of table `0_sys_prefs` ###
+
+DROP TABLE IF EXISTS `0_sys_prefs`;
+
+CREATE TABLE `0_sys_prefs` (
+  `name` varchar(35) NOT NULL default '',
+  `category` varchar(30) default NULL,
+  `type` varchar(20) NOT NULL default 'varchar',
+  `length` smallint(6) default NULL,
+  `value` tinytext,
+  PRIMARY KEY  (`name`),
+  KEY `category` (`category`)
+) TYPE=MyISAM;
+
+
+### Data of table `0_sys_prefs` ###
+
+INSERT INTO `0_sys_prefs` VALUES ('coy_name', 'setup.company', 'varchar', '60', 'Training Co.');
+INSERT INTO `0_sys_prefs` VALUES ('gst_no', 'setup.company', 'varchar', '25', '9876543');
+INSERT INTO `0_sys_prefs` VALUES ('coy_no', 'setup.company', 'varchar', '25', '123456789');
+INSERT INTO `0_sys_prefs` VALUES ('tax_prd', 'setup.company', 'int', '11', '1');
+INSERT INTO `0_sys_prefs` VALUES ('tax_last', 'setup.company', 'int', '11', '1');
+INSERT INTO `0_sys_prefs` VALUES ('postal_address', 'setup.company', 'tinytext', '0', 'Address 1\r\nAddress 2\r\nAddress 3');
+INSERT INTO `0_sys_prefs` VALUES ('phone', 'setup.company', 'varchar', '30', '(222) 111.222.333');
+INSERT INTO `0_sys_prefs` VALUES ('fax', 'setup.company', 'varchar', '30', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('email', 'setup.company', 'varchar', '100', 'delta@delta.com');
+INSERT INTO `0_sys_prefs` VALUES ('coy_logo', 'setup.company', 'varchar', '100', 'logo_frontaccounting.jpg');
+INSERT INTO `0_sys_prefs` VALUES ('domicile', 'setup.company', 'varchar', '55', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('curr_default', 'setup.company', 'char', '3', 'USD');
+INSERT INTO `0_sys_prefs` VALUES ('use_dimension', 'setup.company', 'tinyint', '1', '1');
+INSERT INTO `0_sys_prefs` VALUES ('f_year', 'setup.company', 'int', '11', '2');
+INSERT INTO `0_sys_prefs` VALUES ('no_item_list', 'setup.company', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('no_customer_list', 'setup.company', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('no_supplier_list', 'setup.company', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('base_sales', 'setup.company', 'int', '11', '1');
+INSERT INTO `0_sys_prefs` VALUES ('time_zone', 'setup.company', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('add_pct', 'setup.company', 'int', '5', '-1');
+INSERT INTO `0_sys_prefs` VALUES ('round_to', 'setup.company', 'int', '5', '1');
+INSERT INTO `0_sys_prefs` VALUES ('login_tout', 'setup.company', 'smallint', '6', '600');
+INSERT INTO `0_sys_prefs` VALUES ('past_due_days', 'glsetup.general', 'int', '11', '30');
+INSERT INTO `0_sys_prefs` VALUES ('profit_loss_year_act', 'glsetup.general', 'varchar', '11', '9990');
+INSERT INTO `0_sys_prefs` VALUES ('retained_earnings_act', 'glsetup.general', 'varchar', '11', '3590');
+INSERT INTO `0_sys_prefs` VALUES ('bank_charge_act', 'glsetup.general', 'varchar', '11', '5690');
+INSERT INTO `0_sys_prefs` VALUES ('exchange_diff_act', 'glsetup.general', 'varchar', '11', '4450');
+INSERT INTO `0_sys_prefs` VALUES ('default_credit_limit', 'glsetup.customer', 'int', '11', '1000');
+INSERT INTO `0_sys_prefs` VALUES ('accumulate_shipping', 'glsetup.customer', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('legal_text', 'glsetup.customer', 'tinytext', '0', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('freight_act', 'glsetup.customer', 'varchar', '11', '4430');
+INSERT INTO `0_sys_prefs` VALUES ('debtors_act', 'glsetup.sales', 'varchar', '11', '1200');
+INSERT INTO `0_sys_prefs` VALUES ('default_sales_act', 'glsetup.sales', 'varchar', '11', '4010');
+INSERT INTO `0_sys_prefs` VALUES ('default_sales_discount_act', 'glsetup.sales', 'varchar', '11', '4510');
+INSERT INTO `0_sys_prefs` VALUES ('default_prompt_payment_act', 'glsetup.sales', 'varchar', '11', '4500');
+INSERT INTO `0_sys_prefs` VALUES ('default_delivery_required', 'glsetup.sales', 'smallint', '6', '1');
+INSERT INTO `0_sys_prefs` VALUES ('default_dim_required', 'glsetup.dims', 'int', '11', '20');
+INSERT INTO `0_sys_prefs` VALUES ('pyt_discount_act', 'glsetup.purchase', 'varchar', '11', '5060');
+INSERT INTO `0_sys_prefs` VALUES ('creditors_act', 'glsetup.purchase', 'varchar', '11', '2100');
+INSERT INTO `0_sys_prefs` VALUES ('po_over_receive', 'glsetup.purchase', 'int', '11', '10');
+INSERT INTO `0_sys_prefs` VALUES ('po_over_charge', 'glsetup.purchase', 'int', '11', '10');
+INSERT INTO `0_sys_prefs` VALUES ('allow_negative_stock', 'glsetup.inventory', 'tinyint', '1', '0');
+INSERT INTO `0_sys_prefs` VALUES ('default_inventory_act', 'glsetup.items', 'varchar', '11', '1510');
+INSERT INTO `0_sys_prefs` VALUES ('default_cogs_act', 'glsetup.items', 'varchar', '11', '5010');
+INSERT INTO `0_sys_prefs` VALUES ('default_adj_act', 'glsetup.items', 'varchar', '11', '5040');
+INSERT INTO `0_sys_prefs` VALUES ('default_inv_sales_act', 'glsetup.items', 'varchar', '11', '4010');
+INSERT INTO `0_sys_prefs` VALUES ('default_assembly_act', 'glsetup.items', 'varchar', '11', '1530');
+INSERT INTO `0_sys_prefs` VALUES ('default_workorder_required', 'glsetup.manuf', 'int', '11', '20');
+INSERT INTO `0_sys_prefs` VALUES ('version_id', 'system', 'varchar', '11', '2.3');
+
 
 
 ### Structure of table `0_sys_types` ###
@@ -1697,7 +1837,6 @@ DROP TABLE IF EXISTS `0_sys_types`;
 
 CREATE TABLE `0_sys_types` (
   `type_id` smallint(6) NOT NULL default '0',
-  `type_name` varchar(60) NOT NULL default '',
   `type_no` int(11) NOT NULL default '1',
   `next_reference` varchar(100) NOT NULL default '',
   PRIMARY KEY  (`type_id`)
@@ -1706,27 +1845,28 @@ CREATE TABLE `0_sys_types` (
 
 ### Data of table `0_sys_types` ###
 
-INSERT INTO `0_sys_types` VALUES ('0', 'Journal - GL', '19', '3');
-INSERT INTO `0_sys_types` VALUES ('1', 'Payment - GL', '8', '2');
-INSERT INTO `0_sys_types` VALUES ('2', 'Receipt - GL', '5', '2');
-INSERT INTO `0_sys_types` VALUES ('4', 'Funds Transfer', '3', '1');
-INSERT INTO `0_sys_types` VALUES ('10', 'Sales Invoice', '19', '4');
-INSERT INTO `0_sys_types` VALUES ('11', 'Credit Note', '3', '2');
-INSERT INTO `0_sys_types` VALUES ('12', 'Receipt', '6', '1');
-INSERT INTO `0_sys_types` VALUES ('13', 'Delivery', '5', '2');
-INSERT INTO `0_sys_types` VALUES ('16', 'Location Transfer', '2', '1');
-INSERT INTO `0_sys_types` VALUES ('17', 'Inventory Adjustment', '2', '1');
-INSERT INTO `0_sys_types` VALUES ('18', 'Purchase Order', '1', '3');
-INSERT INTO `0_sys_types` VALUES ('20', 'Supplier Invoice', '8', '3');
-INSERT INTO `0_sys_types` VALUES ('21', 'Supplier Credit Note', '1', '1');
-INSERT INTO `0_sys_types` VALUES ('22', 'Supplier Payment', '4', '2');
-INSERT INTO `0_sys_types` VALUES ('25', 'Purchase Order Delivery', '1', '2');
-INSERT INTO `0_sys_types` VALUES ('26', 'Work Order', '1', '8');
-INSERT INTO `0_sys_types` VALUES ('28', 'Work Order Issue', '1', '1');
-INSERT INTO `0_sys_types` VALUES ('29', 'Work Order Production', '1', '2');
-INSERT INTO `0_sys_types` VALUES ('30', 'Sales Order', '1', '1');
-INSERT INTO `0_sys_types` VALUES ('35', 'Cost Update', '1', '1');
-INSERT INTO `0_sys_types` VALUES ('40', 'Dimension', '1', '3');
+INSERT INTO `0_sys_types` VALUES ('0', '19', '3');
+INSERT INTO `0_sys_types` VALUES ('1', '8', '2');
+INSERT INTO `0_sys_types` VALUES ('2', '5', '2');
+INSERT INTO `0_sys_types` VALUES ('4', '3', '1');
+INSERT INTO `0_sys_types` VALUES ('10', '19', '4');
+INSERT INTO `0_sys_types` VALUES ('11', '3', '2');
+INSERT INTO `0_sys_types` VALUES ('12', '6', '1');
+INSERT INTO `0_sys_types` VALUES ('13', '5', '2');
+INSERT INTO `0_sys_types` VALUES ('16', '2', '1');
+INSERT INTO `0_sys_types` VALUES ('17', '2', '1');
+INSERT INTO `0_sys_types` VALUES ('18', '1', '3');
+INSERT INTO `0_sys_types` VALUES ('20', '8', '3');
+INSERT INTO `0_sys_types` VALUES ('21', '1', '1');
+INSERT INTO `0_sys_types` VALUES ('22', '4', '2');
+INSERT INTO `0_sys_types` VALUES ('25', '1', '2');
+INSERT INTO `0_sys_types` VALUES ('26', '1', '8');
+INSERT INTO `0_sys_types` VALUES ('28', '1', '1');
+INSERT INTO `0_sys_types` VALUES ('29', '1', '2');
+INSERT INTO `0_sys_types` VALUES ('30', '5', '6');
+INSERT INTO `0_sys_types` VALUES ('32', '0', '1');
+INSERT INTO `0_sys_types` VALUES ('35', '1', '1');
+INSERT INTO `0_sys_types` VALUES ('40', '1', '3');
 
 
 ### Structure of table `0_tax_group_items` ###
@@ -1800,7 +1940,9 @@ CREATE TABLE `0_trans_tax_details` (
   `net_amount` double NOT NULL default '0',
   `amount` double NOT NULL default '0',
   `memo` tinytext,
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY `Type_and_Number` (`trans_type`,`trans_no`),
+  KEY (`tran_date`)
 ) TYPE=InnoDB AUTO_INCREMENT=12 ;
 
 
@@ -1827,7 +1969,7 @@ CREATE TABLE `0_users` (
   `user_id` varchar(60) NOT NULL default '',
   `password` varchar(100) NOT NULL default '',
   `real_name` varchar(100) NOT NULL default '',
-  `full_access` int(11) NOT NULL default '1',
+  `role_id` int(11) NOT NULL default '1',
   `phone` varchar(30) NOT NULL default '',
   `email` varchar(100) default NULL,
   `language` varchar(20) default NULL,
@@ -1861,7 +2003,7 @@ CREATE TABLE `0_users` (
 ### Data of table `0_users` ###
 
 INSERT INTO `0_users` VALUES ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@adm.com', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2009-01-30 09:39:03', '10', '1', '1', '1', '1', '0', 'orders', '0');
-INSERT INTO `0_users` VALUES ('2', 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '1', '999-999-999', 'demo@demo.nu', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '3', '1', '1', '0', '0', '2008-02-06 19:02:35', '10', '1', '1', '1', '1', '0', 'orders', '0');
+INSERT INTO `0_users` VALUES ('2', 'demouser', '5f4dcc3b5aa765d61d8327deb882cf99', 'Demo User', '9', '999-999-999', 'demo@demo.nu', 'en_US', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '3', '1', '1', '0', '0', '2008-02-06 19:02:35', '10', '1', '1', '1', '1', '0', 'orders', '0');
 
 ### Structure of table `0_voided` ###
 
@@ -1908,7 +2050,8 @@ CREATE TABLE `0_wo_issues` (
   `issue_date` date default NULL,
   `loc_code` varchar(5) default NULL,
   `workcentre_id` int(11) default NULL,
-  PRIMARY KEY  (`issue_no`)
+  PRIMARY KEY  (`issue_no`),
+  KEY (`workorder_id`)
 ) TYPE=InnoDB  AUTO_INCREMENT=1 ;
 
 
@@ -1926,7 +2069,8 @@ CREATE TABLE `0_wo_manufacture` (
   `workorder_id` int(11) NOT NULL default '0',
   `quantity` double NOT NULL default '0',
   `date_` date NOT NULL default '0000-00-00',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY (`workorder_id`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
@@ -1948,7 +2092,8 @@ CREATE TABLE `0_wo_requirements` (
   `std_cost` double NOT NULL default '0',
   `loc_code` char(5) NOT NULL default '',
   `units_issued` double NOT NULL default '0',
-  PRIMARY KEY  (`id`)
+  PRIMARY KEY  (`id`),
+  KEY (`workorder_id`)
 ) TYPE=InnoDB AUTO_INCREMENT=22 ;
 
 
@@ -2029,22 +2174,48 @@ INSERT INTO `0_workorders` VALUES ('5', '5', 'DEF', '5', '3400', '2009-06-21', '
 INSERT INTO `0_workorders` VALUES ('6', '6', 'DEF', '-5', '3400', '2009-06-21', '1', '2009-06-21', '2009-06-21', '-5', '1', '1', '0');
 INSERT INTO `0_workorders` VALUES ('7', '7', 'DEF', '-2', '3400', '2009-06-21', '1', '2009-06-21', '2009-06-21', '-2', '1', '1', '10');
 
-DROP TABLE IF EXISTS `0_security_roles`;
 
-CREATE TABLE `0_security_roles` (
+### Structure of table `0_tags` ###
+
+DROP TABLE IF EXISTS `0_tags`;
+
+CREATE TABLE `0_tags` (
   `id` int(11) NOT NULL auto_increment,
-  `role` varchar(20) NOT NULL,
-  `description` varchar(50) default NULL,
-  `modules` text,
-  `areas` text,
+  `type` smallint(6) NOT NULL,
+  `name` varchar(30) NOT NULL,
+  `description` varchar(60) default NULL,
   `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
-  UNIQUE KEY `role` (`role`)
-) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1 AUTO_INCREMENT=8 ;
+  UNIQUE KEY(`type`,`name`)
+) TYPE=MyISAM AUTO_INCREMENT=1;
+
+
+### Data of table `0_chart_tags` ###
+
+
+
+### Structure of table `0_tag_associations` ###
+
+DROP TABLE IF EXISTS `0_tag_associations`;
+
+CREATE TABLE `0_tag_associations` (
+  `record_id` varchar(11) NOT NULL,
+  `tag_id` int(11) NOT NULL,
+  UNIQUE KEY(`record_id`,`tag_id`)
+) TYPE=MyISAM;
+
+
+### Data of table `0_tag_associations` ###
 
+DROP TABLE IF EXISTS `0_useronline` ;
 
-### Data of table `0_security_roles` ###
+CREATE TABLE `0_useronline` (
+       `id` int(11) NOT NULL AUTO_INCREMENT ,
+       `timestamp` int(15) NOT NULL default '0',
+       `ip` varchar(40) NOT NULL default '',
+       `file` varchar(100) NOT NULL default '',
+       PRIMARY KEY `id` (`id`) ,
+       KEY (`timestamp`),
+       KEY(`ip`)
+) TYPE=MYISAM AUTO_INCREMENT=1;
 
-INSERT INTO `0_security_roles` VALUES ('2', 'System Admin', 'Full system access', '256;512;768;1024;1280;1536;1792', '257;258;259;260;261;262;263;264;267;268;269;270;271;272;277;278;279;280;513;523;524;525;526;527;533;534;535;536;769;770;771;772;773;774;775;776;777;779;780;789;790;791;799;800;801;1025;1026;1035;1036;1045;1046;1047;1281;1291;1301;1302;1303;1537;1538;1539;1540;1541;1542;1543;1547;1548;1549;1550;1551;1552;1557;1558;1559;1793;1794;1795;1796;1797;1798;1799;1800;1801;1802;1803;1804;1805;1806;1807;1808;1809;1810', '0');
-INSERT INTO `0_security_roles` VALUES ('7', 'Accountant', 'Accounting features and most non-admin options', '256;512;768;1024;1280;1536;1792', '257;258;263;264;267;268;269;270;271;272;277;278;279;280;513;523;524;525;526;527;533;534;535;536;769;770;771;772;773;774;775;776;777;779;780;789;790;791;799;800;801;1026;1045;1046;1047;1291;1301;1302;1538;1547;1548;1549;1550;1552;1557;1558;1559;1796;1804;1805', '0');
-INSERT INTO `0_security_roles` VALUES ('6', 'Sub Admin', 'Near full system access', '256;512;768;1024;1280;1536;1792', '257;258;263;264;267;268;269;270;271;272;277;278;279;280;513;523;524;525;526;527;533;534;535;536;769;770;771;772;773;774;775;776;777;779;780;789;790;791;799;800;801;1026;1045;1046;1047;1291;1301;1302;1538;1547;1548;1549;1550;1552;1557;1558;1559;1796;1804;1805', '0');