-- MySQL dump 10.13  Distrib 8.4.7, for macos15.7 (arm64)
--
-- Host: 127.0.0.1    Database: poskasir
-- ------------------------------------------------------
-- Server version	8.4.7

/*!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 */;
/*!50503 SET NAMES utf8mb4 */;
/*!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 `audit_logs`
--

DROP TABLE IF EXISTS `audit_logs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `audit_logs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `user_id` bigint unsigned DEFAULT NULL,
  `branch_id` bigint unsigned DEFAULT NULL,
  `action` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `auditable_type` varchar(80) COLLATE utf8mb4_unicode_ci NOT NULL,
  `auditable_id` bigint unsigned DEFAULT NULL,
  `old_values` json DEFAULT NULL,
  `new_values` json DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `audit_logs_user_id_foreign` (`user_id`),
  KEY `audit_logs_branch_id_foreign` (`branch_id`),
  KEY `audit_logs_auditable_type_auditable_id_index` (`auditable_type`,`auditable_id`),
  KEY `audit_logs_action_index` (`action`),
  CONSTRAINT `audit_logs_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE SET NULL,
  CONSTRAINT `audit_logs_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `audit_logs`
--

LOCK TABLES `audit_logs` WRITE;
/*!40000 ALTER TABLE `audit_logs` DISABLE KEYS */;
INSERT INTO `audit_logs` VALUES (1,NULL,NULL,'application.setup','App\\Models\\User',1,NULL,'{\"branch_id\": 1}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 05:50:16','2026-08-18 05:50:16'),(2,1,NULL,'master.user.created','App\\Models\\User',2,NULL,'{\"id\": 2, \"name\": \"kasir\", \"role_id\": \"2\", \"username\": \"kasir\", \"branch_id\": null, \"created_at\": \"2026-08-18T06:41:01.000000Z\", \"updated_at\": \"2026-08-18T06:41:01.000000Z\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 06:41:01','2026-08-18 06:41:01'),(3,1,NULL,'master.payment-method.toggle','App\\Models\\PaymentMethod',4,'{\"id\": 4, \"code\": \"KARTU\", \"name\": \"Debit/Kartu\", \"is_cash\": false, \"is_active\": true, \"created_at\": \"2026-08-18T05:50:16.000000Z\", \"updated_at\": \"2026-08-18T05:50:16.000000Z\"}','{\"id\": 4, \"code\": \"KARTU\", \"name\": \"Debit/Kartu\", \"is_cash\": false, \"is_active\": false, \"created_at\": \"2026-08-18T05:50:16.000000Z\", \"updated_at\": \"2026-08-18T07:06:38.000000Z\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:06:38','2026-08-18 07:06:38'),(4,1,NULL,'sale.paid','App\\Models\\Sale',2,NULL,'{\"id\": 2, \"total\": \"10000.00\", \"number\": \"POS-20260818-01M09V508ZT899H7K4PDE4HJKW\", \"status\": \"paid\", \"sold_at\": \"2026-08-18T07:07:40.000000Z\", \"subtotal\": \"12000.00\", \"branch_id\": 1, \"total_hpp\": \"0.00\", \"cashier_id\": 1, \"created_at\": \"2026-08-18T07:07:40.000000Z\", \"updated_at\": \"2026-08-18T07:07:40.000000Z\", \"gross_profit\": \"10000.00\", \"discount_value\": \"2000.00\", \"discount_percent\": null}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:07:40','2026-08-18 07:07:40'),(5,1,NULL,'hpp.material.updated','App\\Models\\RawMaterial',1,'{\"id\": 1, \"code\": \"MIE_GORENG\", \"name\": \"Mie Instan Goreng\", \"is_active\": true, \"created_at\": \"2026-08-18T05:57:57.000000Z\", \"updated_at\": \"2026-08-18T05:57:57.000000Z\", \"category_id\": 1, \"base_unit_id\": 2, \"average_price\": \"0.0000\", \"maximum_stock\": null, \"minimum_stock\": \"0.0000\", \"last_purchase_price\": \"0.0000\"}','{\"id\": 1, \"code\": \"MIE_GORENG\", \"name\": \"Mie Instan Goreng\", \"is_active\": true, \"created_at\": \"2026-08-18T05:57:57.000000Z\", \"updated_at\": \"2026-08-18T07:10:02.000000Z\", \"category_id\": 1, \"base_unit_id\": 2, \"average_price\": \"5000.0000\", \"maximum_stock\": null, \"minimum_stock\": \"0.0000\", \"last_purchase_price\": \"0.0000\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:10:02','2026-08-18 07:10:02'),(6,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": null, \"margin_type\": \"markup\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:11:54','2026-08-18 07:11:54'),(7,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": \"5000\", \"margin_type\": \"markup\", \"margin_value\": \"1\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:13:56','2026-08-18 07:13:56'),(8,1,NULL,'price.final_set','App\\Models\\Product',7,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"7\", \"final_price\": \"10000\", \"margin_type\": \"markup\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:14:13','2026-08-18 07:14:13'),(9,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": \"10000\", \"margin_type\": \"markup\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:24:10','2026-08-18 07:24:10'),(10,1,NULL,'price.final_set','App\\Models\\Product',7,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"7\", \"final_price\": \"10000\", \"margin_type\": \"markup\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:24:12','2026-08-18 07:24:12'),(11,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": \"10000\", \"margin_type\": \"margin\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:24:27','2026-08-18 07:24:27'),(12,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": \"10000\", \"margin_type\": \"margin\", \"margin_value\": \"0\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:24:56','2026-08-18 07:24:56'),(13,1,NULL,'price.final_set','App\\Models\\Product',1,NULL,'{\"data\": {\"hpp\": \"5000\", \"branch_id\": \"1\", \"product_id\": \"1\", \"final_price\": \"10000.00\", \"margin_type\": \"markup\", \"margin_value\": \"100\"}}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:25:41','2026-08-18 07:25:41'),(14,1,NULL,'sale.paid','App\\Models\\Sale',3,NULL,'{\"id\": 3, \"total\": \"8000.00\", \"number\": \"POS-20260818-01M09X6XWTE29K9GBEZ5P7P3CA\", \"status\": \"paid\", \"sold_at\": \"2026-08-18T07:43:40.000000Z\", \"subtotal\": \"10000.00\", \"branch_id\": 1, \"total_hpp\": \"5000.00\", \"cashier_id\": 1, \"created_at\": \"2026-08-18T07:43:40.000000Z\", \"updated_at\": \"2026-08-18T07:43:40.000000Z\", \"gross_profit\": \"3000.00\", \"discount_value\": \"2000.00\", \"discount_percent\": null}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:43:40','2026-08-18 07:43:40'),(15,1,NULL,'sale.paid','App\\Models\\Sale',4,NULL,'{\"id\": 4, \"total\": \"10000.00\", \"number\": \"POS-20260818-01M09XHHZYS46B8MVXVWGRE4EB\", \"status\": \"paid\", \"sold_at\": \"2026-08-18T07:49:29.000000Z\", \"subtotal\": \"10000.00\", \"branch_id\": 1, \"total_hpp\": \"5000.00\", \"cashier_id\": 1, \"created_at\": \"2026-08-18T07:49:29.000000Z\", \"updated_at\": \"2026-08-18T07:49:29.000000Z\", \"gross_profit\": \"5000.00\", \"discount_value\": \"0.00\", \"discount_percent\": null}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-18 07:49:29','2026-08-18 07:49:29'),(16,1,NULL,'stock.opname.created','App\\Models\\StockOpname',1,NULL,'{\"id\": 1, \"notes\": null, \"number\": \"OPN-01M0CSD576AGDP04JTZZN9TT92\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:34:54.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:34:54.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:34:54','2026-08-19 10:34:54'),(17,1,NULL,'stock.opname.created','App\\Models\\StockOpname',2,NULL,'{\"id\": 2, \"notes\": null, \"number\": \"OPN-01M0CSJCQME39JTDHC9V6A61G4\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:37:45.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:37:45.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:37:45','2026-08-19 10:37:45'),(18,1,NULL,'stock.opname.created','App\\Models\\StockOpname',3,NULL,'{\"id\": 3, \"notes\": null, \"number\": \"OPN-01M0CSKGHV76ERE9ZKD0T36QBE\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:38:22.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:38:22.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:38:22','2026-08-19 10:38:22'),(19,1,NULL,'stock.opname.created','App\\Models\\StockOpname',4,NULL,'{\"id\": 4, \"notes\": null, \"number\": \"OPN-01M0CT6WB356BPQ5QWTSJBQWEQ\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:48:56.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:48:56.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:48:56','2026-08-19 10:48:56'),(20,1,NULL,'stock.opname.created','App\\Models\\StockOpname',5,NULL,'{\"id\": 5, \"notes\": null, \"number\": \"OPN-01M0CTDH0HDGGGN4MH8D63V67A\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:52:34.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:52:34.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:52:34','2026-08-19 10:52:34'),(21,1,NULL,'stock.opname.created','App\\Models\\StockOpname',6,NULL,'{\"id\": 6, \"notes\": null, \"number\": \"OPN-01M0CTEC7NBMGSFQ8AV4315HXB\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:53:02.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:53:02.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:53:02','2026-08-19 10:53:02'),(22,1,NULL,'stock.opname.created','App\\Models\\StockOpname',7,NULL,'{\"id\": 7, \"notes\": null, \"number\": \"OPN-01M0CTMK4FQZDH3TW1KJVRNWRQ\", \"status\": \"counting\", \"branch_id\": \"1\", \"created_at\": \"2026-08-19T10:56:26.000000Z\", \"created_by\": 1, \"updated_at\": \"2026-08-19T10:56:26.000000Z\", \"opname_date\": \"2026-08-19\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 10:56:26','2026-08-19 10:56:26'),(23,1,NULL,'sale.paid','App\\Models\\Sale',5,NULL,'{\"id\": 5, \"total\": \"87000.00\", \"number\": \"POS-20260819-01M0CV70M8AZP3CFE4EF3JS5FF\", \"status\": \"paid\", \"sold_at\": \"2026-08-19T11:06:29.000000Z\", \"subtotal\": \"87000.00\", \"branch_id\": 1, \"total_hpp\": \"0.00\", \"cashier_id\": 1, \"created_at\": \"2026-08-19T11:06:29.000000Z\", \"updated_at\": \"2026-08-19T11:06:29.000000Z\", \"gross_profit\": \"87000.00\", \"discount_value\": \"0.00\", \"discount_percent\": null}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 11:06:29','2026-08-19 11:06:29'),(24,1,NULL,'master.branch.updated','App\\Models\\Branch',1,'{\"id\": 1, \"code\": \"kemang\", \"name\": \"kemang\", \"phone\": null, \"address\": null, \"is_active\": true, \"created_at\": \"2026-08-18T05:50:16.000000Z\", \"updated_at\": \"2026-08-18T05:50:16.000000Z\"}','{\"id\": 1, \"code\": \"depok1\", \"name\": \"Kartini Raya\", \"phone\": null, \"address\": null, \"is_active\": true, \"created_at\": \"2026-08-18T05:50:16.000000Z\", \"updated_at\": \"2026-08-19T11:09:14.000000Z\"}','127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','2026-08-19 11:09:14','2026-08-19 11:09:14');
/*!40000 ALTER TABLE `audit_logs` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `branch_user`
--

DROP TABLE IF EXISTS `branch_user`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `branch_user` (
  `branch_id` bigint unsigned NOT NULL,
  `user_id` bigint unsigned NOT NULL,
  PRIMARY KEY (`branch_id`,`user_id`),
  KEY `branch_user_user_id_foreign` (`user_id`),
  CONSTRAINT `branch_user_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `branch_user_user_id_foreign` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `branch_user`
--

LOCK TABLES `branch_user` WRITE;
/*!40000 ALTER TABLE `branch_user` DISABLE KEYS */;
INSERT INTO `branch_user` VALUES (1,1);
/*!40000 ALTER TABLE `branch_user` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `branches`
--

DROP TABLE IF EXISTS `branches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `branches` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `address` text COLLATE utf8mb4_unicode_ci,
  `phone` varchar(30) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `branches_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `branches`
--

LOCK TABLES `branches` WRITE;
/*!40000 ALTER TABLE `branches` DISABLE KEYS */;
INSERT INTO `branches` VALUES (1,'depok1','Kartini Raya',NULL,NULL,1,'2026-08-18 05:50:16','2026-08-19 11:09:14');
/*!40000 ALTER TABLE `branches` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cache`
--

DROP TABLE IF EXISTS `cache`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` mediumtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` bigint NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache`
--

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

--
-- Table structure for table `cache_locks`
--

DROP TABLE IF EXISTS `cache_locks`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cache_locks` (
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `owner` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `expiration` bigint NOT NULL,
  PRIMARY KEY (`key`),
  KEY `cache_locks_expiration_index` (`expiration`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cache_locks`
--

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

--
-- Table structure for table `cash_accounts`
--

DROP TABLE IF EXISTS `cash_accounts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cash_accounts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `opening_balance` decimal(18,2) NOT NULL DEFAULT '0.00',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cash_accounts_branch_id_code_unique` (`branch_id`,`code`),
  CONSTRAINT `cash_accounts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cash_accounts`
--

LOCK TABLES `cash_accounts` WRITE;
/*!40000 ALTER TABLE `cash_accounts` DISABLE KEYS */;
INSERT INTO `cash_accounts` VALUES (1,1,'01','utama-kas',10000.00,1,'2026-08-18 05:50:16','2026-08-18 05:50:16');
/*!40000 ALTER TABLE `cash_accounts` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `cash_transactions`
--

DROP TABLE IF EXISTS `cash_transactions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `cash_transactions` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `cash_account_id` bigint unsigned NOT NULL,
  `payment_method_id` bigint unsigned DEFAULT NULL,
  `expense_category_id` bigint unsigned DEFAULT NULL,
  `created_by` bigint unsigned NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `type` varchar(10) COLLATE utf8mb4_unicode_ci NOT NULL,
  `category` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `amount` decimal(18,2) NOT NULL,
  `source_type` varchar(40) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `source_id` bigint unsigned DEFAULT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `transaction_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `cash_transactions_number_unique` (`number`),
  KEY `cash_transactions_branch_id_foreign` (`branch_id`),
  KEY `cash_transactions_cash_account_id_foreign` (`cash_account_id`),
  KEY `cash_transactions_payment_method_id_foreign` (`payment_method_id`),
  KEY `cash_transactions_expense_category_id_foreign` (`expense_category_id`),
  KEY `cash_transactions_created_by_foreign` (`created_by`),
  KEY `cash_transactions_source_type_source_id_index` (`source_type`,`source_id`),
  KEY `cash_transactions_type_index` (`type`),
  KEY `cash_transactions_category_index` (`category`),
  KEY `cash_transactions_transaction_at_index` (`transaction_at`),
  CONSTRAINT `cash_transactions_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `cash_transactions_cash_account_id_foreign` FOREIGN KEY (`cash_account_id`) REFERENCES `cash_accounts` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `cash_transactions_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `cash_transactions_expense_category_id_foreign` FOREIGN KEY (`expense_category_id`) REFERENCES `expense_categories` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `cash_transactions_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `cash_transactions`
--

LOCK TABLES `cash_transactions` WRITE;
/*!40000 ALTER TABLE `cash_transactions` DISABLE KEYS */;
INSERT INTO `cash_transactions` VALUES (1,1,1,1,NULL,1,'KIN-01M09XHJ06JP4YFKCZW8HJBX97','in','pos_sale',10000.00,'sale',4,'Penjualan POS-20260818-01M09XHHZYS46B8MVXVWGRE4EB','2026-08-18 07:49:29','2026-08-18 07:49:29','2026-08-18 07:49:29'),(2,1,1,1,NULL,1,'KIN-01M0CV70N3FGB3BSCG3TVTCH5M','in','pos_sale',87000.00,'sale',5,'Penjualan POS-20260819-01M0CV70M8AZP3CFE4EF3JS5FF','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `cash_transactions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `categories`
--

DROP TABLE IF EXISTS `categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `categories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `sort_order` int unsigned NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `categories_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `categories`
--

LOCK TABLES `categories` WRITE;
/*!40000 ALTER TABLE `categories` DISABLE KEYS */;
INSERT INTO `categories` VALUES (1,'MIE','Mie Instan',1,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(2,'NASI','Nasi',2,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,'MINUMAN','Minuman',3,1,'2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `categories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `expense_categories`
--

DROP TABLE IF EXISTS `expense_categories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `expense_categories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `expense_categories_code_unique` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `expense_categories`
--

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

--
-- Table structure for table `failed_jobs`
--

DROP TABLE IF EXISTS `failed_jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `failed_jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `uuid` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `connection` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `exception` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `failed_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `failed_jobs_uuid_unique` (`uuid`),
  KEY `failed_jobs_connection_queue_failed_at_index` (`connection`,`queue`,`failed_at`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `failed_jobs`
--

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

--
-- Table structure for table `hpp_histories`
--

DROP TABLE IF EXISTS `hpp_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `hpp_histories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned DEFAULT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `changed_by` bigint unsigned NOT NULL,
  `unit_cost` decimal(18,4) DEFAULT NULL,
  `total_hpp` decimal(18,2) DEFAULT NULL,
  `source_type` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
  `source_id` bigint unsigned DEFAULT NULL,
  `effective_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `hpp_histories_branch_id_foreign` (`branch_id`),
  KEY `hpp_histories_product_id_foreign` (`product_id`),
  KEY `hpp_histories_raw_material_id_foreign` (`raw_material_id`),
  KEY `hpp_histories_changed_by_foreign` (`changed_by`),
  KEY `hpp_histories_source_type_source_id_index` (`source_type`,`source_id`),
  CONSTRAINT `hpp_histories_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `hpp_histories_changed_by_foreign` FOREIGN KEY (`changed_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `hpp_histories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `hpp_histories_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `hpp_histories`
--

LOCK TABLES `hpp_histories` WRITE;
/*!40000 ALTER TABLE `hpp_histories` DISABLE KEYS */;
INSERT INTO `hpp_histories` VALUES (1,NULL,NULL,1,1,5000.0000,NULL,'manual',NULL,'2026-08-18 07:10:02','2026-08-18 07:10:02','2026-08-18 07:10:02');
/*!40000 ALTER TABLE `hpp_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `job_batches`
--

DROP TABLE IF EXISTS `job_batches`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `job_batches` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `total_jobs` int NOT NULL,
  `pending_jobs` int NOT NULL,
  `failed_jobs` int NOT NULL,
  `failed_job_ids` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `options` mediumtext COLLATE utf8mb4_unicode_ci,
  `cancelled_at` int DEFAULT NULL,
  `created_at` int NOT NULL,
  `finished_at` int DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `job_batches`
--

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

--
-- Table structure for table `jobs`
--

DROP TABLE IF EXISTS `jobs`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `jobs` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `queue` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `attempts` smallint unsigned NOT NULL,
  `reserved_at` int unsigned DEFAULT NULL,
  `available_at` int unsigned NOT NULL,
  `created_at` int unsigned NOT NULL,
  PRIMARY KEY (`id`),
  KEY `jobs_queue_index` (`queue`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `jobs`
--

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

--
-- Table structure for table `migrations`
--

DROP TABLE IF EXISTS `migrations`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `migrations` (
  `id` int unsigned NOT NULL AUTO_INCREMENT,
  `migration` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `batch` int NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `migrations`
--

LOCK TABLES `migrations` WRITE;
/*!40000 ALTER TABLE `migrations` DISABLE KEYS */;
INSERT INTO `migrations` VALUES (1,'0001_01_01_000000_create_users_table',1),(2,'0001_01_01_000001_create_cache_table',1),(3,'0001_01_01_000002_create_jobs_table',1),(4,'2026_08_18_000000_create_pos_tables',1),(5,'2026_08_18_010000_add_username_to_users_table',2);
/*!40000 ALTER TABLE `migrations` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `password_reset_tokens`
--

DROP TABLE IF EXISTS `password_reset_tokens`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `password_reset_tokens` (
  `email` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `token` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`email`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `password_reset_tokens`
--

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

--
-- Table structure for table `payment_methods`
--

DROP TABLE IF EXISTS `payment_methods`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `payment_methods` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_cash` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `payment_methods_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `payment_methods`
--

LOCK TABLES `payment_methods` WRITE;
/*!40000 ALTER TABLE `payment_methods` DISABLE KEYS */;
INSERT INTO `payment_methods` VALUES (1,'TUNAI','Tunai',1,1,'2026-08-18 05:50:16','2026-08-18 05:50:16'),(2,'TRANSFER','Transfer',0,1,'2026-08-18 05:50:16','2026-08-18 05:50:16'),(3,'QRIS','QRIS',0,1,'2026-08-18 05:50:16','2026-08-18 05:50:16'),(4,'KARTU','Debit/Kartu',0,0,'2026-08-18 05:50:16','2026-08-18 07:06:38');
/*!40000 ALTER TABLE `payment_methods` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `payments`
--

DROP TABLE IF EXISTS `payments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `payments` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint unsigned NOT NULL,
  `payment_method_id` bigint unsigned NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'paid',
  `amount` decimal(18,2) NOT NULL,
  `received_amount` decimal(18,2) DEFAULT NULL,
  `change_amount` decimal(18,2) NOT NULL DEFAULT '0.00',
  `reference_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `paid_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `payments_sale_id_foreign` (`sale_id`),
  KEY `payments_payment_method_id_foreign` (`payment_method_id`),
  KEY `payments_status_index` (`status`),
  KEY `payments_paid_at_index` (`paid_at`),
  CONSTRAINT `payments_payment_method_id_foreign` FOREIGN KEY (`payment_method_id`) REFERENCES `payment_methods` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `payments_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `payments`
--

LOCK TABLES `payments` WRITE;
/*!40000 ALTER TABLE `payments` DISABLE KEYS */;
INSERT INTO `payments` VALUES (1,2,3,'paid',10000.00,NULL,0.00,NULL,'2026-08-18 07:07:40','2026-08-18 07:07:40','2026-08-18 07:07:40'),(2,3,3,'paid',8000.00,NULL,0.00,NULL,'2026-08-18 07:43:40','2026-08-18 07:43:40','2026-08-18 07:43:40'),(3,4,1,'paid',10000.00,10000.00,0.00,NULL,'2026-08-18 07:49:29','2026-08-18 07:49:29','2026-08-18 07:49:29'),(4,5,1,'paid',87000.00,100000.00,13000.00,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `payments` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `price_histories`
--

DROP TABLE IF EXISTS `price_histories`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `price_histories` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint unsigned NOT NULL,
  `branch_id` bigint unsigned NOT NULL,
  `set_by` bigint unsigned NOT NULL,
  `hpp_snapshot` decimal(18,2) NOT NULL,
  `margin_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `margin_value` decimal(18,4) NOT NULL,
  `estimated_price` decimal(18,2) NOT NULL,
  `final_price` decimal(18,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `price_histories_branch_id_foreign` (`branch_id`),
  KEY `price_histories_set_by_foreign` (`set_by`),
  KEY `price_histories_product_id_branch_id_created_at_index` (`product_id`,`branch_id`,`created_at`),
  CONSTRAINT `price_histories_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `price_histories_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `price_histories_set_by_foreign` FOREIGN KEY (`set_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `price_histories`
--

LOCK TABLES `price_histories` WRITE;
/*!40000 ALTER TABLE `price_histories` DISABLE KEYS */;
INSERT INTO `price_histories` VALUES (1,1,1,1,5000.00,'markup',0.0000,5000.00,5000.00,'2026-08-18 07:11:54','2026-08-18 07:11:54'),(2,1,1,1,5000.00,'markup',1.0000,5050.00,5000.00,'2026-08-18 07:13:56','2026-08-18 07:13:56'),(3,7,1,1,5000.00,'markup',0.0000,5000.00,10000.00,'2026-08-18 07:14:13','2026-08-18 07:14:13'),(4,1,1,1,5000.00,'markup',0.0000,5000.00,10000.00,'2026-08-18 07:24:10','2026-08-18 07:24:10'),(5,7,1,1,5000.00,'markup',0.0000,5000.00,10000.00,'2026-08-18 07:24:12','2026-08-18 07:24:12'),(6,1,1,1,5000.00,'margin',0.0000,5000.00,10000.00,'2026-08-18 07:24:27','2026-08-18 07:24:27'),(7,1,1,1,5000.00,'margin',0.0000,5000.00,10000.00,'2026-08-18 07:24:56','2026-08-18 07:24:56'),(8,1,1,1,5000.00,'markup',100.0000,10000.00,10000.00,'2026-08-18 07:25:41','2026-08-18 07:25:41');
/*!40000 ALTER TABLE `price_histories` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `product_prices`
--

DROP TABLE IF EXISTS `product_prices`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `product_prices` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint unsigned NOT NULL,
  `branch_id` bigint unsigned NOT NULL,
  `set_by` bigint unsigned NOT NULL,
  `hpp_snapshot` decimal(18,2) NOT NULL,
  `margin_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `margin_value` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `estimated_price` decimal(18,2) NOT NULL,
  `final_price` decimal(18,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `product_prices_product_id_branch_id_unique` (`product_id`,`branch_id`),
  KEY `product_prices_branch_id_foreign` (`branch_id`),
  KEY `product_prices_set_by_foreign` (`set_by`),
  CONSTRAINT `product_prices_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `product_prices_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE CASCADE,
  CONSTRAINT `product_prices_set_by_foreign` FOREIGN KEY (`set_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `product_prices`
--

LOCK TABLES `product_prices` WRITE;
/*!40000 ALTER TABLE `product_prices` DISABLE KEYS */;
INSERT INTO `product_prices` VALUES (1,1,1,1,5000.00,'markup',100.0000,10000.00,10000.00,'2026-08-18 07:11:54','2026-08-18 07:25:41'),(2,7,1,1,5000.00,'markup',0.0000,5000.00,10000.00,'2026-08-18 07:14:13','2026-08-18 07:14:13');
/*!40000 ALTER TABLE `product_prices` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `products`
--

DROP TABLE IF EXISTS `products`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `products` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `category_id` bigint unsigned DEFAULT NULL,
  `sale_unit_id` bigint unsigned NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `barcode` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `description` text COLLATE utf8mb4_unicode_ci,
  `image_path` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `final_price` decimal(18,2) NOT NULL DEFAULT '0.00',
  `tax_percent` decimal(8,4) NOT NULL DEFAULT '0.0000',
  `sort_order` int unsigned NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `products_code_unique` (`code`),
  UNIQUE KEY `products_barcode_unique` (`barcode`),
  KEY `products_category_id_foreign` (`category_id`),
  KEY `products_sale_unit_id_foreign` (`sale_unit_id`),
  KEY `products_name_index` (`name`),
  KEY `products_type_index` (`type`),
  CONSTRAINT `products_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `products_sale_unit_id_foreign` FOREIGN KEY (`sale_unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `products`
--

LOCK TABLES `products` WRITE;
/*!40000 ALTER TABLE `products` DISABLE KEYS */;
INSERT INTO `products` VALUES (1,1,3,'INDOMIE_GORENG',NULL,'Indomie Goreng',NULL,'products/wamindo-indomie-goreng.png','bom',10000.00,0.0000,1,1,'2026-08-18 05:57:57','2026-08-18 07:24:10'),(2,1,3,'INDOMIE_GORENG_TELUR',NULL,'Indomie Goreng Telur',NULL,'products/wamindo-indomie-goreng.png','bom',15000.00,0.0000,1,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,1,3,'INDOMIE_KUAH',NULL,'Indomie Kuah',NULL,'products/wamindo-indomie-kuah.png','bom',12000.00,0.0000,1,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(4,1,3,'INDOMIE_KUAH_TELUR',NULL,'Indomie Kuah Telur',NULL,'products/wamindo-indomie-kuah.png','bom',15000.00,0.0000,1,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(5,2,3,'NASI_GORENG',NULL,'Nasi Goreng',NULL,'products/wamindo-nasi-goreng.png','bom',15000.00,0.0000,2,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(6,2,3,'NASI_GORENG_TELUR',NULL,'Nasi Goreng Telur',NULL,'products/wamindo-nasi-goreng.png','bom',18000.00,0.0000,2,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(7,3,3,'ES_TEH_MANIS',NULL,'Es Teh Manis',NULL,'products/wamindo-es-teh-manis.png','non_stock',10000.00,0.0000,3,1,'2026-08-18 05:57:57','2026-08-18 07:14:13'),(8,3,3,'TEH_HANGAT',NULL,'Teh Hangat',NULL,'products/wamindo-es-teh-manis.png','non_stock',4000.00,0.0000,3,1,'2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `products` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `raw_materials`
--

DROP TABLE IF EXISTS `raw_materials`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `raw_materials` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `category_id` bigint unsigned DEFAULT NULL,
  `base_unit_id` bigint unsigned NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `minimum_stock` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `maximum_stock` decimal(18,4) DEFAULT NULL,
  `last_purchase_price` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `average_price` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `raw_materials_code_unique` (`code`),
  KEY `raw_materials_category_id_foreign` (`category_id`),
  KEY `raw_materials_base_unit_id_foreign` (`base_unit_id`),
  KEY `raw_materials_name_index` (`name`),
  CONSTRAINT `raw_materials_base_unit_id_foreign` FOREIGN KEY (`base_unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `raw_materials_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `raw_materials`
--

LOCK TABLES `raw_materials` WRITE;
/*!40000 ALTER TABLE `raw_materials` DISABLE KEYS */;
INSERT INTO `raw_materials` VALUES (1,1,2,'MIE_GORENG','Mie Instan Goreng',0.0000,NULL,0.0000,5000.0000,1,'2026-08-18 05:57:57','2026-08-18 07:10:02'),(2,1,2,'MIE_KUAH','Mie Instan Kuah',0.0000,NULL,0.0000,0.0000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,1,2,'TELUR','Telur Ayam',0.0000,NULL,0.0000,0.0000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(4,2,1,'NASI_MATANG','Nasi Matang',0.0000,NULL,0.0000,0.0000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `raw_materials` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `recipe_items`
--

DROP TABLE IF EXISTS `recipe_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `recipe_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `recipe_id` bigint unsigned NOT NULL,
  `raw_material_id` bigint unsigned NOT NULL,
  `unit_id` bigint unsigned NOT NULL,
  `quantity` decimal(18,6) NOT NULL,
  `base_quantity` decimal(18,6) NOT NULL,
  `unit_cost` decimal(18,4) NOT NULL,
  `total_hpp` decimal(18,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `recipe_items_recipe_id_raw_material_id_unique` (`recipe_id`,`raw_material_id`),
  KEY `recipe_items_raw_material_id_foreign` (`raw_material_id`),
  KEY `recipe_items_unit_id_foreign` (`unit_id`),
  CONSTRAINT `recipe_items_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `recipe_items_recipe_id_foreign` FOREIGN KEY (`recipe_id`) REFERENCES `recipes` (`id`) ON DELETE CASCADE,
  CONSTRAINT `recipe_items_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `recipe_items`
--

LOCK TABLES `recipe_items` WRITE;
/*!40000 ALTER TABLE `recipe_items` DISABLE KEYS */;
INSERT INTO `recipe_items` VALUES (1,1,1,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(2,2,1,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,2,3,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(4,3,2,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(5,4,2,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(6,4,3,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(7,5,4,1,50.000000,50.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(8,6,4,1,50.000000,50.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(9,6,3,2,1.000000,1.000000,0.0000,0.00,'2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `recipe_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `recipes`
--

DROP TABLE IF EXISTS `recipes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `recipes` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `product_id` bigint unsigned NOT NULL,
  `created_by` bigint unsigned NOT NULL,
  `version` int unsigned NOT NULL,
  `total_hpp` decimal(18,2) NOT NULL DEFAULT '0.00',
  `is_active` tinyint(1) NOT NULL DEFAULT '0',
  `effective_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `recipes_product_id_version_unique` (`product_id`,`version`),
  KEY `recipes_created_by_foreign` (`created_by`),
  KEY `recipes_is_active_index` (`is_active`),
  CONSTRAINT `recipes_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `recipes_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `recipes`
--

LOCK TABLES `recipes` WRITE;
/*!40000 ALTER TABLE `recipes` DISABLE KEYS */;
INSERT INTO `recipes` VALUES (1,1,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57'),(2,2,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,3,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57'),(4,4,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57'),(5,5,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57'),(6,6,1,1,0.00,1,'2026-08-18 05:57:57','2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `recipes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `roles`
--

DROP TABLE IF EXISTS `roles`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `roles` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `permissions` json DEFAULT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `roles_code_unique` (`code`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `roles`
--

LOCK TABLES `roles` WRITE;
/*!40000 ALTER TABLE `roles` DISABLE KEYS */;
INSERT INTO `roles` VALUES (1,'Administrator','admin','[\"*\"]',1,'2026-08-18 05:50:16','2026-08-18 05:50:16'),(2,'Kasir','cashier','[\"process_sales\"]',1,'2026-08-18 05:50:16','2026-08-18 05:50:16');
/*!40000 ALTER TABLE `roles` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sale_items`
--

DROP TABLE IF EXISTS `sale_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sale_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned NOT NULL,
  `category_id` bigint unsigned DEFAULT NULL,
  `product_code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `product_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `unit_price` decimal(18,2) NOT NULL,
  `quantity` decimal(18,4) NOT NULL,
  `subtotal` decimal(18,2) NOT NULL,
  `unit_hpp` decimal(18,2) NOT NULL,
  `total_hpp` decimal(18,2) NOT NULL,
  `gross_profit` decimal(18,2) NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `sale_items_sale_id_foreign` (`sale_id`),
  KEY `sale_items_product_id_foreign` (`product_id`),
  KEY `sale_items_category_id_foreign` (`category_id`),
  CONSTRAINT `sale_items_category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `categories` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `sale_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `sale_items_sale_id_foreign` FOREIGN KEY (`sale_id`) REFERENCES `sales` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sale_items`
--

LOCK TABLES `sale_items` WRITE;
/*!40000 ALTER TABLE `sale_items` DISABLE KEYS */;
INSERT INTO `sale_items` VALUES (2,2,1,1,'INDOMIE_GORENG','Indomie Goreng',12000.00,1.0000,12000.00,0.00,0.00,10000.00,'pedes','2026-08-18 07:07:40','2026-08-18 07:07:40'),(3,3,1,1,'INDOMIE_GORENG','Indomie Goreng',10000.00,1.0000,10000.00,5000.00,5000.00,3000.00,'ga pedas','2026-08-18 07:43:40','2026-08-18 07:43:40'),(4,4,1,1,'INDOMIE_GORENG','Indomie Goreng',10000.00,1.0000,10000.00,5000.00,5000.00,5000.00,NULL,'2026-08-18 07:49:29','2026-08-18 07:49:29'),(5,5,4,1,'INDOMIE_KUAH_TELUR','Indomie Kuah Telur',15000.00,2.0000,30000.00,0.00,0.00,30000.00,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29'),(6,5,5,2,'NASI_GORENG','Nasi Goreng',15000.00,2.0000,30000.00,0.00,0.00,30000.00,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29'),(7,5,3,1,'INDOMIE_KUAH','Indomie Kuah',12000.00,1.0000,12000.00,0.00,0.00,12000.00,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29'),(8,5,2,1,'INDOMIE_GORENG_TELUR','Indomie Goreng Telur',15000.00,1.0000,15000.00,0.00,0.00,15000.00,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `sale_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sales`
--

DROP TABLE IF EXISTS `sales`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sales` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `cashier_id` bigint unsigned NOT NULL,
  `cancelled_by` bigint unsigned DEFAULT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `subtotal` decimal(18,2) NOT NULL,
  `discount_value` decimal(18,2) NOT NULL DEFAULT '0.00',
  `discount_percent` decimal(8,4) DEFAULT NULL,
  `total` decimal(18,2) NOT NULL,
  `total_hpp` decimal(18,2) NOT NULL,
  `gross_profit` decimal(18,2) NOT NULL,
  `sold_at` timestamp NOT NULL,
  `cancelled_at` timestamp NULL DEFAULT NULL,
  `cancellation_reason` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `sales_number_unique` (`number`),
  KEY `sales_cashier_id_foreign` (`cashier_id`),
  KEY `sales_cancelled_by_foreign` (`cancelled_by`),
  KEY `sales_branch_id_status_sold_at_index` (`branch_id`,`status`,`sold_at`),
  KEY `sales_status_index` (`status`),
  KEY `sales_sold_at_index` (`sold_at`),
  CONSTRAINT `sales_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `sales_cancelled_by_foreign` FOREIGN KEY (`cancelled_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `sales_cashier_id_foreign` FOREIGN KEY (`cashier_id`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sales`
--

LOCK TABLES `sales` WRITE;
/*!40000 ALTER TABLE `sales` DISABLE KEYS */;
INSERT INTO `sales` VALUES (2,1,1,NULL,'POS-20260818-01M09V508ZT899H7K4PDE4HJKW','paid',12000.00,2000.00,NULL,10000.00,0.00,10000.00,'2026-08-18 07:07:40',NULL,NULL,'2026-08-18 07:07:40','2026-08-18 07:07:40'),(3,1,1,NULL,'POS-20260818-01M09X6XWTE29K9GBEZ5P7P3CA','paid',10000.00,2000.00,NULL,8000.00,5000.00,3000.00,'2026-08-18 07:43:40',NULL,NULL,'2026-08-18 07:43:40','2026-08-18 07:43:40'),(4,1,1,NULL,'POS-20260818-01M09XHHZYS46B8MVXVWGRE4EB','paid',10000.00,0.00,NULL,10000.00,5000.00,5000.00,'2026-08-18 07:49:29',NULL,NULL,'2026-08-18 07:49:29','2026-08-18 07:49:29'),(5,1,1,NULL,'POS-20260819-01M0CV70M8AZP3CFE4EF3JS5FF','paid',87000.00,0.00,NULL,87000.00,0.00,87000.00,'2026-08-19 11:06:29',NULL,NULL,'2026-08-19 11:06:29','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `sales` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `sessions`
--

DROP TABLE IF EXISTS `sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `sessions` (
  `id` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `user_id` bigint unsigned DEFAULT NULL,
  `ip_address` varchar(45) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `user_agent` text COLLATE utf8mb4_unicode_ci,
  `payload` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `last_activity` int NOT NULL,
  PRIMARY KEY (`id`),
  KEY `sessions_user_id_index` (`user_id`),
  KEY `sessions_last_activity_index` (`last_activity`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `sessions`
--

LOCK TABLES `sessions` WRITE;
/*!40000 ALTER TABLE `sessions` DISABLE KEYS */;
INSERT INTO `sessions` VALUES ('cd9IKPn79LZh33BZPv6y1VV8u7VDGiJRCsudOxIh',1,'127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','eyJfdG9rZW4iOiI4OXVVWG1oWTU1UUVNSmJ0M2phMDhDM0VoY1dKamNvNEJMbzhsakhqIiwidXJsIjpbXSwiX3ByZXZpb3VzIjp7InVybCI6Imh0dHA6XC9cLzEyNy4wLjAuMTo4MDAwXC9hZG1pblwvY2FzaCIsInJvdXRlIjoiY2FzaC5pbmRleCJ9LCJfZmxhc2giOnsib2xkIjpbXSwibmV3IjpbXX0sImxvZ2luX3dlYl81OWJhMzZhZGRjMmIyZjk0MDE1ODBmMDE0YzdmNThlYTRlMzA5ODlkIjoxfQ==',1787138122),('D2NrOnQzTVgLC7ieP1H5WBXYQq1iR86JzMniMehT',NULL,'127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','eyJfdG9rZW4iOiIzNTdBRkJZUGVoUGxscEcyeGt2c0J2bkx4ZTBDb0VRekk4SEQ2enkwIiwiX3ByZXZpb3VzIjp7InVybCI6Imh0dHA6XC9cLzEyNy4wLjAuMTo4MDAwXC9sb2dpbiIsInJvdXRlIjoibG9naW4ifSwiX2ZsYXNoIjp7Im9sZCI6W10sIm5ldyI6W119LCJ1cmwiOnsiaW50ZW5kZWQiOiJodHRwOlwvXC8xMjcuMC4wLjE6ODAwMFwvcG9zXC9yZWNlaXB0XC81In19',1787137833),('Pi44BL62O6jKHToiXWPzwmakv46VPU1W9A9olHHB',1,'127.0.0.1','Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36','eyJfdG9rZW4iOiJHTHVFWHU5MjYwOGhSWmF6WnI0bzlWcWxweENZZUR5UGZ4UVl4dmIyIiwiX3ByZXZpb3VzIjp7InVybCI6Imh0dHA6XC9cLzEyNy4wLjAuMTo4MDAwXC9hZG1pblwvbWFzdGVyIiwicm91dGUiOiJtYXN0ZXIuaW5kZXgifSwiX2ZsYXNoIjp7Im9sZCI6W10sIm5ldyI6W119LCJsb2dpbl93ZWJfNTliYTM2YWRkYzJiMmY5NDAxNTgwZjAxNGM3ZjU4ZWE0ZTMwOTg5ZCI6MX0=',1787135911);
/*!40000 ALTER TABLE `sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `settings`
--

DROP TABLE IF EXISTS `settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `settings` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned DEFAULT NULL,
  `key` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `value` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `settings_branch_id_key_unique` (`branch_id`,`key`),
  CONSTRAINT `settings_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `settings`
--

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

--
-- Table structure for table `stock_adjustment_items`
--

DROP TABLE IF EXISTS `stock_adjustment_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_adjustment_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `stock_adjustment_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `quantity_before` decimal(18,4) NOT NULL,
  `adjustment_quantity` decimal(18,4) NOT NULL,
  `quantity_after` decimal(18,4) NOT NULL,
  `reason` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `stock_adjustment_items_stock_adjustment_id_foreign` (`stock_adjustment_id`),
  KEY `stock_adjustment_items_product_id_foreign` (`product_id`),
  KEY `stock_adjustment_items_raw_material_id_foreign` (`raw_material_id`),
  CONSTRAINT `stock_adjustment_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_adjustment_items_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_adjustment_items_stock_adjustment_id_foreign` FOREIGN KEY (`stock_adjustment_id`) REFERENCES `stock_adjustments` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_adjustment_items`
--

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

--
-- Table structure for table `stock_adjustments`
--

DROP TABLE IF EXISTS `stock_adjustments`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_adjustments` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `created_by` bigint unsigned NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `adjustment_date` date NOT NULL,
  `reason` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'posted',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `stock_adjustments_number_unique` (`number`),
  KEY `stock_adjustments_branch_id_foreign` (`branch_id`),
  KEY `stock_adjustments_created_by_foreign` (`created_by`),
  KEY `stock_adjustments_adjustment_date_index` (`adjustment_date`),
  KEY `stock_adjustments_status_index` (`status`),
  CONSTRAINT `stock_adjustments_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_adjustments_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_adjustments`
--

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

--
-- Table structure for table `stock_balances`
--

DROP TABLE IF EXISTS `stock_balances`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_balances` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `quantity` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `stock_balance_product_unique` (`branch_id`,`product_id`),
  UNIQUE KEY `stock_balance_material_unique` (`branch_id`,`raw_material_id`),
  KEY `stock_balances_product_id_foreign` (`product_id`),
  KEY `stock_balances_raw_material_id_foreign` (`raw_material_id`),
  CONSTRAINT `stock_balances_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE CASCADE,
  CONSTRAINT `stock_balances_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_balances_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_balances`
--

LOCK TABLES `stock_balances` WRITE;
/*!40000 ALTER TABLE `stock_balances` DISABLE KEYS */;
INSERT INTO `stock_balances` VALUES (2,1,NULL,1,96.0000,'2026-08-18 07:04:32','2026-08-19 11:06:29'),(3,1,NULL,3,147.0000,'2026-08-18 07:04:32','2026-08-19 11:06:29'),(4,1,NULL,2,97.0000,'2026-08-18 07:04:32','2026-08-19 11:06:29'),(5,1,NULL,4,4900.0000,'2026-08-18 07:04:32','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `stock_balances` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `stock_movements`
--

DROP TABLE IF EXISTS `stock_movements`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_movements` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `created_by` bigint unsigned NOT NULL,
  `type` varchar(30) COLLATE utf8mb4_unicode_ci NOT NULL,
  `source_type` varchar(40) COLLATE utf8mb4_unicode_ci NOT NULL,
  `source_id` bigint unsigned DEFAULT NULL,
  `quantity` decimal(18,4) NOT NULL,
  `quantity_before` decimal(18,4) NOT NULL,
  `quantity_after` decimal(18,4) NOT NULL,
  `unit_cost` decimal(18,4) NOT NULL DEFAULT '0.0000',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `moved_at` timestamp NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `stock_movements_branch_id_foreign` (`branch_id`),
  KEY `stock_movements_product_id_foreign` (`product_id`),
  KEY `stock_movements_raw_material_id_foreign` (`raw_material_id`),
  KEY `stock_movements_created_by_foreign` (`created_by`),
  KEY `stock_movements_source_type_source_id_index` (`source_type`,`source_id`),
  KEY `stock_movements_type_index` (`type`),
  KEY `stock_movements_source_type_index` (`source_type`),
  KEY `stock_movements_moved_at_index` (`moved_at`),
  CONSTRAINT `stock_movements_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_movements_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_movements_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_movements_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_movements`
--

LOCK TABLES `stock_movements` WRITE;
/*!40000 ALTER TABLE `stock_movements` DISABLE KEYS */;
INSERT INTO `stock_movements` VALUES (1,1,NULL,1,1,'initial_stock','initial_stock',NULL,100.0000,0.0000,100.0000,0.0000,'Stok bahan untuk kapasitas 50 porsi tiap menu BOM','2026-08-18 07:04:32','2026-08-18 07:04:32','2026-08-18 07:04:32'),(2,1,NULL,3,1,'initial_stock','initial_stock',NULL,150.0000,0.0000,150.0000,0.0000,'Stok bahan untuk kapasitas 50 porsi tiap menu BOM','2026-08-18 07:04:32','2026-08-18 07:04:32','2026-08-18 07:04:32'),(3,1,NULL,2,1,'initial_stock','initial_stock',NULL,100.0000,0.0000,100.0000,0.0000,'Stok bahan untuk kapasitas 50 porsi tiap menu BOM','2026-08-18 07:04:32','2026-08-18 07:04:32','2026-08-18 07:04:32'),(4,1,NULL,4,1,'initial_stock','initial_stock',NULL,5000.0000,0.0000,5000.0000,0.0000,'Stok bahan untuk kapasitas 50 porsi tiap menu BOM','2026-08-18 07:04:32','2026-08-18 07:04:32','2026-08-18 07:04:32'),(5,1,NULL,1,1,'pos_sale','sale',2,-1.0000,100.0000,99.0000,0.0000,'Indomie Goreng','2026-08-18 07:07:40','2026-08-18 07:07:40','2026-08-18 07:07:40'),(6,1,NULL,1,1,'pos_sale','sale',3,-1.0000,99.0000,98.0000,0.0000,'Indomie Goreng','2026-08-18 07:43:40','2026-08-18 07:43:40','2026-08-18 07:43:40'),(7,1,NULL,1,1,'pos_sale','sale',4,-1.0000,98.0000,97.0000,0.0000,'Indomie Goreng','2026-08-18 07:49:29','2026-08-18 07:49:29','2026-08-18 07:49:29'),(8,1,NULL,2,1,'pos_sale','sale',5,-2.0000,100.0000,98.0000,0.0000,'Indomie Kuah Telur','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29'),(9,1,NULL,3,1,'pos_sale','sale',5,-2.0000,150.0000,148.0000,0.0000,'Indomie Kuah Telur','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29'),(10,1,NULL,4,1,'pos_sale','sale',5,-100.0000,5000.0000,4900.0000,0.0000,'Nasi Goreng','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29'),(11,1,NULL,2,1,'pos_sale','sale',5,-1.0000,98.0000,97.0000,0.0000,'Indomie Kuah','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29'),(12,1,NULL,1,1,'pos_sale','sale',5,-1.0000,97.0000,96.0000,0.0000,'Indomie Goreng Telur','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29'),(13,1,NULL,3,1,'pos_sale','sale',5,-1.0000,148.0000,147.0000,0.0000,'Indomie Goreng Telur','2026-08-19 11:06:29','2026-08-19 11:06:29','2026-08-19 11:06:29');
/*!40000 ALTER TABLE `stock_movements` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `stock_opname_items`
--

DROP TABLE IF EXISTS `stock_opname_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_opname_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `stock_opname_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `system_quantity` decimal(18,4) NOT NULL,
  `physical_quantity` decimal(18,4) DEFAULT NULL,
  `difference` decimal(18,4) DEFAULT NULL,
  `difference_value` decimal(18,2) DEFAULT NULL,
  `notes` text COLLATE utf8mb4_unicode_ci,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `stock_opname_items_stock_opname_id_foreign` (`stock_opname_id`),
  KEY `stock_opname_items_product_id_foreign` (`product_id`),
  KEY `stock_opname_items_raw_material_id_foreign` (`raw_material_id`),
  CONSTRAINT `stock_opname_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_opname_items_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_opname_items_stock_opname_id_foreign` FOREIGN KEY (`stock_opname_id`) REFERENCES `stock_opnames` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=29 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_opname_items`
--

LOCK TABLES `stock_opname_items` WRITE;
/*!40000 ALTER TABLE `stock_opname_items` DISABLE KEYS */;
INSERT INTO `stock_opname_items` VALUES (1,1,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:34:54','2026-08-19 10:34:54'),(2,1,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:34:54','2026-08-19 10:34:54'),(3,1,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:34:54','2026-08-19 10:34:54'),(4,1,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:34:54','2026-08-19 10:34:54'),(5,2,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:37:45','2026-08-19 10:37:45'),(6,2,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:37:45','2026-08-19 10:37:45'),(7,2,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:37:45','2026-08-19 10:37:45'),(8,2,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:37:45','2026-08-19 10:37:45'),(9,3,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:38:22','2026-08-19 10:38:22'),(10,3,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:38:22','2026-08-19 10:38:22'),(11,3,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:38:22','2026-08-19 10:38:22'),(12,3,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:38:22','2026-08-19 10:38:22'),(13,4,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:48:56','2026-08-19 10:48:56'),(14,4,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:48:56','2026-08-19 10:48:56'),(15,4,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:48:56','2026-08-19 10:48:56'),(16,4,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:48:56','2026-08-19 10:48:56'),(17,5,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:52:34','2026-08-19 10:52:34'),(18,5,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:52:34','2026-08-19 10:52:34'),(19,5,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:52:34','2026-08-19 10:52:34'),(20,5,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:52:34','2026-08-19 10:52:34'),(21,6,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:53:02','2026-08-19 10:53:02'),(22,6,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:53:02','2026-08-19 10:53:02'),(23,6,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:53:02','2026-08-19 10:53:02'),(24,6,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:53:02','2026-08-19 10:53:02'),(25,7,NULL,1,97.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:56:26','2026-08-19 10:56:26'),(26,7,NULL,2,100.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:56:26','2026-08-19 10:56:26'),(27,7,NULL,3,150.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:56:26','2026-08-19 10:56:26'),(28,7,NULL,4,5000.0000,NULL,NULL,NULL,NULL,'2026-08-19 10:56:26','2026-08-19 10:56:26');
/*!40000 ALTER TABLE `stock_opname_items` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `stock_opnames`
--

DROP TABLE IF EXISTS `stock_opnames`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_opnames` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `created_by` bigint unsigned NOT NULL,
  `posted_by` bigint unsigned DEFAULT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `opname_date` date NOT NULL,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'draft',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `posted_at` timestamp NULL DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `stock_opnames_number_unique` (`number`),
  KEY `stock_opnames_branch_id_foreign` (`branch_id`),
  KEY `stock_opnames_created_by_foreign` (`created_by`),
  KEY `stock_opnames_posted_by_foreign` (`posted_by`),
  KEY `stock_opnames_opname_date_index` (`opname_date`),
  KEY `stock_opnames_status_index` (`status`),
  CONSTRAINT `stock_opnames_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_opnames_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_opnames_posted_by_foreign` FOREIGN KEY (`posted_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=8 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_opnames`
--

LOCK TABLES `stock_opnames` WRITE;
/*!40000 ALTER TABLE `stock_opnames` DISABLE KEYS */;
INSERT INTO `stock_opnames` VALUES (1,1,1,NULL,'OPN-01M0CSD576AGDP04JTZZN9TT92','2026-08-19','counting',NULL,NULL,'2026-08-19 10:34:54','2026-08-19 10:34:54'),(2,1,1,NULL,'OPN-01M0CSJCQME39JTDHC9V6A61G4','2026-08-19','counting',NULL,NULL,'2026-08-19 10:37:45','2026-08-19 10:37:45'),(3,1,1,NULL,'OPN-01M0CSKGHV76ERE9ZKD0T36QBE','2026-08-19','counting',NULL,NULL,'2026-08-19 10:38:22','2026-08-19 10:38:22'),(4,1,1,NULL,'OPN-01M0CT6WB356BPQ5QWTSJBQWEQ','2026-08-19','counting',NULL,NULL,'2026-08-19 10:48:56','2026-08-19 10:48:56'),(5,1,1,NULL,'OPN-01M0CTDH0HDGGGN4MH8D63V67A','2026-08-19','counting',NULL,NULL,'2026-08-19 10:52:34','2026-08-19 10:52:34'),(6,1,1,NULL,'OPN-01M0CTEC7NBMGSFQ8AV4315HXB','2026-08-19','counting',NULL,NULL,'2026-08-19 10:53:02','2026-08-19 10:53:02'),(7,1,1,NULL,'OPN-01M0CTMK4FQZDH3TW1KJVRNWRQ','2026-08-19','counting',NULL,NULL,'2026-08-19 10:56:26','2026-08-19 10:56:26');
/*!40000 ALTER TABLE `stock_opnames` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `stock_receipt_items`
--

DROP TABLE IF EXISTS `stock_receipt_items`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_receipt_items` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `stock_receipt_id` bigint unsigned NOT NULL,
  `product_id` bigint unsigned DEFAULT NULL,
  `raw_material_id` bigint unsigned DEFAULT NULL,
  `unit_id` bigint unsigned NOT NULL,
  `quantity` decimal(18,4) NOT NULL,
  `base_quantity` decimal(18,4) NOT NULL,
  `unit_price` decimal(18,4) NOT NULL,
  `total` decimal(18,2) NOT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `stock_receipt_items_stock_receipt_id_foreign` (`stock_receipt_id`),
  KEY `stock_receipt_items_product_id_foreign` (`product_id`),
  KEY `stock_receipt_items_raw_material_id_foreign` (`raw_material_id`),
  KEY `stock_receipt_items_unit_id_foreign` (`unit_id`),
  CONSTRAINT `stock_receipt_items_product_id_foreign` FOREIGN KEY (`product_id`) REFERENCES `products` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_receipt_items_raw_material_id_foreign` FOREIGN KEY (`raw_material_id`) REFERENCES `raw_materials` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_receipt_items_stock_receipt_id_foreign` FOREIGN KEY (`stock_receipt_id`) REFERENCES `stock_receipts` (`id`) ON DELETE CASCADE,
  CONSTRAINT `stock_receipt_items_unit_id_foreign` FOREIGN KEY (`unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_receipt_items`
--

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

--
-- Table structure for table `stock_receipts`
--

DROP TABLE IF EXISTS `stock_receipts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `stock_receipts` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `branch_id` bigint unsigned NOT NULL,
  `created_by` bigint unsigned NOT NULL,
  `number` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `document_number` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `receipt_date` date NOT NULL,
  `supplier` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `total` decimal(18,2) NOT NULL DEFAULT '0.00',
  `notes` text COLLATE utf8mb4_unicode_ci,
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'posted',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `stock_receipts_number_unique` (`number`),
  KEY `stock_receipts_branch_id_foreign` (`branch_id`),
  KEY `stock_receipts_created_by_foreign` (`created_by`),
  KEY `stock_receipts_document_number_index` (`document_number`),
  KEY `stock_receipts_receipt_date_index` (`receipt_date`),
  KEY `stock_receipts_status_index` (`status`),
  CONSTRAINT `stock_receipts_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `stock_receipts_created_by_foreign` FOREIGN KEY (`created_by`) REFERENCES `users` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `stock_receipts`
--

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

--
-- Table structure for table `units`
--

DROP TABLE IF EXISTS `units`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `units` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `base_unit_id` bigint unsigned DEFAULT NULL,
  `code` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `symbol` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL,
  `conversion_factor` decimal(18,6) NOT NULL DEFAULT '1.000000',
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `units_code_unique` (`code`),
  KEY `units_base_unit_id_foreign` (`base_unit_id`),
  CONSTRAINT `units_base_unit_id_foreign` FOREIGN KEY (`base_unit_id`) REFERENCES `units` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `units`
--

LOCK TABLES `units` WRITE;
/*!40000 ALTER TABLE `units` DISABLE KEYS */;
INSERT INTO `units` VALUES (1,NULL,'GRAM','Gram','g',1.000000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(2,NULL,'PCS','Pcs','pcs',1.000000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(3,NULL,'PORSI','Porsi','porsi',1.000000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57'),(4,1,'KG','Kilogram','kg',1000.000000,1,'2026-08-18 05:57:57','2026-08-18 05:57:57');
/*!40000 ALTER TABLE `units` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` bigint unsigned NOT NULL AUTO_INCREMENT,
  `role_id` bigint unsigned DEFAULT NULL,
  `branch_id` bigint unsigned DEFAULT NULL,
  `name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `username` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `email` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `email_verified_at` timestamp NULL DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL,
  `is_active` tinyint(1) NOT NULL DEFAULT '1',
  `remember_token` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
  `created_at` timestamp NULL DEFAULT NULL,
  `updated_at` timestamp NULL DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `users_username_unique` (`username`),
  UNIQUE KEY `users_email_unique` (`email`),
  KEY `users_role_id_foreign` (`role_id`),
  KEY `users_branch_id_foreign` (`branch_id`),
  CONSTRAINT `users_branch_id_foreign` FOREIGN KEY (`branch_id`) REFERENCES `branches` (`id`) ON DELETE RESTRICT,
  CONSTRAINT `users_role_id_foreign` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`) ON DELETE RESTRICT
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,1,NULL,'admin','admin','admin@gmail.com',NULL,'$2y$12$OteqVppQQZI8OrqCqI8KLeD9dxNznN9E5ZPPXC1V5ZwUvkhRokSCa',1,NULL,'2026-08-18 05:50:16','2026-08-18 05:50:16'),(2,2,NULL,'kasir','kasir',NULL,NULL,'$2y$12$LRrs3GrbAwBOuxLxnllPJOAT1SnfbpaCcl9hRLroeZ7qMVWYyO0Ge',1,NULL,'2026-08-18 06:41:01','2026-08-18 06:41:01');
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Dumping routines for database 'poskasir'
--
/*!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-08-19 23:33:56
