-- MySQL dump 10.13  Distrib 5.7.33, for Linux (i686)
--
-- Host: localhost    Database: db_farm
-- ------------------------------------------------------
-- 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 `tb_animals`
--

DROP TABLE IF EXISTS `tb_animals`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_animals` (
  `anm_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'id',
  `anm_code` varchar(100) NOT NULL COMMENT 'รหัสประจำตัว',
  `anm_type_id` int(11) NOT NULL COMMENT 'ประเภทสัตว์',
  `anm_spicies_id` int(11) NOT NULL COMMENT 'รหัสสายพันธุ์',
  `anm_name` varchar(100) NOT NULL COMMENT 'ชื่อ',
  `anm_sex` varchar(20) NOT NULL COMMENT 'เพศ',
  `anm_birth` date NOT NULL COMMENT 'วันเกิด',
  `anm_cost` varchar(10) NOT NULL COMMENT 'ราคาต้นทุน',
  `anm_price` int(11) NOT NULL COMMENT 'ราคาขาย',
  `anm_note` text NOT NULL COMMENT 'หมายเหตุ',
  PRIMARY KEY (`anm_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_animals`
--

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

--
-- Table structure for table `tb_animals_spicies`
--

DROP TABLE IF EXISTS `tb_animals_spicies`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_animals_spicies` (
  `anm_spicies_id` int(11) NOT NULL AUTO_INCREMENT,
  `anm_spicies_name` varchar(100) NOT NULL,
  `anm_type_id` int(11) NOT NULL,
  PRIMARY KEY (`anm_spicies_id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_animals_spicies`
--

LOCK TABLES `tb_animals_spicies` WRITE;
/*!40000 ALTER TABLE `tb_animals_spicies` DISABLE KEYS */;
INSERT INTO `tb_animals_spicies` VALUES (1,'โฮนสไตน์ฟรีเชี่ยน (Holstein Friesian)',1),(2,'ลูกผสมสองสาย (ลาร์จไวท์ แลนด์เรด',3),(3,'ดูร็อคเจอซี่',3),(4,'ลาร์จไวท์',3),(5,'แลนด์เรด',3),(6,'ลูกผสมเปียแต็ง',3);
/*!40000 ALTER TABLE `tb_animals_spicies` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_animals_type`
--

DROP TABLE IF EXISTS `tb_animals_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_animals_type` (
  `anm_type_id` int(11) NOT NULL AUTO_INCREMENT,
  `anm_type_name` varchar(100) NOT NULL,
  PRIMARY KEY (`anm_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_animals_type`
--

LOCK TABLES `tb_animals_type` WRITE;
/*!40000 ALTER TABLE `tb_animals_type` DISABLE KEYS */;
INSERT INTO `tb_animals_type` VALUES (1,'วัว-นม'),(2,'วัว-เนื้อ'),(3,'หมู'),(4,'ไก่');
/*!40000 ALTER TABLE `tb_animals_type` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_cost_type`
--

DROP TABLE IF EXISTS `tb_cost_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_cost_type` (
  `cost_type_id` int(11) NOT NULL AUTO_INCREMENT,
  `cost_type_text` text NOT NULL,
  PRIMARY KEY (`cost_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_cost_type`
--

LOCK TABLES `tb_cost_type` WRITE;
/*!40000 ALTER TABLE `tb_cost_type` DISABLE KEYS */;
INSERT INTO `tb_cost_type` VALUES (1,'อาหารสัตว์'),(2,'เวชภัณฑ์'),(3,'ค่าใช้จ่ายประจำเดือน');
/*!40000 ALTER TABLE `tb_cost_type` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_group_news`
--

DROP TABLE IF EXISTS `tb_group_news`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_group_news` (
  `group_news_id` int(11) NOT NULL AUTO_INCREMENT,
  `group_news_name` varchar(250) NOT NULL,
  PRIMARY KEY (`group_news_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_group_news`
--

LOCK TABLES `tb_group_news` WRITE;
/*!40000 ALTER TABLE `tb_group_news` DISABLE KEYS */;
INSERT INTO `tb_group_news` VALUES (1,'ข่าวทั่วไป'),(2,'ข่าวประชาสัมพันธ์'),(3,'ข่าวสมัครงาน'),(4,'เกร็ดความรู้'),(5,'อื่น ๆ');
/*!40000 ALTER TABLE `tb_group_news` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_income_type`
--

DROP TABLE IF EXISTS `tb_income_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_income_type` (
  `inc_type_id` int(11) NOT NULL AUTO_INCREMENT,
  `inc_type_text` text NOT NULL,
  PRIMARY KEY (`inc_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_income_type`
--

LOCK TABLES `tb_income_type` WRITE;
/*!40000 ALTER TABLE `tb_income_type` DISABLE KEYS */;
INSERT INTO `tb_income_type` VALUES (1,'นมวัว กิโลกรัมละ 20 บาท');
/*!40000 ALTER TABLE `tb_income_type` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_news`
--

DROP TABLE IF EXISTS `tb_news`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_news` (
  `news_id` int(11) NOT NULL AUTO_INCREMENT,
  `news_topic` varchar(250) NOT NULL,
  `news_detail` text NOT NULL,
  `group_news_id` int(11) NOT NULL,
  `title_pic` varchar(250) NOT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL,
  `slide` int(1) NOT NULL,
  PRIMARY KEY (`news_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_news`
--

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

--
-- Table structure for table `tb_picture`
--

DROP TABLE IF EXISTS `tb_picture`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_picture` (
  `pic_id` int(11) NOT NULL AUTO_INCREMENT,
  `data_id` int(11) NOT NULL,
  `news_id` int(11) NOT NULL,
  `pic_name` varchar(250) NOT NULL,
  `created` datetime NOT NULL,
  PRIMARY KEY (`pic_id`)
) ENGINE=InnoDB AUTO_INCREMENT=104 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_picture`
--

LOCK TABLES `tb_picture` WRITE;
/*!40000 ALTER TABLE `tb_picture` DISABLE KEYS */;
INSERT INTO `tb_picture` VALUES (48,27,0,'img/pic_detail/b982cdeb22f9493ec916e3f503089b68.jpg','2019-07-09 00:22:51'),(51,53,0,'img/pic_detail/722dcc674011b5e5c8fd248a35ebbb1d.jpg','2019-07-11 23:02:06'),(52,54,0,'img/pic_detail/df31411c7f24818d2af8ee73d1ea4d82.jpg','2019-07-14 19:39:15'),(53,53,0,'img/pic_detail/6ce63a277f50d5d83be60a244ada19bd.jpeg','2019-07-15 03:10:51'),(54,53,0,'img/pic_detail/dac0e004386f0458f48d835df05430ab.jpeg','2019-07-15 03:10:59'),(55,53,0,'img/pic_detail/9c84832d679f004310c481b65250ea95.jpeg','2019-07-15 03:11:04'),(56,53,0,'img/pic_detail/229dc26ce14acc004ba9e15aa75b57c6.jpeg','2019-07-15 03:11:10'),(57,53,0,'img/pic_detail/19b67bfdfc966aa573ea5c48719cc83c.jpeg','2019-07-15 03:11:28'),(67,1,0,'img/pic_detail/3e2c2f89f807e1389cacd778e1cc14ea.jpg','2019-08-26 04:47:05'),(70,1,0,'img/pic_detail/79ea1849501a00e69db00c355a44a882.jpg','2019-08-26 04:50:21'),(71,1,0,'img/pic_detail/a4cadb481c545ae4066ca6c738b9d424.jpg','2019-08-26 05:06:18'),(72,1,0,'img/pic_detail/519df485345685f50be6c3cdec82f021.jpg','2019-08-26 05:02:51'),(73,1,0,'img/pic_detail/34b7477599d665c08a76fbc18c3e5542.jpg','2019-08-26 05:02:57'),(74,1,0,'img/pic_detail/9b3a7dcceb47d68d2b2fa3737a8d97bd.jpg','2019-08-26 05:06:49'),(75,9,0,'img/pic_detail/9bb3a990947bca01f9b4e366ffd91306.jpg','2019-08-26 07:16:27'),(76,9,0,'img/pic_detail/9dce586b2b2285722f78c62e0c5324d8.jpg','2019-08-26 07:16:32'),(77,9,0,'img/pic_detail/702400d3bec412aa44826766c2d6f429.jpg','2019-08-26 07:16:37'),(78,9,0,'img/pic_detail/0f613eda3ae26d9d37a5d1ab830eee2f.jpg','2019-08-26 07:16:42'),(79,9,0,'img/pic_detail/a1cd35c6e4b1f416beab4720620be8d2.jpg','2019-08-26 07:16:47'),(80,9,0,'img/pic_detail/72efe51022efe5fd00b110308413df06.jpg','2019-08-26 07:16:51'),(81,12,0,'img/pic_detail/e1ef4ea948ab44f36e339c15a2e3cde6.jpg','2019-08-26 07:24:35'),(82,12,0,'img/pic_detail/85e93c0537df3a61e25bd9051fb09699.jpg','2019-08-26 07:24:41'),(83,12,0,'img/pic_detail/640c2e35317e4ab9a21090396ccc2b8c.jpg','2019-08-26 07:24:48'),(84,13,0,'img/pic_detail/f6cd0895de9d2c35ee567904e9bba7cd.jpg','2019-08-26 07:27:14'),(85,13,0,'img/pic_detail/e5273091bc8f87b63f76d60fcd9a9e38.jpg','2019-08-26 07:27:19'),(86,13,0,'img/pic_detail/c8c61c1af81a9d23276324bf08bdc863.jpg','2019-08-26 07:27:24'),(87,13,0,'img/pic_detail/c16f8e75d7ad29755fd7710b8d59d01a.jpg','2019-08-26 07:27:29'),(88,19,0,'img/pic_detail/b0f35805b2d4ae25e58468799a17815c.jpg','2019-08-26 07:39:16'),(89,19,0,'img/pic_detail/c00c72a6a79b926f28afeae85c1a339e.jpg','2019-08-26 07:39:22'),(90,19,0,'img/pic_detail/ad97d9a25a5e04b75af68a4043195b82.jpg','2019-08-26 07:39:29'),(91,19,0,'img/pic_detail/92993216d2279869acc185dc0d9acf3e.jpg','2019-08-26 07:39:36'),(92,19,0,'img/pic_detail/6adda3a7c3537853b325874d9afeb282.jpg','2019-08-26 07:39:43'),(93,21,0,'img/pic_detail/88cef7613eea43c4c6998208767632f4.jpg','2019-08-26 07:53:40'),(94,21,0,'img/pic_detail/aa83de783719cddcdad67e28cbfb167b.jpg','2019-08-26 07:53:48'),(101,0,15,'img/pic_detail/043ef2d71e0c16da84d8cea8a6f4da9f.jpg','2020-02-21 02:42:42'),(102,0,15,'img/pic_detail/8c2e3fc635ba2bf8237b7b86787ac7be.png','2020-02-21 02:42:52'),(103,0,15,'img/pic_detail/6912d18678b9c1587c5f474d0b6d08ac.png','2020-02-21 02:43:01');
/*!40000 ALTER TABLE `tb_picture` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_product`
--

DROP TABLE IF EXISTS `tb_product`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_product` (
  `pro_id` int(11) NOT NULL AUTO_INCREMENT,
  `pro_name` varchar(255) NOT NULL,
  `pro_cate_id` int(11) NOT NULL,
  `pro_img` varchar(255) NOT NULL,
  `pro_price` varchar(100) NOT NULL,
  `pro_unit` varchar(100) NOT NULL,
  `title_pic` varchar(100) NOT NULL,
  `status` int(11) NOT NULL,
  `created` datetime NOT NULL,
  `updated` datetime NOT NULL,
  PRIMARY KEY (`pro_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_product`
--

LOCK TABLES `tb_product` WRITE;
/*!40000 ALTER TABLE `tb_product` DISABLE KEYS */;
INSERT INTO `tb_product` VALUES (1,'เสื้อร้องไห้',6,'','350','แพค','img/title_pic/aee3e51a5894a551e091478ab1e1bb3b.jpg',0,'2020-11-03 14:21:14','2020-11-03 14:46:33'),(2,'น้ำนมโคดิบ',1,'','25','กก.','img/title_pic/877dd5d8680950983ce718d327bdc3e7.jpg',0,'2020-11-03 14:23:24','2020-11-09 09:57:09'),(3,'กล้วยหอม',4,'','80','หวี','img/title_pic/2a88a7435468152d2dd79b70430d9e4a.jpg',0,'2020-11-03 14:37:06','2020-11-03 14:42:52'),(4,'ส้ม',4,'','40','กก.','img/title_pic/d65540ef0b08d63b51fc20a2860ccee7.jpg',0,'2020-11-03 16:01:16','2020-11-03 16:01:16'),(5,'แครอท',5,'','25','กก.','img/title_pic/afe5609411d8195b2d80151d8fad9a2b.jpg',0,'2020-11-03 16:01:49','2020-11-03 16:01:49'),(6,'กะหล่ำ',5,'','15','กก.','img/title_pic/91b7d6305742ba34776cc77377b3b02b.jpg',0,'2020-11-03 16:19:33','2020-11-03 16:19:33'),(7,'แอปเปิ้ล',4,'','60','กก.','img/title_pic/62cb661a5bf0bca90d46cf5969dbce8a.jpg',0,'2020-11-03 16:19:55','2020-11-03 16:19:55'),(8,'กีวี่',4,'','30','แพค','img/title_pic/4d7359d0022279e23464b2c9d256972c.jpg',0,'2020-11-03 16:20:18','2020-11-03 16:20:18'),(9,'สตอเบอร์รี่',4,'','120','แพค','img/title_pic/208ce44f11d5a9975f3c7fd22c538e3d.jpg',0,'2020-11-03 16:20:54','2020-11-03 16:20:54');
/*!40000 ALTER TABLE `tb_product` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_product_category`
--

DROP TABLE IF EXISTS `tb_product_category`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_product_category` (
  `pro_cate_id` int(11) NOT NULL AUTO_INCREMENT,
  `pro_cate_name` varchar(250) NOT NULL,
  PRIMARY KEY (`pro_cate_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_product_category`
--

LOCK TABLES `tb_product_category` WRITE;
/*!40000 ALTER TABLE `tb_product_category` DISABLE KEYS */;
INSERT INTO `tb_product_category` VALUES (1,'ผลผลิตจาก โคนม'),(2,'พืช'),(3,'ผลผลิตจาก โคเนื้อ'),(4,'ผลไม้'),(5,'ผัก'),(6,'เนื้อวัว'),(7,'เนื้อหมู'),(8,'เนื้อไก่'),(9,'ผลผลิตจาก ไก่');
/*!40000 ALTER TABLE `tb_product_category` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_state_type`
--

DROP TABLE IF EXISTS `tb_state_type`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_state_type` (
  `state_type_id` int(11) NOT NULL AUTO_INCREMENT,
  `state_type` varchar(100) NOT NULL,
  PRIMARY KEY (`state_type_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_state_type`
--

LOCK TABLES `tb_state_type` WRITE;
/*!40000 ALTER TABLE `tb_state_type` DISABLE KEYS */;
INSERT INTO `tb_state_type` VALUES (1,'งบประมาณแผ่นดิน'),(2,'รายได้จากผลผลิต'),(3,'ค่าใช้จ่าย'),(4,'เวชภัณฑ์'),(5,'อาหารสัตว์');
/*!40000 ALTER TABLE `tb_state_type` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `tb_statement`
--

DROP TABLE IF EXISTS `tb_statement`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `tb_statement` (
  `s_id` int(11) NOT NULL AUTO_INCREMENT,
  `s_topic` varchar(250) NOT NULL COMMENT 'รายการ',
  `s_money` float NOT NULL COMMENT 'ราคา',
  `s_type` varchar(11) NOT NULL COMMENT 'รายรับ/รายจ่าย',
  `anm_type_id` int(11) NOT NULL COMMENT 'กลุ่มสัตว์เลี้ยง',
  `s_animal_id` int(11) NOT NULL COMMENT 'หมายเลขประจำตัวสัตว์',
  `created` datetime NOT NULL,
  `state_type` varchar(100) NOT NULL,
  `state_date` date NOT NULL,
  PRIMARY KEY (`s_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `tb_statement`
--

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

--
-- Dumping events for database 'db_farm'
--

--
-- Dumping routines for database 'db_farm'
--
/*!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 2024-05-18  0:00:25
