-- phpMyAdmin SQL Dump
-- version 5.2.1
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Generation Time: Mar 13, 2026 at 02:52 PM
-- Wersja serwera: 10.4.32-MariaDB
-- Wersja PHP: 8.2.12

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `atelier_20260227`
--

-- --------------------------------------------------------

--
-- Struktura tabeli dla tabeli `transaction`
--

CREATE TABLE `transaction` (
  `id` int(11) NOT NULL,
  `ticket_key` bigint(20) NOT NULL,
  `id_shop` int(11) NOT NULL,
  `id_device` int(11) NOT NULL,
  `id_client` int(11) DEFAULT NULL,
  `id_client_department` int(11) DEFAULT NULL,
  `id_customer` int(11) DEFAULT NULL,
  `id_company` int(11) DEFAULT NULL,
  `id_voucher` int(11) DEFAULT NULL,
  `total_gross_amount_after_discount` decimal(10,2) NOT NULL,
  `tax_amount_after_discount` decimal(10,2) NOT NULL,
  `discount_total_value` decimal(10,2) NOT NULL,
  `id_employee` int(11) NOT NULL,
  `will_be_invoiced` tinyint(1) NOT NULL DEFAULT 0,
  `id_invoice` int(11) DEFAULT NULL,
  `deferral_payment` tinyint(1) NOT NULL,
  `id_payment_type` int(11) NOT NULL COMMENT '0 -> deferal\r\n1 -> cash\r\n2 -> card\r\n3 -> togoodtogo\r\n4 -> sodexo\r\n5 -> monizze\r\n6 -> bank transfer\r\n7 -> payonic\r\n',
  `insert_timestamp` datetime NOT NULL DEFAULT current_timestamp(),
  `remark` varchar(255) NOT NULL DEFAULT '',
  `id_serving_method` int(11) NOT NULL DEFAULT 2
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;

--
-- Indeksy dla zrzutów tabel
--

--
-- Indeksy dla tabeli `transaction`
--
ALTER TABLE `transaction`
  ADD PRIMARY KEY (`id`),
  ADD KEY `idx_transaction_insert_ts` (`insert_timestamp`),
  ADD KEY `idx_transaction_id` (`id`),
  ADD KEY `idx_trans_invoice` (`id_invoice`),
  ADD KEY `idx_t_shop_ts` (`id_shop`,`insert_timestamp`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `transaction`
--
ALTER TABLE `transaction`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
