-- MySQL dump 10.13  Distrib 5.7.33, for Linux (i686)
--
-- Host: localhost    Database: tsview
-- ------------------------------------------------------
-- Server version	5.7.33-0ubuntu0.16.04.1

/*!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 utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!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 */;

--
-- Table structure for table `app_settings`
--

DROP TABLE IF EXISTS `app_settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `app_settings` (
  `setting_key` varchar(100) NOT NULL,
  `setting_value` text,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`setting_key`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `app_settings`
--

LOCK TABLES `app_settings` WRITE;
/*!40000 ALTER TABLE `app_settings` DISABLE KEYS */;
/*!40000 ALTER TABLE `app_settings` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `app_users`
--

DROP TABLE IF EXISTS `app_users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `app_users` (
  `employee_id` int(10) unsigned NOT NULL,
  `username` varchar(255) DEFAULT NULL,
  `full_name` varchar(255) DEFAULT NULL,
  `is_enabled` tinyint(1) NOT NULL DEFAULT '1',
  `is_admin` tinyint(1) NOT NULL DEFAULT '0',
  `permissions_json` longtext,
  `last_login_at` datetime DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`employee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `app_users`
--

LOCK TABLES `app_users` WRITE;
/*!40000 ALTER TABLE `app_users` DISABLE KEYS */;
INSERT INTO `app_users` VALUES (1,'admin','Peter Abboud',1,0,NULL,'2026-04-08 17:04:42','2026-04-08 21:04:42'),(2,'buceina','Online 20',1,0,NULL,'2026-03-23 02:40:09','2026-03-23 06:40:09');
/*!40000 ALTER TABLE `app_users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `commission_payment_states`
--

DROP TABLE IF EXISTS `commission_payment_states`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `commission_payment_states` (
  `payment_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned DEFAULT NULL,
  `sale_id` int(10) unsigned DEFAULT NULL,
  `payment_amount` decimal(15,2) DEFAULT NULL,
  `is_verified` tinyint(1) NOT NULL DEFAULT '0',
  `is_paid` tinyint(1) NOT NULL DEFAULT '0',
  `is_ignored` tinyint(1) NOT NULL DEFAULT '0',
  `closed_period_id` int(10) unsigned DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`payment_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `commission_payment_states`
--

LOCK TABLES `commission_payment_states` WRITE;
/*!40000 ALTER TABLE `commission_payment_states` DISABLE KEYS */;
/*!40000 ALTER TABLE `commission_payment_states` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `employee_commissions`
--

DROP TABLE IF EXISTS `employee_commissions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `employee_commissions` (
  `employee_id` int(10) unsigned NOT NULL,
  `commission_percent` decimal(5,2) NOT NULL DEFAULT '0.00',
  `updated_at` timestamp NULL DEFAULT NULL,
  `show_in_reports` tinyint(1) DEFAULT '1',
  PRIMARY KEY (`employee_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `employee_commissions`
--

LOCK TABLES `employee_commissions` WRITE;
/*!40000 ALTER TABLE `employee_commissions` DISABLE KEYS */;
/*!40000 ALTER TABLE `employee_commissions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `pending_invoice_states`
--

DROP TABLE IF EXISTS `pending_invoice_states`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pending_invoice_states` (
  `sale_id` int(10) unsigned NOT NULL,
  `vendor_id` int(10) unsigned DEFAULT NULL,
  `assigned_vendor_id` int(10) unsigned DEFAULT NULL,
  `is_ignored` tinyint(1) NOT NULL DEFAULT '0',
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`sale_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `pending_invoice_states`
--

LOCK TABLES `pending_invoice_states` WRITE;
/*!40000 ALTER TABLE `pending_invoice_states` DISABLE KEYS */;
/*!40000 ALTER TABLE `pending_invoice_states` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `vendor_advances`
--

DROP TABLE IF EXISTS `vendor_advances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendor_advances` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `vendor_id` int(10) unsigned NOT NULL,
  `advance_date` date NOT NULL,
  `description` varchar(255) DEFAULT NULL,
  `amount` decimal(15,2) NOT NULL,
  `settled_period_id` int(10) unsigned DEFAULT NULL,
  `is_carry_over` tinyint(1) NOT NULL DEFAULT '0',
  `created_from_period_id` int(10) unsigned DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `vendor_advances`
--

LOCK TABLES `vendor_advances` WRITE;
/*!40000 ALTER TABLE `vendor_advances` DISABLE KEYS */;
/*!40000 ALTER TABLE `vendor_advances` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `vendor_period_closures`
--

DROP TABLE IF EXISTS `vendor_period_closures`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `vendor_period_closures` (
  `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
  `vendor_id` int(10) unsigned NOT NULL,
  `period_start_date` date NOT NULL,
  `period_end_date` date NOT NULL,
  `payout_date` date DEFAULT NULL,
  `payments_count` int(10) unsigned NOT NULL DEFAULT '0',
  `payments_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `commission_percent` decimal(5,2) NOT NULL DEFAULT '0.00',
  `commission_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `advances_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `paid_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `carry_over_total` decimal(15,2) NOT NULL DEFAULT '0.00',
  `closure_note` text,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `vendor_period_closures`
--

LOCK TABLES `vendor_period_closures` WRITE;
/*!40000 ALTER TABLE `vendor_period_closures` DISABLE KEYS */;
/*!40000 ALTER TABLE `vendor_period_closures` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping events for database 'tsview'
--

--
-- Dumping routines for database 'tsview'
--
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!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 */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2026-04-22  0:04:47
