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`);
INNER JOIN (SELECT * FROM `0_stock_moves` WHERE `type`=11 AND `qty`<0) writeoffs ON writeoffs.`trans_no`=moves.`trans_no` AND writeoffs.`type`=11
WHERE moves.`type`=11;
-ALTER TABLE `0_stock_moves` DROP COLUMN `visible`;
# stock_moves.discount_percent field are obsolete
UPDATE `0_stock_moves` SET
price = price*(1-discount_percent);
-ALTER TABLE `0_stock_moves` DROP COLUMN `discount_percent`;
-
-ALTER TABLE `0_stock_moves` DROP COLUMN `person_id`;
DROP TABLE IF EXISTS `0_movement_types`;
+
+# change salesman breakpoint meaning to turnover level
+UPDATE `0_salesman`
+ SET `break_pt` = `break_pt`*100.0/`provision`
+WHERE `provision` != 0;
+