Added ajax and some smaller fixes in sales module files
[fa-stable.git] / sql / alter.sql
index ae2fd8176b6e781b4fbaa7390e60a40658dbefc7..ab30ca4f8b3bd41a7fd569eccf13f412729be4c3 100644 (file)
 -- ALTER TABLE
 -- 
 
-CREATE TABLE `0_item_units` (
-  `abbr` VARCHAR(20) NOT NULL, 
-  `name` VARCHAR(40) NOT NULL, 
-  `decimals` TINYINT(2) NOT NULL,
+ALTER TABLE `0_company` ADD `base_sales` INT( 11 ) DEFAULT '-1' NOT NULL AFTER `no_supplier_list` ;
+ALTER TABLE `0_sales_types` ADD `factor` DOUBLE DEFAULT '1' NOT NULL AFTER `tax_included` ;
+
+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, 
+  `decimals` tinyint(2) NOT NULL,
   PRIMARY KEY (`abbr`),
-  UNIQUE (`name`)
-)
-TYPE = myisam
-COMMENT = 'units of measure';
+  UNIQUE KEY `name` (`name`)
+) TYPE = MyISAM;
+
+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`;