2a8cc246a63293064c89968d4365a640e9241cb6
[fa-stable.git] / sql / en_US-new.sql
1 -- phpMyAdmin SQL Dump
2 -- version 2.7.0-pl2
3 -- http://www.phpmyadmin.net
4 -- 
5 -- Host: localhost
6 -- Created: 09 februar 2007 at 11:03
7 -- Server Version: 4.1.11
8 -- PHP-version: 4.4.1
9 -- 
10 -- Database: `en_US-new`
11 -- 
12
13 -- --------------------------------------------------------
14
15 -- 
16 -- Structure for table `areas`
17 -- 
18
19 DROP TABLE IF EXISTS `0_areas`;
20 CREATE TABLE IF NOT EXISTS `0_areas` (
21   `area_code` int(11) NOT NULL auto_increment,
22   `description` varchar(60) NOT NULL default '',
23   PRIMARY KEY  (`area_code`),
24   UNIQUE KEY `description` (`description`)
25 ) TYPE=MyISAM;
26
27 -- --------------------------------------------------------
28
29 -- 
30 -- Structure for table `bank_accounts`
31 -- 
32
33 DROP TABLE IF EXISTS `0_bank_accounts`;
34 CREATE TABLE IF NOT EXISTS `0_bank_accounts` (
35   `account_code` varchar(11) NOT NULL default '',
36   `account_type` smallint(6) NOT NULL default '0',
37   `bank_account_name` varchar(60) NOT NULL default '',
38   `bank_account_number` varchar(100) NOT NULL default '',
39   `bank_name` varchar(60) NOT NULL default '',
40   `bank_address` tinytext,
41   `bank_curr_code` char(3) NOT NULL default '',
42   PRIMARY KEY  (`account_code`),
43   KEY `bank_account_name` (`bank_account_name`),
44   KEY `bank_account_number` (`bank_account_number`)
45 ) TYPE=MyISAM;
46
47 -- --------------------------------------------------------
48
49 -- 
50 -- Structure for table `bank_trans`
51 -- 
52
53 DROP TABLE IF EXISTS `0_bank_trans`;
54 CREATE TABLE IF NOT EXISTS `0_bank_trans` (
55   `id` int(11) NOT NULL auto_increment,
56   `type` smallint(6) default NULL,
57   `trans_no` int(11) default NULL,
58   `bank_act` varchar(11) default NULL,
59   `ref` varchar(40) default NULL,
60   `trans_date` date NOT NULL default '0000-00-00',
61   `bank_trans_type_id` int(10) unsigned default NULL,
62   `amount` double default NULL,
63   `dimension_id` int(11) NOT NULL default '0',
64   `dimension2_id` int(11) NOT NULL default '0',
65   `person_type_id` int(11) NOT NULL default '0',
66   `person_id` tinyblob,
67   PRIMARY KEY  (`id`),
68   KEY `bank_act` (`bank_act`,`ref`),
69   KEY `type` (`type`,`trans_no`)
70 ) TYPE=InnoDB;
71
72 -- --------------------------------------------------------
73
74 -- 
75 -- Structure for table `bank_trans_types`
76 -- 
77
78 DROP TABLE IF EXISTS `0_bank_trans_types`;
79 CREATE TABLE IF NOT EXISTS `0_bank_trans_types` (
80   `id` int(11) NOT NULL auto_increment,
81   `name` varchar(60) NOT NULL default '',
82   PRIMARY KEY  (`id`),
83   UNIQUE KEY `name` (`name`)
84 ) TYPE=MyISAM;
85
86 -- --------------------------------------------------------
87
88 -- 
89 -- Structure for table `bom`
90 -- 
91
92 DROP TABLE IF EXISTS `0_bom`;
93 CREATE TABLE IF NOT EXISTS `0_bom` (
94   `id` int(11) NOT NULL auto_increment,
95   `parent` char(20) NOT NULL default '',
96   `component` char(20) NOT NULL default '',
97   `workcentre_added` char(5) NOT NULL default '',
98   `loc_code` char(5) NOT NULL default '',
99   `quantity` double NOT NULL default '1',
100   PRIMARY KEY  (`parent`,`component`,`workcentre_added`,`loc_code`),
101   KEY `component` (`component`),
102   KEY `id` (`id`),
103   KEY `loc_code` (`loc_code`),
104   KEY `parent` (`parent`,`loc_code`),
105   KEY `Parent_2` (`parent`),
106   KEY `workcentre_added` (`workcentre_added`)
107 ) TYPE=MyISAM;
108
109 -- --------------------------------------------------------
110
111 -- 
112 -- Structure for table `budget_trans`
113 -- 
114
115 DROP TABLE IF EXISTS `0_budget_trans`;
116 CREATE TABLE IF NOT EXISTS `0_budget_trans` (
117   `counter` int(11) NOT NULL auto_increment,
118   `type` smallint(6) NOT NULL default '0',
119   `type_no` bigint(16) NOT NULL default '1',
120   `tran_date` date NOT NULL default '0000-00-00',
121   `account` varchar(11) NOT NULL default '',
122   `memo_` tinytext NOT NULL,
123   `amount` double NOT NULL default '0',
124   `dimension_id` int(11) default '0',
125   `dimension2_id` int(11) default '0',
126   `person_type_id` int(11) default NULL,
127   `person_id` tinyblob,
128   PRIMARY KEY  (`counter`),
129   KEY `Type_and_Number` (`type`,`type_no`)
130 ) TYPE=InnoDB;
131
132 -- --------------------------------------------------------
133
134 -- 
135 -- Structure for table `chart_class`
136 -- 
137
138 DROP TABLE IF EXISTS `0_chart_class`;
139 CREATE TABLE IF NOT EXISTS `0_chart_class` (
140   `cid` int(11) NOT NULL default '0',
141   `class_name` varchar(60) NOT NULL default '',
142   `balance_sheet` tinyint(1) NOT NULL default '0',
143   PRIMARY KEY  (`cid`)
144 ) TYPE=MyISAM;
145
146 -- --------------------------------------------------------
147
148 -- 
149 -- Structure for table `chart_master`
150 -- 
151
152 DROP TABLE IF EXISTS `0_chart_master`;
153 CREATE TABLE IF NOT EXISTS `0_chart_master` (
154   `account_code` varchar(11) NOT NULL default '',
155   `account_code2` varchar(11) default '',
156   `account_name` varchar(60) NOT NULL default '',
157   `account_type` int(11) NOT NULL default '0',
158   `tax_code` int(11) NOT NULL default '0',
159   PRIMARY KEY  (`account_code`),
160   KEY `account_code` (`account_code`),
161   KEY `account_name` (`account_name`)
162 ) TYPE=MyISAM;
163
164 -- --------------------------------------------------------
165
166 -- 
167 -- Structure for table `chart_types`
168 -- 
169
170 DROP TABLE IF EXISTS `0_chart_types`;
171 CREATE TABLE IF NOT EXISTS `0_chart_types` (
172   `id` int(11) NOT NULL auto_increment,
173   `name` varchar(60) NOT NULL default '',
174   `class_id` tinyint(1) NOT NULL default '0',
175   `parent` int(11) NOT NULL default '-1',
176   PRIMARY KEY  (`id`),
177   UNIQUE KEY `name` (`name`)
178 ) TYPE=MyISAM;
179
180 -- --------------------------------------------------------
181
182 -- 
183 -- Structure for table `comments`
184 -- 
185
186 DROP TABLE IF EXISTS `0_comments`;
187 CREATE TABLE IF NOT EXISTS `0_comments` (
188   `type` int(11) NOT NULL default '0',
189   `id` int(11) NOT NULL default '0',
190   `date_` date default '0000-00-00',
191   `memo_` tinytext
192 ) TYPE=InnoDB;
193
194 -- --------------------------------------------------------
195
196 -- 
197 -- Structure for table `company`
198 -- 
199
200 DROP TABLE IF EXISTS `0_company`;
201 CREATE TABLE IF NOT EXISTS `0_company` (
202   `coy_code` int(11) NOT NULL default '1',
203   `coy_name` varchar(60) NOT NULL default '',
204   `gst_no` varchar(25) NOT NULL default '',
205   `coy_no` varchar(25) NOT NULL default '0',
206   `tax_prd` int(11) NOT NULL default '1',
207   `tax_last` int(11) NOT NULL default '1',
208   `postal_address` tinytext NOT NULL,
209   `phone` varchar(30) NOT NULL default '',
210   `fax` varchar(30) NOT NULL default '',
211   `email` varchar(100) NOT NULL default '',
212   `coy_logo` varchar(100) NOT NULL default '',
213   `domicile` varchar(55) NOT NULL default '',
214   `curr_default` char(3) NOT NULL default '',
215   `debtors_act` varchar(11) NOT NULL default '',
216   `pyt_discount_act` varchar(11) NOT NULL default '',
217   `creditors_act` varchar(11) NOT NULL default '',
218   `grn_act` varchar(11) NOT NULL default '',
219   `exchange_diff_act` varchar(11) NOT NULL default '',
220   `purch_exchange_diff_act` varchar(11) NOT NULL default '',
221   `retained_earnings_act` varchar(11) NOT NULL default '',
222   `freight_act` varchar(11) NOT NULL default '',
223   `default_sales_act` varchar(11) NOT NULL default '',
224   `default_sales_discount_act` varchar(11) NOT NULL default '',
225   `default_prompt_payment_act` varchar(11) NOT NULL default '',
226   `default_inventory_act` varchar(11) NOT NULL default '',
227   `default_cogs_act` varchar(11) NOT NULL default '',
228   `default_adj_act` varchar(11) NOT NULL default '',
229   `default_inv_sales_act` varchar(11) NOT NULL default '',
230   `default_assembly_act` varchar(11) NOT NULL default '',
231   `payroll_act` varchar(11) NOT NULL default '',
232   `custom1_name` varchar(60) NOT NULL default '',
233   `custom2_name` varchar(60) NOT NULL default '',
234   `custom3_name` varchar(60) NOT NULL default '',
235   `custom1_value` varchar(100) NOT NULL default '',
236   `custom2_value` varchar(100) NOT NULL default '',
237   `custom3_value` varchar(100) NOT NULL default '',
238   `allow_negative_stock` tinyint(1) NOT NULL default '0',
239   `po_over_receive` int(11) NOT NULL default '10',
240   `po_over_charge` int(11) NOT NULL default '10',
241   `default_credit_limit` int(11) NOT NULL default '1000',
242   `default_workorder_required` int(11) NOT NULL default '20',
243   `default_dim_required` int(11) NOT NULL default '20',
244   `past_due_days` int(11) NOT NULL default '30',
245   `use_dimension` tinyint(1) default '0',
246   `f_year` int(11) NOT NULL default '1',
247   `no_item_list` TINYINT(1) NOT NULL DEFAULT '0',
248   `no_customer_list` TINYINT(1) NOT NULL DEFAULT '0',
249   `no_supplier_list` TINYINT(1) NOT NULL DEFAULT '0',
250   PRIMARY KEY  (`coy_code`)
251 ) TYPE=MyISAM;
252
253 -- --------------------------------------------------------
254
255 -- 
256 -- Structure for table `credit_status`
257 -- 
258
259 DROP TABLE IF EXISTS `0_credit_status`;
260 CREATE TABLE IF NOT EXISTS `0_credit_status` (
261   `id` int(11) NOT NULL auto_increment,
262   `reason_description` char(100) NOT NULL default '',
263   `dissallow_invoices` tinyint(1) NOT NULL default '0',
264   PRIMARY KEY  (`id`),
265   UNIQUE KEY `reason_description` (`reason_description`)
266 ) TYPE=MyISAM;
267
268 -- --------------------------------------------------------
269
270 -- 
271 -- Structure for table `currencies`
272 -- 
273
274 DROP TABLE IF EXISTS `0_currencies`;
275 CREATE TABLE IF NOT EXISTS `0_currencies` (
276   `currency` varchar(60) NOT NULL default '',
277   `curr_abrev` char(3) NOT NULL default '',
278   `curr_symbol` varchar(10) NOT NULL default '',
279   `country` varchar(100) NOT NULL default '',
280   `hundreds_name` varchar(15) NOT NULL default '',
281   PRIMARY KEY  (`curr_abrev`)
282 ) TYPE=MyISAM;
283
284 -- --------------------------------------------------------
285
286 -- 
287 -- Structure for table `cust_allocations`
288 -- 
289
290 DROP TABLE IF EXISTS `0_cust_allocations`;
291 CREATE TABLE IF NOT EXISTS `0_cust_allocations` (
292   `id` int(11) NOT NULL auto_increment,
293   `amt` double unsigned default NULL,
294   `date_alloc` date NOT NULL default '0000-00-00',
295   `trans_no_from` int(11) default NULL,
296   `trans_type_from` int(11) default NULL,
297   `trans_no_to` int(11) default NULL,
298   `trans_type_to` int(11) default NULL,
299   PRIMARY KEY  (`id`)
300 ) TYPE=InnoDB;
301
302 -- --------------------------------------------------------
303
304 -- 
305 -- Structure for table `cust_branch`
306 -- 
307
308 DROP TABLE IF EXISTS `0_cust_branch`;
309 CREATE TABLE IF NOT EXISTS `0_cust_branch` (
310   `branch_code` int(11) NOT NULL auto_increment,
311   `debtor_no` int(11) NOT NULL default '0',
312   `br_name` varchar(60) NOT NULL default '',
313   `br_address` tinytext NOT NULL,
314   `area` int(11) default NULL,
315   `salesman` int(11) NOT NULL default '0',
316   `phone` varchar(30) NOT NULL default '',
317   `fax` varchar(30) NOT NULL default '',
318   `contact_name` varchar(60) NOT NULL default '',
319   `email` varchar(100) NOT NULL default '',
320   `default_location` varchar(5) NOT NULL default '',
321   `tax_group_id` int(11) default NULL,
322   `sales_account` varchar(11) default NULL,
323   `sales_discount_account` varchar(11) default NULL,
324   `receivables_account` varchar(11) default NULL,
325   `payment_discount_account` varchar(11) default NULL,
326   `default_ship_via` int(11) NOT NULL default '1',
327   `disable_trans` tinyint(4) NOT NULL default '0',
328   `br_post_address` tinytext NOT NULL,
329   PRIMARY KEY  (`branch_code`,`debtor_no`),
330   KEY `branch_code` (`branch_code`),
331   KEY `br_name` (`br_name`)
332 ) TYPE=MyISAM;
333
334 -- --------------------------------------------------------
335
336 -- 
337 -- Structure for table `debtor_trans`
338 -- 
339
340 DROP TABLE IF EXISTS `0_debtor_trans`;
341 CREATE TABLE IF NOT EXISTS `0_debtor_trans` (
342   `trans_no` int(11) unsigned NOT NULL default '0',
343   `type` smallint(6) unsigned NOT NULL default '0',
344   `debtor_no` int(11) unsigned default NULL,
345   `branch_code` int(11) NOT NULL default '-1',
346   `tran_date` date NOT NULL default '0000-00-00',
347   `due_date` date NOT NULL default '0000-00-00',
348   `reference` varchar(60) NOT NULL default '',
349   `tpe` int(11) NOT NULL default '0',
350   `order_` int(11) NOT NULL default '0',
351   `ov_amount` double NOT NULL default '0',
352   `ov_gst` double NOT NULL default '0',
353   `ov_freight` double NOT NULL default '0',
354   `ov_discount` double NOT NULL default '0',
355   `alloc` double NOT NULL default '0',
356   `rate` double NOT NULL default '1',
357   `ship_via` int(11) default NULL,
358   PRIMARY KEY  (`trans_no`,`type`),
359   KEY `debtor_no` (`debtor_no`,`branch_code`)
360 ) TYPE=InnoDB;
361
362 -- --------------------------------------------------------
363
364 -- 
365 -- Structure for table `debtor_trans_details`
366 -- 
367
368 DROP TABLE IF EXISTS `0_debtor_trans_details`;
369 CREATE TABLE IF NOT EXISTS `0_debtor_trans_details` (
370   `id` int(11) NOT NULL auto_increment,
371   `debtor_trans_no` int(11) default NULL,
372   `debtor_trans_type` int(11) default NULL,
373   `stock_id` varchar(20) NOT NULL default '',
374   `description` tinytext,
375   `unit_price` double NOT NULL default '0',
376   `unit_tax` double NOT NULL default '0',
377   `quantity` double NOT NULL default '0',
378   `discount_percent` double NOT NULL default '0',
379   `standard_cost` double NOT NULL default '0',
380   PRIMARY KEY  (`id`)
381 ) TYPE=InnoDB;
382
383 -- --------------------------------------------------------
384
385 -- 
386 -- Structure for table `debtor_trans_tax_details`
387 -- 
388
389 DROP TABLE IF EXISTS `0_debtor_trans_tax_details`;
390 CREATE TABLE IF NOT EXISTS `0_debtor_trans_tax_details` (
391   `id` int(11) NOT NULL auto_increment,
392   `debtor_trans_no` int(11) default NULL,
393   `debtor_trans_type` int(11) default NULL,
394   `tax_type_id` int(11) NOT NULL default '0',
395   `tax_type_name` varchar(60) default NULL,
396   `rate` double NOT NULL default '0',
397   `included_in_price` tinyint(1) NOT NULL default '0',
398   `amount` double NOT NULL default '0',
399   PRIMARY KEY  (`id`)
400 ) TYPE=InnoDB;
401
402 -- --------------------------------------------------------
403
404 -- 
405 -- Structure for table `debtors_master`
406 -- 
407
408 DROP TABLE IF EXISTS `0_debtors_master`;
409 CREATE TABLE IF NOT EXISTS `0_debtors_master` (
410   `debtor_no` int(11) NOT NULL auto_increment,
411   `name` varchar(60) NOT NULL default '',
412   `address` tinytext,
413   `email` varchar(100) NOT NULL default '',
414   `tax_id` varchar(55) NOT NULL default '',
415   `curr_code` char(3) NOT NULL default '',
416   `sales_type` int(11) NOT NULL default '1',
417   `dimension_id` int(11) NOT NULL default '0',
418   `dimension2_id` int(11) NOT NULL default '0',
419   `credit_status` int(11) NOT NULL default '0',
420   `payment_terms` int(11) default NULL,
421   `discount` double NOT NULL default '0',
422   `pymt_discount` double NOT NULL default '0',
423   `credit_limit` float NOT NULL default '1000',
424   PRIMARY KEY  (`debtor_no`),
425   UNIQUE KEY `name` (`name`)
426 ) TYPE=MyISAM;
427
428 -- --------------------------------------------------------
429
430 -- 
431 -- Structure for table `dimensions`
432 -- 
433
434 DROP TABLE IF EXISTS `0_dimensions`;
435 CREATE TABLE IF NOT EXISTS `0_dimensions` (
436   `id` int(11) NOT NULL auto_increment,
437   `reference` varchar(60) NOT NULL default '',
438   `name` varchar(60) NOT NULL default '',
439   `type_` tinyint(1) NOT NULL default '1',
440   `closed` tinyint(1) NOT NULL default '0',
441   `date_` date NOT NULL default '0000-00-00',
442   `due_date` date NOT NULL default '0000-00-00',
443   PRIMARY KEY  (`id`),
444   UNIQUE KEY `reference` (`reference`)
445 ) TYPE=InnoDB;
446
447 -- --------------------------------------------------------
448
449 -- 
450 -- Structure for table `exchange_rates`
451 -- 
452
453 DROP TABLE IF EXISTS `0_exchange_rates`;
454 CREATE TABLE IF NOT EXISTS `0_exchange_rates` (
455   `id` int(11) NOT NULL auto_increment,
456   `curr_code` char(3) NOT NULL default '',
457   `rate_buy` double NOT NULL default '0',
458   `rate_sell` double NOT NULL default '0',
459   `date_` date NOT NULL default '0000-00-00',
460   PRIMARY KEY  (`id`),
461   UNIQUE KEY `curr_code` (`curr_code`,`date_`)
462 ) TYPE=MyISAM;
463
464 -- --------------------------------------------------------
465
466 -- 
467 -- Structure for table `fiscal_year`
468 -- 
469
470 DROP TABLE IF EXISTS `0_fiscal_year`;
471 CREATE TABLE IF NOT EXISTS `0_fiscal_year` (
472   `id` int(11) NOT NULL auto_increment,
473   `begin` date default '0000-00-00',
474   `end` date default '0000-00-00',
475   `closed` tinyint(1) NOT NULL default '0',
476   PRIMARY KEY  (`id`)
477 ) TYPE=InnoDB;
478
479 -- --------------------------------------------------------
480
481 -- 
482 -- Structure for table `form_items`
483 -- 
484
485 DROP TABLE IF EXISTS `0_form_items`;
486 CREATE TABLE IF NOT EXISTS `0_form_items` (
487   `form_id` int(11) NOT NULL default '0',
488   `form_type` int(11) NOT NULL default '0',
489   `trans_type` int(11) NOT NULL default '0',
490   `trans_id` int(11) NOT NULL default '0',
491   `param1` varchar(100) NOT NULL default '',
492   `param2` varchar(100) default NULL,
493   PRIMARY KEY  (`form_id`,`form_type`)
494 ) TYPE=InnoDB;
495
496 -- --------------------------------------------------------
497
498 -- 
499 -- Structure for table `gl_trans`
500 -- 
501
502 DROP TABLE IF EXISTS `0_gl_trans`;
503 CREATE TABLE IF NOT EXISTS `0_gl_trans` (
504   `counter` int(11) NOT NULL auto_increment,
505   `type` smallint(6) NOT NULL default '0',
506   `type_no` bigint(16) NOT NULL default '1',
507   `tran_date` date NOT NULL default '0000-00-00',
508   `account` varchar(11) NOT NULL default '',
509   `memo_` tinytext NOT NULL,
510   `amount` double NOT NULL default '0',
511   `dimension_id` int(11) NOT NULL default '0',
512   `dimension2_id` int(11) NOT NULL default '0',
513   `person_type_id` int(11) default NULL,
514   `person_id` tinyblob,
515   PRIMARY KEY  (`counter`),
516   KEY `Type_and_Number` (`type`,`type_no`)
517 ) TYPE=InnoDB;
518
519 -- --------------------------------------------------------
520
521 -- 
522 -- Structure for table `grn_batch`
523 -- 
524
525 DROP TABLE IF EXISTS `0_grn_batch`;
526 CREATE TABLE IF NOT EXISTS `0_grn_batch` (
527   `id` int(11) NOT NULL auto_increment,
528   `supplier_id` int(11) NOT NULL default '0',
529   `purch_order_no` int(11) default NULL,
530   `reference` varchar(60) NOT NULL default '',
531   `delivery_date` date NOT NULL default '0000-00-00',
532   `loc_code` varchar(5) default NULL,
533   PRIMARY KEY  (`id`)
534 ) TYPE=InnoDB;
535
536 -- --------------------------------------------------------
537
538 -- 
539 -- Structure for table `grn_items`
540 -- 
541
542 DROP TABLE IF EXISTS `0_grn_items`;
543 CREATE TABLE IF NOT EXISTS `0_grn_items` (
544   `id` int(11) NOT NULL auto_increment,
545   `grn_batch_id` int(11) default NULL,
546   `po_detail_item` int(11) NOT NULL default '0',
547   `item_code` varchar(20) NOT NULL default '',
548   `description` tinytext,
549   `qty_recd` double NOT NULL default '0',
550   `quantity_inv` double NOT NULL default '0',
551   PRIMARY KEY  (`id`)
552 ) TYPE=InnoDB;
553
554 -- --------------------------------------------------------
555
556 -- 
557 -- Structure for table `item_tax_type_exemptions`
558 -- 
559
560 DROP TABLE IF EXISTS `0_item_tax_type_exemptions`;
561 CREATE TABLE IF NOT EXISTS `0_item_tax_type_exemptions` (
562   `item_tax_type_id` int(11) NOT NULL default '0',
563   `tax_type_id` int(11) NOT NULL default '0',
564   PRIMARY KEY  (`item_tax_type_id`,`tax_type_id`)
565 ) TYPE=InnoDB;
566
567 -- --------------------------------------------------------
568
569 -- 
570 -- Structure for table `item_tax_types`
571 -- 
572
573 DROP TABLE IF EXISTS `0_item_tax_types`;
574 CREATE TABLE IF NOT EXISTS `0_item_tax_types` (
575   `id` int(11) NOT NULL auto_increment,
576   `name` varchar(60) NOT NULL default '',
577   `exempt` tinyint(1) NOT NULL default '0',
578   PRIMARY KEY  (`id`),
579   UNIQUE KEY `name` (`name`)
580 ) TYPE=InnoDB;
581
582 -- --------------------------------------------------------
583
584 -- 
585 -- Structure for table `loc_stock`
586 -- 
587
588 DROP TABLE IF EXISTS `0_loc_stock`;
589 CREATE TABLE IF NOT EXISTS `0_loc_stock` (
590   `loc_code` char(5) NOT NULL default '',
591   `stock_id` char(20) NOT NULL default '',
592   `reorder_level` bigint(20) NOT NULL default '0',
593   PRIMARY KEY  (`loc_code`,`stock_id`),
594   KEY `stock_id` (`stock_id`)
595 ) TYPE=InnoDB;
596
597 -- --------------------------------------------------------
598
599 -- 
600 -- Structure for table `locations`
601 -- 
602
603 DROP TABLE IF EXISTS `0_locations`;
604 CREATE TABLE IF NOT EXISTS `0_locations` (
605   `loc_code` varchar(5) NOT NULL default '',
606   `location_name` varchar(60) NOT NULL default '',
607   `delivery_address` tinytext NOT NULL,
608   `phone` varchar(30) NOT NULL default '',
609   `fax` varchar(30) NOT NULL default '',
610   `email` varchar(100) NOT NULL default '',
611   `contact` varchar(30) NOT NULL default '',
612   PRIMARY KEY  (`loc_code`)
613 ) TYPE=MyISAM;
614
615 -- --------------------------------------------------------
616
617 -- 
618 -- Structure for table `movement_types`
619 -- 
620
621 DROP TABLE IF EXISTS `0_movement_types`;
622 CREATE TABLE IF NOT EXISTS `0_movement_types` (
623   `id` int(11) NOT NULL auto_increment,
624   `name` varchar(60) NOT NULL default '',
625   PRIMARY KEY  (`id`),
626   UNIQUE KEY `name` (`name`)
627 ) TYPE=MyISAM;
628
629 -- --------------------------------------------------------
630
631 -- 
632 -- Structure for table `payment_terms`
633 -- 
634
635 DROP TABLE IF EXISTS `0_payment_terms`;
636 CREATE TABLE IF NOT EXISTS `0_payment_terms` (
637   `terms_indicator` int(11) NOT NULL auto_increment,
638   `terms` char(80) NOT NULL default '',
639   `days_before_due` smallint(6) NOT NULL default '0',
640   `day_in_following_month` smallint(6) NOT NULL default '0',
641   PRIMARY KEY  (`terms_indicator`),
642   UNIQUE KEY `terms` (`terms`)
643 ) TYPE=MyISAM;
644
645 -- --------------------------------------------------------
646
647 -- 
648 -- Structure for table `prices`
649 -- 
650
651 DROP TABLE IF EXISTS `0_prices`;
652 CREATE TABLE IF NOT EXISTS `0_prices` (
653   `id` int(11) NOT NULL auto_increment,
654   `stock_id` varchar(20) NOT NULL default '',
655   `sales_type_id` int(11) NOT NULL default '0',
656   `curr_abrev` char(3) NOT NULL default '',
657   `price` double NOT NULL default '0',
658   PRIMARY KEY  (`id`),
659   UNIQUE KEY `price` (`stock_id`,`sales_type_id`,`curr_abrev`)
660 ) TYPE=MyISAM;
661
662 -- --------------------------------------------------------
663
664 -- 
665 -- Structure for table `purch_data`
666 -- 
667
668 DROP TABLE IF EXISTS `0_purch_data`;
669 CREATE TABLE IF NOT EXISTS `0_purch_data` (
670   `supplier_id` int(11) NOT NULL default '0',
671   `stock_id` char(20) NOT NULL default '',
672   `price` double NOT NULL default '0',
673   `suppliers_uom` char(50) NOT NULL default '',
674   `conversion_factor` double NOT NULL default '1',
675   `supplier_description` char(50) NOT NULL default '',
676   PRIMARY KEY  (`supplier_id`,`stock_id`)
677 ) TYPE=MyISAM;
678
679 -- --------------------------------------------------------
680
681 -- 
682 -- Structure for table `purch_order_details`
683 -- 
684
685 DROP TABLE IF EXISTS `0_purch_order_details`;
686 CREATE TABLE IF NOT EXISTS `0_purch_order_details` (
687   `po_detail_item` int(11) NOT NULL auto_increment,
688   `order_no` int(11) NOT NULL default '0',
689   `item_code` varchar(20) NOT NULL default '',
690   `description` tinytext,
691   `delivery_date` date NOT NULL default '0000-00-00',
692   `qty_invoiced` double NOT NULL default '0',
693   `unit_price` double NOT NULL default '0',
694   `act_price` double NOT NULL default '0',
695   `std_cost_unit` double NOT NULL default '0',
696   `quantity_ordered` double NOT NULL default '0',
697   `quantity_received` double NOT NULL default '0',
698   PRIMARY KEY  (`po_detail_item`)
699 ) TYPE=InnoDB;
700
701 -- --------------------------------------------------------
702
703 -- 
704 -- Structure for table `purch_orders`
705 -- 
706
707 DROP TABLE IF EXISTS `0_purch_orders`;
708 CREATE TABLE IF NOT EXISTS `0_purch_orders` (
709   `order_no` int(11) NOT NULL auto_increment,
710   `supplier_id` int(11) NOT NULL default '0',
711   `comments` tinytext,
712   `ord_date` date NOT NULL default '0000-00-00',
713   `reference` tinytext NOT NULL,
714   `requisition_no` tinytext,
715   `into_stock_location` varchar(5) NOT NULL default '',
716   `delivery_address` tinytext NOT NULL,
717   PRIMARY KEY  (`order_no`)
718 ) TYPE=InnoDB;
719
720 -- --------------------------------------------------------
721
722 -- 
723 -- Structure for table `refs`
724 -- 
725
726 DROP TABLE IF EXISTS `0_refs`;
727 CREATE TABLE IF NOT EXISTS `0_refs` (
728   `id` int(11) NOT NULL default '0',
729   `type` int(11) NOT NULL default '0',
730   `reference` varchar(100) NOT NULL default '',
731   PRIMARY KEY  (`id`,`type`)
732 ) TYPE=InnoDB;
733
734 -- --------------------------------------------------------
735
736 -- 
737 -- Structure for table `sales_order_details`
738 -- 
739
740 DROP TABLE IF EXISTS `0_sales_order_details`;
741 CREATE TABLE IF NOT EXISTS `0_sales_order_details` (
742   `order_no` int(11) NOT NULL default '0',
743   `stk_code` varchar(20) NOT NULL default '',
744   `description` tinytext,
745   `qty_invoiced` double NOT NULL default '0',
746   `unit_price` double NOT NULL default '0',
747   `quantity` double NOT NULL default '0',
748   `discount_percent` double NOT NULL default '0',
749   PRIMARY KEY  (`order_no`,`stk_code`)
750 ) TYPE=InnoDB;
751
752 -- --------------------------------------------------------
753
754 -- 
755 -- Structure for table `sales_orders`
756 -- 
757
758 DROP TABLE IF EXISTS `0_sales_orders`;
759 CREATE TABLE IF NOT EXISTS `0_sales_orders` (
760   `order_no` int(11) NOT NULL auto_increment,
761   `debtor_no` int(11) NOT NULL default '0',
762   `branch_code` int(11) NOT NULL default '0',
763   `customer_ref` tinytext NOT NULL,
764   `comments` tinytext,
765   `ord_date` date NOT NULL default '0000-00-00',
766   `order_type` int(11) NOT NULL default '0',
767   `ship_via` int(11) NOT NULL default '0',
768   `delivery_address` tinytext NOT NULL,
769   `contact_phone` varchar(30) default NULL,
770   `contact_email` varchar(100) default NULL,
771   `deliver_to` tinytext NOT NULL,
772   `freight_cost` double NOT NULL default '0',
773   `from_stk_loc` varchar(5) NOT NULL default '',
774   `delivery_date` date NOT NULL default '0000-00-00',
775   PRIMARY KEY  (`order_no`)
776 ) TYPE=InnoDB;
777
778 -- --------------------------------------------------------
779
780 -- 
781 -- Structure for table `sales_types`
782 -- 
783
784 DROP TABLE IF EXISTS `0_sales_types`;
785 CREATE TABLE IF NOT EXISTS `0_sales_types` (
786   `id` int(11) NOT NULL auto_increment,
787   `sales_type` char(50) NOT NULL default '',
788   PRIMARY KEY  (`id`),
789   UNIQUE KEY `sales_type` (`sales_type`)
790 ) TYPE=MyISAM;
791
792 -- --------------------------------------------------------
793
794 -- 
795 -- Structure for table `salesman`
796 -- 
797
798 DROP TABLE IF EXISTS `0_salesman`;
799 CREATE TABLE IF NOT EXISTS `0_salesman` (
800   `salesman_code` int(11) NOT NULL auto_increment,
801   `salesman_name` char(60) NOT NULL default '',
802   `salesman_phone` char(30) NOT NULL default '',
803   `salesman_fax` char(30) NOT NULL default '',
804   `salesman_email` varchar(100) NOT NULL default '',
805   PRIMARY KEY  (`salesman_code`),
806   UNIQUE KEY `salesman_name` (`salesman_name`)
807 ) TYPE=MyISAM;
808
809 -- --------------------------------------------------------
810
811 -- 
812 -- Structure for table `shippers`
813 -- 
814
815 DROP TABLE IF EXISTS `0_shippers`;
816 CREATE TABLE IF NOT EXISTS `0_shippers` (
817   `shipper_id` int(11) NOT NULL auto_increment,
818   `shipper_name` varchar(60) NOT NULL default '',
819   `phone` varchar(30) NOT NULL default '',
820   `contact` tinytext NOT NULL,
821   `address` tinytext NOT NULL,
822   PRIMARY KEY  (`shipper_id`),
823   UNIQUE KEY `name` (`shipper_name`)
824 ) TYPE=MyISAM;
825
826 -- --------------------------------------------------------
827
828 -- 
829 -- Structure for table `stock_category`
830 -- 
831
832 DROP TABLE IF EXISTS `0_stock_category`;
833 CREATE TABLE IF NOT EXISTS `0_stock_category` (
834   `category_id` int(11) NOT NULL auto_increment,
835   `description` varchar(60) NOT NULL default '',
836   `stock_act` varchar(11) default NULL,
837   `cogs_act` varchar(11) default NULL,
838   `adj_gl_act` varchar(11) default NULL,
839   `purch_price_var_act` varchar(11) default NULL,
840   PRIMARY KEY  (`category_id`),
841   UNIQUE KEY `description` (`description`)
842 ) TYPE=MyISAM;
843
844 -- --------------------------------------------------------
845
846 -- 
847 -- Structure for table `stock_master`
848 -- 
849
850 DROP TABLE IF EXISTS `0_stock_master`;
851 CREATE TABLE IF NOT EXISTS `0_stock_master` (
852   `stock_id` varchar(20) NOT NULL default '',
853   `category_id` int(11) NOT NULL default '0',
854   `tax_type_id` int(11) NOT NULL default '0',
855   `description` varchar(200) NOT NULL default '',
856   `long_description` tinytext NOT NULL,
857   `units` varchar(20) NOT NULL default 'each',
858   `mb_flag` char(1) NOT NULL default 'B',
859   `sales_account` varchar(11) NOT NULL default '',
860   `cogs_account` varchar(11) NOT NULL default '',
861   `inventory_account` varchar(11) NOT NULL default '',
862   `adjustment_account` varchar(11) NOT NULL default '',
863   `assembly_account` varchar(11) NOT NULL default '',
864   `dimension_id` int(11) default NULL,
865   `dimension2_id` int(11) default NULL,
866   `actual_cost` double NOT NULL default '0',
867   `last_cost` double NOT NULL default '0',
868   `material_cost` double NOT NULL default '0',
869   `labour_cost` double NOT NULL default '0',
870   `overhead_cost` double NOT NULL default '0',
871   PRIMARY KEY  (`stock_id`)
872 ) TYPE=InnoDB;
873
874 -- --------------------------------------------------------
875
876 -- 
877 -- Structure for table `stock_moves`
878 -- 
879
880 DROP TABLE IF EXISTS `0_stock_moves`;
881 CREATE TABLE IF NOT EXISTS `0_stock_moves` (
882   `trans_id` int(11) NOT NULL auto_increment,
883   `trans_no` int(11) NOT NULL default '0',
884   `stock_id` char(20) NOT NULL default '',
885   `type` smallint(6) NOT NULL default '0',
886   `loc_code` char(5) NOT NULL default '',
887   `tran_date` date NOT NULL default '0000-00-00',
888   `person_id` int(11) default NULL,
889   `price` double NOT NULL default '0',
890   `reference` char(40) NOT NULL default '',
891   `qty` double NOT NULL default '1',
892   `discount_percent` double NOT NULL default '0',
893   `standard_cost` double NOT NULL default '0',
894   `visible` tinyint(1) NOT NULL default '1',
895   PRIMARY KEY  (`trans_id`),
896   KEY `type` (`type`,`trans_no`)
897 ) TYPE=InnoDB;
898
899 -- --------------------------------------------------------
900
901 -- 
902 -- Structure for table `supp_allocations`
903 -- 
904
905 DROP TABLE IF EXISTS `0_supp_allocations`;
906 CREATE TABLE IF NOT EXISTS `0_supp_allocations` (
907   `id` int(11) NOT NULL auto_increment,
908   `amt` double unsigned default NULL,
909   `date_alloc` date NOT NULL default '0000-00-00',
910   `trans_no_from` int(11) default NULL,
911   `trans_type_from` int(11) default NULL,
912   `trans_no_to` int(11) default NULL,
913   `trans_type_to` int(11) default NULL,
914   PRIMARY KEY  (`id`)
915 ) TYPE=InnoDB;
916
917 -- --------------------------------------------------------
918
919 -- 
920 -- Structure for table `supp_invoice_items`
921 -- 
922
923 DROP TABLE IF EXISTS `0_supp_invoice_items`;
924 CREATE TABLE IF NOT EXISTS `0_supp_invoice_items` (
925   `id` int(11) NOT NULL auto_increment,
926   `supp_trans_no` int(11) default NULL,
927   `supp_trans_type` int(11) default NULL,
928   `gl_code` int(11) NOT NULL default '0',
929   `grn_item_id` int(11) default NULL,
930   `po_detail_item_id` int(11) default NULL,
931   `stock_id` varchar(20) NOT NULL default '',
932   `description` tinytext,
933   `quantity` double NOT NULL default '0',
934   `unit_price` double NOT NULL default '0',
935   `unit_tax` double NOT NULL default '0',
936   `memo_` tinytext,
937   PRIMARY KEY  (`id`)
938 ) TYPE=InnoDB;
939
940 -- --------------------------------------------------------
941
942 -- 
943 -- Structure for table `supp_invoice_tax_items`
944 -- 
945
946 DROP TABLE IF EXISTS `0_supp_invoice_tax_items`;
947 CREATE TABLE IF NOT EXISTS `0_supp_invoice_tax_items` (
948   `id` int(11) NOT NULL auto_increment,
949   `supp_trans_no` int(11) default NULL,
950   `supp_trans_type` int(11) default NULL,
951   `tax_type_id` int(11) NOT NULL default '0',
952   `tax_type_name` varchar(60) default NULL,
953   `rate` double NOT NULL default '0',
954   `included_in_price` tinyint(1) NOT NULL default '0',
955   `amount` double NOT NULL default '0',
956   PRIMARY KEY  (`id`)
957 ) TYPE=InnoDB;
958
959 -- --------------------------------------------------------
960
961 -- 
962 -- Structure for table `supp_trans`
963 -- 
964
965 DROP TABLE IF EXISTS `0_supp_trans`;
966 CREATE TABLE IF NOT EXISTS `0_supp_trans` (
967   `trans_no` int(11) unsigned NOT NULL default '0',
968   `type` smallint(6) unsigned NOT NULL default '0',
969   `supplier_id` int(11) unsigned default NULL,
970   `reference` tinytext NOT NULL,
971   `supp_reference` varchar(60) NOT NULL default '',
972   `tran_date` date NOT NULL default '0000-00-00',
973   `due_date` date NOT NULL default '0000-00-00',
974   `ov_amount` double NOT NULL default '0',
975   `ov_discount` double NOT NULL default '0',
976   `ov_gst` double NOT NULL default '0',
977   `rate` double NOT NULL default '1',
978   `alloc` double NOT NULL default '0',
979   PRIMARY KEY  (`trans_no`,`type`),
980   KEY `supplier_id` (`supplier_id`),
981   KEY `SupplierID_2` (`supplier_id`,`supp_reference`),
982   KEY `type` (`type`)
983 ) TYPE=InnoDB;
984
985 -- --------------------------------------------------------
986
987 -- 
988 -- Structure for table `suppliers`
989 -- 
990
991 DROP TABLE IF EXISTS `0_suppliers`;
992 CREATE TABLE IF NOT EXISTS `0_suppliers` (
993   `supplier_id` int(11) NOT NULL auto_increment,
994   `supp_name` varchar(60) NOT NULL default '',
995   `address` tinytext NOT NULL,
996   `email` varchar(100) NOT NULL default '',
997   `bank_account` varchar(60) NOT NULL default '',
998   `curr_code` char(3) default NULL,
999   `payment_terms` int(11) default NULL,
1000   `dimension_id` int(11) default '0',
1001   `dimension2_id` int(11) default '0',
1002   `tax_group_id` int(11) default NULL,
1003   `purchase_account` varchar(11) default NULL,
1004   `payable_account` varchar(11) default NULL,
1005   `payment_discount_account` varchar(11) default NULL,
1006   PRIMARY KEY  (`supplier_id`)
1007 ) TYPE=MyISAM;
1008
1009 -- --------------------------------------------------------
1010
1011 -- 
1012 -- Structure for table `sys_types`
1013 -- 
1014
1015 DROP TABLE IF EXISTS `0_sys_types`;
1016 CREATE TABLE IF NOT EXISTS `0_sys_types` (
1017   `type_id` smallint(6) NOT NULL default '0',
1018   `type_name` varchar(60) NOT NULL default '',
1019   `type_no` int(11) NOT NULL default '1',
1020   `next_reference` varchar(100) NOT NULL default '',
1021   PRIMARY KEY  (`type_id`)
1022 ) TYPE=InnoDB;
1023
1024 -- --------------------------------------------------------
1025
1026 -- 
1027 -- Structure for table `tax_group_items`
1028 -- 
1029
1030 DROP TABLE IF EXISTS `0_tax_group_items`;
1031 CREATE TABLE IF NOT EXISTS `0_tax_group_items` (
1032   `tax_group_id` int(11) NOT NULL default '0',
1033   `tax_type_id` int(11) NOT NULL default '0',
1034   `rate` double NOT NULL default '0',
1035   `included_in_price` tinyint(1) NOT NULL default '0',
1036   PRIMARY KEY  (`tax_group_id`,`tax_type_id`)
1037 ) TYPE=InnoDB;
1038
1039 -- --------------------------------------------------------
1040
1041 -- 
1042 -- Structure for table `tax_groups`
1043 -- 
1044
1045 DROP TABLE IF EXISTS `0_tax_groups`;
1046 CREATE TABLE IF NOT EXISTS `0_tax_groups` (
1047   `id` int(11) NOT NULL auto_increment,
1048   `name` varchar(60) NOT NULL default '',
1049   `tax_shipping` tinyint(1) NOT NULL default '0',
1050   PRIMARY KEY  (`id`),
1051   UNIQUE KEY `name` (`name`)
1052 ) TYPE=InnoDB;
1053
1054 -- --------------------------------------------------------
1055
1056 -- 
1057 -- Structure for table `tax_types`
1058 -- 
1059
1060 DROP TABLE IF EXISTS `0_tax_types`;
1061 CREATE TABLE IF NOT EXISTS `0_tax_types` (
1062   `id` int(11) NOT NULL auto_increment,
1063   `rate` double NOT NULL default '0',
1064   `sales_gl_code` varchar(11) NOT NULL default '',
1065   `purchasing_gl_code` varchar(11) NOT NULL default '',
1066   `name` varchar(60) NOT NULL default '',
1067   `out` tinyint(1) NOT NULL default '1',
1068   PRIMARY KEY  (`id`),
1069   UNIQUE KEY `name` (`name`)
1070 ) TYPE=InnoDB;
1071
1072 -- --------------------------------------------------------
1073
1074 -- 
1075 -- Structure for table `users`
1076 -- 
1077
1078 DROP TABLE IF EXISTS `0_users`;
1079 CREATE TABLE IF NOT EXISTS `0_users` (
1080   `user_id` varchar(60) NOT NULL default '',
1081   `password` varchar(100) NOT NULL default '',
1082   `real_name` varchar(100) NOT NULL default '',
1083   `full_access` int(11) NOT NULL default '1',
1084   `phone` varchar(30) NOT NULL default '',
1085   `email` varchar(100) default NULL,
1086   `language` varchar(20) default NULL,
1087   `date_format` tinyint(1) NOT NULL default '0',
1088   `date_sep` tinyint(1) NOT NULL default '0',
1089   `tho_sep` tinyint(1) NOT NULL default '0',
1090   `dec_sep` tinyint(1) NOT NULL default '0',
1091   `theme` varchar(20) NOT NULL default 'default',
1092   `page_size` varchar(20) NOT NULL default 'A4',
1093   `prices_dec` smallint(6) NOT NULL default '2',
1094   `qty_dec` smallint(6) NOT NULL default '2',
1095   `rates_dec` smallint(6) NOT NULL default '4',
1096   `percent_dec` smallint(6) NOT NULL default '1',
1097   `show_gl` tinyint(1) NOT NULL default '1',
1098   `show_codes` tinyint(1) NOT NULL default '0',
1099   `last_visit_date` datetime default NULL,
1100   PRIMARY KEY  (`user_id`)
1101 ) TYPE=MyISAM;
1102
1103 -- --------------------------------------------------------
1104
1105 -- 
1106 -- Structure for table `voided`
1107 -- 
1108
1109 DROP TABLE IF EXISTS `0_voided`;
1110 CREATE TABLE IF NOT EXISTS `0_voided` (
1111   `type` int(11) NOT NULL default '0',
1112   `id` int(11) NOT NULL default '0',
1113   `date_` date NOT NULL default '0000-00-00',
1114   `memo_` tinytext NOT NULL,
1115   UNIQUE KEY `id` (`type`,`id`)
1116 ) TYPE=InnoDB;
1117
1118 -- --------------------------------------------------------
1119
1120 -- 
1121 -- Structure for table `wo_issue_items`
1122 -- 
1123
1124 DROP TABLE IF EXISTS `0_wo_issue_items`;
1125 CREATE TABLE IF NOT EXISTS `0_wo_issue_items` (
1126   `id` int(11) NOT NULL auto_increment,
1127   `stock_id` varchar(40) default NULL,
1128   `issue_id` int(11) default NULL,
1129   `qty_issued` double default NULL,
1130   PRIMARY KEY  (`id`)
1131 ) TYPE=InnoDB;
1132
1133 -- --------------------------------------------------------
1134
1135 -- 
1136 -- Structure for table `wo_issues`
1137 -- 
1138
1139 DROP TABLE IF EXISTS `0_wo_issues`;
1140 CREATE TABLE IF NOT EXISTS `0_wo_issues` (
1141   `issue_no` int(11) NOT NULL auto_increment,
1142   `workorder_id` int(11) NOT NULL default '0',
1143   `reference` varchar(100) default NULL,
1144   `issue_date` date default NULL,
1145   `loc_code` varchar(5) default NULL,
1146   `workcentre_id` int(11) default NULL,
1147   PRIMARY KEY  (`issue_no`)
1148 ) TYPE=InnoDB;
1149
1150 -- --------------------------------------------------------
1151
1152 -- 
1153 -- Structure for table `wo_manufacture`
1154 -- 
1155
1156 DROP TABLE IF EXISTS `0_wo_manufacture`;
1157 CREATE TABLE IF NOT EXISTS `0_wo_manufacture` (
1158   `id` int(11) NOT NULL auto_increment,
1159   `reference` varchar(100) default NULL,
1160   `workorder_id` int(11) NOT NULL default '0',
1161   `quantity` double NOT NULL default '0',
1162   `date_` date NOT NULL default '0000-00-00',
1163   PRIMARY KEY  (`id`)
1164 ) TYPE=InnoDB;
1165
1166 -- --------------------------------------------------------
1167
1168 -- 
1169 -- Structure for table `wo_requirements`
1170 -- 
1171
1172 DROP TABLE IF EXISTS `0_wo_requirements`;
1173 CREATE TABLE IF NOT EXISTS `0_wo_requirements` (
1174   `id` int(11) NOT NULL auto_increment,
1175   `workorder_id` int(11) NOT NULL default '0',
1176   `stock_id` char(20) NOT NULL default '',
1177   `workcentre` char(5) NOT NULL default '',
1178   `units_req` double NOT NULL default '1',
1179   `std_cost` double NOT NULL default '0',
1180   `loc_code` char(5) NOT NULL default '',
1181   `units_issued` double NOT NULL default '0',
1182   PRIMARY KEY  (`id`)
1183 ) TYPE=InnoDB;
1184
1185 -- --------------------------------------------------------
1186
1187 -- 
1188 -- Structure for table `workcentres`
1189 -- 
1190
1191 DROP TABLE IF EXISTS `0_workcentres`;
1192 CREATE TABLE IF NOT EXISTS `0_workcentres` (
1193   `id` int(11) NOT NULL auto_increment,
1194   `name` char(40) NOT NULL default '',
1195   `description` char(50) NOT NULL default '',
1196   PRIMARY KEY  (`id`),
1197   UNIQUE KEY `name` (`name`)
1198 ) TYPE=MyISAM;
1199
1200 -- --------------------------------------------------------
1201
1202 -- 
1203 -- Structure for table `workorders`
1204 -- 
1205
1206 DROP TABLE IF EXISTS `0_workorders`;
1207 CREATE TABLE IF NOT EXISTS `0_workorders` (
1208   `id` int(11) NOT NULL auto_increment,
1209   `wo_ref` varchar(60) NOT NULL default '',
1210   `loc_code` varchar(5) NOT NULL default '',
1211   `units_reqd` double NOT NULL default '1',
1212   `stock_id` varchar(20) NOT NULL default '',
1213   `date_` date NOT NULL default '0000-00-00',
1214   `type` tinyint(4) NOT NULL default '0',
1215   `required_by` date NOT NULL default '0000-00-00',
1216   `released_date` date NOT NULL default '0000-00-00',
1217   `units_issued` double NOT NULL default '0',
1218   `closed` tinyint(1) NOT NULL default '0',
1219   `released` tinyint(1) NOT NULL default '0',
1220   `additional_costs` double NOT NULL default '0',
1221   PRIMARY KEY  (`id`),
1222   UNIQUE KEY `wo_ref` (`wo_ref`)
1223 ) TYPE=InnoDB;
1224
1225 -- --------------------------------------------------------
1226
1227 -- 
1228 -- Data in table `areas`
1229 -- 
1230
1231 INSERT INTO `0_areas` VALUES (1, 'USA');
1232
1233 -- 
1234 -- Data in table `bank_accounts`
1235 -- 
1236
1237 INSERT INTO `0_bank_accounts` VALUES ('1700', 0, 'Current account', 'N/A', 'N/A', NULL, 'USD');
1238 INSERT INTO `0_bank_accounts` VALUES ('1705', 0, 'Petty Cash account', 'N/A', 'N/A', NULL, 'USD');
1239
1240 -- 
1241 -- Data in table `bank_trans_types`
1242 -- 
1243
1244 INSERT INTO `0_bank_trans_types` VALUES (1, 'Cash');
1245 INSERT INTO `0_bank_trans_types` VALUES (2, 'Transfer');
1246
1247 -- 
1248 -- Data in table `chart_class`
1249 -- 
1250
1251 INSERT INTO `0_chart_class` VALUES (1, 'Assets', 1);
1252 INSERT INTO `0_chart_class` VALUES (2, 'Liabilities', 1);
1253 INSERT INTO `0_chart_class` VALUES (3, 'Income', 0);
1254 INSERT INTO `0_chart_class` VALUES (4, 'Costs', 0);
1255
1256 -- 
1257 -- Data in table `chart_master`
1258 -- 
1259
1260 INSERT INTO `0_chart_master` VALUES ('3000', NULL, 'Sales', 1, 1);
1261 INSERT INTO `0_chart_master` VALUES ('3010', NULL, 'Sales  - Wholesale', 1, 1);
1262 INSERT INTO `0_chart_master` VALUES ('3020', NULL, 'Sales of Other items', 1, 1);
1263 INSERT INTO `0_chart_master` VALUES ('3400', NULL, 'Difference On Exchange', 1, 0);
1264 INSERT INTO `0_chart_master` VALUES ('5000', NULL, 'Direct Labour', 2, 0);
1265 INSERT INTO `0_chart_master` VALUES ('5050', NULL, 'Direct Labour Recovery', 2, 0);
1266 INSERT INTO `0_chart_master` VALUES ('4200', NULL, 'Material Usage Varaiance', 2, 4);
1267 INSERT INTO `0_chart_master` VALUES ('4210', NULL, 'Consumable Materials', 2, 4);
1268 INSERT INTO `0_chart_master` VALUES ('4220', NULL, 'Purchase price Variance', 2, 0);
1269 INSERT INTO `0_chart_master` VALUES ('4000', NULL, 'Purchases of materials', 2, 4);
1270 INSERT INTO `0_chart_master` VALUES ('4250', NULL, 'Discounts Received', 2, 0);
1271 INSERT INTO `0_chart_master` VALUES ('4260', NULL, 'Exchange Variation', 2, 0);
1272 INSERT INTO `0_chart_master` VALUES ('4300', NULL, 'Freight Inwards', 2, 4);
1273 INSERT INTO `0_chart_master` VALUES ('4010', NULL, 'Cost of Goods Sold - Retail', 2, 4);
1274 INSERT INTO `0_chart_master` VALUES ('6790', NULL, 'Bank Charges', 5, 4);
1275 INSERT INTO `0_chart_master` VALUES ('6800', NULL, 'Entertainments', 5, 4);
1276 INSERT INTO `0_chart_master` VALUES ('6810', NULL, 'Legal Expenses', 5, 4);
1277 INSERT INTO `0_chart_master` VALUES ('6600', NULL, 'Repairs and Maintenance Office', 5, 4);
1278 INSERT INTO `0_chart_master` VALUES ('6730', NULL, 'phone', 5, 4);
1279 INSERT INTO `0_chart_master` VALUES ('8200', NULL, 'Bank Interest', 52, 0);
1280 INSERT INTO `0_chart_master` VALUES ('6840', NULL, 'Credit Control', 5, 0);
1281 INSERT INTO `0_chart_master` VALUES ('7040', NULL, 'Depreciation Office Equipment', 51, 0);
1282 INSERT INTO `0_chart_master` VALUES ('3800', NULL, 'Freight Outwards', 5, 4);
1283 INSERT INTO `0_chart_master` VALUES ('4500', NULL, 'Packaging', 5, 4);
1284 INSERT INTO `0_chart_master` VALUES ('6400', NULL, 'Commissions', 5, 0);
1285 INSERT INTO `0_chart_master` VALUES ('3200', NULL, 'Prompt Payment Discounts', 1, 0);
1286 INSERT INTO `0_chart_master` VALUES ('6700', NULL, 'General Expenses', 5, 4);
1287 INSERT INTO `0_chart_master` VALUES ('5200', NULL, 'Indirect Labour', 2, 0);
1288 INSERT INTO `0_chart_master` VALUES ('5210', NULL, 'Overhead Recovery', 5, 0);
1289 INSERT INTO `0_chart_master` VALUES ('1700', NULL, 'Bank account', 10, 0);
1290 INSERT INTO `0_chart_master` VALUES ('1705', NULL, 'Petty Cash', 10, 0);
1291 INSERT INTO `0_chart_master` VALUES ('1710', NULL, 'Foreign currency account', 10, 0);
1292 INSERT INTO `0_chart_master` VALUES ('1500', NULL, 'Accounts Receivable', 20, 0);
1293 INSERT INTO `0_chart_master` VALUES ('1400', NULL, 'Stocks of Raw Materials', 45, 0);
1294 INSERT INTO `0_chart_master` VALUES ('1410', NULL, 'Stocks of Work In Progress', 45, 0);
1295 INSERT INTO `0_chart_master` VALUES ('1420', NULL, 'Stocks of Finsihed Goods', 45, 0);
1296 INSERT INTO `0_chart_master` VALUES ('1430', NULL, 'Goods Received Clearing account', 30, 0);
1297 INSERT INTO `0_chart_master` VALUES ('2630', NULL, 'Accounts Payable', 30, 0);
1298 INSERT INTO `0_chart_master` VALUES ('2660', NULL, 'VAT out 5', 30, 0);
1299 INSERT INTO `0_chart_master` VALUES ('2662', NULL, 'VAT out 1', 30, 0);
1300 INSERT INTO `0_chart_master` VALUES ('2664', NULL, 'VAT out 25', 30, 0);
1301 INSERT INTO `0_chart_master` VALUES ('2680', NULL, 'VAT In 5', 30, 0);
1302 INSERT INTO `0_chart_master` VALUES ('2682', NULL, 'VAT In 25', 30, 0);
1303 INSERT INTO `0_chart_master` VALUES ('2050', NULL, 'Retained Earnings', 50, 0);
1304 INSERT INTO `0_chart_master` VALUES ('2000', NULL, 'Share Capital', 50, 0);
1305
1306 -- 
1307 -- Data in table `chart_types`
1308 -- 
1309
1310 INSERT INTO `0_chart_types` VALUES (1, 'Sales', 3, -1);
1311 INSERT INTO `0_chart_types` VALUES (2, 'Cost of Sales', 4, -1);
1312 INSERT INTO `0_chart_types` VALUES (5, 'Expenses', 4, -1);
1313 INSERT INTO `0_chart_types` VALUES (10, 'Cash/Bank', 1, -1);
1314 INSERT INTO `0_chart_types` VALUES (20, 'Accounts Receivable', 1, -1);
1315 INSERT INTO `0_chart_types` VALUES (30, 'Accounts Payable', 2, -1);
1316 INSERT INTO `0_chart_types` VALUES (40, 'Fixed Assets', 1, -1);
1317 INSERT INTO `0_chart_types` VALUES (45, 'Inventory', 1, -1);
1318 INSERT INTO `0_chart_types` VALUES (50, 'Equity', 2, -1);
1319 INSERT INTO `0_chart_types` VALUES (51, 'Depreciations', 4, -1);
1320 INSERT INTO `0_chart_types` VALUES (52, 'Financials', 4, -1);
1321
1322 -- 
1323 -- Data in table `company`
1324 -- 
1325
1326 INSERT INTO `0_company` VALUES (1, 'Company name', '', '', 1, 1, 'N/A', '', '', '', '', '', 'USD', '1500', '4250', '2630', '1430', '4260', '4220', '2050', '3800', '3000', '3000', '3200', '1420', '4010', '4210', '3000', '1410', '5000', '', '', '', '', '', '', 0, 10, 10, 1000, 20, 20, 30, 1, 1, 0, 0, 0);
1327
1328 -- 
1329 -- Data in table `credit_status`
1330 -- 
1331
1332 INSERT INTO `0_credit_status` VALUES (1, 'Good History', 0);
1333 INSERT INTO `0_credit_status` VALUES (3, 'No more work until payment received', 1);
1334 INSERT INTO `0_credit_status` VALUES (4, 'In liquidation', 1);
1335
1336 -- 
1337 -- Data in table `currencies`
1338 -- 
1339
1340 INSERT INTO `0_currencies` VALUES ('Euro', 'EUR', '?', 'Europe', 'Cents');
1341 INSERT INTO `0_currencies` VALUES ('Pounds', 'GBP', '?', 'England', 'Pence');
1342 INSERT INTO `0_currencies` VALUES ('US Dollars', 'USD', '$', 'United States', 'Cents');
1343
1344 -- 
1345 -- Data in table `fiscal_year`
1346 -- 
1347
1348 INSERT INTO `0_fiscal_year` VALUES (1, '2007-01-01', '2007-12-31', 0);
1349
1350 -- 
1351 -- Data in table `locations`
1352 -- 
1353
1354 INSERT INTO `0_locations` VALUES ('DEF', 'Default', 'N/A', '', '', '', '');
1355
1356 -- 
1357 -- Data in table `movement_types`
1358 -- 
1359
1360 INSERT INTO `0_movement_types` VALUES (1, 'Adjustment');
1361
1362 -- 
1363 -- Data in table `payment_terms`
1364 -- 
1365
1366 INSERT INTO `0_payment_terms` VALUES (1, 'Due 15th Of the Following Month', 0, 17);
1367 INSERT INTO `0_payment_terms` VALUES (2, 'Due By End Of The Following Month', 0, 30);
1368 INSERT INTO `0_payment_terms` VALUES (3, 'Payment due within 10 days', 10, 0);
1369 INSERT INTO `0_payment_terms` VALUES (4, 'Cash Only', 1, 0);
1370
1371 -- 
1372 -- Data in table `sales_types`
1373 -- 
1374
1375 INSERT INTO `0_sales_types` VALUES (1, 'Retail');
1376 INSERT INTO `0_sales_types` VALUES (2, 'Wholesale');
1377
1378 -- 
1379 -- Data in table `salesman`
1380 -- 
1381
1382 INSERT INTO `0_salesman` VALUES (1, 'Sales Person', '', '', '');
1383
1384 -- 
1385 -- Data in table `shippers`
1386 -- 
1387
1388 INSERT INTO `0_shippers` VALUES (1, 'Default', '', '', '');
1389
1390 -- 
1391 -- Data in table `stock_category`
1392 -- 
1393
1394 INSERT INTO `0_stock_category` VALUES (1, 'Components', NULL, NULL, NULL, NULL);
1395 INSERT INTO `0_stock_category` VALUES (2, 'Charges', NULL, NULL, NULL, NULL);
1396 INSERT INTO `0_stock_category` VALUES (3, 'Systems', NULL, NULL, NULL, NULL);
1397 INSERT INTO `0_stock_category` VALUES (4, 'Services', NULL, NULL, NULL, NULL);
1398
1399 -- 
1400 -- Data in table `sys_types`
1401 -- 
1402
1403 INSERT INTO `0_sys_types` VALUES (0, 'Journal - GL', 17, '1');
1404 INSERT INTO `0_sys_types` VALUES (1, 'Payment - GL', 7, '1');
1405 INSERT INTO `0_sys_types` VALUES (2, 'Receipt - GL', 4, '1');
1406 INSERT INTO `0_sys_types` VALUES (4, 'Funds Transfer', 3, '1');
1407 INSERT INTO `0_sys_types` VALUES (10, 'Sales Invoice', 16, '1');
1408 INSERT INTO `0_sys_types` VALUES (11, 'Credit Note', 2, '1');
1409 INSERT INTO `0_sys_types` VALUES (12, 'Receipt', 6, '1');
1410 INSERT INTO `0_sys_types` VALUES (16, 'Location Transfer', 2, '1');
1411 INSERT INTO `0_sys_types` VALUES (17, 'Inventory Adjustment', 2, '1');
1412 INSERT INTO `0_sys_types` VALUES (18, 'Purchase Order', 1, '1');
1413 INSERT INTO `0_sys_types` VALUES (20, 'Supplier Invoice', 6, '1');
1414 INSERT INTO `0_sys_types` VALUES (21, 'Supplier Credit Note', 1, '1');
1415 INSERT INTO `0_sys_types` VALUES (22, 'Supplier Payment', 3, '1');
1416 INSERT INTO `0_sys_types` VALUES (25, 'Purchase Order Delivery', 1, '1');
1417 INSERT INTO `0_sys_types` VALUES (26, 'Work Order', 1, '1');
1418 INSERT INTO `0_sys_types` VALUES (28, 'Work Order Issue', 1, '1');
1419 INSERT INTO `0_sys_types` VALUES (29, 'Work Order Production', 1, '1');
1420 INSERT INTO `0_sys_types` VALUES (30, 'Sales Order', 1, '1');
1421 INSERT INTO `0_sys_types` VALUES (35, 'Cost Update', 1, '1');
1422 INSERT INTO `0_sys_types` VALUES (40, 'Dimension', 1, '1');
1423
1424 -- 
1425 -- Data in table `users`
1426 -- 
1427
1428 INSERT INTO `0_users` VALUES ('admin', '5f4dcc3b5aa765d61d8327deb882cf99', 'Administrator', 2, '', 'info@frontaccounting.com', 'en_US', 0, 0, 0, 0, 'default', 'Letter', 2, 2, 4, 1, 1, 0, '2007-03-20 10:52:46');
1429