CREATE TABLE bs.`salesByItemTypeDay` (
  `itemTypeFk` smallint(5) unsigned NOT NULL,
  `itemCategoryFk` int(10) unsigned NOT NULL,
  `dated` date NOT NULL,
  `netSale` int(11) NOT NULL DEFAULT 0,
  `stems` int(11) NOT NULL DEFAULT 0,
  `references` int(11) NOT NULL DEFAULT 0,
  `trash` int(11) NOT NULL DEFAULT 0,
  `faults` int(11) NOT NULL DEFAULT 0,
  `claimed` decimal(10,2) NOT NULL DEFAULT 0.00,
  `accepted` decimal(10,2) NOT NULL DEFAULT 0.00,
  `sale` decimal(10,2) NOT NULL DEFAULT 0.00,
  `buy` decimal(10,2) NOT NULL DEFAULT 0.00,
  `saleComponent` decimal(10,2) NOT NULL DEFAULT 0.00,
  `costComponent` decimal(10,2) NOT NULL DEFAULT 0.00,
  `marginComponent` decimal(10,2) NOT NULL DEFAULT 0.00,
  PRIMARY KEY (`itemTypeFk`,`dated`),
  KEY `itemTypeSalesByweek_itemCategoryFk_idx` (`itemCategoryFk`),
  KEY `itemTypeSalesByweek_period_idx` (`dated`),
  CONSTRAINT `itemTypeSalesByweek_itemCategoryFk` FOREIGN KEY (`itemCategoryFk`) REFERENCES `vn`.`itemCategory` (`id`) ON UPDATE CASCADE,
  CONSTRAINT `itemTypeSalesByweek_itemTypeFk` FOREIGN KEY (`itemTypeFk`) REFERENCES `vn`.`itemType` (`id`) ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci COMMENT='Ventas diarias agrupadas por reino y familia';

ALTER TABLE `vn`.`claimConfig` ADD maxResponsibility INT NULL;

UPDATE `vn`.`claimConfig`
	SET maxResponsibility=5
	WHERE id=1;

INSERT INTO `bs`.`nightTask` (`order`,`schema`,`procedure`)
	VALUES (1005,'bs','salesByItemTypeDay_addLauncher');
