SET 
  SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET 
  time_zone = "+00:00";
CREATE TABLE `aauth_login_attempts` (
  `id` int(11) NOT NULL, 
  `ip_address` varchar(39) DEFAULT '0', 
  `timestamp` datetime DEFAULT NULL, 
  `login_attempts` tinyint(2) DEFAULT 0
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
CREATE TABLE `aauth_pms` (
  `id` int(11) UNSIGNED NOT NULL, 
  `sender_id` int(11) UNSIGNED NOT NULL, 
  `receiver_id` int(11) UNSIGNED NOT NULL, 
  `title` varchar(255) NOT NULL, 
  `message` text DEFAULT NULL, 
  `date_sent` datetime DEFAULT NULL, 
  `date_read` datetime DEFAULT NULL, 
  `pm_deleted_sender` int(1) NOT NULL, 
  `pm_deleted_receiver` int(1) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `aauth_users` (
  `id` int(11) UNSIGNED NOT NULL, 
  `email` varchar(100) NOT NULL, 
  `pass` varchar(64) NOT NULL, 
  `username` varchar(100) DEFAULT NULL, 
  `banned` tinyint(1) DEFAULT 0, 
  `last_login` datetime DEFAULT NULL, 
  `last_activity` datetime DEFAULT NULL, 
  `date_created` datetime DEFAULT NULL, 
  `forgot_exp` text DEFAULT NULL, 
  `remember_time` datetime DEFAULT NULL, 
  `remember_exp` text DEFAULT NULL, 
  `verification_code` text DEFAULT NULL, 
  `totp_secret` varchar(16) DEFAULT NULL, 
  `ip_address` text DEFAULT NULL, 
  `roleid` int(1) NOT NULL, 
  `picture` varchar(50) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `aauth_user_variables` (
  `id` int(11) UNSIGNED NOT NULL, 
  `user_id` int(11) UNSIGNED NOT NULL, 
  `data_key` varchar(100) NOT NULL, 
  `value` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `accounts` (
  `id` int(5) NOT NULL, 
  `acn` varchar(35) NOT NULL, 
  `holder` varchar(100) NOT NULL, 
  `adate` datetime NOT NULL, 
  `lastbal` decimal(16, 2) DEFAULT 0.00, 
  `code` varchar(30) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `accounts` (
  `id`, `acn`, `holder`, `adate`, `lastbal`, 
  `code`
) 
VALUES 
  (
    1, '12345678', 'Company Sales Account', 
    '2018-01-01 00:00:00', '0.00', 'Company Sales Account'
  );
CREATE TABLE `api_keys` (
  `id` int(11) NOT NULL, 
  `user_id` int(11) NOT NULL, 
  `key` varchar(40) DEFAULT NULL, 
  `level` int(2) NOT NULL, 
  `ignore_limits` tinyint(1) NOT NULL DEFAULT 0, 
  `is_private_key` tinyint(1) NOT NULL DEFAULT 0, 
  `ip_addresses` text DEFAULT NULL, 
  `date_created` date NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `app_system` (
  `id` int(1) NOT NULL, 
  `cname` char(50) NOT NULL, 
  `address` varchar(255) NOT NULL, 
  `city` varchar(30) NOT NULL, 
  `region` varchar(40) NOT NULL, 
  `country` varchar(30) NOT NULL, 
  `postbox` varchar(15) NOT NULL, 
  `phone` varchar(20) NOT NULL, 
  `email` varchar(30) NOT NULL, 
  `taxid` varchar(20) NOT NULL, 
  `tax` int(11) NOT NULL, 
  `currency` varchar(4) CHARACTER SET utf8 COLLATE utf8_swedish_ci NOT NULL, 
  `currency_format` int(1) NOT NULL, 
  `prefix` varchar(5) NOT NULL, 
  `dformat` int(1) NOT NULL, 
  `zone` varchar(25) NOT NULL, 
  `logo` varchar(30) NOT NULL, 
  `lang` varchar(20) DEFAULT 'english'
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `app_system` (
  `id`, `cname`, `address`, `city`, `region`, 
  `country`, `postbox`, `phone`, `email`, 
  `taxid`, `tax`, `currency`, `currency_format`, 
  `prefix`, `dformat`, `zone`, `logo`, 
  `lang`
) 
VALUES 
  (
    1, 'ABC Company', '412 Example South Street,', 
    'Los Angeles', 'FL', 'USA', '123', 
    '410-987-89-60', 'support@ultimatekode.com', 
    '23442', 1, '$', 0, 'SRN', 1, 'Asia/Calcutta', 
    'logo.png', 'english'
  );
CREATE TABLE `bank_accounts` (
  `id` int(11) NOT NULL, 
  `name` varchar(50) NOT NULL, 
  `bank` varchar(50) NOT NULL, 
  `acn` varchar(50) NOT NULL, 
  `code` varchar(50) DEFAULT NULL, 
  `note` varchar(2000) DEFAULT NULL, 
  `address` varchar(100) DEFAULT NULL, 
  `branch` varchar(100) DEFAULT NULL, 
  `enable` enum('Yes', 'No') NOT NULL DEFAULT 'No'
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `billing_terms` (
  `id` int(4) NOT NULL, 
  `title` varchar(100) NOT NULL, 
  `type` int(1) NOT NULL, 
  `terms` text NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `billing_terms` (`id`, `title`, `type`, `terms`) 
VALUES 
  (
    1, 'Payment on receipt', 0, 'Payment due on receipt'
  );
CREATE TABLE `ci_sessions` (
  `id` varchar(128) NOT NULL, 
  `ip_address` varchar(45) NOT NULL, 
  `timestamp` int(10) UNSIGNED NOT NULL DEFAULT 0, 
  `data` blob NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
INSERT INTO `ci_sessions` (
  `id`, `ip_address`, `timestamp`, `data`
) 
VALUES 
  (
    'dkrjgs4tcb0ad1cmsajohb7kki92qf3p', 
    '::1', 1655184289, 0x5f5f63695f6c6173745f726567656e65726174657c693a313635353138343235353b69647c733a313a2237223b757365726e616d657c733a353a2261646d696e223b656d61696c7c733a31353a2261646d696e40676d61696c2e636f6d223b6c6f67676564696e7c623a313b
  );
CREATE TABLE `conf` (
  `id` int(1) NOT NULL DEFAULT 1, 
  `bank` int(1) NOT NULL, 
  `acid` int(11) NOT NULL, 
  `ext1` varchar(255) DEFAULT NULL, 
  `ext2` varchar(255) DEFAULT NULL, 
  `recaptcha_p` varchar(255) DEFAULT NULL, 
  `captcha` int(1) NOT NULL, 
  `recaptcha_s` varchar(255) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `conf` (
  `id`, `bank`, `acid`, `ext1`, `ext2`, 
  `recaptcha_p`, `captcha`, `recaptcha_s`
) 
VALUES 
  (1, 1, 1, 'ltr', '0', '0', 0, '0');
CREATE TABLE `corn_job` (
  `id` int(1) NOT NULL, 
  `cornkey` varchar(50) NOT NULL, 
  `rec_email` int(11) DEFAULT NULL, 
  `email` int(11) DEFAULT NULL, 
  `rec_due` int(11) DEFAULT NULL, 
  `recemail` varchar(60) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
INSERT INTO `corn_job` (
  `id`, `cornkey`, `rec_email`, `email`, 
  `rec_due`, `recemail`
) 
VALUES 
  (1, '345648', 0, 0, 0, '0');
CREATE TABLE `currencies` (
  `id` int(4) NOT NULL, 
  `code` varchar(3) CHARACTER SET latin1 DEFAULT NULL, 
  `symbol` varchar(3) DEFAULT NULL, 
  `rate` decimal(10, 3) NOT NULL, 
  `thous` char(1) CHARACTER SET latin1 DEFAULT NULL, 
  `dpoint` char(1) CHARACTER SET latin1 NOT NULL, 
  `decim` int(2) NOT NULL, 
  `cpos` int(11) NOT NULL DEFAULT 1
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `currencies` (
  `id`, `code`, `symbol`, `rate`, `thous`, 
  `dpoint`, `decim`, `cpos`
) 
VALUES 
  (
    1, 'GBP', 'X', '0.717', ',', '.', 2, 1
  );
CREATE TABLE `customers` (
  `id` int(11) UNSIGNED NOT NULL, 
  `name` varchar(50) NOT NULL, 
  `phone` varchar(20) DEFAULT NULL, 
  `address` varchar(50) DEFAULT NULL, 
  `city` varchar(50) DEFAULT NULL, 
  `region` varchar(30) DEFAULT NULL, 
  `country` varchar(50) DEFAULT NULL, 
  `postbox` varchar(20) DEFAULT NULL, 
  `email` varchar(60) DEFAULT NULL, 
  `picture` varchar(100) NOT NULL DEFAULT 'example.png', 
  `gid` int(5) NOT NULL DEFAULT 1, 
  `company` varchar(100) DEFAULT NULL, 
  `taxid` varchar(100) DEFAULT NULL, 
  `name_s` varchar(100) DEFAULT NULL, 
  `phone_s` varchar(100) DEFAULT NULL, 
  `email_s` varchar(100) DEFAULT NULL, 
  `address_s` varchar(100) DEFAULT NULL, 
  `city_s` varchar(100) DEFAULT NULL, 
  `region_s` varchar(100) DEFAULT NULL, 
  `country_s` varchar(100) DEFAULT NULL, 
  `postbox_s` varchar(100) DEFAULT NULL, 
  `balance` float(16, 2) DEFAULT 0.00
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `customers_group` (
  `id` int(10) NOT NULL, 
  `title` varchar(60) DEFAULT NULL, 
  `summary` varchar(250) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `customers_group` (`id`, `title`, `summary`) 
VALUES 
  (
    1, 'Default Group', 'Default Group'
  );
CREATE TABLE `documents` (
  `id` int(11) NOT NULL, 
  `title` varchar(100) DEFAULT NULL, 
  `filename` varchar(50) DEFAULT NULL, 
  `cdate` date NOT NULL, 
  `permission` int(1) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `employee_profile` (
  `id` int(11) NOT NULL, 
  `username` varchar(30) NOT NULL, 
  `name` varchar(50) NOT NULL, 
  `address` varchar(100) DEFAULT NULL, 
  `city` varchar(50) DEFAULT NULL, 
  `region` varchar(50) DEFAULT NULL, 
  `country` varchar(50) DEFAULT NULL, 
  `postbox` varchar(20) DEFAULT NULL, 
  `phone` varchar(15) DEFAULT NULL, 
  `phonealt` varchar(15) DEFAULT NULL, 
  `picture` varchar(50) NOT NULL DEFAULT 'example.png', 
  `sign` varchar(100) DEFAULT 'sign.png'
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `employee_profile` (
  `id`, `username`, `name`, `address`, 
  `city`, `region`, `country`, `postbox`, 
  `phone`, `phonealt`, `picture`, `sign`
) 
VALUES 
  (
    7, 'admin', 'BusinessOwner', 'Test Street', 
    'Test City', 'Test Region', 'Test Country', 
    '123456', '12345678', '0', 'example.png', 
    'sign.png'
  );
CREATE TABLE `events` (
  `id` int(11) NOT NULL, 
  `title` varchar(255) NOT NULL, 
  `description` text NOT NULL, 
  `color` varchar(7) NOT NULL DEFAULT '#3a87ad', 
  `start` datetime NOT NULL, 
  `end` datetime DEFAULT NULL, 
  `allDay` varchar(50) NOT NULL DEFAULT 'true', 
  `rel` int(2) NOT NULL DEFAULT 0, 
  `rid` int(11) NOT NULL DEFAULT 0
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `goals` (
  `id` int(1) NOT NULL, 
  `income` bigint(20) NOT NULL, 
  `expense` bigint(20) NOT NULL, 
  `sales` bigint(20) NOT NULL, 
  `netincome` bigint(20) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `goals` (
  `id`, `income`, `expense`, `sales`, 
  `netincome`
) 
VALUES 
  (1, 9999, 3333, 99999, 100000);
CREATE TABLE `invoices` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `invoicedate` date NOT NULL, 
  `invoiceduedate` date NOT NULL, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `shipping` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `total` decimal(16, 2) DEFAULT 0.00, 
  `pmethod` varchar(14) DEFAULT NULL, 
  `notes` varchar(255) DEFAULT NULL, 
  `status` enum(
    'paid', 'due', 'canceled', 'partial'
  ) NOT NULL DEFAULT 'due', 
  `csd` int(5) NOT NULL DEFAULT 0, 
  `eid` int(4) NOT NULL, 
  `pamnt` decimal(16, 2) DEFAULT 0.00, 
  `items` int(11) NOT NULL, 
  `taxstatus` enum('yes', 'no') NOT NULL DEFAULT 'yes', 
  `discstatus` tinyint(1) NOT NULL, 
  `format_discount` enum('%', 'flat', 'b_p', 'bflat') NOT NULL DEFAULT '%', 
  `refer` varchar(20) DEFAULT NULL, 
  `term` int(3) NOT NULL, 
  `multi` int(4) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `invoice_items` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `pid` int(11) NOT NULL DEFAULT 0, 
  `product` varchar(255) DEFAULT NULL, 
  `qty` int(11) NOT NULL DEFAULT 0, 
  `price` decimal(16, 2) NOT NULL DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `totaltax` decimal(16, 2) DEFAULT 0.00, 
  `totaldiscount` decimal(16, 2) DEFAULT 0.00, 
  `product_des` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `meta_data` (
  `id` int(11) NOT NULL, 
  `type` int(3) NOT NULL, 
  `rid` int(11) NOT NULL, 
  `col1` varchar(255) NOT NULL, 
  `col2` varchar(255) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4;
CREATE TABLE `milestones` (
  `id` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `name` varchar(255) DEFAULT NULL, 
  `sdate` date NOT NULL, 
  `edate` date NOT NULL, 
  `exp` text NOT NULL, 
  `color` varchar(10) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
CREATE TABLE `notes` (
  `id` int(11) NOT NULL, 
  `title` varchar(255) NOT NULL, 
  `content` text DEFAULT NULL, 
  `cdate` date NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `online_payment` (
  `id` int(11) NOT NULL, 
  `default_acid` int(11) NOT NULL DEFAULT 1, 
  `currency_code` varchar(3) NOT NULL, 
  `enable` int(1) NOT NULL, 
  `bank` int(1) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
INSERT INTO `online_payment` (
  `id`, `default_acid`, `currency_code`, 
  `enable`, `bank`
) 
VALUES 
  (1, 1, 'USD', 1, 1);
CREATE TABLE `payment_gateways` (
  `id` int(5) NOT NULL, 
  `name` varchar(50) NOT NULL, 
  `enable` enum('Yes', 'No') NOT NULL, 
  `key1` varchar(255) NOT NULL, 
  `key2` varchar(255) DEFAULT NULL, 
  `currency` varchar(3) NOT NULL DEFAULT 'USD', 
  `dev_mode` enum('true', 'false') NOT NULL, 
  `ord` int(5) NOT NULL, 
  `surcharge` decimal(16, 2) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
INSERT INTO `payment_gateways` (
  `id`, `name`, `enable`, `key1`, `key2`, 
  `currency`, `dev_mode`, `ord`, `surcharge`
) 
VALUES 
  (
    1, 'Stripe', 'Yes', 'sk_test_secratekey', 
    'sk_test_publickey', 'USD', 'true', 
    1, '0.00'
  ), 
  (
    2, 'Authorize.Net', 'Yes', 'TRANSACTIONKEY', 
    'LOGINID', 'AUD', 'true', 2, '0.00'
  ), 
  (
    3, 'Pin Payments', 'Yes', 'TEST', 'none', 
    'AUD', 'true', 3, '0.00'
  ), 
  (
    4, 'PayPal', 'Yes', 'MyPayPalClientId', 
    'MyPayPalSecret', 'USD', 'true', 
    4, '0.00'
  ), 
  (
    5, 'SecurePay', 'Yes', 'ABC0001', 'abc123', 
    'AUD', 'true', 5, '0.00'
  );
CREATE TABLE `products` (
  `pid` int(11) NOT NULL, 
  `pcat` int(3) NOT NULL DEFAULT 1, 
  `warehouse` int(11) NOT NULL DEFAULT 1, 
  `product_name` varchar(50) NOT NULL, 
  `product_code` varchar(255) DEFAULT NULL, 
  `product_price` decimal(16, 2) DEFAULT 0.00, 
  `fproduct_price` decimal(16, 2) NOT NULL DEFAULT 0.00, 
  `taxrate` decimal(16, 2) NOT NULL DEFAULT 0.00, 
  `disrate` decimal(16, 2) NOT NULL DEFAULT 0.00, 
  `qty` int(11) NOT NULL, 
  `product_des` text DEFAULT NULL, 
  `alert` int(11) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `product_cat` (
  `id` int(3) NOT NULL, 
  `title` varchar(100) NOT NULL, 
  `extra` varchar(255) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `product_cat` (`id`, `title`, `extra`) 
VALUES 
  (
    1, 'General', 'General Product Category'
  );
CREATE TABLE `product_warehouse` (
  `id` int(3) NOT NULL, 
  `title` varchar(100) NOT NULL, 
  `extra` varchar(255) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `product_warehouse` (`id`, `title`, `extra`) 
VALUES 
  (
    1, 'Main Warehouse', 'Main Warehouse D'
  );
CREATE TABLE `projects` (
  `id` int(11) NOT NULL, 
  `p_id` varchar(20) NOT NULL, 
  `name` varchar(255) DEFAULT NULL, 
  `status` enum(
    'Waiting', 'Pending', 'Terminated', 
    'Finished', 'Progress'
  ) NOT NULL DEFAULT 'Pending', 
  `priority` enum('Low', 'Medium', 'High', 'Urgent') NOT NULL DEFAULT 'Medium', 
  `progress` int(3) NOT NULL, 
  `cid` int(11) NOT NULL, 
  `sdate` date NOT NULL, 
  `edate` date NOT NULL, 
  `tag` varchar(255) DEFAULT NULL, 
  `phase` varchar(255) DEFAULT NULL, 
  `note` text DEFAULT NULL, 
  `worth` decimal(16, 2) NOT NULL DEFAULT 0.00, 
  `ptype` int(1) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `project_meta` (
  `id` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `meta_key` int(11) NOT NULL, 
  `meta_data` varchar(200) CHARACTER SET latin1 DEFAULT NULL, 
  `value` varchar(255) DEFAULT NULL, 
  `key3` varchar(20) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `purchase` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `invoicedate` date NOT NULL, 
  `invoiceduedate` date NOT NULL, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `shipping` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `total` decimal(16, 2) DEFAULT 0.00, 
  `pmethod` varchar(14) DEFAULT NULL, 
  `notes` varchar(255) DEFAULT NULL, 
  `status` enum(
    'paid', 'due', 'canceled', 'partial'
  ) DEFAULT 'due', 
  `csd` int(5) NOT NULL DEFAULT 0, 
  `eid` int(4) NOT NULL, 
  `pamnt` decimal(16, 2) DEFAULT 0.00, 
  `items` int(11) NOT NULL, 
  `taxstatus` enum('yes', 'no') DEFAULT 'yes', 
  `discstatus` tinyint(1) NOT NULL, 
  `format_discount` enum('%', 'flat', 'b_p', 'bflat') DEFAULT NULL, 
  `refer` varchar(20) DEFAULT NULL, 
  `term` int(3) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `purchase_items` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `product` varchar(255) DEFAULT NULL, 
  `qty` int(11) NOT NULL, 
  `price` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `totaltax` decimal(16, 2) DEFAULT 0.00, 
  `totaldiscount` decimal(16, 2) DEFAULT 0.00, 
  `product_des` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `quotes` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `invoicedate` date NOT NULL, 
  `invoiceduedate` date NOT NULL, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `shipping` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `total` decimal(16, 2) DEFAULT 0.00, 
  `pmethod` varchar(14) DEFAULT NULL, 
  `notes` varchar(255) DEFAULT NULL, 
  `status` enum(
    'pending', 'accepted', 'rejected'
  ) DEFAULT 'pending', 
  `csd` int(5) NOT NULL DEFAULT 0, 
  `eid` int(4) NOT NULL, 
  `pamnt` decimal(16, 2) NOT NULL, 
  `items` int(11) NOT NULL, 
  `taxstatus` enum('yes', 'no') DEFAULT 'yes', 
  `discstatus` tinyint(1) NOT NULL, 
  `format_discount` enum('%', 'flat', 'b_p', 'bflat') DEFAULT '%', 
  `refer` varchar(20) DEFAULT NULL, 
  `term` int(3) NOT NULL, 
  `proposal` text DEFAULT NULL, 
  `multi` int(4) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `quotes_items` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `product` varchar(255) DEFAULT NULL, 
  `qty` int(11) NOT NULL, 
  `price` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `totaltax` decimal(16, 2) DEFAULT 0.00, 
  `totaldiscount` decimal(16, 2) DEFAULT 0.00, 
  `product_des` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `rec_invoices` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `invoicedate` date NOT NULL, 
  `invoiceduedate` date NOT NULL, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `shipping` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `total` decimal(16, 2) DEFAULT 0.00, 
  `pmethod` varchar(14) DEFAULT NULL, 
  `notes` varchar(255) DEFAULT NULL, 
  `status` enum(
    'paid', 'due', 'canceled', 'partial'
  ) NOT NULL DEFAULT 'due', 
  `csd` int(5) NOT NULL DEFAULT 0, 
  `eid` int(4) NOT NULL, 
  `pamnt` decimal(16, 2) DEFAULT 0.00, 
  `items` int(11) NOT NULL, 
  `taxstatus` enum('yes', 'no') DEFAULT 'yes', 
  `discstatus` tinyint(1) DEFAULT NULL, 
  `format_discount` enum('%', 'flat', 'b_p', 'bflat') DEFAULT '%', 
  `refer` varchar(20) DEFAULT NULL, 
  `term` int(3) NOT NULL, 
  `rec` varchar(10) NOT NULL, 
  `ron` enum('Recurring', 'Stopped') DEFAULT 'Recurring', 
  `multi` int(4) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `rec_invoice_items` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `product` varchar(255) DEFAULT NULL, 
  `qty` int(11) NOT NULL, 
  `price` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `totaltax` decimal(16, 2) DEFAULT 0.00, 
  `totaldiscount` decimal(16, 2) DEFAULT 0.00, 
  `product_des` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `reports` (
  `id` int(11) NOT NULL, 
  `month` varchar(10) DEFAULT NULL, 
  `year` int(4) NOT NULL, 
  `invoices` int(11) NOT NULL, 
  `sales` decimal(16, 2) DEFAULT 0.00, 
  `items` int(11) NOT NULL, 
  `income` decimal(16, 2) DEFAULT 0.00, 
  `expense` decimal(16, 2) DEFAULT 0.00
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
CREATE TABLE `stock_return` (
  `id` int(11) NOT NULL, 
  `tid` int(8) NOT NULL, 
  `invoicedate` date NOT NULL, 
  `invoiceduedate` date NOT NULL, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `shipping` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `total` decimal(16, 2) DEFAULT 0.00, 
  `pmethod` varchar(14) DEFAULT NULL, 
  `notes` varchar(255) DEFAULT NULL, 
  `status` enum(
    'pending', 'accepted', 'rejected', 
    'partial', 'canceled'
  ) DEFAULT 'pending', 
  `csd` int(5) NOT NULL DEFAULT 0, 
  `eid` int(4) NOT NULL, 
  `pamnt` decimal(16, 2) DEFAULT 0.00, 
  `items` int(11) NOT NULL, 
  `taxstatus` enum('yes', 'no') DEFAULT 'yes', 
  `discstatus` tinyint(1) NOT NULL, 
  `format_discount` enum('%', 'flat', 'b_p', 'bflat') DEFAULT NULL, 
  `refer` varchar(20) DEFAULT NULL, 
  `term` int(3) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `stock_return_items` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `pid` int(11) NOT NULL, 
  `product` varchar(255) DEFAULT NULL, 
  `qty` int(11) NOT NULL, 
  `price` decimal(16, 2) DEFAULT 0.00, 
  `tax` decimal(16, 2) DEFAULT 0.00, 
  `discount` decimal(16, 2) DEFAULT 0.00, 
  `subtotal` decimal(16, 2) DEFAULT 0.00, 
  `totaltax` decimal(16, 2) DEFAULT 0.00, 
  `totaldiscount` decimal(16, 2) DEFAULT 0.00, 
  `product_des` text DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `supplier` (
  `id` int(10) UNSIGNED NOT NULL, 
  `name` varchar(50) NOT NULL, 
  `phone` varchar(20) DEFAULT NULL, 
  `address` varchar(50) DEFAULT NULL, 
  `city` varchar(50) DEFAULT NULL, 
  `region` varchar(30) DEFAULT NULL, 
  `country` varchar(50) DEFAULT NULL, 
  `postbox` varchar(20) DEFAULT NULL, 
  `email` varchar(60) DEFAULT NULL, 
  `picture` varchar(100) NOT NULL DEFAULT 'example.png', 
  `gid` int(5) NOT NULL DEFAULT 1, 
  `company` varchar(100) DEFAULT NULL, 
  `taxid` varchar(100) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `sys_smtp` (
  `id` int(11) NOT NULL, 
  `host` varchar(100) NOT NULL, 
  `port` int(11) NOT NULL, 
  `auth` enum('true', 'false') NOT NULL, 
  `auth_type` enum('none', 'tls', 'ssl') NOT NULL, 
  `username` varchar(100) NOT NULL, 
  `password` varchar(50) NOT NULL, 
  `sender` varchar(100) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `sys_smtp` (
  `id`, `host`, `port`, `auth`, `auth_type`, 
  `username`, `password`, `sender`
) 
VALUES 
  (
    1, 'smtp.com', 587, 'true', 'none', 
    'support@example.com', '123456', 
    'support@example.com'
  );
CREATE TABLE `tickets` (
  `id` int(11) NOT NULL, 
  `subject` varchar(255) NOT NULL, 
  `created` datetime NOT NULL, 
  `cid` int(11) NOT NULL, 
  `status` enum(
    'Solved', 'Processing', 'Waiting'
  ) NOT NULL, 
  `section` varchar(11) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `tickets_th` (
  `id` int(11) NOT NULL, 
  `tid` int(11) NOT NULL, 
  `message` text DEFAULT NULL, 
  `cid` int(11) NOT NULL, 
  `eid` int(11) NOT NULL, 
  `cdate` datetime NOT NULL, 
  `attach` varchar(255) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `todolist` (
  `id` int(11) NOT NULL, 
  `tdate` date NOT NULL, 
  `name` varchar(100) DEFAULT NULL, 
  `status` enum('Due', 'Done', 'Progress') NOT NULL DEFAULT 'Due', 
  `start` date NOT NULL, 
  `duedate` date NOT NULL, 
  `description` text DEFAULT NULL, 
  `eid` int(11) NOT NULL, 
  `aid` int(11) NOT NULL, 
  `related` int(11) NOT NULL, 
  `priority` enum('Low', 'Medium', 'High', 'Urgent') NOT NULL, 
  `rid` int(11) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `transactions` (
  `id` int(11) NOT NULL, 
  `acid` int(11) NOT NULL, 
  `account` varchar(200) NOT NULL, 
  `type` enum('Income', 'Expense', 'Transfer') NOT NULL, 
  `cat` varchar(200) NOT NULL, 
  `debit` decimal(16, 2) DEFAULT 0.00, 
  `credit` decimal(16, 2) DEFAULT 0.00, 
  `payer` varchar(200) DEFAULT NULL, 
  `payerid` int(11) NOT NULL DEFAULT 0, 
  `method` varchar(200) DEFAULT NULL, 
  `date` date NOT NULL, 
  `tid` int(11) NOT NULL DEFAULT 0, 
  `eid` int(11) NOT NULL, 
  `note` varchar(255) DEFAULT NULL, 
  `ext` int(1) DEFAULT 0
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
CREATE TABLE `transactions_cat` (
  `id` int(11) NOT NULL, 
  `name` varchar(25) NOT NULL
) ENGINE = InnoDB DEFAULT CHARSET = utf8;
INSERT INTO `transactions_cat` (`id`, `name`) 
VALUES 
  (1, 'Sales'), 
  (2, 'Purchase');
CREATE TABLE `univarsal_api` (
  `id` int(11) NOT NULL, 
  `name` varchar(100) DEFAULT NULL, 
  `key1` varchar(255) DEFAULT NULL, 
  `key2` varchar(255) DEFAULT NULL, 
  `url` varchar(255) DEFAULT NULL, 
  `method` varchar(10) DEFAULT NULL, 
  `other` text DEFAULT NULL, 
  `active` int(11) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
INSERT INTO `univarsal_api` (
  `id`, `name`, `key1`, `key2`, `url`, 
  `method`, `other`, `active`
) 
VALUES 
  (
    1, 'Goo.gl URL Shortner', 'yourkey', 
    '0', '0', '0', '0', 0
  ), 
  (
    2, 'Twilio SMS API', 'ac', 'key', '+11234567', 
    '0', '0', 1
  ), 
  (
    3, 'Company Support', '1', '1', 'support@gmail.com', 
    NULL, '<p>Your footer</p>', 1
  ), 
  (
    4, 'Currency', '.', ',', '2', 'l', NULL, 
    NULL
  ), 
  (
    5, 'Exchange', 'key1', 'key2', 'USD', 
    NULL, NULL, 1
  ), 
  (
    6, 'New Invoice Notification', '[{Company}] Invoice #{BillNumber} Generated', 
    NULL, NULL, NULL, 'Dear Client,\r\nWe are contacting you in regard to a payment received for invoice # {BillNumber} that has been created on your account. You may find the invoice with below link.\r\n\r\nView Invoice\r\n{URL}\r\n\r\nWe look forward to conducting future business with you.\r\n\r\nKind Regards,\r\nTeam\r\n{CompanyDetails}', 
    NULL
  ), 
  (
    7, 'Invoice Payment Reminder', '[{Company}] Invoice #{BillNumber} Payment Reminder', 
    NULL, NULL, NULL, '<p>Dear Client,</p><p>We are contacting you in regard to a payment reminder of invoice # {BillNumber} that has been created on your account. You may find the invoice with below link. Please pay the balance of {Amount} due by {DueDate}.</p><p>\r\n\r\n<b>View Invoice</b></p><p><span style=\"font-size: 1rem;\">{URL}\r\n</span></p><p><span style=\"font-size: 1rem;\">\r\nWe look forward to conducting future business with you.</span></p><p><span style=\"font-size: 1rem;\">\r\n\r\nKind Regards,\r\n</span></p><p><span style=\"font-size: 1rem;\">\r\nTeam\r\n</span></p><p><span style=\"font-size: 1rem;\">\r\n{CompanyDetails}</span></p>', 
    NULL
  ), 
  (
    8, 'Invoice Refund Proceeded', '{Company} Invoice #{BillNumber} Refund Proceeded', 
    NULL, NULL, NULL, '<p>Dear Client,</p><p>\r\nWe are contacting you in regard to a refund request processed for invoice # {BillNumber} that has been created on your account. You may find the invoice with below link. Please pay the balance of {Amount}  by {DueDate}.\r\n</p><p>\r\nView Invoice\r\n</p><p>{URL}\r\n</p><p>\r\nWe look forward to conducting future business with you.\r\n</p><p>\r\nKind Regards,\r\n</p><p>\r\nTeam\r\n\r\n{CompanyDetails}</p>', 
    NULL
  ), 
  (
    9, 'Invoice payment Received', '{Company} Payment Received for Invoice #{BillNumber}', 
    NULL, NULL, NULL, '<p>Dear Client,\r\n</p><p>We are contacting you in regard to a payment received for invoice  # {BillNumber} that has been created on your account. You can find the invoice with below link.\r\n</p><p>\r\nView Invoice</p><p>\r\n{URL}\r\n</p><p>\r\nWe look forward to conducting future business with you.\r\n</p><p>\r\nKind Regards,\r\n</p><p>\r\nTeam\r\n</p><p>\r\n{CompanyDetails}</p>', 
    NULL
  ), 
  (
    10, 'Invoice Overdue Notice', '{Company} Invoice #{BillNumber} Generated for you', 
    NULL, NULL, NULL, '<p>Dear Client,</p><p>\r\nWe are contacting you in regard to an Overdue Notice for invoice # {BillNumber} that has been created on your account. You may find the invoice with below link.\r\nPlease pay the balance of {Amount} due by {DueDate}.\r\n</p><p>View Invoice\r\n</p><p>{URL}\r\n</p><p>\r\nWe look forward to conducting future business with you.\r\n</p><p>\r\nKind Regards,\r\n</p><p>\r\nTeam</p><p>\r\n\r\n{CompanyDetails}</p>', 
    NULL
  ), 
  (
    11, 'Quote Proposal', '{Company} Quote #{BillNumber} Generated for you', 
    NULL, NULL, NULL, '<p>Dear Client,</p><p>\r\nWe are contacting you in regard to a new quote # {BillNumber} that has been created on your account. You may find the quote with below link.\r\n</p><p>\r\nView Invoice\r\n</p><p>{URL}\r\n</p><p>\r\nWe look forward to conducting future business with you.</p><p>\r\n\r\nKind Regards,</p><p>\r\n\r\nTeam</p><p>\r\n\r\n{CompanyDetails}</p>', 
    NULL
  ), 
  (
    12, 'Purchase Order Request', '{Company} Purchase Order #{BillNumber} Requested', 
    NULL, NULL, NULL, '<p>Dear Client,\r\n</p><p>We are contacting you in regard to a new purchase # {BillNumber} that has been requested on your account. You may find the order with below link. </p><p>\r\n\r\nView Invoice\r\n</p><p>{URL}</p><p>\r\n\r\nWe look forward to conducting future business with you.</p><p>\r\n\r\nKind Regards,\r\n</p><p>\r\nTeam</p><p>\r\n\r\n{CompanyDetails}</p>', 
    NULL
  ), 
  (
    13, 'Stock Return Mail', '{Company} New purchase return # {BillNumber}', 
    NULL, NULL, NULL, 'Dear Client,\r\n\r\nWe are contacting you in regard to a new purchase return # {BillNumber} that has been requested on your account. You may find the order with below link.\r\n\r\nView Invoice\r\n\r\n{URL}\r\n\r\nWe look forward to conducting future business with you.\r\n\r\nKind Regards,\r\n\r\nTeam\r\n\r\n{CompanyDetails}', 
    NULL
  ), 
  (
    30, 'New Invoice Notification', NULL, 
    NULL, NULL, NULL, 'Dear Customer, new invoice  # {BillNumber} generated. {URL} Regards', 
    NULL
  ), 
  (
    31, 'Invoice Payment Reminder', NULL, 
    NULL, NULL, NULL, 'Dear Customer, Please make payment of invoice  # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    32, 'Invoice Refund Proceeded', NULL, 
    NULL, NULL, NULL, 'Dear Customer, Refund generated of invoice # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    33, 'Invoice payment Received', NULL, 
    NULL, NULL, NULL, 'Dear Customer, Payment received of invoice # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    34, 'Invoice Overdue Notice', NULL, 
    NULL, NULL, NULL, 'Dear Customer, Dear Customer,Payment is overdue of invoice # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    35, 'Quote Proposal', NULL, NULL, NULL, 
    NULL, 'Dear Customer, Dear Customer, a quote created for you # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    36, 'Purchase Order Request', NULL, 
    NULL, NULL, NULL, 'Dear Customer, Dear, a purchased order for you # {BillNumber}. {URL} Regards', 
    NULL
  ), 
  (
    51, 'QT#', 'PO#', 'REC#', 'SR#', 'TRN#', 
    'SRN#', 1
  );
CREATE TABLE `users` (
  `users_id` int(11) NOT NULL, 
  `user_id` varchar(255) DEFAULT NULL, 
  `var_key` varchar(255) DEFAULT NULL, 
  `status` varchar(255) DEFAULT NULL, 
  `is_deleted` varchar(255) DEFAULT NULL, 
  `name` varchar(255) DEFAULT NULL, 
  `password` varchar(255) DEFAULT NULL, 
  `email` varchar(255) DEFAULT NULL, 
  `profile_pic` varchar(255) DEFAULT NULL, 
  `user_type` varchar(255) DEFAULT NULL, 
  `cid` int(11) DEFAULT NULL
) ENGINE = InnoDB DEFAULT CHARSET = latin1;
ALTER TABLE 
  `aauth_login_attempts` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `aauth_pms` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `full_index` (
    `id`, `sender_id`, `receiver_id`, 
    `date_read`
  );
ALTER TABLE 
  `aauth_users` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `email` (`email`), 
ADD 
  KEY `username` (`username`);
ALTER TABLE 
  `aauth_user_variables` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `user_id_index` (`user_id`);
ALTER TABLE 
  `accounts` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `acn` (`acn`), 
ADD 
  KEY `id` (`id`);
ALTER TABLE 
  `api_keys` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `app_system` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `id` (`id`);
ALTER TABLE 
  `bank_accounts` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `billing_terms` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `ci_sessions` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `ci_sessions_timestamp` (`timestamp`);
ALTER TABLE 
  `conf` 
ADD 
  UNIQUE KEY `id_2` (`id`), 
ADD 
  KEY `id` (`id`);
ALTER TABLE 
  `corn_job` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `currencies` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `customers` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `gid` (`gid`);
ALTER TABLE 
  `customers_group` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `id` (`id`);
ALTER TABLE 
  `documents` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `employee_profile` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `events` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `rel` (`rel`), 
ADD 
  KEY `rid` (`rid`);
ALTER TABLE 
  `invoices` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `invoice` (`tid`), 
ADD 
  KEY `eid` (`eid`), 
ADD 
  KEY `csd` (`csd`);
ALTER TABLE 
  `invoice_items` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `invoice` (`tid`);
ALTER TABLE 
  `meta_data` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `type` (`type`), 
ADD 
  KEY `rid` (`rid`);
ALTER TABLE 
  `milestones` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `notes` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `online_payment` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `payment_gateways` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `products` 
ADD 
  PRIMARY KEY (`pid`), 
ADD 
  KEY `pcat` (`pcat`), 
ADD 
  KEY `warehouse` (`warehouse`);
ALTER TABLE 
  `product_cat` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `product_warehouse` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `projects` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `p_id` (`p_id`);
ALTER TABLE 
  `project_meta` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `pid` (`pid`), 
ADD 
  KEY `meta_key` (`meta_key`), 
ADD 
  KEY `key3` (`key3`);
ALTER TABLE 
  `purchase` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `invoice` (`tid`), 
ADD 
  KEY `eid` (`eid`), 
ADD 
  KEY `csd` (`csd`);
ALTER TABLE 
  `purchase_items` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `invoice` (`tid`);
ALTER TABLE 
  `quotes` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `invoice` (`tid`), 
ADD 
  KEY `eid` (`eid`), 
ADD 
  KEY `csd` (`csd`);
ALTER TABLE 
  `quotes_items` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `invoice` (`tid`);
ALTER TABLE 
  `rec_invoices` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `invoice` (`tid`), 
ADD 
  KEY `eid` (`eid`), 
ADD 
  KEY `csd` (`csd`);
ALTER TABLE 
  `rec_invoice_items` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `invoice` (`tid`);
ALTER TABLE 
  `reports` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `stock_return` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  UNIQUE KEY `invoice` (`tid`), 
ADD 
  KEY `eid` (`eid`), 
ADD 
  KEY `csd` (`csd`);
ALTER TABLE 
  `stock_return_items` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `invoice` (`tid`) KEY_BLOCK_SIZE = 1024 USING BTREE;
ALTER TABLE 
  `supplier` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `sys_smtp` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `tickets` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `tickets_th` 
ADD 
  PRIMARY KEY (`id`), 
ADD 
  KEY `tid` (`tid`), 
ADD 
  KEY `cid` (`cid`), 
ADD 
  KEY `eid` (`eid`);
ALTER TABLE 
  `todolist` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `transactions` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `transactions_cat` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `univarsal_api` 
ADD 
  PRIMARY KEY (`id`);
ALTER TABLE 
  `users` 
ADD 
  PRIMARY KEY (`users_id`);
ALTER TABLE 
  `aauth_login_attempts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `aauth_pms` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `aauth_users` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 8;
ALTER TABLE 
  `aauth_user_variables` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `accounts` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `api_keys` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `bank_accounts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `billing_terms` MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `currencies` MODIFY `id` int(4) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `customers` MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `customers_group` MODIFY `id` int(10) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `documents` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `employee_profile` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 8;
ALTER TABLE 
  `events` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `invoices` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `invoice_items` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `meta_data` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `milestones` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `notes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `payment_gateways` MODIFY `id` int(5) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 6;
ALTER TABLE 
  `products` MODIFY `pid` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `product_cat` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `product_warehouse` MODIFY `id` int(3) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 2;
ALTER TABLE 
  `projects` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `project_meta` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `purchase` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `purchase_items` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `quotes` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `quotes_items` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `rec_invoices` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `rec_invoice_items` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `reports` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `stock_return` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `stock_return_items` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `supplier` MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `tickets` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `tickets_th` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `todolist` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `transactions` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT;
ALTER TABLE 
  `transactions_cat` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 3;
ALTER TABLE 
  `univarsal_api` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, 
  AUTO_INCREMENT = 52;
ALTER TABLE 
  `users` MODIFY `users_id` int(11) NOT NULL AUTO_INCREMENT;
COMMIT;
