X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter2.4.sql;h=c0fdca279ba582820837a3cbf6a654d01b00b3a0;hb=7eb7d3b1b680e17ba618b1a3f670f335eceb330e;hp=c9900f7cbf5b2a1c9e189cb4289a527154351829;hpb=6e0c436eff1b7664473ea0dd1264b78f096a7808;p=fa-stable.git diff --git a/sql/alter2.4.sql b/sql/alter2.4.sql index c9900f7c..c0fdca27 100644 --- a/sql/alter2.4.sql +++ b/sql/alter2.4.sql @@ -21,4 +21,28 @@ CREATE TABLE `0_wo_costing` ( PRIMARY KEY (`id`) ) TYPE=InnoDB; +UPDATE `0_gl_trans` gl + LEFT JOIN `0_cust_branch` br ON br.receivables_account=gl.account AND br.debtor_no=gl.person_id AND gl.person_type_id=2 + LEFT JOIN `0_suppliers` sup ON sup.payable_account=gl.account AND sup.supplier_id=gl.person_id AND gl.person_type_id=3 + SET `person_id` = IF(br.receivables_account, br.debtor_no, IF(sup.payable_account, sup.supplier_id, NULL)), + `person_type_id` = IF(br.receivables_account, 2, IF(sup.payable_account, 3, NULL)); +ALTER TABLE `0_tax_group_items` ADD COLUMN `tax_shipping` tinyint(1) NOT NULL default '0' AFTER `rate`; +UPDATE `0_tax_group_items` tgi + SET tgi.tax_shipping=1 + WHERE tgi.rate=(SELECT 0_tax_types.rate FROM 0_tax_types, 0_tax_groups + WHERE tax_shipping=1 AND tgi.tax_group_id=0_tax_groups.id AND tgi.tax_type_id=0_tax_types.id); +ALTER TABLE `0_tax_groups` DROP COLUMN `tax_shipping`; + +ALTER TABLE `0_sales_order_details` ADD KEY `stkcode` (`stk_code`); +ALTER TABLE `0_purch_order_details` ADD KEY `itemcode` (`item_code`); +ALTER TABLE `0_sys_prefs` CHANGE `value` `value` TEXT NOT NULL DEFAULT ''; +ALTER TABLE `0_cust_branch` ADD COLUMN `bank_account` varchar(60) DEFAULT NULL AFTER `notes`; + +ALTER TABLE `0_debtor_trans` ADD COLUMN `tax_included` tinyint(1) unsigned NOT NULL default '0' AFTER `payment_terms`; +UPDATE `0_debtor_trans` tr, `0_trans_tax_details` td SET tr.tax_included=td.included_in_price + WHERE tr.`type`=td.trans_type AND tr.trans_no=td.trans_no AND td.included_in_price +ALTER TABLE `0_bank_accounts` ADD COLUMN `bank_charge_act` varchar(15) NOT NULL DEFAULT '' AFTER `id`; +UPDATE `0_bank_accounts` SET `bank_charge_act`=(SELECT `value` FROM 0_sys_prefs WHERE name='bank_charge_act'); +ALTER TABLE `0_users` ADD `transaction_days` INT( 6 ) NOT NULL COMMENT 'Transaction days' AFTER `startup_tab`; +UPDATE `0_users` SET `transaction_days`=30;