-- --------------------------------------------------------
-- Host:                         127.0.0.1
-- Server version:               11.0.2-MariaDB - mariadb.org binary distribution
-- Server OS:                    Win64
-- HeidiSQL Version:             12.3.0.6589
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;


-- Dumping database structure for pointofsale
DROP DATABASE IF EXISTS `pointofsale`;
CREATE DATABASE IF NOT EXISTS `pointofsale` /*!40100 DEFAULT CHARACTER SET armscii8 COLLATE armscii8_bin */;
USE `pointofsale`;

-- Dumping structure for table pointofsale.employee
DROP TABLE IF EXISTS `employee`;
CREATE TABLE IF NOT EXISTS `employee` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` varchar(50) NOT NULL,
  `IsArchived` tinyint(4) NOT NULL DEFAULT 0,
  `IsModified` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table pointofsale.employee: ~4 rows (approximately)
DELETE FROM `employee`;
INSERT INTO `employee` (`Id`, `Name`, `IsArchived`, `IsModified`) VALUES
	(1, 'Jette', 0, 0),
	(2, 'Lone', 1, 0),
	(3, 'Emilie', 0, 0),
	(4, 'Ny', 1, 0);

-- Dumping structure for table pointofsale.payment
DROP TABLE IF EXISTS `payment`;
CREATE TABLE IF NOT EXISTS `payment` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `SaleId` int(11) NOT NULL DEFAULT 0,
  `Amount` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `Type` tinytext NOT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=armscii8 COLLATE=armscii8_bin;

-- Dumping data for table pointofsale.payment: ~3 rows (approximately)
DELETE FROM `payment`;
INSERT INTO `payment` (`Id`, `SaleId`, `Amount`, `Type`) VALUES
	(1, 1, 150.000000, 'Kontant'),
	(2, 1, 50.000000, 'Kort'),
	(3, 2, 200.000000, 'Kontant');

-- Dumping structure for table pointofsale.product
DROP TABLE IF EXISTS `product`;
CREATE TABLE IF NOT EXISTS `product` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` tinytext NOT NULL,
  `Price` decimal(10,2) NOT NULL,
  `Description` mediumtext DEFAULT NULL,
  `ProductGroupId` int(11) NOT NULL DEFAULT 0,
  `IsArchived` tinyint(4) NOT NULL DEFAULT 0,
  `Index` int(11) NOT NULL DEFAULT 0,
  `IsModified` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`Id`),
  KEY `FK_Product_Categories` (`ProductGroupId`) USING BTREE,
  CONSTRAINT `FK_Product_ProductGroup` FOREIGN KEY (`Id`) REFERENCES `productgroup` (`Id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table pointofsale.product: ~6 rows (approximately)
DELETE FROM `product`;
INSERT INTO `product` (`Id`, `Name`, `Price`, `Description`, `ProductGroupId`, `IsArchived`, `Index`, `IsModified`) VALUES
	(1, 'Buket 1', 0.00, NULL, 3, 0, 1, 1),
	(2, '3D Print 1.2', 0.00, NULL, 2, 0, 1, 1),
	(3, 'Jul 1', 0.00, NULL, 8, 0, 3, 1),
	(4, 'Buket 2', 0.00, NULL, 3, 1, 4, 1),
	(5, '3D Print 1.1', 0.00, NULL, 2, 0, 0, 1),
	(6, '3D Print 1.3', 0.00, NULL, 2, 0, 2, 1);

-- Dumping structure for table pointofsale.productgroup
DROP TABLE IF EXISTS `productgroup`;
CREATE TABLE IF NOT EXISTS `productgroup` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Name` tinytext NOT NULL,
  `IsArchived` tinyint(4) NOT NULL DEFAULT 0,
  `Index` int(11) NOT NULL,
  `IsModified` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

-- Dumping data for table pointofsale.productgroup: ~8 rows (approximately)
DELETE FROM `productgroup`;
INSERT INTO `productgroup` (`Id`, `Name`, `IsArchived`, `Index`, `IsModified`) VALUES
	(1, 'Buketter 1', 1, 0, 0),
	(2, '3D Print', 0, 0, 0),
	(3, 'Buket', 0, 1, 0),
	(4, 'Begravelse', 0, 2, 0),
	(5, 'Sammenplantning', 0, 3, 0),
	(6, 'Planter', 0, 4, 0),
	(7, 'Gravpynt', 1, 5, 0),
	(8, 'Jul', 0, 5, 0);

-- Dumping structure for table pointofsale.sale
DROP TABLE IF EXISTS `sale`;
CREATE TABLE IF NOT EXISTS `sale` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `Time` datetime NOT NULL,
  `EmployeeId` int(11) NOT NULL DEFAULT 0,
  `IsModified` tinyint(4) DEFAULT NULL,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=armscii8 COLLATE=armscii8_bin;

-- Dumping data for table pointofsale.sale: ~2 rows (approximately)
DELETE FROM `sale`;
INSERT INTO `sale` (`Id`, `Time`, `EmployeeId`, `IsModified`) VALUES
	(1, '2023-07-08 23:09:12', 1, 0),
	(2, '2023-07-08 23:09:29', 1, 0);

-- Dumping structure for table pointofsale.sale_line
DROP TABLE IF EXISTS `sale_line`;
CREATE TABLE IF NOT EXISTS `sale_line` (
  `Id` int(11) NOT NULL AUTO_INCREMENT,
  `SaleId` int(11) NOT NULL DEFAULT 0,
  `Product` tinytext NOT NULL,
  `Pieces` smallint(6) NOT NULL DEFAULT 0,
  `Price` decimal(20,6) NOT NULL DEFAULT 0.000000,
  `Total` decimal(20,6) NOT NULL DEFAULT 0.000000,
  PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=armscii8 COLLATE=armscii8_bin;

-- Dumping data for table pointofsale.sale_line: ~2 rows (approximately)
DELETE FROM `sale_line`;
INSERT INTO `sale_line` (`Id`, `SaleId`, `Product`, `Pieces`, `Price`, `Total`) VALUES
	(1, 1, 'Buket', 2, 75.000000, 150.000000),
	(2, 2, '3D Print', 5, 30.000000, 150.000000);

/*!40103 SET TIME_ZONE=IFNULL(@OLD_TIME_ZONE, 'system') */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IFNULL(@OLD_FOREIGN_KEY_CHECKS, 1) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40111 SET SQL_NOTES=IFNULL(@OLD_SQL_NOTES, 1) */;
