INSERT INTO `admin_menus` (`menu_id`, `parent_id`, `admin_groups_id`, `menu_pos`, `filename`, `params`, `menu_item_type`) VALUES
(308,87,'1',308,'sales_discount_coupons.php','','');


INSERT INTO `admin_menus_description` (`menu_id`, `menu_text`, `language_id`) VALUES (308,'Discount Coupons',1);

INSERT INTO admin_files ( admin_files_name, admin_files_is_boxes, admin_files_to_boxes, admin_groups_id) VALUES ( 'sales_discount_coupons.php', 1, 1, '1');

INSERT INTO `admin_menus` (`menu_id`, `parent_id`, `admin_groups_id`, `menu_pos`, `filename`, `params`, `menu_item_type`) VALUES
(311,85,'1',311,'sales_subscription_discounts.php','','');


INSERT INTO `admin_menus_description` (`menu_id`, `menu_text`, `language_id`) VALUES (311,'Subscription',1);

INSERT INTO admin_files ( admin_files_name, admin_files_is_boxes, admin_files_to_boxes, admin_groups_id) VALUES ( 'sales_subscription_discounts.php', 1, 1, '1');

INSERT INTO `admin_menus` (`menu_id`, `parent_id`, `admin_groups_id`, `menu_pos`, `filename`, `params`, `menu_item_type`) VALUES
(312,85,'1',312,'sales_services_discounts.php','','');


INSERT INTO `admin_menus_description` (`menu_id`, `menu_text`, `language_id`) VALUES (312,'Services',1);

INSERT INTO admin_files ( admin_files_name, admin_files_is_boxes, admin_files_to_boxes, admin_groups_id) VALUES ( 'sales_services_discounts.php', 1, 1, '1');

alter table coupon_redeem_track add column email_redeem_id varchar(32);
alter table coupons add column coupon_flag char(1) default 'U';

delete from admin_menus where menu_id='190';
delete from admin_menus where menu_id='191';
delete from admin_menus where menu_id='192';
delete from admin_menus_description where menu_id='190';
delete from admin_menus_description where menu_id='191';
delete from admin_menus_description where menu_id='192';

insert into email_messages (message_subject,message_text,message_format,message_type) values('Sales Gift Voucher','<table width="100%" style="font-family: Verdana, Arial, sans-serif; font-size: 12px;" cellpadding="0" cellspacing="0" border="0"><tr><td  colspan="2">Hi %%Customer Name%%,</td></tr><tr><td width="20">&nbsp;</td><td>The %%Store Name%% has created a Gift Voucher for you to the value of %%Coupon Value%%.<br> The Gift Voucher ID is %%Coupon Code%%.<br> You can redeem it by going to %%Store URL%% and entering it during the checkout process.</td></tr><tr><td colspan="2"><br>With thanks,<br><br>%%Store Owner%% <br>%%Store Address%%</td></tr></table>','H','SGV'); 
DROP TABLE IF EXISTS  `subscription_discounts`;
CREATE TABLE `subscription_discounts` (
  `discount_id` int(11) unsigned NOT NULL auto_increment,
  `discount_start_date` date default NULL,
  `discount_start_time` time default NULL,
  `discount_end_date` date default NULL,
  `discount_end_time` time default NULL,
  `discount_value` decimal(8,2) default NULL,
  `discount_type` char(20) default NULL,
  `subscription_id` int(11) unsigned default NULL,
  PRIMARY KEY  (`discount_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS  `services_discounts`;
CREATE TABLE `services_discounts` (
  `discount_id` int(11) unsigned NOT NULL auto_increment,
  `discount_start_date` date default NULL,
  `discount_start_time` time default NULL,
  `discount_end_date` date default NULL,
  `discount_end_time` time default NULL,
  `discount_value` decimal(8,2) default NULL,
  `discount_type` char(1) default NULL,
  `service_id` int(11) unsigned default NULL,
  PRIMARY KEY  (`discount_id`),
  UNIQUE KEY `discount_id` (`discount_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS `coupon_discount_email`;
CREATE TABLE `coupon_discount_email` (
  `discount_coupon_id` int(11) unsigned NOT NULL auto_increment,
  `coupon_id` int(11) unsigned default NULL,
  `discount_coupon_code` varchar(32) default NULL,
  `customer_id` int(11) unsigned default NULL,
  `date_sent` datetime default NULL,
  `amount` decimal(8,4) default NULL,
  `tax` int(11) unsigned default NULL,
  `content` text,
  PRIMARY KEY  (`discount_coupon_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT into sql_queries values('freeway_v1_2_3.sql',now());

