X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=sql%2Falter.sql;h=9d87fc5737f3cdd1edf0379395bf01760a8c5308;hb=60d8961142e146fc12a209727c7c77774303f07a;hp=0ce763f6e1f745a14d5382cd48a31c058a97a040;hpb=2c0772b38fe1e37dcb0560998c5907eee92d85c8;p=fa-stable.git diff --git a/sql/alter.sql b/sql/alter.sql index 0ce763f6..9d87fc57 100644 --- a/sql/alter.sql +++ b/sql/alter.sql @@ -16,6 +16,7 @@ -- ALTER TABLE -- +DROP TABLE IF EXISTS `0_item_units`; CREATE TABLE IF NOT EXISTS `0_item_units` ( `abbr` varchar(20) NOT NULL, `name` varchar(40) NOT NULL, @@ -23,15 +24,9 @@ CREATE TABLE IF NOT EXISTS `0_item_units` ( PRIMARY KEY (`abbr`), UNIQUE KEY `name` (`name`) ) TYPE = MyISAM; -INSERT INTO `0_item_units` VALUES ('each', 'Each', '0'); -INSERT INTO `0_item_units` VALUES ('m', 'Meter', '0'); -INSERT INTO `0_item_units` VALUES ('kg', 'Kilogram', '0'); -INSERT INTO `0_item_units` VALUES ('tons', 'Tons', '0'); -INSERT INTO `0_item_units` VALUES ('l', 'Liter', '0'); -INSERT INTO `0_item_units` VALUES ('lbs', 'Pounds', '0'); -INSERT INTO `0_item_units` VALUES ('dozen', 'Dozen', '0'); -INSERT INTO `0_item_units` VALUES ('pack', 'Pack', '0'); -INSERT INTO `0_item_units` VALUES ('hrs', 'Hours', '0'); + +INSERT INTO `0_item_units` (`abbr`, `name`, `decimals`) SELECT DISTINCT `units`, CONCAT(UPPER(SUBSTRING(`units`, 1, 1)), LOWER(SUBSTRING(`units`, 2))), 0 FROM `0_stock_master` ; +UPDATE `0_debtor_trans` SET `ov_amount`=-`ov_amount`, `ov_gst`=-`ov_gst`, `ov_freight`=-`ov_freight`, `ov_discount`=-`ov_discount` WHERE `ov_amount` < 0 AND `type` <> 10 AND `type` <> 13 ; DROP TABLE IF EXISTS `0_form_items`;