Merged changes from main trunk up to 2.2.5
[fa-stable.git] / sql / en_US-new.sql
index 0b50e244e67a8e9d4999fbb84ede6e2330fa36c3..d107e9ba6f096e0172d994380107b6fd4c0021b0 100644 (file)
@@ -58,7 +58,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` ###
@@ -84,7 +85,8 @@ CREATE TABLE `0_bank_accounts` (
   `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 ;
 
 
@@ -113,7 +115,9 @@ 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=1 ;
 
 
@@ -137,7 +141,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=1 ;
 
@@ -163,7 +166,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 ;
 
 
@@ -202,8 +206,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  ;
 
 
@@ -227,6 +231,7 @@ INSERT INTO `0_chart_master` VALUES ('2110', '', 'Accrued Income Tax - Federal',
 INSERT INTO `0_chart_master` VALUES ('2120', '', 'Accrued Income Tax - State', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2130', '', 'Accrued Franchise Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2140', '', 'Accrued Real & Personal Prop Tax', '4', '0');
+INSERT INTO `0_chart_master` VALUES ('2145', '', 'Purchase Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2150', '', 'Sales Tax', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2160', '', 'Accrued Use Tax Payable', '4', '0');
 INSERT INTO `0_chart_master` VALUES ('2210', '', 'Accrued Wages', '4', '0');
@@ -300,6 +305,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 ;
 
@@ -328,7 +334,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  ;
 
 
@@ -396,7 +403,6 @@ CREATE TABLE `0_company` (
   PRIMARY KEY  (`coy_code`)
 ) TYPE=MyISAM  ;
 
-
 ### Data of table `0_company` ###
 
 INSERT INTO `0_company` VALUES ('1', 'Company name', '', '', '1', '1', 'N/A', '', '', '', '', '', 'USD', '1200', '5060', '2100', '5690', '4450', '9990', '3590', '4430', '4010', '4510', '4500', '1510', '5010', '5040', '4010', '1530', '5000', '0', '10', '10', '1000', '20', '20', '30', '1', '1', '0', '0', '0', '1', '0', '0', '', '1', '2.2', '0', '-1', '1', '600');
@@ -457,7 +463,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=1 ;
 
 
@@ -496,7 +504,8 @@ CREATE TABLE `0_cust_branch` (
   `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=1 ;
 
 
@@ -530,8 +539,10 @@ 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`)
+  `payment_terms` int(11) default NULL,
+  PRIMARY KEY  (`type`, `trans_no`),
+  KEY `debtor_no` (`debtor_no`,`branch_code`),
+  KEY (`tran_date`)
 ) TYPE=InnoDB  ;
 
 
@@ -555,7 +566,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=1 ;
 
 
@@ -586,7 +598,8 @@ CREATE TABLE `0_debtors_master` (
   `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=1 ;
 
 
@@ -607,7 +620,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=1 ;
 
 
@@ -643,7 +659,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=2 ;
 
 
@@ -669,7 +687,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=1 ;
 
 
@@ -688,7 +710,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=1 ;
 
 
@@ -708,7 +732,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=1 ;
 
 
@@ -750,7 +775,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=1 ;
 
 
@@ -997,7 +1023,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=1 ;
 
 
@@ -1018,7 +1045,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=1 ;
 
 
@@ -1036,6 +1064,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 ;
@@ -1043,9 +1072,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` ###
@@ -1107,7 +1136,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  ;
 
 
@@ -1129,7 +1159,8 @@ CREATE TABLE `0_sales_order_details` (
   `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=1 ;
 
 
@@ -1161,6 +1192,7 @@ 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',
+  `payment_terms` int(11) default NULL,
   PRIMARY KEY  (`trans_type`, `order_no`)
 ) TYPE=InnoDB;
 
@@ -1253,16 +1285,16 @@ CREATE TABLE IF NOT EXISTS `0_security_roles` (
 -- 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;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;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;3075;3076;3077;3078;3079;3080;3081;3329;3330;3331;3332;3333;3334;3335;5377;5633;5634;5635;5636;5637;5638;5639;5640;5641;5889;5891;7937;7938;7939;7940;8193;8194;8195;8196;8197;8449;8450;8451;10497;10753;10754;10755;10756;10757;11009;11010;11012;13313;13314;13315;15617;15618;15619;15620;15621;15622;15623;15624;15625;15626;15873;15874;15875;15876;15877;15878;15879;15880;15881;15882;15883;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;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;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;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;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', '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;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(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;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', '521;523;524;771;772;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;5377;5633;5633;5634;5635;5637;5638;5639;5640;5640;5889;5891;8193;8194;8194;8196;8197;8449;8450;8451;10753;10755;11009;11010;11012;13313;13315;15617;15619;15620;15621;15624;15624;15873;15873;15874;15876;15877;15878;15879;15880;15882;16129;16129;16130;16130;16131;16132', 0);
+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;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` ###
 
@@ -1310,7 +1342,7 @@ DROP TABLE IF EXISTS `0_stock_category`;
 CREATE TABLE `0_stock_category` (
   `category_id` int(11) NOT NULL auto_increment,
   `description` varchar(60) NOT NULL default '',
-  `dflt_tax_type` int(11) NOT NULL default '0',
+  `dflt_tax_type` int(11) NOT NULL default '1',
   `dflt_units` varchar(20) NOT NULL default 'each',
   `dflt_mb_flag` char(1) NOT NULL default 'B',
   `dflt_sales_act` varchar(11) NOT NULL default '',
@@ -1361,6 +1393,7 @@ CREATE TABLE `0_stock_master` (
   `overhead_cost` double NOT NULL default '0',
   `inactive` tinyint(1) NOT NULL default '0',
   `no_sale` tinyint(1) NOT NULL default '0',
+  `editable` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`stock_id`)
 ) TYPE=InnoDB  ;
 
@@ -1388,7 +1421,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=1 ;
 
 
@@ -1408,7 +1442,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=1 ;
 
 
@@ -1433,7 +1469,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=1 ;
 
 
@@ -1458,10 +1495,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  ;
 
 
@@ -1499,13 +1537,81 @@ 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=1 ;
 
 
 ### Data of table `0_suppliers` ###
 
 
+### 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', 'Company name');
+INSERT INTO `0_sys_prefs` VALUES ('gst_no', 'setup.company', 'varchar', '25', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('coy_no', 'setup.company', 'varchar', '25', NULL);
+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', 'N/A');
+INSERT INTO `0_sys_prefs` VALUES ('phone', 'setup.company', 'varchar', '30', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('fax', 'setup.company', 'varchar', '30', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('email', 'setup.company', 'varchar', '100', NULL);
+INSERT INTO `0_sys_prefs` VALUES ('coy_logo', 'setup.company', 'varchar', '100', NULL);
+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', '1');
+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` ###
 
@@ -1593,14 +1699,13 @@ CREATE TABLE `0_tax_types` (
   `purchasing_gl_code` varchar(11) NOT NULL default '',
   `name` varchar(60) NOT NULL default '',
   `inactive` tinyint(1) NOT NULL default '0',
-  PRIMARY KEY  (`id`),
-  UNIQUE KEY `name` (`name`,`rate`)
+  PRIMARY KEY  (`id`)
 ) TYPE=InnoDB AUTO_INCREMENT=2 ;
 
 
 ### Data of table `0_tax_types` ###
 
-INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2150', 'Tax', '0');
+INSERT INTO `0_tax_types` VALUES ('1', '5', '2150', '2145', 'Tax', '0');
 
 
 ### Structure of table `0_trans_tax_details` ###
@@ -1619,7 +1724,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=1 ;
 
 
@@ -1716,7 +1823,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 ;
 
 
@@ -1734,7 +1842,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=1 ;
 
 
@@ -1755,7 +1864,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=1 ;
 
 
@@ -1815,7 +1925,9 @@ DROP TABLE IF EXISTS `0_tags`;
 CREATE TABLE `0_tags` (
   `id` int(11) NOT NULL auto_increment,
   `type` smallint(6) NOT NULL,
-  `name` varchar(60) NOT NULL,
+  `name` varchar(30) NOT NULL,
+  `description` varchar(60) default NULL,
+  `inactive` tinyint(1) NOT NULL default '0',
   PRIMARY KEY  (`id`),
   UNIQUE KEY(`type`,`name`)
 ) TYPE=MyISAM AUTO_INCREMENT=1;
@@ -1830,11 +1942,23 @@ CREATE TABLE `0_tags` (
 DROP TABLE IF EXISTS `0_tag_associations`;
 
 CREATE TABLE `0_tag_associations` (
-  `id` int(11) NOT NULL auto_increment,
   `record_id` varchar(11) NOT NULL,
   `tag_id` int(11) NOT NULL,
-  PRIMARY KEY  (`id`)
-) TYPE=MyISAM AUTO_INCREMENT=1;
+  UNIQUE KEY(`record_id`,`tag_id`)
+) TYPE=MyISAM;
 
 
 ### Data of table `0_tag_associations` ###
+
+DROP TABLE IF EXISTS `0_useronline` ;
+
+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;
+