Feature 5388: Print Invoices (documents) list gets too long. Fixed by default 180...
[fa-stable.git] / sql / en_US-new.sql
1 -- MySQL dump of database 'en_US-new' on host 'localhost'
2 -- Backup Date and Time: 2020-01-21 11:16
3 -- Built by FrontAccounting 2.4.7
4 -- http://frontaccounting.com
5 -- Company: Training Co.
6 -- User: Administrator
7
8 -- Compatibility: 2.4.1
9
10
11 SET NAMES latin1;
12
13
14 -- Structure of table `0_areas` --
15
16 DROP TABLE IF EXISTS `0_areas`;
17
18 CREATE TABLE `0_areas` (
19   `area_code` int(11) NOT NULL AUTO_INCREMENT,
20   `description` varchar(60) NOT NULL DEFAULT '',
21   `inactive` tinyint(1) NOT NULL DEFAULT '0',
22   PRIMARY KEY (`area_code`),
23   UNIQUE KEY `description` (`description`)
24 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
25
26 -- Data of table `0_areas` --
27
28 INSERT INTO `0_areas` VALUES
29 ('1', 'Global', '0');
30
31 -- Structure of table `0_attachments` --
32
33 DROP TABLE IF EXISTS `0_attachments`;
34
35 CREATE TABLE `0_attachments` (
36   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
37   `description` varchar(60) NOT NULL DEFAULT '',
38   `type_no` int(11) NOT NULL DEFAULT '0',
39   `trans_no` int(11) NOT NULL DEFAULT '0',
40   `unique_name` varchar(60) NOT NULL DEFAULT '',
41   `tran_date` date NOT NULL DEFAULT '0000-00-00',
42   `filename` varchar(60) NOT NULL DEFAULT '',
43   `filesize` int(11) NOT NULL DEFAULT '0',
44   `filetype` varchar(60) NOT NULL DEFAULT '',
45   PRIMARY KEY (`id`),
46   KEY `type_no` (`type_no`,`trans_no`)
47 ) ENGINE=InnoDB;
48
49 -- Data of table `0_attachments` --
50
51 -- Structure of table `0_audit_trail` --
52
53 DROP TABLE IF EXISTS `0_audit_trail`;
54
55 CREATE TABLE `0_audit_trail` (
56   `id` int(11) NOT NULL AUTO_INCREMENT,
57   `type` smallint(6) unsigned NOT NULL DEFAULT '0',
58   `trans_no` int(11) unsigned NOT NULL DEFAULT '0',
59   `user` smallint(6) unsigned NOT NULL DEFAULT '0',
60   `stamp` timestamp NOT NULL,
61   `description` varchar(60) DEFAULT NULL,
62   `fiscal_year` int(11) NOT NULL DEFAULT '0',
63   `gl_date` date NOT NULL DEFAULT '0000-00-00',
64   `gl_seq` int(11) unsigned DEFAULT NULL,
65   PRIMARY KEY (`id`),
66   KEY `Seq` (`fiscal_year`,`gl_date`,`gl_seq`),
67   KEY `Type_and_Number` (`type`,`trans_no`)
68 ) ENGINE=InnoDB;
69
70 -- Data of table `0_audit_trail` --
71
72 -- Structure of table `0_bank_accounts` --
73
74 DROP TABLE IF EXISTS `0_bank_accounts`;
75
76 CREATE TABLE `0_bank_accounts` (
77   `account_code` varchar(15) NOT NULL DEFAULT '',
78   `account_type` smallint(6) NOT NULL DEFAULT '0',
79   `bank_account_name` varchar(60) NOT NULL DEFAULT '',
80   `bank_account_number` varchar(100) NOT NULL DEFAULT '',
81   `bank_name` varchar(60) NOT NULL DEFAULT '',
82   `bank_address` tinytext,
83   `bank_curr_code` char(3) NOT NULL DEFAULT '',
84   `dflt_curr_act` tinyint(1) NOT NULL DEFAULT '0',
85   `id` smallint(6) NOT NULL AUTO_INCREMENT,
86   `bank_charge_act` varchar(15) NOT NULL DEFAULT '',
87   `last_reconciled_date` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
88   `ending_reconcile_balance` double NOT NULL DEFAULT '0',
89   `inactive` tinyint(1) NOT NULL DEFAULT '0',
90   PRIMARY KEY (`id`),
91   KEY `bank_account_name` (`bank_account_name`),
92   KEY `bank_account_number` (`bank_account_number`),
93   KEY `account_code` (`account_code`)
94 ) ENGINE=InnoDB AUTO_INCREMENT=3 ;
95
96 -- Data of table `0_bank_accounts` --
97
98 INSERT INTO `0_bank_accounts` VALUES
99 ('1060', '0', 'Current account', 'N/A', 'N/A', NULL, 'USD', '1', '1', '5690', '0000-00-00 00:00:00', '0', '0'),
100 ('1065', '3', 'Petty Cash account', 'N/A', 'N/A', NULL, 'USD', '0', '2', '5690', '0000-00-00 00:00:00', '0', '0');
101
102 -- Structure of table `0_bank_trans` --
103
104 DROP TABLE IF EXISTS `0_bank_trans`;
105
106 CREATE TABLE `0_bank_trans` (
107   `id` int(11) NOT NULL AUTO_INCREMENT,
108   `type` smallint(6) DEFAULT NULL,
109   `trans_no` int(11) DEFAULT NULL,
110   `bank_act` varchar(15) NOT NULL DEFAULT '',
111   `ref` varchar(40) DEFAULT NULL,
112   `trans_date` date NOT NULL DEFAULT '0000-00-00',
113   `amount` double DEFAULT NULL,
114   `dimension_id` int(11) NOT NULL DEFAULT '0',
115   `dimension2_id` int(11) NOT NULL DEFAULT '0',
116   `person_type_id` int(11) NOT NULL DEFAULT '0',
117   `person_id` tinyblob,
118   `reconciled` date DEFAULT NULL,
119   PRIMARY KEY (`id`),
120   KEY `bank_act` (`bank_act`,`ref`),
121   KEY `type` (`type`,`trans_no`),
122   KEY `bank_act_2` (`bank_act`,`reconciled`),
123   KEY `bank_act_3` (`bank_act`,`trans_date`)
124 ) ENGINE=InnoDB;
125
126 -- Data of table `0_bank_trans` --
127
128 -- Structure of table `0_bom` --
129
130 DROP TABLE IF EXISTS `0_bom`;
131
132 CREATE TABLE `0_bom` (
133   `id` int(11) NOT NULL AUTO_INCREMENT,
134   `parent` char(20) NOT NULL DEFAULT '',
135   `component` char(20) NOT NULL DEFAULT '',
136   `workcentre_added` int(11) NOT NULL DEFAULT '0',
137   `loc_code` char(5) NOT NULL DEFAULT '',
138   `quantity` double NOT NULL DEFAULT '1',
139   PRIMARY KEY (`parent`,`component`,`workcentre_added`,`loc_code`),
140   KEY `component` (`component`),
141   KEY `id` (`id`),
142   KEY `loc_code` (`loc_code`),
143   KEY `parent` (`parent`,`loc_code`),
144   KEY `workcentre_added` (`workcentre_added`)
145 ) ENGINE=InnoDB;
146
147 -- Data of table `0_bom` --
148
149 -- Structure of table `0_budget_trans` --
150
151 DROP TABLE IF EXISTS `0_budget_trans`;
152
153 CREATE TABLE `0_budget_trans` (
154   `id` int(11) NOT NULL AUTO_INCREMENT,
155   `tran_date` date NOT NULL DEFAULT '0000-00-00',
156   `account` varchar(15) NOT NULL DEFAULT '',
157   `memo_` tinytext NOT NULL,
158   `amount` double NOT NULL DEFAULT '0',
159   `dimension_id` int(11) DEFAULT '0',
160   `dimension2_id` int(11) DEFAULT '0',
161   PRIMARY KEY (`id`),
162   KEY `Account` (`account`,`tran_date`,`dimension_id`,`dimension2_id`)
163 ) ENGINE=InnoDB ;
164
165 -- Data of table `0_budget_trans` --
166
167 -- Structure of table `0_chart_class` --
168
169 DROP TABLE IF EXISTS `0_chart_class`;
170
171 CREATE TABLE `0_chart_class` (
172   `cid` varchar(3) NOT NULL,
173   `class_name` varchar(60) NOT NULL DEFAULT '',
174   `ctype` tinyint(1) NOT NULL DEFAULT '0',
175   `inactive` tinyint(1) NOT NULL DEFAULT '0',
176   PRIMARY KEY (`cid`)
177 ) ENGINE=InnoDB ;
178
179 -- Data of table `0_chart_class` --
180
181 INSERT INTO `0_chart_class` VALUES
182 ('1', 'Assets', '1', '0'),
183 ('2', 'Liabilities', '2', '0'),
184 ('3', 'Income', '4', '0'),
185 ('4', 'Costs', '6', '0');
186
187 -- Structure of table `0_chart_master` --
188
189 DROP TABLE IF EXISTS `0_chart_master`;
190
191 CREATE TABLE `0_chart_master` (
192   `account_code` varchar(15) NOT NULL DEFAULT '',
193   `account_code2` varchar(15) NOT NULL DEFAULT '',
194   `account_name` varchar(60) NOT NULL DEFAULT '',
195   `account_type` varchar(10) NOT NULL DEFAULT '0',
196   `inactive` tinyint(1) NOT NULL DEFAULT '0',
197   PRIMARY KEY (`account_code`),
198   KEY `account_name` (`account_name`),
199   KEY `accounts_by_type` (`account_type`,`account_code`)
200 ) ENGINE=InnoDB ;
201
202 -- Data of table `0_chart_master` --
203
204 INSERT INTO `0_chart_master` VALUES
205 ('1060', '', 'Checking Account', '1', '0'),
206 ('1065', '', 'Petty Cash', '1', '0'),
207 ('1200', '', 'Accounts Receivables', '1', '0'),
208 ('1205', '', 'Allowance for doubtful accounts', '1', '0'),
209 ('1510', '', 'Inventory', '2', '0'),
210 ('1520', '', 'Stocks of Raw Materials', '2', '0'),
211 ('1530', '', 'Stocks of Work In Progress', '2', '0'),
212 ('1540', '', 'Stocks of Finished Goods', '2', '0'),
213 ('1550', '', 'Goods Received Clearing account', '2', '0'),
214 ('1820', '', 'Office Furniture & Equipment', '3', '0'),
215 ('1825', '', 'Accum. Amort. -Furn. & Equip.', '3', '0'),
216 ('1840', '', 'Vehicle', '3', '0'),
217 ('1845', '', 'Accum. Amort. -Vehicle', '3', '0'),
218 ('2100', '', 'Accounts Payable', '4', '0'),
219 ('2105', '', 'Deferred Income', '4', '0'),
220 ('2110', '', 'Accrued Income Tax - Federal', '4', '0'),
221 ('2120', '', 'Accrued Income Tax - State', '4', '0'),
222 ('2130', '', 'Accrued Franchise Tax', '4', '0'),
223 ('2140', '', 'Accrued Real & Personal Prop Tax', '4', '0'),
224 ('2150', '', 'Sales Tax', '4', '0'),
225 ('2160', '', 'Accrued Use Tax Payable', '4', '0'),
226 ('2210', '', 'Accrued Wages', '4', '0'),
227 ('2220', '', 'Accrued Comp Time', '4', '0'),
228 ('2230', '', 'Accrued Holiday Pay', '4', '0'),
229 ('2240', '', 'Accrued Vacation Pay', '4', '0'),
230 ('2310', '', 'Accr. Benefits - 401K', '4', '0'),
231 ('2320', '', 'Accr. Benefits - Stock Purchase', '4', '0'),
232 ('2330', '', 'Accr. Benefits - Med, Den', '4', '0'),
233 ('2340', '', 'Accr. Benefits - Payroll Taxes', '4', '0'),
234 ('2350', '', 'Accr. Benefits - Credit Union', '4', '0'),
235 ('2360', '', 'Accr. Benefits - Savings Bond', '4', '0'),
236 ('2370', '', 'Accr. Benefits - Garnish', '4', '0'),
237 ('2380', '', 'Accr. Benefits - Charity Cont.', '4', '0'),
238 ('2620', '', 'Bank Loans', '5', '0'),
239 ('2680', '', 'Loans from Shareholders', '5', '0'),
240 ('3350', '', 'Common Shares', '6', '0'),
241 ('3590', '', 'Retained Earnings - prior years', '7', '0'),
242 ('4010', '', 'Sales', '8', '0'),
243 ('4430', '', 'Shipping & Handling', '9', '0'),
244 ('4440', '', 'Interest', '9', '0'),
245 ('4450', '', 'Foreign Exchange Gain', '9', '0'),
246 ('4500', '', 'Prompt Payment Discounts', '9', '0'),
247 ('4510', '', 'Discounts Given', '9', '0'),
248 ('5010', '', 'Cost of Goods Sold - Retail', '10', '0'),
249 ('5020', '', 'Material Usage Varaiance', '10', '0'),
250 ('5030', '', 'Consumable Materials', '10', '0'),
251 ('5040', '', 'Purchase price Variance', '10', '0'),
252 ('5050', '', 'Purchases of materials', '10', '0'),
253 ('5060', '', 'Discounts Received', '10', '0'),
254 ('5100', '', 'Freight', '10', '0'),
255 ('5410', '', 'Wages & Salaries', '11', '0'),
256 ('5420', '', 'Wages - Overtime', '11', '0'),
257 ('5430', '', 'Benefits - Comp Time', '11', '0'),
258 ('5440', '', 'Benefits - Payroll Taxes', '11', '0'),
259 ('5450', '', 'Benefits - Workers Comp', '11', '0'),
260 ('5460', '', 'Benefits - Pension', '11', '0'),
261 ('5470', '', 'Benefits - General Benefits', '11', '0'),
262 ('5510', '', 'Inc Tax Exp - Federal', '11', '0'),
263 ('5520', '', 'Inc Tax Exp - State', '11', '0'),
264 ('5530', '', 'Taxes - Real Estate', '11', '0'),
265 ('5540', '', 'Taxes - Personal Property', '11', '0'),
266 ('5550', '', 'Taxes - Franchise', '11', '0'),
267 ('5560', '', 'Taxes - Foreign Withholding', '11', '0'),
268 ('5610', '', 'Accounting & Legal', '12', '0'),
269 ('5615', '', 'Advertising & Promotions', '12', '0'),
270 ('5620', '', 'Bad Debts', '12', '0'),
271 ('5660', '', 'Amortization Expense', '12', '0'),
272 ('5685', '', 'Insurance', '12', '0'),
273 ('5690', '', 'Interest & Bank Charges', '12', '0'),
274 ('5700', '', 'Office Supplies', '12', '0'),
275 ('5760', '', 'Rent', '12', '0'),
276 ('5765', '', 'Repair & Maintenance', '12', '0'),
277 ('5780', '', 'Telephone', '12', '0'),
278 ('5785', '', 'Travel & Entertainment', '12', '0'),
279 ('5790', '', 'Utilities', '12', '0'),
280 ('5795', '', 'Registrations', '12', '0'),
281 ('5800', '', 'Licenses', '12', '0'),
282 ('5810', '', 'Foreign Exchange Loss', '12', '0'),
283 ('9990', '', 'Year Profit/Loss', '12', '0');
284
285 -- Structure of table `0_chart_types` --
286
287 DROP TABLE IF EXISTS `0_chart_types`;
288
289 CREATE TABLE `0_chart_types` (
290   `id` varchar(10) NOT NULL,
291   `name` varchar(60) NOT NULL DEFAULT '',
292   `class_id` varchar(3) NOT NULL DEFAULT '',
293   `parent` varchar(10) NOT NULL DEFAULT '-1',
294   `inactive` tinyint(1) NOT NULL DEFAULT '0',
295   PRIMARY KEY (`id`),
296   KEY `name` (`name`),
297   KEY `class_id` (`class_id`)
298 ) ENGINE=InnoDB ;
299
300 -- Data of table `0_chart_types` --
301
302 INSERT INTO `0_chart_types` VALUES
303 ('1', 'Current Assets', '1', '', '0'),
304 ('2', 'Inventory Assets', '1', '', '0'),
305 ('3', 'Capital Assets', '1', '', '0'),
306 ('4', 'Current Liabilities', '2', '', '0'),
307 ('5', 'Long Term Liabilities', '2', '', '0'),
308 ('6', 'Share Capital', '2', '', '0'),
309 ('7', 'Retained Earnings', '2', '', '0'),
310 ('8', 'Sales Revenue', '3', '', '0'),
311 ('9', 'Other Revenue', '3', '', '0'),
312 ('10', 'Cost of Goods Sold', '4', '', '0'),
313 ('11', 'Payroll Expenses', '4', '', '0'),
314 ('12', 'General & Administrative expenses', '4', '', '0');
315
316 -- Structure of table `0_comments` --
317
318 DROP TABLE IF EXISTS `0_comments`;
319
320 CREATE TABLE `0_comments` (
321   `type` int(11) NOT NULL DEFAULT '0',
322   `id` int(11) NOT NULL DEFAULT '0',
323   `date_` date DEFAULT '0000-00-00',
324   `memo_` tinytext,
325   KEY `type_and_id` (`type`,`id`)
326 ) ENGINE=InnoDB ;
327
328 -- Data of table `0_comments` --
329
330 -- Structure of table `0_credit_status` --
331
332 DROP TABLE IF EXISTS `0_credit_status`;
333
334 CREATE TABLE `0_credit_status` (
335   `id` int(11) NOT NULL AUTO_INCREMENT,
336   `reason_description` char(100) NOT NULL DEFAULT '',
337   `dissallow_invoices` tinyint(1) NOT NULL DEFAULT '0',
338   `inactive` tinyint(1) NOT NULL DEFAULT '0',
339   PRIMARY KEY (`id`),
340   UNIQUE KEY `reason_description` (`reason_description`)
341 ) ENGINE=InnoDB AUTO_INCREMENT=5 ;
342
343 -- Data of table `0_credit_status` --
344
345 INSERT INTO `0_credit_status` VALUES
346 ('1', 'Good History', '0', '0'),
347 ('3', 'No more work until payment received', '1', '0'),
348 ('4', 'In liquidation', '1', '0');
349
350 -- Structure of table `0_crm_categories` --
351
352 DROP TABLE IF EXISTS `0_crm_categories`;
353
354 CREATE TABLE `0_crm_categories` (
355   `id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'pure technical key',
356   `type` varchar(20) NOT NULL COMMENT 'contact type e.g. customer',
357   `action` varchar(20) NOT NULL COMMENT 'detailed usage e.g. department',
358   `name` varchar(30) NOT NULL COMMENT 'for category selector',
359   `description` tinytext NOT NULL COMMENT 'usage description',
360   `system` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'nonzero for core system usage',
361   `inactive` tinyint(1) NOT NULL DEFAULT '0',
362   PRIMARY KEY (`id`),
363   UNIQUE KEY `type` (`type`,`action`),
364   UNIQUE KEY `type_2` (`type`,`name`)
365 ) ENGINE=InnoDB AUTO_INCREMENT=13 ;
366
367 -- Data of table `0_crm_categories` --
368
369 INSERT INTO `0_crm_categories` VALUES
370 ('1', 'cust_branch', 'general', 'General', 'General contact data for customer branch (overrides company setting)', '1', '0'),
371 ('2', 'cust_branch', 'invoice', 'Invoices', 'Invoice posting (overrides company setting)', '1', '0'),
372 ('3', 'cust_branch', 'order', 'Orders', 'Order confirmation (overrides company setting)', '1', '0'),
373 ('4', 'cust_branch', 'delivery', 'Deliveries', 'Delivery coordination (overrides company setting)', '1', '0'),
374 ('5', 'customer', 'general', 'General', 'General contact data for customer', '1', '0'),
375 ('6', 'customer', 'order', 'Orders', 'Order confirmation', '1', '0'),
376 ('7', 'customer', 'delivery', 'Deliveries', 'Delivery coordination', '1', '0'),
377 ('8', 'customer', 'invoice', 'Invoices', 'Invoice posting', '1', '0'),
378 ('9', 'supplier', 'general', 'General', 'General contact data for supplier', '1', '0'),
379 ('10', 'supplier', 'order', 'Orders', 'Order confirmation', '1', '0'),
380 ('11', 'supplier', 'delivery', 'Deliveries', 'Delivery coordination', '1', '0'),
381 ('12', 'supplier', 'invoice', 'Invoices', 'Invoice posting', '1', '0');
382
383 -- Structure of table `0_crm_contacts` --
384
385 DROP TABLE IF EXISTS `0_crm_contacts`;
386
387 CREATE TABLE `0_crm_contacts` (
388   `id` int(11) NOT NULL AUTO_INCREMENT,
389   `person_id` int(11) NOT NULL DEFAULT '0' COMMENT 'foreign key to crm_persons',
390   `type` varchar(20) NOT NULL COMMENT 'foreign key to crm_categories',
391   `action` varchar(20) NOT NULL COMMENT 'foreign key to crm_categories',
392   `entity_id` varchar(11) DEFAULT NULL COMMENT 'entity id in related class table',
393   PRIMARY KEY (`id`),
394   KEY `type` (`type`,`action`)
395 ) ENGINE=InnoDB;
396
397 -- Data of table `0_crm_contacts` --
398
399 -- Structure of table `0_crm_persons` --
400
401 DROP TABLE IF EXISTS `0_crm_persons`;
402
403 CREATE TABLE `0_crm_persons` (
404   `id` int(11) NOT NULL AUTO_INCREMENT,
405   `ref` varchar(30) NOT NULL,
406   `name` varchar(60) NOT NULL,
407   `name2` varchar(60) DEFAULT NULL,
408   `address` tinytext,
409   `phone` varchar(30) DEFAULT NULL,
410   `phone2` varchar(30) DEFAULT NULL,
411   `fax` varchar(30) DEFAULT NULL,
412   `email` varchar(100) DEFAULT NULL,
413   `lang` char(5) DEFAULT NULL,
414   `notes` tinytext NOT NULL,
415   `inactive` tinyint(1) NOT NULL DEFAULT '0',
416   PRIMARY KEY (`id`),
417   KEY `ref` (`ref`)
418 ) ENGINE=InnoDB;
419
420 -- Data of table `0_crm_persons` --
421
422 -- Structure of table `0_currencies` --
423
424 DROP TABLE IF EXISTS `0_currencies`;
425
426 CREATE TABLE `0_currencies` (
427   `currency` varchar(60) NOT NULL DEFAULT '',
428   `curr_abrev` char(3) NOT NULL DEFAULT '',
429   `curr_symbol` varchar(10) NOT NULL DEFAULT '',
430   `country` varchar(100) NOT NULL DEFAULT '',
431   `hundreds_name` varchar(15) NOT NULL DEFAULT '',
432   `auto_update` tinyint(1) NOT NULL DEFAULT '1',
433   `inactive` tinyint(1) NOT NULL DEFAULT '0',
434   PRIMARY KEY (`curr_abrev`)
435 ) ENGINE=InnoDB ;
436
437 -- Data of table `0_currencies` --
438
439 INSERT INTO `0_currencies` VALUES
440 ('CA Dollars', 'CAD', '$', 'Canada', 'Cents', '1', '0'),
441 ('Euro', 'EUR', '€', 'Europe', 'Cents', '1', '0'),
442 ('Pounds', 'GBP', '£', 'England', 'Pence', '1', '0'),
443 ('US Dollars', 'USD', '$', 'United States', 'Cents', '1', '0');
444
445 -- Structure of table `0_cust_allocations` --
446
447 DROP TABLE IF EXISTS `0_cust_allocations`;
448
449 CREATE TABLE `0_cust_allocations` (
450   `id` int(11) NOT NULL AUTO_INCREMENT,
451   `person_id` int(11) DEFAULT NULL,
452   `amt` double unsigned DEFAULT NULL,
453   `date_alloc` date NOT NULL DEFAULT '0000-00-00',
454   `trans_no_from` int(11) DEFAULT NULL,
455   `trans_type_from` int(11) DEFAULT NULL,
456   `trans_no_to` int(11) DEFAULT NULL,
457   `trans_type_to` int(11) DEFAULT NULL,
458   PRIMARY KEY (`id`),
459   UNIQUE KEY `trans_type_from` (`person_id`,`trans_type_from`,`trans_no_from`,`trans_type_to`,`trans_no_to`),
460   KEY `From` (`trans_type_from`,`trans_no_from`),
461   KEY `To` (`trans_type_to`,`trans_no_to`)
462 ) ENGINE=InnoDB;
463
464 -- Data of table `0_cust_allocations` --
465
466 -- Structure of table `0_cust_branch` --
467
468 DROP TABLE IF EXISTS `0_cust_branch`;
469
470 CREATE TABLE `0_cust_branch` (
471   `branch_code` int(11) NOT NULL AUTO_INCREMENT,
472   `debtor_no` int(11) NOT NULL DEFAULT '0',
473   `br_name` varchar(60) NOT NULL DEFAULT '',
474   `branch_ref` varchar(30) NOT NULL DEFAULT '',
475   `br_address` tinytext NOT NULL,
476   `area` int(11) DEFAULT NULL,
477   `salesman` int(11) NOT NULL DEFAULT '0',
478   `default_location` varchar(5) NOT NULL DEFAULT '',
479   `tax_group_id` int(11) DEFAULT NULL,
480   `sales_account` varchar(15) NOT NULL DEFAULT '',
481   `sales_discount_account` varchar(15) NOT NULL DEFAULT '',
482   `receivables_account` varchar(15) NOT NULL DEFAULT '',
483   `payment_discount_account` varchar(15) NOT NULL DEFAULT '',
484   `default_ship_via` int(11) NOT NULL DEFAULT '1',
485   `br_post_address` tinytext NOT NULL,
486   `group_no` int(11) NOT NULL DEFAULT '0',
487   `notes` tinytext NOT NULL,
488   `bank_account` varchar(60) DEFAULT NULL,
489   `inactive` tinyint(1) NOT NULL DEFAULT '0',
490   PRIMARY KEY (`branch_code`,`debtor_no`),
491   KEY `branch_ref` (`branch_ref`),
492   KEY `group_no` (`group_no`)
493 ) ENGINE=InnoDB;
494
495 -- Data of table `0_cust_branch` --
496
497 -- Structure of table `0_debtor_trans` --
498
499 DROP TABLE IF EXISTS `0_debtor_trans`;
500
501 CREATE TABLE `0_debtor_trans` (
502   `trans_no` int(11) unsigned NOT NULL DEFAULT '0',
503   `type` smallint(6) unsigned NOT NULL DEFAULT '0',
504   `version` tinyint(1) unsigned NOT NULL DEFAULT '0',
505   `debtor_no` int(11) unsigned NOT NULL,
506   `branch_code` int(11) NOT NULL DEFAULT '-1',
507   `tran_date` date NOT NULL DEFAULT '0000-00-00',
508   `due_date` date NOT NULL DEFAULT '0000-00-00',
509   `reference` varchar(60) NOT NULL DEFAULT '',
510   `tpe` int(11) NOT NULL DEFAULT '0',
511   `order_` int(11) NOT NULL DEFAULT '0',
512   `ov_amount` double NOT NULL DEFAULT '0',
513   `ov_gst` double NOT NULL DEFAULT '0',
514   `ov_freight` double NOT NULL DEFAULT '0',
515   `ov_freight_tax` double NOT NULL DEFAULT '0',
516   `ov_discount` double NOT NULL DEFAULT '0',
517   `alloc` double NOT NULL DEFAULT '0',
518   `prep_amount` double NOT NULL DEFAULT '0',
519   `rate` double NOT NULL DEFAULT '1',
520   `ship_via` int(11) DEFAULT NULL,
521   `dimension_id` int(11) NOT NULL DEFAULT '0',
522   `dimension2_id` int(11) NOT NULL DEFAULT '0',
523   `payment_terms` int(11) DEFAULT NULL,
524   `tax_included` tinyint(1) unsigned NOT NULL DEFAULT '0',
525   PRIMARY KEY (`type`,`trans_no`,`debtor_no`),
526   KEY `debtor_no` (`debtor_no`,`branch_code`),
527   KEY `tran_date` (`tran_date`),
528   KEY `order_` (`order_`)
529 ) ENGINE=InnoDB ;
530
531 -- Data of table `0_debtor_trans` --
532
533 -- Structure of table `0_debtor_trans_details` --
534
535 DROP TABLE IF EXISTS `0_debtor_trans_details`;
536
537 CREATE TABLE `0_debtor_trans_details` (
538   `id` int(11) NOT NULL AUTO_INCREMENT,
539   `debtor_trans_no` int(11) DEFAULT NULL,
540   `debtor_trans_type` int(11) DEFAULT NULL,
541   `stock_id` varchar(20) NOT NULL DEFAULT '',
542   `description` tinytext,
543   `unit_price` double NOT NULL DEFAULT '0',
544   `unit_tax` double NOT NULL DEFAULT '0',
545   `quantity` double NOT NULL DEFAULT '0',
546   `discount_percent` double NOT NULL DEFAULT '0',
547   `standard_cost` double NOT NULL DEFAULT '0',
548   `qty_done` double NOT NULL DEFAULT '0',
549   `src_id` int(11) NOT NULL,
550   PRIMARY KEY (`id`),
551   KEY `Transaction` (`debtor_trans_type`,`debtor_trans_no`),
552   KEY `src_id` (`src_id`)
553 ) ENGINE=InnoDB;
554
555 -- Data of table `0_debtor_trans_details` --
556
557 -- Structure of table `0_debtors_master` --
558
559 DROP TABLE IF EXISTS `0_debtors_master`;
560
561 CREATE TABLE `0_debtors_master` (
562   `debtor_no` int(11) NOT NULL AUTO_INCREMENT,
563   `name` varchar(100) NOT NULL DEFAULT '',
564   `debtor_ref` varchar(30) NOT NULL,
565   `address` tinytext,
566   `tax_id` varchar(55) NOT NULL DEFAULT '',
567   `curr_code` char(3) NOT NULL DEFAULT '',
568   `sales_type` int(11) NOT NULL DEFAULT '1',
569   `dimension_id` int(11) NOT NULL DEFAULT '0',
570   `dimension2_id` int(11) NOT NULL DEFAULT '0',
571   `credit_status` int(11) NOT NULL DEFAULT '0',
572   `payment_terms` int(11) DEFAULT NULL,
573   `discount` double NOT NULL DEFAULT '0',
574   `pymt_discount` double NOT NULL DEFAULT '0',
575   `credit_limit` float NOT NULL DEFAULT '1000',
576   `notes` tinytext NOT NULL,
577   `inactive` tinyint(1) NOT NULL DEFAULT '0',
578   PRIMARY KEY (`debtor_no`),
579   UNIQUE KEY `debtor_ref` (`debtor_ref`),
580   KEY `name` (`name`)
581 ) ENGINE=InnoDB;
582
583 -- Data of table `0_debtors_master` --
584
585 -- Structure of table `0_dimensions` --
586
587 DROP TABLE IF EXISTS `0_dimensions`;
588
589 CREATE TABLE `0_dimensions` (
590   `id` int(11) NOT NULL AUTO_INCREMENT,
591   `reference` varchar(60) NOT NULL DEFAULT '',
592   `name` varchar(60) NOT NULL DEFAULT '',
593   `type_` tinyint(1) NOT NULL DEFAULT '1',
594   `closed` tinyint(1) NOT NULL DEFAULT '0',
595   `date_` date NOT NULL DEFAULT '0000-00-00',
596   `due_date` date NOT NULL DEFAULT '0000-00-00',
597   PRIMARY KEY (`id`),
598   UNIQUE KEY `reference` (`reference`),
599   KEY `date_` (`date_`),
600   KEY `due_date` (`due_date`),
601   KEY `type_` (`type_`)
602 ) ENGINE=InnoDB;
603
604 -- Data of table `0_dimensions` --
605
606 -- Structure of table `0_exchange_rates` --
607
608 DROP TABLE IF EXISTS `0_exchange_rates`;
609
610 CREATE TABLE `0_exchange_rates` (
611   `id` int(11) NOT NULL AUTO_INCREMENT,
612   `curr_code` char(3) NOT NULL DEFAULT '',
613   `rate_buy` double NOT NULL DEFAULT '0',
614   `rate_sell` double NOT NULL DEFAULT '0',
615   `date_` date NOT NULL DEFAULT '0000-00-00',
616   PRIMARY KEY (`id`),
617   UNIQUE KEY `curr_code` (`curr_code`,`date_`)
618 ) ENGINE=InnoDB;
619
620 -- Data of table `0_exchange_rates` --
621
622 -- Structure of table `0_fiscal_year` --
623
624 DROP TABLE IF EXISTS `0_fiscal_year`;
625
626 CREATE TABLE `0_fiscal_year` (
627   `id` int(11) NOT NULL AUTO_INCREMENT,
628   `begin` date DEFAULT '0000-00-00',
629   `end` date DEFAULT '0000-00-00',
630   `closed` tinyint(1) NOT NULL DEFAULT '0',
631   PRIMARY KEY (`id`),
632   UNIQUE KEY `begin` (`begin`),
633   UNIQUE KEY `end` (`end`)
634 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
635
636 -- Data of table `0_fiscal_year` --
637
638 INSERT INTO `0_fiscal_year` VALUES
639 ('1', '2019-01-01', '2019-12-31', '1');
640
641 -- Structure of table `0_gl_trans` --
642
643 DROP TABLE IF EXISTS `0_gl_trans`;
644
645 CREATE TABLE `0_gl_trans` (
646   `counter` int(11) NOT NULL AUTO_INCREMENT,
647   `type` smallint(6) NOT NULL DEFAULT '0',
648   `type_no` int(11) NOT NULL DEFAULT '0',
649   `tran_date` date NOT NULL DEFAULT '0000-00-00',
650   `account` varchar(15) NOT NULL DEFAULT '',
651   `memo_` tinytext NOT NULL,
652   `amount` double NOT NULL DEFAULT '0',
653   `dimension_id` int(11) NOT NULL DEFAULT '0',
654   `dimension2_id` int(11) NOT NULL DEFAULT '0',
655   `person_type_id` int(11) DEFAULT NULL,
656   `person_id` tinyblob,
657   PRIMARY KEY (`counter`),
658   KEY `Type_and_Number` (`type`,`type_no`),
659   KEY `dimension_id` (`dimension_id`),
660   KEY `dimension2_id` (`dimension2_id`),
661   KEY `tran_date` (`tran_date`),
662   KEY `account_and_tran_date` (`account`,`tran_date`)
663 ) ENGINE=InnoDB;
664
665 -- Data of table `0_gl_trans` --
666
667 -- Structure of table `0_grn_batch` --
668
669 DROP TABLE IF EXISTS `0_grn_batch`;
670
671 CREATE TABLE `0_grn_batch` (
672   `id` int(11) NOT NULL AUTO_INCREMENT,
673   `supplier_id` int(11) NOT NULL DEFAULT '0',
674   `purch_order_no` int(11) DEFAULT NULL,
675   `reference` varchar(60) NOT NULL DEFAULT '',
676   `delivery_date` date NOT NULL DEFAULT '0000-00-00',
677   `loc_code` varchar(5) DEFAULT NULL,
678   `rate` double DEFAULT '1',
679   PRIMARY KEY (`id`),
680   KEY `delivery_date` (`delivery_date`),
681   KEY `purch_order_no` (`purch_order_no`)
682 ) ENGINE=InnoDB;
683
684 -- Data of table `0_grn_batch` --
685
686 -- Structure of table `0_grn_items` --
687
688 DROP TABLE IF EXISTS `0_grn_items`;
689
690 CREATE TABLE `0_grn_items` (
691   `id` int(11) NOT NULL AUTO_INCREMENT,
692   `grn_batch_id` int(11) DEFAULT NULL,
693   `po_detail_item` int(11) NOT NULL DEFAULT '0',
694   `item_code` varchar(20) NOT NULL DEFAULT '',
695   `description` tinytext,
696   `qty_recd` double NOT NULL DEFAULT '0',
697   `quantity_inv` double NOT NULL DEFAULT '0',
698   PRIMARY KEY (`id`),
699   KEY `grn_batch_id` (`grn_batch_id`)
700 ) ENGINE=InnoDB;
701
702 -- Data of table `0_grn_items` --
703
704 -- Structure of table `0_groups` --
705
706 DROP TABLE IF EXISTS `0_groups`;
707
708 CREATE TABLE `0_groups` (
709   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
710   `description` varchar(60) NOT NULL DEFAULT '',
711   `inactive` tinyint(1) NOT NULL DEFAULT '0',
712   PRIMARY KEY (`id`),
713   UNIQUE KEY `description` (`description`)
714 ) ENGINE=InnoDB AUTO_INCREMENT=4 ;
715
716 -- Data of table `0_groups` --
717
718 INSERT INTO `0_groups` VALUES
719 ('1', 'Small', '0'),
720 ('2', 'Medium', '0'),
721 ('3', 'Large', '0');
722
723 -- Structure of table `0_item_codes` --
724
725 DROP TABLE IF EXISTS `0_item_codes`;
726
727 CREATE TABLE `0_item_codes` (
728   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
729   `item_code` varchar(20) NOT NULL,
730   `stock_id` varchar(20) NOT NULL,
731   `description` varchar(200) NOT NULL DEFAULT '',
732   `category_id` smallint(6) unsigned NOT NULL,
733   `quantity` double NOT NULL DEFAULT '1',
734   `is_foreign` tinyint(1) NOT NULL DEFAULT '0',
735   `inactive` tinyint(1) NOT NULL DEFAULT '0',
736   PRIMARY KEY (`id`),
737   UNIQUE KEY `stock_id` (`stock_id`,`item_code`),
738   KEY `item_code` (`item_code`)
739 ) ENGINE=InnoDB;
740
741 -- Data of table `0_item_codes` --
742
743 -- Structure of table `0_item_tax_type_exemptions` --
744
745 DROP TABLE IF EXISTS `0_item_tax_type_exemptions`;
746
747 CREATE TABLE `0_item_tax_type_exemptions` (
748   `item_tax_type_id` int(11) NOT NULL DEFAULT '0',
749   `tax_type_id` int(11) NOT NULL DEFAULT '0',
750   PRIMARY KEY (`item_tax_type_id`,`tax_type_id`)
751 ) ENGINE=InnoDB;
752
753 -- Data of table `0_item_tax_type_exemptions` --
754
755 -- Structure of table `0_item_tax_types` --
756
757 DROP TABLE IF EXISTS `0_item_tax_types`;
758
759 CREATE TABLE `0_item_tax_types` (
760   `id` int(11) NOT NULL AUTO_INCREMENT,
761   `name` varchar(60) NOT NULL DEFAULT '',
762   `exempt` tinyint(1) NOT NULL DEFAULT '0',
763   `inactive` tinyint(1) NOT NULL DEFAULT '0',
764   PRIMARY KEY (`id`),
765   UNIQUE KEY `name` (`name`)
766 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
767
768 -- Data of table `0_item_tax_types` --
769
770 INSERT INTO `0_item_tax_types` VALUES
771 ('1', 'Regular', '0', '0');
772
773 -- Structure of table `0_item_units` --
774
775 DROP TABLE IF EXISTS `0_item_units`;
776
777 CREATE TABLE `0_item_units` (
778   `abbr` varchar(20) NOT NULL,
779   `name` varchar(40) NOT NULL,
780   `decimals` tinyint(2) NOT NULL,
781   `inactive` tinyint(1) NOT NULL DEFAULT '0',
782   PRIMARY KEY (`abbr`),
783   UNIQUE KEY `name` (`name`)
784 ) ENGINE=InnoDB ;
785
786 -- Data of table `0_item_units` --
787
788 INSERT INTO `0_item_units` VALUES
789 ('each', 'Each', '0', '0'),
790 ('hr', 'Hours', '0', '0');
791
792 -- Structure of table `0_journal` --
793
794 DROP TABLE IF EXISTS `0_journal`;
795
796 CREATE TABLE `0_journal` (
797   `type` smallint(6) NOT NULL DEFAULT '0',
798   `trans_no` int(11) NOT NULL DEFAULT '0',
799   `tran_date` date DEFAULT '0000-00-00',
800   `reference` varchar(60) NOT NULL DEFAULT '',
801   `source_ref` varchar(60) NOT NULL DEFAULT '',
802   `event_date` date DEFAULT '0000-00-00',
803   `doc_date` date NOT NULL DEFAULT '0000-00-00',
804   `currency` char(3) NOT NULL DEFAULT '',
805   `amount` double NOT NULL DEFAULT '0',
806   `rate` double NOT NULL DEFAULT '1',
807   PRIMARY KEY (`type`,`trans_no`),
808   KEY `tran_date` (`tran_date`)
809 ) ENGINE=InnoDB ;
810
811 -- Data of table `0_journal` --
812
813 -- Structure of table `0_loc_stock` --
814
815 DROP TABLE IF EXISTS `0_loc_stock`;
816
817 CREATE TABLE `0_loc_stock` (
818   `loc_code` char(5) NOT NULL DEFAULT '',
819   `stock_id` char(20) NOT NULL DEFAULT '',
820   `reorder_level` double NOT NULL DEFAULT '0',
821   PRIMARY KEY (`loc_code`,`stock_id`),
822   KEY `stock_id` (`stock_id`)
823 ) ENGINE=InnoDB ;
824
825 -- Data of table `0_loc_stock` --
826
827 -- Structure of table `0_locations` --
828
829 DROP TABLE IF EXISTS `0_locations`;
830
831 CREATE TABLE `0_locations` (
832   `loc_code` varchar(5) NOT NULL DEFAULT '',
833   `location_name` varchar(60) NOT NULL DEFAULT '',
834   `delivery_address` tinytext NOT NULL,
835   `phone` varchar(30) NOT NULL DEFAULT '',
836   `phone2` varchar(30) NOT NULL DEFAULT '',
837   `fax` varchar(30) NOT NULL DEFAULT '',
838   `email` varchar(100) NOT NULL DEFAULT '',
839   `contact` varchar(30) NOT NULL DEFAULT '',
840   `fixed_asset` tinyint(1) NOT NULL DEFAULT '0',
841   `inactive` tinyint(1) NOT NULL DEFAULT '0',
842   PRIMARY KEY (`loc_code`)
843 ) ENGINE=InnoDB ;
844
845 -- Data of table `0_locations` --
846
847 INSERT INTO `0_locations` VALUES
848 ('DEF', 'Default', 'N/A', '', '', '', '', '', '0', '0');
849
850 -- Structure of table `0_payment_terms` --
851
852 DROP TABLE IF EXISTS `0_payment_terms`;
853
854 CREATE TABLE `0_payment_terms` (
855   `terms_indicator` int(11) NOT NULL AUTO_INCREMENT,
856   `terms` char(80) NOT NULL DEFAULT '',
857   `days_before_due` smallint(6) NOT NULL DEFAULT '0',
858   `day_in_following_month` smallint(6) NOT NULL DEFAULT '0',
859   `inactive` tinyint(1) NOT NULL DEFAULT '0',
860   PRIMARY KEY (`terms_indicator`),
861   UNIQUE KEY `terms` (`terms`)
862 ) ENGINE=InnoDB AUTO_INCREMENT=6 ;
863
864 -- Data of table `0_payment_terms` --
865
866 INSERT INTO `0_payment_terms` VALUES
867 ('1', 'Due 15th Of the Following Month', '0', '17', '0'),
868 ('2', 'Due By End Of The Following Month', '0', '30', '0'),
869 ('3', 'Payment due within 10 days', '10', '0', '0'),
870 ('4', 'Cash Only', '0', '0', '0'),
871 ('5', 'Prepaid', '-1', '0', '0');
872
873 -- Structure of table `0_prices` --
874
875 DROP TABLE IF EXISTS `0_prices`;
876
877 CREATE TABLE `0_prices` (
878   `id` int(11) NOT NULL AUTO_INCREMENT,
879   `stock_id` varchar(20) NOT NULL DEFAULT '',
880   `sales_type_id` int(11) NOT NULL DEFAULT '0',
881   `curr_abrev` char(3) NOT NULL DEFAULT '',
882   `price` double NOT NULL DEFAULT '0',
883   PRIMARY KEY (`id`),
884   UNIQUE KEY `price` (`stock_id`,`sales_type_id`,`curr_abrev`)
885 ) ENGINE=InnoDB;
886
887 -- Data of table `0_prices` --
888
889 -- Structure of table `0_print_profiles` --
890
891 DROP TABLE IF EXISTS `0_print_profiles`;
892
893 CREATE TABLE `0_print_profiles` (
894   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
895   `profile` varchar(30) NOT NULL,
896   `report` varchar(5) DEFAULT NULL,
897   `printer` tinyint(3) unsigned DEFAULT NULL,
898   PRIMARY KEY (`id`),
899   UNIQUE KEY `profile` (`profile`,`report`)
900 ) ENGINE=InnoDB AUTO_INCREMENT=10 ;
901
902 -- Data of table `0_print_profiles` --
903
904 INSERT INTO `0_print_profiles` VALUES
905 ('1', 'Out of office', NULL, '0'),
906 ('2', 'Sales Department', NULL, '0'),
907 ('3', 'Central', NULL, '2'),
908 ('4', 'Sales Department', '104', '2'),
909 ('5', 'Sales Department', '105', '2'),
910 ('6', 'Sales Department', '107', '2'),
911 ('7', 'Sales Department', '109', '2'),
912 ('8', 'Sales Department', '110', '2'),
913 ('9', 'Sales Department', '201', '2');
914
915 -- Structure of table `0_printers` --
916
917 DROP TABLE IF EXISTS `0_printers`;
918
919 CREATE TABLE `0_printers` (
920   `id` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
921   `name` varchar(20) NOT NULL,
922   `description` varchar(60) NOT NULL,
923   `queue` varchar(20) NOT NULL,
924   `host` varchar(40) NOT NULL,
925   `port` smallint(11) unsigned NOT NULL,
926   `timeout` tinyint(3) unsigned NOT NULL,
927   PRIMARY KEY (`id`),
928   UNIQUE KEY `name` (`name`)
929 ) ENGINE=InnoDB AUTO_INCREMENT=4 ;
930
931 -- Data of table `0_printers` --
932
933 INSERT INTO `0_printers` VALUES
934 ('1', 'QL500', 'Label printer', 'QL500', 'server', '127', '20'),
935 ('2', 'Samsung', 'Main network printer', 'scx4521F', 'server', '515', '5'),
936 ('3', 'Local', 'Local print server at user IP', 'lp', '', '515', '10');
937
938 -- Structure of table `0_purch_data` --
939
940 DROP TABLE IF EXISTS `0_purch_data`;
941
942 CREATE TABLE `0_purch_data` (
943   `supplier_id` int(11) NOT NULL DEFAULT '0',
944   `stock_id` char(20) NOT NULL DEFAULT '',
945   `price` double NOT NULL DEFAULT '0',
946   `suppliers_uom` char(50) NOT NULL DEFAULT '',
947   `conversion_factor` double NOT NULL DEFAULT '1',
948   `supplier_description` char(50) NOT NULL DEFAULT '',
949   PRIMARY KEY (`supplier_id`,`stock_id`)
950 ) ENGINE=InnoDB;
951
952 -- Data of table `0_purch_data` --
953
954 -- Structure of table `0_purch_order_details` --
955
956 DROP TABLE IF EXISTS `0_purch_order_details`;
957
958 CREATE TABLE `0_purch_order_details` (
959   `po_detail_item` int(11) NOT NULL AUTO_INCREMENT,
960   `order_no` int(11) NOT NULL DEFAULT '0',
961   `item_code` varchar(20) NOT NULL DEFAULT '',
962   `description` tinytext,
963   `delivery_date` date NOT NULL DEFAULT '0000-00-00',
964   `qty_invoiced` double NOT NULL DEFAULT '0',
965   `unit_price` double NOT NULL DEFAULT '0',
966   `act_price` double NOT NULL DEFAULT '0',
967   `std_cost_unit` double NOT NULL DEFAULT '0',
968   `quantity_ordered` double NOT NULL DEFAULT '0',
969   `quantity_received` double NOT NULL DEFAULT '0',
970   PRIMARY KEY (`po_detail_item`),
971   KEY `order` (`order_no`,`po_detail_item`),
972   KEY `itemcode` (`item_code`)
973 ) ENGINE=InnoDB;
974
975 -- Data of table `0_purch_order_details` --
976
977 -- Structure of table `0_purch_orders` --
978
979 DROP TABLE IF EXISTS `0_purch_orders`;
980
981 CREATE TABLE `0_purch_orders` (
982   `order_no` int(11) NOT NULL AUTO_INCREMENT,
983   `supplier_id` int(11) NOT NULL DEFAULT '0',
984   `comments` tinytext,
985   `ord_date` date NOT NULL DEFAULT '0000-00-00',
986   `reference` tinytext NOT NULL,
987   `requisition_no` tinytext,
988   `into_stock_location` varchar(5) NOT NULL DEFAULT '',
989   `delivery_address` tinytext NOT NULL,
990   `total` double NOT NULL DEFAULT '0',
991   `prep_amount` double NOT NULL DEFAULT '0',
992   `alloc` double NOT NULL DEFAULT '0',
993   `tax_included` tinyint(1) NOT NULL DEFAULT '0',
994   PRIMARY KEY (`order_no`),
995   KEY `ord_date` (`ord_date`)
996 ) ENGINE=InnoDB;
997
998 -- Data of table `0_purch_orders` --
999
1000 -- Structure of table `0_quick_entries` --
1001
1002 DROP TABLE IF EXISTS `0_quick_entries`;
1003
1004 CREATE TABLE `0_quick_entries` (
1005   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
1006   `type` tinyint(1) NOT NULL DEFAULT '0',
1007   `description` varchar(60) NOT NULL,
1008   `usage` varchar(120) DEFAULT NULL,
1009   `base_amount` double NOT NULL DEFAULT '0',
1010   `base_desc` varchar(60) DEFAULT NULL,
1011   `bal_type` tinyint(1) NOT NULL DEFAULT '0',
1012   PRIMARY KEY (`id`),
1013   KEY `description` (`description`)
1014 ) ENGINE=InnoDB AUTO_INCREMENT=4 ;
1015
1016 -- Data of table `0_quick_entries` --
1017
1018 INSERT INTO `0_quick_entries` VALUES
1019 ('1', '1', 'Maintenance', NULL, '0', 'Amount', '0'),
1020 ('2', '4', 'Phone', NULL, '0', 'Amount', '0'),
1021 ('3', '2', 'Cash Sales', 'Retail sales without invoice', '0', 'Amount', '0');
1022
1023 -- Structure of table `0_quick_entry_lines` --
1024
1025 DROP TABLE IF EXISTS `0_quick_entry_lines`;
1026
1027 CREATE TABLE `0_quick_entry_lines` (
1028   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
1029   `qid` smallint(6) unsigned NOT NULL,
1030   `amount` double DEFAULT '0',
1031   `memo` tinytext NOT NULL,
1032   `action` varchar(2) NOT NULL,
1033   `dest_id` varchar(15) NOT NULL DEFAULT '',
1034   `dimension_id` smallint(6) unsigned DEFAULT NULL,
1035   `dimension2_id` smallint(6) unsigned DEFAULT NULL,
1036   PRIMARY KEY (`id`),
1037   KEY `qid` (`qid`)
1038 ) ENGINE=InnoDB AUTO_INCREMENT=7 ;
1039
1040 -- Data of table `0_quick_entry_lines` --
1041
1042 INSERT INTO `0_quick_entry_lines` VALUES
1043 ('1', '1', '0', '', 't-', '1', '0', '0'),
1044 ('2', '2', '0', '', 't-', '1', '0', '0'),
1045 ('3', '3', '0', '', 't-', '1', '0', '0'),
1046 ('4', '3', '0', '', '=', '4010', '0', '0'),
1047 ('5', '1', '0', '', '=', '5765', '0', '0'),
1048 ('6', '2', '0', '', '=', '5780', '0', '0');
1049
1050 -- Structure of table `0_recurrent_invoices` --
1051
1052 DROP TABLE IF EXISTS `0_recurrent_invoices`;
1053
1054 CREATE TABLE `0_recurrent_invoices` (
1055   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
1056   `description` varchar(60) NOT NULL DEFAULT '',
1057   `order_no` int(11) unsigned NOT NULL,
1058   `debtor_no` int(11) unsigned DEFAULT NULL,
1059   `group_no` smallint(6) unsigned DEFAULT NULL,
1060   `days` int(11) NOT NULL DEFAULT '0',
1061   `monthly` int(11) NOT NULL DEFAULT '0',
1062   `begin` date NOT NULL DEFAULT '0000-00-00',
1063   `end` date NOT NULL DEFAULT '0000-00-00',
1064   `last_sent` date NOT NULL DEFAULT '0000-00-00',
1065   PRIMARY KEY (`id`),
1066   UNIQUE KEY `description` (`description`)
1067 ) ENGINE=InnoDB;
1068
1069 -- Data of table `0_recurrent_invoices` --
1070
1071 -- Structure of table `0_reflines` --
1072
1073 DROP TABLE IF EXISTS `0_reflines`;
1074
1075 CREATE TABLE `0_reflines` (
1076   `id` int(11) NOT NULL AUTO_INCREMENT,
1077   `trans_type` int(11) NOT NULL,
1078   `prefix` char(5) NOT NULL DEFAULT '',
1079   `pattern` varchar(35) NOT NULL DEFAULT '1',
1080   `description` varchar(60) NOT NULL DEFAULT '',
1081   `default` tinyint(1) NOT NULL DEFAULT '0',
1082   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1083   PRIMARY KEY (`id`),
1084   UNIQUE KEY `prefix` (`trans_type`,`prefix`)
1085 ) ENGINE=InnoDB AUTO_INCREMENT=23 ;
1086
1087 -- Data of table `0_reflines` --
1088
1089 INSERT INTO `0_reflines` VALUES
1090 ('1', '0', '', '{001}/{YYYY}', '', '1', '0'),
1091 ('2', '1', '', '{001}/{YYYY}', '', '1', '0'),
1092 ('3', '2', '', '{001}/{YYYY}', '', '1', '0'),
1093 ('4', '4', '', '{001}/{YYYY}', '', '1', '0'),
1094 ('5', '10', '', '{001}/{YYYY}', '', '1', '0'),
1095 ('6', '11', '', '{001}/{YYYY}', '', '1', '0'),
1096 ('7', '12', '', '{001}/{YYYY}', '', '1', '0'),
1097 ('8', '13', '', '{001}/{YYYY}', '', '1', '0'),
1098 ('9', '16', '', '{001}/{YYYY}', '', '1', '0'),
1099 ('10', '17', '', '{001}/{YYYY}', '', '1', '0'),
1100 ('11', '18', '', '{001}/{YYYY}', '', '1', '0'),
1101 ('12', '20', '', '{001}/{YYYY}', '', '1', '0'),
1102 ('13', '21', '', '{001}/{YYYY}', '', '1', '0'),
1103 ('14', '22', '', '{001}/{YYYY}', '', '1', '0'),
1104 ('15', '25', '', '{001}/{YYYY}', '', '1', '0'),
1105 ('16', '26', '', '{001}/{YYYY}', '', '1', '0'),
1106 ('17', '28', '', '{001}/{YYYY}', '', '1', '0'),
1107 ('18', '29', '', '{001}/{YYYY}', '', '1', '0'),
1108 ('19', '30', '', '{001}/{YYYY}', '', '1', '0'),
1109 ('20', '32', '', '{001}/{YYYY}', '', '1', '0'),
1110 ('21', '35', '', '{001}/{YYYY}', '', '1', '0'),
1111 ('22', '40', '', '{001}/{YYYY}', '', '1', '0');
1112
1113 -- Structure of table `0_refs` --
1114
1115 DROP TABLE IF EXISTS `0_refs`;
1116
1117 CREATE TABLE `0_refs` (
1118   `id` int(11) NOT NULL DEFAULT '0',
1119   `type` int(11) NOT NULL DEFAULT '0',
1120   `reference` varchar(100) NOT NULL DEFAULT '',
1121   PRIMARY KEY (`id`,`type`),
1122   KEY `Type_and_Reference` (`type`,`reference`)
1123 ) ENGINE=InnoDB;
1124
1125 -- Data of table `0_refs` --
1126
1127 -- Structure of table `0_sales_order_details` --
1128
1129 DROP TABLE IF EXISTS `0_sales_order_details`;
1130
1131 CREATE TABLE `0_sales_order_details` (
1132   `id` int(11) NOT NULL AUTO_INCREMENT,
1133   `order_no` int(11) NOT NULL DEFAULT '0',
1134   `trans_type` smallint(6) NOT NULL DEFAULT '30',
1135   `stk_code` varchar(20) NOT NULL DEFAULT '',
1136   `description` tinytext,
1137   `qty_sent` double NOT NULL DEFAULT '0',
1138   `unit_price` double NOT NULL DEFAULT '0',
1139   `quantity` double NOT NULL DEFAULT '0',
1140   `invoiced` double NOT NULL DEFAULT '0',
1141   `discount_percent` double NOT NULL DEFAULT '0',
1142   PRIMARY KEY (`id`),
1143   KEY `sorder` (`trans_type`,`order_no`),
1144   KEY `stkcode` (`stk_code`)
1145 ) ENGINE=InnoDB;
1146
1147 -- Data of table `0_sales_order_details` --
1148
1149 -- Structure of table `0_sales_orders` --
1150
1151 DROP TABLE IF EXISTS `0_sales_orders`;
1152
1153 CREATE TABLE `0_sales_orders` (
1154   `order_no` int(11) NOT NULL,
1155   `trans_type` smallint(6) NOT NULL DEFAULT '30',
1156   `version` tinyint(1) unsigned NOT NULL DEFAULT '0',
1157   `type` tinyint(1) NOT NULL DEFAULT '0',
1158   `debtor_no` int(11) NOT NULL DEFAULT '0',
1159   `branch_code` int(11) NOT NULL DEFAULT '0',
1160   `reference` varchar(100) NOT NULL DEFAULT '',
1161   `customer_ref` tinytext NOT NULL,
1162   `comments` tinytext,
1163   `ord_date` date NOT NULL DEFAULT '0000-00-00',
1164   `order_type` int(11) NOT NULL DEFAULT '0',
1165   `ship_via` int(11) NOT NULL DEFAULT '0',
1166   `delivery_address` tinytext NOT NULL,
1167   `contact_phone` varchar(30) DEFAULT NULL,
1168   `contact_email` varchar(100) DEFAULT NULL,
1169   `deliver_to` tinytext NOT NULL,
1170   `freight_cost` double NOT NULL DEFAULT '0',
1171   `from_stk_loc` varchar(5) NOT NULL DEFAULT '',
1172   `delivery_date` date NOT NULL DEFAULT '0000-00-00',
1173   `payment_terms` int(11) DEFAULT NULL,
1174   `total` double NOT NULL DEFAULT '0',
1175   `prep_amount` double NOT NULL DEFAULT '0',
1176   `alloc` double NOT NULL DEFAULT '0',
1177   PRIMARY KEY (`trans_type`,`order_no`)
1178 ) ENGINE=InnoDB;
1179
1180 -- Data of table `0_sales_orders` --
1181
1182 -- Structure of table `0_sales_pos` --
1183
1184 DROP TABLE IF EXISTS `0_sales_pos`;
1185
1186 CREATE TABLE `0_sales_pos` (
1187   `id` smallint(6) unsigned NOT NULL AUTO_INCREMENT,
1188   `pos_name` varchar(30) NOT NULL,
1189   `cash_sale` tinyint(1) NOT NULL,
1190   `credit_sale` tinyint(1) NOT NULL,
1191   `pos_location` varchar(5) NOT NULL,
1192   `pos_account` smallint(6) unsigned NOT NULL,
1193   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1194   PRIMARY KEY (`id`),
1195   UNIQUE KEY `pos_name` (`pos_name`)
1196 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1197
1198 -- Data of table `0_sales_pos` --
1199
1200 INSERT INTO `0_sales_pos` VALUES
1201 ('1', 'Default', '1', '1', 'DEF', '2', '0');
1202
1203 -- Structure of table `0_sales_types` --
1204
1205 DROP TABLE IF EXISTS `0_sales_types`;
1206
1207 CREATE TABLE `0_sales_types` (
1208   `id` int(11) NOT NULL AUTO_INCREMENT,
1209   `sales_type` char(50) NOT NULL DEFAULT '',
1210   `tax_included` int(1) NOT NULL DEFAULT '0',
1211   `factor` double NOT NULL DEFAULT '1',
1212   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1213   PRIMARY KEY (`id`),
1214   UNIQUE KEY `sales_type` (`sales_type`)
1215 ) ENGINE=InnoDB AUTO_INCREMENT=3 ;
1216
1217 -- Data of table `0_sales_types` --
1218
1219 INSERT INTO `0_sales_types` VALUES
1220 ('1', 'Retail', '1', '1', '0'),
1221 ('2', 'Wholesale', '0', '0.7', '0');
1222
1223 -- Structure of table `0_salesman` --
1224
1225 DROP TABLE IF EXISTS `0_salesman`;
1226
1227 CREATE TABLE `0_salesman` (
1228   `salesman_code` int(11) NOT NULL AUTO_INCREMENT,
1229   `salesman_name` char(60) NOT NULL DEFAULT '',
1230   `salesman_phone` char(30) NOT NULL DEFAULT '',
1231   `salesman_fax` char(30) NOT NULL DEFAULT '',
1232   `salesman_email` varchar(100) NOT NULL DEFAULT '',
1233   `provision` double NOT NULL DEFAULT '0',
1234   `break_pt` double NOT NULL DEFAULT '0',
1235   `provision2` double NOT NULL DEFAULT '0',
1236   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1237   PRIMARY KEY (`salesman_code`),
1238   UNIQUE KEY `salesman_name` (`salesman_name`)
1239 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1240
1241 -- Data of table `0_salesman` --
1242
1243 INSERT INTO `0_salesman` VALUES
1244 ('1', 'Sales Person', '', '', '', '5', '1000', '4', '0');
1245
1246 -- Structure of table `0_security_roles` --
1247
1248 DROP TABLE IF EXISTS `0_security_roles`;
1249
1250 CREATE TABLE `0_security_roles` (
1251   `id` int(11) NOT NULL AUTO_INCREMENT,
1252   `role` varchar(30) NOT NULL,
1253   `description` varchar(50) DEFAULT NULL,
1254   `sections` text,
1255   `areas` text,
1256   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1257   PRIMARY KEY (`id`),
1258   UNIQUE KEY `role` (`role`)
1259 ) ENGINE=InnoDB AUTO_INCREMENT=11 ;
1260
1261 -- Data of table `0_security_roles` --
1262
1263 INSERT INTO `0_security_roles` VALUES
1264 ('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;775', '0'),
1265 ('2', 'System Administrator', 'System Administrator', '256;512;768;2816;3072;3328;5376;5632;5888;7936;8192;8448;9472;9728;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;526;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;9217;9218;9220;9473;9474;9475;9476;9729;10497;10753;10754;10755;10756;10757;11009;11010;11011;11012;13057;13313;13314;13315;15617;15618;15619;15620;15621;15622;15623;15624;15628;15625;15626;15627;15873;15874;15875;15876;15877;15878;15879;15880;15883;15881;15882;16129;16130;16131;16132;775', '0'),
1266 ('3', 'Salesman', 'Salesman', '768;3072;5632;8192;15872', '773;774;3073;3075;3081;5633;8194;15873;775', '0'),
1267 ('4', 'Stock Manager', 'Stock Manager', '768;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;775', '0'),
1268 ('5', 'Production Manager', 'Production Manager', '512;768;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;775', '0'),
1269 ('6', 'Purchase Officer', 'Purchase Officer', '512;768;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;775', '0'),
1270 ('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;775', '0'),
1271 ('8', 'AP Officer', 'AP Officer', '512;768;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;775', '0'),
1272 ('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;775', '0'),
1273 ('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;775', '0');
1274
1275 -- Structure of table `0_shippers` --
1276
1277 DROP TABLE IF EXISTS `0_shippers`;
1278
1279 CREATE TABLE `0_shippers` (
1280   `shipper_id` int(11) NOT NULL AUTO_INCREMENT,
1281   `shipper_name` varchar(60) NOT NULL DEFAULT '',
1282   `phone` varchar(30) NOT NULL DEFAULT '',
1283   `phone2` varchar(30) NOT NULL DEFAULT '',
1284   `contact` tinytext NOT NULL,
1285   `address` tinytext NOT NULL,
1286   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1287   PRIMARY KEY (`shipper_id`),
1288   UNIQUE KEY `name` (`shipper_name`)
1289 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1290
1291 -- Data of table `0_shippers` --
1292
1293 INSERT INTO `0_shippers` VALUES
1294 ('1', 'Default', '', '', '', '', '0');
1295
1296 -- Structure of table `0_sql_trail` --
1297
1298 DROP TABLE IF EXISTS `0_sql_trail`;
1299
1300 CREATE TABLE `0_sql_trail` (
1301   `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
1302   `sql` text NOT NULL,
1303   `result` tinyint(1) NOT NULL,
1304   `msg` varchar(255) NOT NULL,
1305   PRIMARY KEY (`id`)
1306 ) ENGINE=InnoDB ;
1307
1308 -- Data of table `0_sql_trail` --
1309
1310 -- Structure of table `0_stock_category` --
1311
1312 DROP TABLE IF EXISTS `0_stock_category`;
1313
1314 CREATE TABLE `0_stock_category` (
1315   `category_id` int(11) NOT NULL AUTO_INCREMENT,
1316   `description` varchar(60) NOT NULL DEFAULT '',
1317   `dflt_tax_type` int(11) NOT NULL DEFAULT '1',
1318   `dflt_units` varchar(20) NOT NULL DEFAULT 'each',
1319   `dflt_mb_flag` char(1) NOT NULL DEFAULT 'B',
1320   `dflt_sales_act` varchar(15) NOT NULL DEFAULT '',
1321   `dflt_cogs_act` varchar(15) NOT NULL DEFAULT '',
1322   `dflt_inventory_act` varchar(15) NOT NULL DEFAULT '',
1323   `dflt_adjustment_act` varchar(15) NOT NULL DEFAULT '',
1324   `dflt_wip_act` varchar(15) NOT NULL DEFAULT '',
1325   `dflt_dim1` int(11) DEFAULT NULL,
1326   `dflt_dim2` int(11) DEFAULT NULL,
1327   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1328   `dflt_no_sale` tinyint(1) NOT NULL DEFAULT '0',
1329   `dflt_no_purchase` tinyint(1) NOT NULL DEFAULT '0',
1330   PRIMARY KEY (`category_id`),
1331   UNIQUE KEY `description` (`description`)
1332 ) ENGINE=InnoDB AUTO_INCREMENT=5 ;
1333
1334 -- Data of table `0_stock_category` --
1335
1336 INSERT INTO `0_stock_category` VALUES
1337 ('1', 'Components', '1', 'each', 'B', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0'),
1338 ('2', 'Charges', '1', 'each', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0'),
1339 ('3', 'Systems', '1', 'each', 'M', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0'),
1340 ('4', 'Services', '1', 'hr', 'D', '4010', '5010', '1510', '5040', '1530', '0', '0', '0', '0', '0');
1341
1342 -- Structure of table `0_stock_fa_class` --
1343
1344 DROP TABLE IF EXISTS `0_stock_fa_class`;
1345
1346 CREATE TABLE `0_stock_fa_class` (
1347   `fa_class_id` varchar(20) NOT NULL DEFAULT '',
1348   `parent_id` varchar(20) NOT NULL DEFAULT '',
1349   `description` varchar(200) NOT NULL DEFAULT '',
1350   `long_description` tinytext NOT NULL,
1351   `depreciation_rate` double NOT NULL DEFAULT '0',
1352   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1353   PRIMARY KEY (`fa_class_id`)
1354 ) ENGINE=InnoDB ;
1355
1356 -- Data of table `0_stock_fa_class` --
1357
1358 -- Structure of table `0_stock_master` --
1359
1360 DROP TABLE IF EXISTS `0_stock_master`;
1361
1362 CREATE TABLE `0_stock_master` (
1363   `stock_id` varchar(20) NOT NULL DEFAULT '',
1364   `category_id` int(11) NOT NULL DEFAULT '0',
1365   `tax_type_id` int(11) NOT NULL DEFAULT '0',
1366   `description` varchar(200) NOT NULL DEFAULT '',
1367   `long_description` tinytext NOT NULL,
1368   `units` varchar(20) NOT NULL DEFAULT 'each',
1369   `mb_flag` char(1) NOT NULL DEFAULT 'B',
1370   `sales_account` varchar(15) NOT NULL DEFAULT '',
1371   `cogs_account` varchar(15) NOT NULL DEFAULT '',
1372   `inventory_account` varchar(15) NOT NULL DEFAULT '',
1373   `adjustment_account` varchar(15) NOT NULL DEFAULT '',
1374   `wip_account` varchar(15) NOT NULL DEFAULT '',
1375   `dimension_id` int(11) DEFAULT NULL,
1376   `dimension2_id` int(11) DEFAULT NULL,
1377   `purchase_cost` double NOT NULL DEFAULT '0',
1378   `material_cost` double NOT NULL DEFAULT '0',
1379   `labour_cost` double NOT NULL DEFAULT '0',
1380   `overhead_cost` double NOT NULL DEFAULT '0',
1381   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1382   `no_sale` tinyint(1) NOT NULL DEFAULT '0',
1383   `no_purchase` tinyint(1) NOT NULL DEFAULT '0',
1384   `editable` tinyint(1) NOT NULL DEFAULT '0',
1385   `depreciation_method` char(1) NOT NULL DEFAULT 'S',
1386   `depreciation_rate` double NOT NULL DEFAULT '0',
1387   `depreciation_factor` double NOT NULL DEFAULT '1',
1388   `depreciation_start` date NOT NULL DEFAULT '0000-00-00',
1389   `depreciation_date` date NOT NULL DEFAULT '0000-00-00',
1390   `fa_class_id` varchar(20) NOT NULL DEFAULT '',
1391   PRIMARY KEY (`stock_id`)
1392 ) ENGINE=InnoDB;
1393
1394 -- Data of table `0_stock_master` --
1395
1396 -- Structure of table `0_stock_moves` --
1397
1398 DROP TABLE IF EXISTS `0_stock_moves`;
1399
1400 CREATE TABLE `0_stock_moves` (
1401   `trans_id` int(11) NOT NULL AUTO_INCREMENT,
1402   `trans_no` int(11) NOT NULL DEFAULT '0',
1403   `stock_id` char(20) NOT NULL DEFAULT '',
1404   `type` smallint(6) NOT NULL DEFAULT '0',
1405   `loc_code` char(5) NOT NULL DEFAULT '',
1406   `tran_date` date NOT NULL DEFAULT '0000-00-00',
1407   `price` double NOT NULL DEFAULT '0',
1408   `reference` char(40) NOT NULL DEFAULT '',
1409   `qty` double NOT NULL DEFAULT '1',
1410   `standard_cost` double NOT NULL DEFAULT '0',
1411   PRIMARY KEY (`trans_id`),
1412   KEY `type` (`type`,`trans_no`),
1413   KEY `Move` (`stock_id`,`loc_code`,`tran_date`)
1414 ) ENGINE=InnoDB;
1415
1416 -- Data of table `0_stock_moves` --
1417
1418 -- Structure of table `0_supp_allocations` --
1419
1420 DROP TABLE IF EXISTS `0_supp_allocations`;
1421
1422 CREATE TABLE `0_supp_allocations` (
1423   `id` int(11) NOT NULL AUTO_INCREMENT,
1424   `person_id` int(11) DEFAULT NULL,
1425   `amt` double unsigned DEFAULT NULL,
1426   `date_alloc` date NOT NULL DEFAULT '0000-00-00',
1427   `trans_no_from` int(11) DEFAULT NULL,
1428   `trans_type_from` int(11) DEFAULT NULL,
1429   `trans_no_to` int(11) DEFAULT NULL,
1430   `trans_type_to` int(11) DEFAULT NULL,
1431   PRIMARY KEY (`id`),
1432   UNIQUE KEY `trans_type_from` (`person_id`,`trans_type_from`,`trans_no_from`,`trans_type_to`,`trans_no_to`),
1433   KEY `From` (`trans_type_from`,`trans_no_from`),
1434   KEY `To` (`trans_type_to`,`trans_no_to`)
1435 ) ENGINE=InnoDB ;
1436
1437 -- Data of table `0_supp_allocations` --
1438
1439 -- Structure of table `0_supp_invoice_items` --
1440
1441 DROP TABLE IF EXISTS `0_supp_invoice_items`;
1442
1443 CREATE TABLE `0_supp_invoice_items` (
1444   `id` int(11) NOT NULL AUTO_INCREMENT,
1445   `supp_trans_no` int(11) DEFAULT NULL,
1446   `supp_trans_type` int(11) DEFAULT NULL,
1447   `gl_code` varchar(15) NOT NULL DEFAULT '',
1448   `grn_item_id` int(11) DEFAULT NULL,
1449   `po_detail_item_id` int(11) DEFAULT NULL,
1450   `stock_id` varchar(20) NOT NULL DEFAULT '',
1451   `description` tinytext,
1452   `quantity` double NOT NULL DEFAULT '0',
1453   `unit_price` double NOT NULL DEFAULT '0',
1454   `unit_tax` double NOT NULL DEFAULT '0',
1455   `memo_` tinytext,
1456   `dimension_id` int(11) NOT NULL DEFAULT '0',
1457   `dimension2_id` int(11) NOT NULL DEFAULT '0',
1458   PRIMARY KEY (`id`),
1459   KEY `Transaction` (`supp_trans_type`,`supp_trans_no`,`stock_id`)
1460 ) ENGINE=InnoDB;
1461
1462 -- Data of table `0_supp_invoice_items` --
1463
1464 -- Structure of table `0_supp_trans` --
1465
1466 DROP TABLE IF EXISTS `0_supp_trans`;
1467
1468 CREATE TABLE `0_supp_trans` (
1469   `trans_no` int(11) unsigned NOT NULL DEFAULT '0',
1470   `type` smallint(6) unsigned NOT NULL DEFAULT '0',
1471   `supplier_id` int(11) unsigned NOT NULL,
1472   `reference` tinytext NOT NULL,
1473   `supp_reference` varchar(60) NOT NULL DEFAULT '',
1474   `tran_date` date NOT NULL DEFAULT '0000-00-00',
1475   `due_date` date NOT NULL DEFAULT '0000-00-00',
1476   `ov_amount` double NOT NULL DEFAULT '0',
1477   `ov_discount` double NOT NULL DEFAULT '0',
1478   `ov_gst` double NOT NULL DEFAULT '0',
1479   `rate` double NOT NULL DEFAULT '1',
1480   `alloc` double NOT NULL DEFAULT '0',
1481   `tax_included` tinyint(1) NOT NULL DEFAULT '0',
1482   PRIMARY KEY (`type`,`trans_no`,`supplier_id`),
1483   KEY `supplier_id` (`supplier_id`),
1484   KEY `tran_date` (`tran_date`)
1485 ) ENGINE=InnoDB ;
1486
1487 -- Data of table `0_supp_trans` --
1488
1489 -- Structure of table `0_suppliers` --
1490
1491 DROP TABLE IF EXISTS `0_suppliers`;
1492
1493 CREATE TABLE `0_suppliers` (
1494   `supplier_id` int(11) NOT NULL AUTO_INCREMENT,
1495   `supp_name` varchar(60) NOT NULL DEFAULT '',
1496   `supp_ref` varchar(30) NOT NULL DEFAULT '',
1497   `address` tinytext NOT NULL,
1498   `supp_address` tinytext NOT NULL,
1499   `gst_no` varchar(25) NOT NULL DEFAULT '',
1500   `contact` varchar(60) NOT NULL DEFAULT '',
1501   `supp_account_no` varchar(40) NOT NULL DEFAULT '',
1502   `website` varchar(100) NOT NULL DEFAULT '',
1503   `bank_account` varchar(60) NOT NULL DEFAULT '',
1504   `curr_code` char(3) DEFAULT NULL,
1505   `payment_terms` int(11) DEFAULT NULL,
1506   `tax_included` tinyint(1) NOT NULL DEFAULT '0',
1507   `dimension_id` int(11) DEFAULT '0',
1508   `dimension2_id` int(11) DEFAULT '0',
1509   `tax_group_id` int(11) DEFAULT NULL,
1510   `credit_limit` double NOT NULL DEFAULT '0',
1511   `purchase_account` varchar(15) NOT NULL DEFAULT '',
1512   `payable_account` varchar(15) NOT NULL DEFAULT '',
1513   `payment_discount_account` varchar(15) NOT NULL DEFAULT '',
1514   `notes` tinytext NOT NULL,
1515   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1516   PRIMARY KEY (`supplier_id`),
1517   KEY `supp_ref` (`supp_ref`)
1518 ) ENGINE=InnoDB;
1519
1520 -- Data of table `0_suppliers` --
1521
1522 -- Structure of table `0_sys_prefs` --
1523
1524 DROP TABLE IF EXISTS `0_sys_prefs`;
1525
1526 CREATE TABLE `0_sys_prefs` (
1527   `name` varchar(35) NOT NULL DEFAULT '',
1528   `category` varchar(30) DEFAULT NULL,
1529   `type` varchar(20) NOT NULL DEFAULT '',
1530   `length` smallint(6) DEFAULT NULL,
1531   `value` text NOT NULL,
1532   PRIMARY KEY (`name`),
1533   KEY `category` (`category`)
1534 ) ENGINE=InnoDB ;
1535
1536 -- Data of table `0_sys_prefs` --
1537
1538 INSERT INTO `0_sys_prefs` VALUES
1539 ('coy_name', 'setup.company', 'varchar', 60, 'Company name'),
1540 ('gst_no', 'setup.company', 'varchar', 25, ''),
1541 ('coy_no', 'setup.company', 'varchar', 25, ''),
1542 ('tax_prd', 'setup.company', 'int', 11, '1'),
1543 ('tax_last', 'setup.company', 'int', 11, '1'),
1544 ('postal_address', 'setup.company', 'tinytext', 0, 'N/A'),
1545 ('phone', 'setup.company', 'varchar', 30, ''),
1546 ('fax', 'setup.company', 'varchar', 30, ''),
1547 ('email', 'setup.company', 'varchar', 100, ''),
1548 ('coy_logo', 'setup.company', 'varchar', 100, ''),
1549 ('domicile', 'setup.company', 'varchar', 55, ''),
1550 ('curr_default', 'setup.company', 'char', 3, 'USD'),
1551 ('use_dimension', 'setup.company', 'tinyint', 1, '1'),
1552 ('f_year', 'setup.company', 'int', 11, '1'),
1553 ('shortname_name_in_list','setup.company', 'tinyint', 1, '0'),
1554 ('no_item_list', 'setup.company', 'tinyint', 1, '0'),
1555 ('no_customer_list', 'setup.company', 'tinyint', 1, '0'),
1556 ('no_supplier_list', 'setup.company', 'tinyint', 1, '0'),
1557 ('base_sales', 'setup.company', 'int', 11, '1'),
1558 ('time_zone', 'setup.company', 'tinyint', 1, '0'),
1559 ('add_pct', 'setup.company', 'int', 5, '-1'),
1560 ('round_to', 'setup.company', 'int', 5, '1'),
1561 ('login_tout', 'setup.company', 'smallint', 6, '600'),
1562 ('past_due_days', 'glsetup.general', 'int', 11, '30'),
1563 ('profit_loss_year_act', 'glsetup.general', 'varchar', 15, '9990'),
1564 ('retained_earnings_act', 'glsetup.general', 'varchar', 15, '3590'),
1565 ('bank_charge_act', 'glsetup.general', 'varchar', 15, '5690'),
1566 ('exchange_diff_act', 'glsetup.general', 'varchar', 15, '4450'),
1567 ('tax_algorithm', 'glsetup.customer', 'tinyint', 1, '1'),
1568 ('default_credit_limit', 'glsetup.customer', 'int', 11, '1000'),
1569 ('accumulate_shipping', 'glsetup.customer', 'tinyint', 1, '0'),
1570 ('legal_text', 'glsetup.customer', 'tinytext', 0, ''),
1571 ('freight_act', 'glsetup.customer', 'varchar', 15, '4430'),
1572 ('debtors_act', 'glsetup.sales', 'varchar', 15, '1200'),
1573 ('default_sales_act', 'glsetup.sales', 'varchar', 15, '4010'),
1574 ('default_sales_discount_act', 'glsetup.sales', 'varchar', 15, '4510'),
1575 ('default_prompt_payment_act', 'glsetup.sales', 'varchar', 15, '4500'),
1576 ('default_delivery_required', 'glsetup.sales', 'smallint', 6, '1'),
1577 ('default_receival_required', 'glsetup.purchase', 'smallint', 6, '10'),
1578 ('default_quote_valid_days', 'glsetup.sales', 'smallint', 6, '30'),
1579 ('default_dim_required', 'glsetup.dims', 'int', 11, '20'),
1580 ('pyt_discount_act', 'glsetup.purchase', 'varchar', 15, '5060'),
1581 ('creditors_act', 'glsetup.purchase', 'varchar', 15, '2100'),
1582 ('po_over_receive', 'glsetup.purchase', 'int', 11, '10'),
1583 ('po_over_charge', 'glsetup.purchase', 'int', 11, '10'),
1584 ('allow_negative_stock', 'glsetup.inventory', 'tinyint', 1, '0'),
1585 ('default_inventory_act', 'glsetup.items', 'varchar', 15, '1510'),
1586 ('default_cogs_act', 'glsetup.items', 'varchar', 15, '5010'),
1587 ('default_adj_act', 'glsetup.items', 'varchar', 15, '5040'),
1588 ('default_inv_sales_act', 'glsetup.items', 'varchar', 15, '4010'),
1589 ('default_wip_act', 'glsetup.items', 'varchar', 15, '1530'),
1590 ('default_workorder_required', 'glsetup.manuf', 'int', 11, '20'),
1591 ('version_id', 'system', 'varchar', 11, '2.4.1'),
1592 ('auto_curr_reval', 'setup.company', 'smallint', 6, '1'),
1593 ('grn_clearing_act', 'glsetup.purchase', 'varchar', 15, '1550'),
1594 ('bcc_email', 'setup.company', 'varchar', 100, ''),
1595 ('deferred_income_act', 'glsetup.sales', 'varchar', '15', '2105'),
1596 ('gl_closing_date','setup.closing_date', 'date', 8, ''),
1597 ('alternative_tax_include_on_docs','setup.company', 'tinyint', 1, '0'),
1598 ('no_zero_lines_amount','glsetup.sales', 'tinyint', 1, '1'),
1599 ('show_po_item_codes','glsetup.purchase', 'tinyint', 1, '0'),
1600 ('accounts_alpha','glsetup.general', 'tinyint', 1, '0'),
1601 ('loc_notification','glsetup.inventory', 'tinyint', 1, '0'),
1602 ('print_invoice_no','glsetup.sales', 'tinyint', 1, '0'),
1603 ('allow_negative_prices','glsetup.inventory', 'tinyint', 1, '1'),
1604 ('print_item_images_on_quote','glsetup.inventory', 'tinyint', 1, '0'),
1605 ('suppress_tax_rates','setup.company', 'tinyint', 1, '0'),
1606 ('company_logo_report','setup.company', 'tinyint', 1, '0'),
1607 ('barcodes_on_stock','setup.company', 'tinyint', 1, '0'),
1608 ('print_dialog_direct','setup.company', 'tinyint', 1, '0'),
1609 ('ref_no_auto_increase','setup.company', 'tinyint', 1, '0'),
1610 ('default_loss_on_asset_disposal_act', 'glsetup.items', 'varchar', '15', '5660'),
1611 ('depreciation_period', 'glsetup.company', 'tinyint', '1', '1'),
1612 ('use_manufacturing','setup.company', 'tinyint', 1, '1'),
1613 ('dim_on_recurrent_invoice','setup.company', 'tinyint', 1, '0'),
1614 ('long_description_invoice','setup.company', 'tinyint', 1, '0'),
1615 ('max_days_in_docs','setup.company', 'smallint', 5, '180'),
1616 ('use_fixed_assets','setup.company', 'tinyint', 1, '1');
1617
1618 -- Structure of table `0_tag_associations` --
1619
1620 DROP TABLE IF EXISTS `0_tag_associations`;
1621
1622 CREATE TABLE `0_tag_associations` (
1623   `record_id` varchar(15) NOT NULL,
1624   `tag_id` int(11) NOT NULL,
1625   PRIMARY KEY (`record_id`,`tag_id`)
1626 ) ENGINE=InnoDB ;
1627
1628 -- Data of table `0_tag_associations` --
1629
1630 -- Structure of table `0_tags` --
1631
1632 DROP TABLE IF EXISTS `0_tags`;
1633
1634 CREATE TABLE `0_tags` (
1635   `id` int(11) NOT NULL AUTO_INCREMENT,
1636   `type` smallint(6) NOT NULL,
1637   `name` varchar(30) NOT NULL,
1638   `description` varchar(60) DEFAULT NULL,
1639   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1640   PRIMARY KEY (`id`),
1641   UNIQUE KEY `type` (`type`,`name`)
1642 ) ENGINE=InnoDB ;
1643
1644 -- Data of table `0_tags` --
1645
1646 -- Structure of table `0_tax_group_items` --
1647
1648 DROP TABLE IF EXISTS `0_tax_group_items`;
1649
1650 CREATE TABLE `0_tax_group_items` (
1651   `tax_group_id` int(11) NOT NULL DEFAULT '0',
1652   `tax_type_id` int(11) NOT NULL DEFAULT '0',
1653   `tax_shipping` tinyint(1) NOT NULL DEFAULT '0',
1654   PRIMARY KEY (`tax_group_id`,`tax_type_id`)
1655 ) ENGINE=InnoDB ;
1656
1657 -- Data of table `0_tax_group_items` --
1658
1659 INSERT INTO `0_tax_group_items` VALUES
1660 ('1', '1', '1');
1661
1662 -- Structure of table `0_tax_groups` --
1663
1664 DROP TABLE IF EXISTS `0_tax_groups`;
1665
1666 CREATE TABLE `0_tax_groups` (
1667   `id` int(11) NOT NULL AUTO_INCREMENT,
1668   `name` varchar(60) NOT NULL DEFAULT '',
1669   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1670   PRIMARY KEY (`id`),
1671   UNIQUE KEY `name` (`name`)
1672 ) ENGINE=InnoDB AUTO_INCREMENT=3 ;
1673
1674 -- Data of table `0_tax_groups` --
1675
1676 INSERT INTO `0_tax_groups` VALUES
1677 ('1', 'Tax', '0'),
1678 ('2', 'Tax Exempt', '0');
1679
1680 -- Structure of table `0_tax_types` --
1681
1682 DROP TABLE IF EXISTS `0_tax_types`;
1683
1684 CREATE TABLE `0_tax_types` (
1685   `id` int(11) NOT NULL AUTO_INCREMENT,
1686   `rate` double NOT NULL DEFAULT '0',
1687   `sales_gl_code` varchar(15) NOT NULL DEFAULT '',
1688   `purchasing_gl_code` varchar(15) NOT NULL DEFAULT '',
1689   `name` varchar(60) NOT NULL DEFAULT '',
1690   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1691   PRIMARY KEY (`id`)
1692 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1693
1694 -- Data of table `0_tax_types` --
1695
1696 INSERT INTO `0_tax_types` VALUES
1697 ('1', '5', '2150', '2150', 'Tax', '0');
1698
1699 -- Structure of table `0_trans_tax_details` --
1700
1701 DROP TABLE IF EXISTS `0_trans_tax_details`;
1702
1703 CREATE TABLE `0_trans_tax_details` (
1704   `id` int(11) NOT NULL AUTO_INCREMENT,
1705   `trans_type` smallint(6) DEFAULT NULL,
1706   `trans_no` int(11) DEFAULT NULL,
1707   `tran_date` date NOT NULL,
1708   `tax_type_id` int(11) NOT NULL DEFAULT '0',
1709   `rate` double NOT NULL DEFAULT '0',
1710   `ex_rate` double NOT NULL DEFAULT '1',
1711   `included_in_price` tinyint(1) NOT NULL DEFAULT '0',
1712   `net_amount` double NOT NULL DEFAULT '0',
1713   `amount` double NOT NULL DEFAULT '0',
1714   `memo` tinytext,
1715   `reg_type` tinyint(1) DEFAULT NULL,
1716   PRIMARY KEY (`id`),
1717   KEY `Type_and_Number` (`trans_type`,`trans_no`),
1718   KEY `tran_date` (`tran_date`)
1719 ) ENGINE=InnoDB;
1720
1721 -- Data of table `0_trans_tax_details` --
1722
1723 -- Structure of table `0_useronline` --
1724
1725 DROP TABLE IF EXISTS `0_useronline`;
1726
1727 CREATE TABLE `0_useronline` (
1728   `id` int(11) NOT NULL AUTO_INCREMENT,
1729   `timestamp` int(15) NOT NULL DEFAULT '0',
1730   `ip` varchar(40) NOT NULL DEFAULT '',
1731   `file` varchar(100) NOT NULL DEFAULT '',
1732   PRIMARY KEY (`id`),
1733   KEY `timestamp` (`timestamp`),
1734   KEY `ip` (`ip`)
1735 ) ENGINE=InnoDB ;
1736
1737 -- Data of table `0_useronline` --
1738
1739
1740 -- Structure of table `0_users` --
1741
1742 DROP TABLE IF EXISTS `0_users`;
1743
1744 CREATE TABLE `0_users` (
1745   `id` smallint(6) NOT NULL AUTO_INCREMENT,
1746   `user_id` varchar(60) NOT NULL DEFAULT '',
1747   `password` varchar(100) NOT NULL DEFAULT '',
1748   `real_name` varchar(100) NOT NULL DEFAULT '',
1749   `role_id` int(11) NOT NULL DEFAULT '1',
1750   `phone` varchar(30) NOT NULL DEFAULT '',
1751   `email` varchar(100) DEFAULT NULL,
1752   `language` varchar(20) DEFAULT NULL,
1753   `date_format` tinyint(1) NOT NULL DEFAULT '0',
1754   `date_sep` tinyint(1) NOT NULL DEFAULT '0',
1755   `tho_sep` tinyint(1) NOT NULL DEFAULT '0',
1756   `dec_sep` tinyint(1) NOT NULL DEFAULT '0',
1757   `theme` varchar(20) NOT NULL DEFAULT 'default',
1758   `page_size` varchar(20) NOT NULL DEFAULT 'A4',
1759   `prices_dec` smallint(6) NOT NULL DEFAULT '2',
1760   `qty_dec` smallint(6) NOT NULL DEFAULT '2',
1761   `rates_dec` smallint(6) NOT NULL DEFAULT '4',
1762   `percent_dec` smallint(6) NOT NULL DEFAULT '1',
1763   `show_gl` tinyint(1) NOT NULL DEFAULT '1',
1764   `show_codes` tinyint(1) NOT NULL DEFAULT '0',
1765   `show_hints` tinyint(1) NOT NULL DEFAULT '0',
1766   `last_visit_date` datetime DEFAULT NULL,
1767   `query_size` tinyint(1) unsigned NOT NULL DEFAULT '10',
1768   `graphic_links` tinyint(1) DEFAULT '1',
1769   `pos` smallint(6) DEFAULT '1',
1770   `print_profile` varchar(30) NOT NULL DEFAULT '',
1771   `rep_popup` tinyint(1) DEFAULT '1',
1772   `sticky_doc_date` tinyint(1) DEFAULT '0',
1773   `startup_tab` varchar(20) NOT NULL DEFAULT '',
1774   `transaction_days` smallint(6) NOT NULL DEFAULT '30',
1775   `save_report_selections` smallint(6) NOT NULL DEFAULT '0',
1776   `use_date_picker` tinyint(1) NOT NULL DEFAULT '1',
1777   `def_print_destination` tinyint(1) NOT NULL DEFAULT '0',
1778   `def_print_orientation` tinyint(1) NOT NULL DEFAULT '0',
1779   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1780   PRIMARY KEY (`id`),
1781   UNIQUE KEY `user_id` (`user_id`)
1782 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1783
1784 -- Data of table `0_users` --
1785
1786 INSERT INTO `0_users` VALUES
1787 ('1', 'admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', '2', '', 'adm@example.com', 'C', '0', '0', '0', '0', 'default', 'Letter', '2', '2', '4', '1', '1', '0', '0', '2019-05-07 13:58:33', '10', '1', '1', '1', '1', '0', 'orders', '30', '0', '1', '0', '0', '0');
1788
1789 -- Structure of table `0_voided` --
1790
1791 DROP TABLE IF EXISTS `0_voided`;
1792
1793 CREATE TABLE `0_voided` (
1794   `type` int(11) NOT NULL DEFAULT '0',
1795   `id` int(11) NOT NULL DEFAULT '0',
1796   `date_` date NOT NULL DEFAULT '0000-00-00',
1797   `memo_` tinytext NOT NULL,
1798   UNIQUE KEY `id` (`type`,`id`)
1799 ) ENGINE=InnoDB ;
1800
1801 -- Data of table `0_voided` --
1802
1803
1804 -- Structure of table `0_wo_costing` --
1805
1806 DROP TABLE IF EXISTS `0_wo_costing`;
1807
1808 CREATE TABLE `0_wo_costing` (
1809   `id` int(11) NOT NULL AUTO_INCREMENT,
1810   `workorder_id` int(11) NOT NULL DEFAULT '0',
1811   `cost_type` tinyint(1) NOT NULL DEFAULT '0',
1812   `trans_type` int(11) NOT NULL DEFAULT '0',
1813   `trans_no` int(11) NOT NULL DEFAULT '0',
1814   `factor` double NOT NULL DEFAULT '1',
1815   PRIMARY KEY (`id`)
1816 ) ENGINE=InnoDB ;
1817
1818 -- Data of table `0_wo_costing` --
1819
1820 -- Structure of table `0_wo_issue_items` --
1821
1822 DROP TABLE IF EXISTS `0_wo_issue_items`;
1823
1824 CREATE TABLE `0_wo_issue_items` (
1825   `id` int(11) NOT NULL AUTO_INCREMENT,
1826   `stock_id` varchar(40) DEFAULT NULL,
1827   `issue_id` int(11) DEFAULT NULL,
1828   `qty_issued` double DEFAULT NULL,
1829   `unit_cost` double NOT NULL DEFAULT '0',
1830   PRIMARY KEY (`id`)
1831 ) ENGINE=InnoDB ;
1832
1833 -- Data of table `0_wo_issue_items` --
1834
1835
1836 -- Structure of table `0_wo_issues` --
1837
1838 DROP TABLE IF EXISTS `0_wo_issues`;
1839
1840 CREATE TABLE `0_wo_issues` (
1841   `issue_no` int(11) NOT NULL AUTO_INCREMENT,
1842   `workorder_id` int(11) NOT NULL DEFAULT '0',
1843   `reference` varchar(100) DEFAULT NULL,
1844   `issue_date` date DEFAULT NULL,
1845   `loc_code` varchar(5) DEFAULT NULL,
1846   `workcentre_id` int(11) DEFAULT NULL,
1847   PRIMARY KEY (`issue_no`),
1848   KEY `workorder_id` (`workorder_id`)
1849 ) ENGINE=InnoDB ;
1850
1851 -- Data of table `0_wo_issues` --
1852
1853 -- Structure of table `0_wo_manufacture` --
1854
1855 DROP TABLE IF EXISTS `0_wo_manufacture`;
1856
1857 CREATE TABLE `0_wo_manufacture` (
1858   `id` int(11) NOT NULL AUTO_INCREMENT,
1859   `reference` varchar(100) DEFAULT NULL,
1860   `workorder_id` int(11) NOT NULL DEFAULT '0',
1861   `quantity` double NOT NULL DEFAULT '0',
1862   `date_` date NOT NULL DEFAULT '0000-00-00',
1863   PRIMARY KEY (`id`),
1864   KEY `workorder_id` (`workorder_id`)
1865 ) ENGINE=InnoDB;
1866
1867 -- Data of table `0_wo_manufacture` --
1868
1869 -- Structure of table `0_wo_requirements` --
1870
1871 DROP TABLE IF EXISTS `0_wo_requirements`;
1872
1873 CREATE TABLE `0_wo_requirements` (
1874   `id` int(11) NOT NULL AUTO_INCREMENT,
1875   `workorder_id` int(11) NOT NULL DEFAULT '0',
1876   `stock_id` char(20) NOT NULL DEFAULT '',
1877   `workcentre` int(11) NOT NULL DEFAULT '0',
1878   `units_req` double NOT NULL DEFAULT '1',
1879   `unit_cost` double NOT NULL DEFAULT '0',
1880   `loc_code` char(5) NOT NULL DEFAULT '',
1881   `units_issued` double NOT NULL DEFAULT '0',
1882   PRIMARY KEY (`id`),
1883   KEY `workorder_id` (`workorder_id`)
1884 ) ENGINE=InnoDB;
1885
1886 -- Data of table `0_wo_requirements` --
1887
1888 -- Structure of table `0_workcentres` --
1889
1890 DROP TABLE IF EXISTS `0_workcentres`;
1891
1892 CREATE TABLE `0_workcentres` (
1893   `id` int(11) NOT NULL AUTO_INCREMENT,
1894   `name` char(40) NOT NULL DEFAULT '',
1895   `description` char(50) NOT NULL DEFAULT '',
1896   `inactive` tinyint(1) NOT NULL DEFAULT '0',
1897   PRIMARY KEY (`id`),
1898   UNIQUE KEY `name` (`name`)
1899 ) ENGINE=InnoDB AUTO_INCREMENT=2 ;
1900
1901 -- Data of table `0_workcentres` --
1902
1903 INSERT INTO `0_workcentres` VALUES
1904 ('1', 'Work Centre', '', '0');
1905
1906 -- Structure of table `0_workorders` --
1907
1908 DROP TABLE IF EXISTS `0_workorders`;
1909
1910 CREATE TABLE `0_workorders` (
1911   `id` int(11) NOT NULL AUTO_INCREMENT,
1912   `wo_ref` varchar(60) NOT NULL DEFAULT '',
1913   `loc_code` varchar(5) NOT NULL DEFAULT '',
1914   `units_reqd` double NOT NULL DEFAULT '1',
1915   `stock_id` varchar(20) NOT NULL DEFAULT '',
1916   `date_` date NOT NULL DEFAULT '0000-00-00',
1917   `type` tinyint(4) NOT NULL DEFAULT '0',
1918   `required_by` date NOT NULL DEFAULT '0000-00-00',
1919   `released_date` date NOT NULL DEFAULT '0000-00-00',
1920   `units_issued` double NOT NULL DEFAULT '0',
1921   `closed` tinyint(1) NOT NULL DEFAULT '0',
1922   `released` tinyint(1) NOT NULL DEFAULT '0',
1923   `additional_costs` double NOT NULL DEFAULT '0',
1924   PRIMARY KEY (`id`),
1925   UNIQUE KEY `wo_ref` (`wo_ref`)
1926 ) ENGINE=InnoDB;
1927
1928 -- Data of table `0_workorders` --