-- phpMyAdmin SQL Dump
-- version 4.5.1
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1
-- Generation Time: Dec 19, 2018 at 07:18 AM
-- Server version: 10.1.16-MariaDB
-- PHP Version: 5.6.24

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
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: `kwikorder`
--

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

--
-- Table structure for table `client`
--

CREATE TABLE `client` (
  `client_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `address` varchar(256) NOT NULL,
  `phone` varchar(16) NOT NULL,
  `phone_alt` varchar(16) NOT NULL DEFAULT '',
  `invoice_name` varchar(128) NOT NULL DEFAULT 'CONSUMIDOR FINAL',
  `invoice_tax_id` varchar(64) NOT NULL DEFAULT 'C/F',
  `invoice_address` varchar(256) NOT NULL DEFAULT 'CIUDAD'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `orders`
--

CREATE TABLE `orders` (
  `order_id` int(11) NOT NULL,
  `name` varchar(128) NOT NULL,
  `address` varchar(256) NOT NULL,
  `phone` varchar(16) NOT NULL,
  `phone_alt` varchar(16) NOT NULL,
  `invoice_name` varchar(128) NOT NULL,
  `invoice_tax_id` varchar(64) NOT NULL,
  `invoice_address` varchar(256) NOT NULL,
  `total` decimal(14,4) NOT NULL,
  `date_added` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `status` int(11) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `order_product`
--

CREATE TABLE `order_product` (
  `order_id` int(11) NOT NULL,
  `sku` varchar(64) NOT NULL,
  `product_name` varchar(128) NOT NULL,
  `product_unit` varchar(32) NOT NULL,
  `quantity` float NOT NULL,
  `price` decimal(14,4) NOT NULL,
  `total` decimal(14,4) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- Table structure for table `product`
--

CREATE TABLE `product` (
  `sku` varchar(64) NOT NULL,
  `name` varchar(128) NOT NULL,
  `category` varchar(128) NOT NULL DEFAULT '',
  `price` decimal(14,4) NOT NULL DEFAULT '0.0000',
  `status` int(11) NOT NULL DEFAULT '1',
  `unit_type` varchar(32) NOT NULL DEFAULT 'unidad',
  `unit_suffix` varchar(32) NOT NULL DEFAULT 'u',
  `min` float NOT NULL DEFAULT '0',
  `max` float NOT NULL DEFAULT '1000',
  `step` float NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Dumping data for table `product`
--

INSERT INTO `product` (`sku`, `name`, `category`, `price`, `status`, `unit_type`, `unit_suffix`, `min`, `max`, `step`) VALUES
('Ajo', 'Ajo', 'vegetales', '5.0000', 1, 'Red', 'Red', 0, 10, 1),
('Arverja China', 'Arverja China', 'frutas', '5.4000', 1, 'libra', 'lb', 0, 20, 0.25),
('Arverjas Grano', 'Arverjas Grano', 'vegetales', '13.0000', 1, 'libra', 'lb', 0, 20, 0.25),
('Berengena', 'Berengena', 'frutas', '4.5000', 1, 'unidad', 'u', 0, 20, 1),
('Brocoli sin hojas', 'Brocoli sin hojas', 'frutas', '5.5000', 1, 'unidad', 'u', 0, 10, 1),
('Calabazin', 'Calabazin (zuchini amarillo)', 'hierbas', '11.5000', 1, 'libra', 'lb', 0, 20, 0.25),
('Camotes', 'Camotes', 'hierbas', '8.0000', 1, 'libra', 'lb', 0, 20, 0.25),
('Chile Chiltepe', 'Chile Chiltepe', 'hierbas', '27.0000', 1, 'libra', 'lb', 0, 20, 0.25),
('Chile Jalapeño', 'Chile Jalapeño', 'hierbas', '10.0000', 1, 'libra', 'lb', 0, 20, 0.25),
('Chile Morron', 'Chile Morron (colores)', 'vegetales', '7.5000', 1, 'unidad', 'u', 0, 20, 1),
('Chile Pimiento', 'Chile Pimiento', 'frutas', '3.0000', 1, 'unidad', 'u', 0, 20, 1);

--
-- Indexes for dumped tables
--

--
-- Indexes for table `client`
--
ALTER TABLE `client`
  ADD PRIMARY KEY (`client_id`) USING BTREE,
  ADD KEY `client_search_index` (`name`,`phone`,`phone_alt`,`invoice_tax_id`) USING BTREE;

--
-- Indexes for table `orders`
--
ALTER TABLE `orders`
  ADD PRIMARY KEY (`order_id`),
  ADD KEY `order_search_index` (`status`,`name`,`phone`,`phone_alt`,`invoice_tax_id`,`total`,`date_added`);

--
-- Indexes for table `order_product`
--
ALTER TABLE `order_product`
  ADD PRIMARY KEY (`order_id`,`sku`);

--
-- Indexes for table `product`
--
ALTER TABLE `product`
  ADD PRIMARY KEY (`sku`),
  ADD KEY `category_search_index` (`name`,`category`,`status`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `client`
--
ALTER TABLE `client`
  MODIFY `client_id` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT for table `orders`
--
ALTER TABLE `orders`
  MODIFY `order_id` int(11) NOT NULL AUTO_INCREMENT;
/*!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 */;
