Reorganized work order costing to make corect registration of costs in journal.
[fa-stable.git] / sql / alter2.4.sql
1 ALTER TABLE `0_suppliers` ADD COLUMN  `tax_algorithm` tinyint(1) NOT NULL default '1' AFTER `tax_included`;
2 ALTER TABLE `0_supp_trans` ADD COLUMN `tax_algorithm` tinyint(1) NULL default '1' AFTER `tax_included`;
3 INSERT INTO `0_sys_prefs` VALUES('tax_algorithm','glsetup.customer', 'tinyint', 1, '1');
4 INSERT INTO `0_sys_prefs` VALUES('gl_closing_date','setup.closing_date', 'date', 8, '');
5 # Fix eventual invalid date/year in audit records
6 UPDATE `0_audit_trail` audit 
7                 LEFT JOIN `0_gl_trans` gl ON  gl.`type`=audit.`type` AND gl.type_no=audit.trans_no
8                 LEFT JOIN `0_fiscal_year` year ON year.begin<=gl.tran_date AND year.end>=gl.tran_date
9                 SET audit.gl_date=gl.tran_date, audit.fiscal_year=year.id
10                 WHERE NOT ISNULL(gl.`type`);
11
12 DROP TABLE IF EXISTS `0_wo_costing`;
13
14 CREATE TABLE `0_wo_costing` (
15   `id` int(11) NOT NULL auto_increment,
16   `workorder_id` int(11) NOT NULL default '0',
17   `cost_type`   tinyint(1) NOT NULL default '0',
18   `trans_type` int(11) NOT NULL default '0',
19   `trans_no` int(11) NOT NULL default '0',
20   `factor` double NOT NULL default '1',
21   PRIMARY KEY  (`id`)
22 ) TYPE=InnoDB;
23
24