-- https://www.phpmyadmin.net/
--
-- إصدار الخادم: 5.7.44

START TRANSACTION;



--
-- Database: `miladapp_master`
--

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

--
-- بنية الجدول `acc_logs`
--

CREATE TABLE `acc_logs` (
  `id` bigint(18) NOT NULL,
  `date` datetime NOT NULL,
  `level` int(1) NOT NULL,
  `host_ip` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `user` varchar(25) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `url` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `user_agent` varchar(300) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
  `message` varchar(255) CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `activity_cal`
--

CREATE TABLE `activity_cal` (
  `activity_cal_id` int(11) NOT NULL,
  `activity_date` datetime DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `activity_type_ref` int(11) DEFAULT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `assignee_user` int(11) DEFAULT NULL,
  `title` varchar(45) NOT NULL,
  `end_date` datetime DEFAULT NULL,
  `allDay` varchar(45) NOT NULL DEFAULT 'true'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `activity_type`
--

CREATE TABLE `activity_type` (
  `activity_type_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `color` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `activity_type`
--

INSERT INTO `activity_type` (`activity_type_id`, `name`, `description`, `color`) VALUES
(11, 'Type 1', NULL, 'rgb(221, 75, 57)'),
(13, 'Type 2', NULL, 'rgb(96, 92, 168)'),
(14, 'Type 3', NULL, 'rgb(0, 31, 63)'),
(15, 'Type 4', NULL, 'rgb(240, 18, 190)');

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

--
-- بنية الجدول `admin_groups`
--

CREATE TABLE `admin_groups` (
  `id` mediumint(8) UNSIGNED NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `admin_groups`
--

INSERT INTO `admin_groups` (`id`, `name`, `description`) VALUES
(1, 'webmaster', 'Webmaster'),
(2, 'admin', 'Administrator'),
(3, 'manager', 'Manager'),
(4, 'staff', 'Staff'),
(5, 'canEditPostedInvoice', '');

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

--
-- بنية الجدول `admin_login_attempts`
--

CREATE TABLE `admin_login_attempts` (
  `id` int(11) UNSIGNED NOT NULL,
  `ip_address` varchar(15) NOT NULL,
  `login` varchar(100) NOT NULL,
  `time` int(11) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `admin_users_groups`
--

CREATE TABLE `admin_users_groups` (
  `id` int(11) UNSIGNED NOT NULL,
  `user_id` int(11) UNSIGNED NOT NULL,
  `group_id` mediumint(8) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `admin_users_groups`
--

INSERT INTO `admin_users_groups` (`id`, `user_id`, `group_id`) VALUES
(1, 1, 1),
(2, 2, 2),
(3, 3, 3),
(4, 4, 4);

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

--
-- بنية الجدول `appointment`
--

CREATE TABLE `appointment` (
  `appointment_id` int(11) NOT NULL,
  `appointment_from` datetime DEFAULT NULL,
  `appointment_to` datetime NOT NULL,
  `customer_ref` int(11) DEFAULT NULL,
  `reason` varchar(45) DEFAULT NULL,
  `description` text
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `apps_countries`
--

CREATE TABLE `apps_countries` (
  `id` int(11) NOT NULL,
  `country_code` varchar(2) NOT NULL DEFAULT '',
  `country_name` varchar(100) NOT NULL DEFAULT ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `apps_countries`
--

INSERT INTO `apps_countries` (`id`, `country_code`, `country_name`) VALUES
(1, 'AF', 'Afghanistan'),
(2, 'AL', 'Albania'),
(3, 'DZ', 'Algeria'),
(4, 'DS', 'American Samoa'),
(5, 'AD', 'Andorra'),
(6, 'AO', 'Angola'),
(7, 'AI', 'Anguilla'),
(8, 'AQ', 'Antarctica'),
(9, 'AG', 'Antigua and Barbuda'),
(10, 'AR', 'Argentina'),
(11, 'AM', 'Armenia'),
(12, 'AW', 'Aruba'),
(13, 'AU', 'Australia'),
(14, 'AT', 'Austria'),
(15, 'AZ', 'Azerbaijan'),
(16, 'BS', 'Bahamas'),
(17, 'BH', 'Bahrain'),
(18, 'BD', 'Bangladesh'),
(19, 'BB', 'Barbados'),
(20, 'BY', 'Belarus'),
(21, 'BE', 'Belgium'),
(22, 'BZ', 'Belize'),
(23, 'BJ', 'Benin'),
(24, 'BM', 'Bermuda'),
(25, 'BT', 'Bhutan'),
(26, 'BO', 'Bolivia'),
(27, 'BA', 'Bosnia and Herzegovina'),
(28, 'BW', 'Botswana'),
(29, 'BV', 'Bouvet Island'),
(30, 'BR', 'Brazil'),
(31, 'IO', 'British Indian Ocean Territory'),
(32, 'BN', 'Brunei Darussalam'),
(33, 'BG', 'Bulgaria'),
(34, 'BF', 'Burkina Faso'),
(35, 'BI', 'Burundi'),
(36, 'KH', 'Cambodia'),
(37, 'CM', 'Cameroon'),
(38, 'CA', 'Canada'),
(39, 'CV', 'Cape Verde'),
(40, 'KY', 'Cayman Islands'),
(41, 'CF', 'Central African Republic'),
(42, 'TD', 'Chad'),
(43, 'CL', 'Chile'),
(44, 'CN', 'China'),
(45, 'CX', 'Christmas Island'),
(46, 'CC', 'Cocos (Keeling) Islands'),
(47, 'CO', 'Colombia'),
(48, 'KM', 'Comoros'),
(49, 'CG', 'Congo'),
(50, 'CK', 'Cook Islands'),
(51, 'CR', 'Costa Rica'),
(52, 'HR', 'Croatia (Hrvatska)'),
(53, 'CU', 'Cuba'),
(54, 'CY', 'Cyprus'),
(55, 'CZ', 'Czech Republic'),
(56, 'DK', 'Denmark'),
(57, 'DJ', 'Djibouti'),
(58, 'DM', 'Dominica'),
(59, 'DO', 'Dominican Republic'),
(60, 'TP', 'East Timor'),
(61, 'EC', 'Ecuador'),
(62, 'EG', 'Egypt'),
(63, 'SV', 'El Salvador'),
(64, 'GQ', 'Equatorial Guinea'),
(65, 'ER', 'Eritrea'),
(66, 'EE', 'Estonia'),
(67, 'ET', 'Ethiopia'),
(68, 'FK', 'Falkland Islands (Malvinas)'),
(69, 'FO', 'Faroe Islands'),
(70, 'FJ', 'Fiji'),
(71, 'FI', 'Finland'),
(72, 'FR', 'France'),
(73, 'FX', 'France, Metropolitan'),
(74, 'GF', 'French Guiana'),
(75, 'PF', 'French Polynesia'),
(76, 'TF', 'French Southern Territories'),
(77, 'GA', 'Gabon'),
(78, 'GM', 'Gambia'),
(79, 'GE', 'Georgia'),
(80, 'DE', 'Germany'),
(81, 'GH', 'Ghana'),
(82, 'GI', 'Gibraltar'),
(83, 'GK', 'Guernsey'),
(84, 'GR', 'Greece'),
(85, 'GL', 'Greenland'),
(86, 'GD', 'Grenada'),
(87, 'GP', 'Guadeloupe'),
(88, 'GU', 'Guam'),
(89, 'GT', 'Guatemala'),
(90, 'GN', 'Guinea'),
(91, 'GW', 'Guinea-Bissau'),
(92, 'GY', 'Guyana'),
(93, 'HT', 'Haiti'),
(94, 'HM', 'Heard and Mc Donald Islands'),
(95, 'HN', 'Honduras'),
(96, 'HK', 'Hong Kong'),
(97, 'HU', 'Hungary'),
(98, 'IS', 'Iceland'),
(99, 'IN', 'India'),
(100, 'IM', 'Isle of Man'),
(101, 'ID', 'Indonesia'),
(102, 'IR', 'Iran (Islamic Republic of)'),
(103, 'IQ', 'Iraq'),
(104, 'IE', 'Ireland'),
(105, 'IL', 'Israel'),
(106, 'IT', 'Italy'),
(107, 'CI', 'Ivory Coast'),
(108, 'JE', 'Jersey'),
(109, 'JM', 'Jamaica'),
(110, 'JP', 'Japan'),
(111, 'JO', 'Jordan'),
(112, 'KZ', 'Kazakhstan'),
(113, 'KE', 'Kenya'),
(114, 'KI', 'Kiribati'),
(115, 'KP', 'Korea, Democratic People\'s Republic of'),
(116, 'KR', 'Korea, Republic of'),
(117, 'XK', 'Kosovo'),
(118, 'KW', 'Kuwait'),
(119, 'KG', 'Kyrgyzstan'),
(120, 'LA', 'Lao People\'s Democratic Republic'),
(121, 'LV', 'Latvia'),
(122, 'LB', 'Lebanon'),
(123, 'LS', 'Lesotho'),
(124, 'LR', 'Liberia'),
(125, 'LY', 'Libyan Arab Jamahiriya'),
(126, 'LI', 'Liechtenstein'),
(127, 'LT', 'Lithuania'),
(128, 'LU', 'Luxembourg'),
(129, 'MO', 'Macau'),
(130, 'MK', 'Macedonia'),
(131, 'MG', 'Madagascar'),
(132, 'MW', 'Malawi'),
(133, 'MY', 'Malaysia'),
(134, 'MV', 'Maldives'),
(135, 'ML', 'Mali'),
(136, 'MT', 'Malta'),
(137, 'MH', 'Marshall Islands'),
(138, 'MQ', 'Martinique'),
(139, 'MR', 'Mauritania'),
(140, 'MU', 'Mauritius'),
(141, 'TY', 'Mayotte'),
(142, 'MX', 'Mexico'),
(143, 'FM', 'Micronesia, Federated States of'),
(144, 'MD', 'Moldova, Republic of'),
(145, 'MC', 'Monaco'),
(146, 'MN', 'Mongolia'),
(147, 'ME', 'Montenegro'),
(148, 'MS', 'Montserrat'),
(149, 'MA', 'Morocco'),
(150, 'MZ', 'Mozambique'),
(151, 'MM', 'Myanmar'),
(152, 'NA', 'Namibia'),
(153, 'NR', 'Nauru'),
(154, 'NP', 'Nepal'),
(155, 'NL', 'Netherlands'),
(156, 'AN', 'Netherlands Antilles'),
(157, 'NC', 'New Caledonia'),
(158, 'NZ', 'New Zealand'),
(159, 'NI', 'Nicaragua'),
(160, 'NE', 'Niger'),
(161, 'NG', 'Nigeria'),
(162, 'NU', 'Niue'),
(163, 'NF', 'Norfolk Island'),
(164, 'MP', 'Northern Mariana Islands'),
(165, 'NO', 'Norway'),
(166, 'OM', 'Oman'),
(167, 'PK', 'Pakistan'),
(168, 'PW', 'Palau'),
(169, 'PS', 'Palestine'),
(170, 'PA', 'Panama'),
(171, 'PG', 'Papua New Guinea'),
(172, 'PY', 'Paraguay'),
(173, 'PE', 'Peru'),
(174, 'PH', 'Philippines'),
(175, 'PN', 'Pitcairn'),
(176, 'PL', 'Poland'),
(177, 'PT', 'Portugal'),
(178, 'PR', 'Puerto Rico'),
(179, 'QA', 'Qatar'),
(180, 'RE', 'Reunion'),
(181, 'RO', 'Romania'),
(182, 'RU', 'Russian Federation'),
(183, 'RW', 'Rwanda'),
(184, 'KN', 'Saint Kitts and Nevis'),
(185, 'LC', 'Saint Lucia'),
(186, 'VC', 'Saint Vincent and the Grenadines'),
(187, 'WS', 'Samoa'),
(188, 'SM', 'San Marino'),
(189, 'ST', 'Sao Tome and Principe'),
(190, 'SA', 'Saudi Arabia'),
(191, 'SN', 'Senegal'),
(192, 'RS', 'Serbia'),
(193, 'SC', 'Seychelles'),
(194, 'SL', 'Sierra Leone'),
(195, 'SG', 'Singapore'),
(196, 'SK', 'Slovakia'),
(197, 'SI', 'Slovenia'),
(198, 'SB', 'Solomon Islands'),
(199, 'SO', 'Somalia'),
(200, 'ZA', 'South Africa'),
(201, 'GS', 'South Georgia South Sandwich Islands'),
(202, 'ES', 'Spain'),
(203, 'LK', 'Sri Lanka'),
(204, 'SH', 'St. Helena'),
(205, 'PM', 'St. Pierre and Miquelon'),
(206, 'SD', 'Sudan'),
(207, 'SR', 'Suriname'),
(208, 'SJ', 'Svalbard and Jan Mayen Islands'),
(209, 'SZ', 'Swaziland'),
(210, 'SE', 'Sweden'),
(211, 'CH', 'Switzerland'),
(212, 'SY', 'Syrian Arab Republic'),
(213, 'TW', 'Taiwan'),
(214, 'TJ', 'Tajikistan'),
(215, 'TZ', 'Tanzania, United Republic of'),
(216, 'TH', 'Thailand'),
(217, 'TG', 'Togo'),
(218, 'TK', 'Tokelau'),
(219, 'TO', 'Tonga'),
(220, 'TT', 'Trinidad and Tobago'),
(221, 'TN', 'Tunisia'),
(222, 'TR', 'Turkey'),
(223, 'TM', 'Turkmenistan'),
(224, 'TC', 'Turks and Caicos Islands'),
(225, 'TV', 'Tuvalu'),
(226, 'UG', 'Uganda'),
(227, 'UA', 'Ukraine'),
(228, 'AE', 'United Arab Emirates'),
(229, 'GB', 'United Kingdom'),
(230, 'US', 'United States'),
(231, 'UM', 'United States minor outlying islands'),
(232, 'UY', 'Uruguay'),
(233, 'UZ', 'Uzbekistan'),
(234, 'VU', 'Vanuatu'),
(235, 'VA', 'Vatican City State'),
(236, 'VE', 'Venezuela'),
(237, 'VN', 'Vietnam'),
(238, 'VG', 'Virgin Islands (British)'),
(239, 'VI', 'Virgin Islands (U.S.)'),
(240, 'WF', 'Wallis and Futuna Islands'),
(241, 'EH', 'Western Sahara'),
(242, 'YE', 'Yemen'),
(243, 'ZR', 'Zaire'),
(244, 'ZM', 'Zambia'),
(245, 'ZW', 'Zimbabwe'),
(246, 'AF', 'Afghanistan'),
(247, 'AL', 'Albania'),
(248, 'DZ', 'Algeria'),
(249, 'DS', 'American Samoa'),
(250, 'AD', 'Andorra'),
(251, 'AO', 'Angola'),
(252, 'AI', 'Anguilla'),
(253, 'AQ', 'Antarctica'),
(254, 'AG', 'Antigua and Barbuda'),
(255, 'AR', 'Argentina'),
(256, 'AM', 'Armenia'),
(257, 'AW', 'Aruba'),
(258, 'AU', 'Australia'),
(259, 'AT', 'Austria'),
(260, 'AZ', 'Azerbaijan'),
(261, 'BS', 'Bahamas'),
(262, 'BH', 'Bahrain'),
(263, 'BD', 'Bangladesh'),
(264, 'BB', 'Barbados'),
(265, 'BY', 'Belarus'),
(266, 'BE', 'Belgium'),
(267, 'BZ', 'Belize'),
(268, 'BJ', 'Benin'),
(269, 'BM', 'Bermuda'),
(270, 'BT', 'Bhutan'),
(271, 'BO', 'Bolivia'),
(272, 'BA', 'Bosnia and Herzegovina'),
(273, 'BW', 'Botswana'),
(274, 'BV', 'Bouvet Island'),
(275, 'BR', 'Brazil'),
(276, 'IO', 'British Indian Ocean Territory'),
(277, 'BN', 'Brunei Darussalam'),
(278, 'BG', 'Bulgaria'),
(279, 'BF', 'Burkina Faso'),
(280, 'BI', 'Burundi'),
(281, 'KH', 'Cambodia'),
(282, 'CM', 'Cameroon'),
(283, 'CA', 'Canada'),
(284, 'CV', 'Cape Verde'),
(285, 'KY', 'Cayman Islands'),
(286, 'CF', 'Central African Republic'),
(287, 'TD', 'Chad'),
(288, 'CL', 'Chile'),
(289, 'CN', 'China'),
(290, 'CX', 'Christmas Island'),
(291, 'CC', 'Cocos (Keeling) Islands'),
(292, 'CO', 'Colombia'),
(293, 'KM', 'Comoros'),
(294, 'CG', 'Congo'),
(295, 'CK', 'Cook Islands');

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

--
-- بنية الجدول `boarding_rate`
--

CREATE TABLE `boarding_rate` (
  `boarding_rate_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `amount` decimal(10,0) DEFAULT NULL,
  `period` varchar(45) DEFAULT NULL,
  `period_days` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `checkup`
--

CREATE TABLE `checkup` (
  `checkup_id` int(11) NOT NULL,
  `lo_1` int(11) DEFAULT NULL,
  `lo_2` int(11) DEFAULT NULL,
  `lo_3` int(11) DEFAULT NULL,
  `ro_1` int(11) DEFAULT NULL,
  `ro_2` int(11) DEFAULT NULL,
  `ro_3` int(11) DEFAULT NULL,
  `fluids` int(11) NOT NULL,
  `folds` int(11) NOT NULL,
  `mare_ref` int(11) NOT NULL,
  `is_ai` tinyint(1) DEFAULT NULL,
  `stallion_ref` int(11) DEFAULT NULL,
  `is_preg` enum('P','N','S','L') DEFAULT NULL,
  `comments` varchar(150) DEFAULT NULL,
  `done_by` int(11) DEFAULT NULL,
  `check_date` datetime DEFAULT NULL,
  `next_check` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `checkup`
--

INSERT INTO `checkup` (`checkup_id`, `lo_1`, `lo_2`, `lo_3`, `ro_1`, `ro_2`, `ro_3`, `fluids`, `folds`, `mare_ref`, `is_ai`, `stallion_ref`, `is_preg`, `comments`, `done_by`, `check_date`, `next_check`) VALUES
(1, 5, 17, 24, 32, 9, 1, 5, 2, 1, 1, NULL, 'P', '', 1, '2017-09-11 05:16:51', '0000-00-00 00:00:00'),
(2, 17, 26, 0, 21, 0, 0, 0, 0, 4, 1, NULL, 'S', '', 1, '2017-09-20 02:16:49', '0000-00-00 00:00:00'),
(3, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, NULL, NULL, '', 1, '2017-09-20 02:19:43', '0000-00-00 00:00:00');

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

--
-- بنية الجدول `cost_center`
--

CREATE TABLE `cost_center` (
  `cost_center_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `show_in` enum('accounting','all') NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `cost_center`
--

INSERT INTO `cost_center` (`cost_center_id`, `name`, `description`, `is_active`, `show_in`) VALUES
(1, 'Reproduction', NULL, 1, 'all'),
(2, 'Training', NULL, 1, 'all'),
(3, 'Milad', NULL, 1, 'accounting');

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

--
-- بنية الجدول `currency`
--

CREATE TABLE `currency` (
  `currency_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `factor` decimal(10,0) DEFAULT NULL,
  `is_default` tinyint(1) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `currency`
--

INSERT INTO `currency` (`currency_id`, `name`, `description`, `factor`, `is_default`, `is_active`, `created_date`) VALUES
(1, 'USD', NULL, NULL, NULL, 1, NULL);

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

--
-- بنية الجدول `customer_group`
--

CREATE TABLE `customer_group` (
  `customer_group_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `customer_group`
--

INSERT INTO `customer_group` (`customer_group_id`, `name`, `description`) VALUES
(1, 'General', 'General'),
(2, 'VIP', 'VIP');

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

--
-- بنية الجدول `entries`
--

CREATE TABLE `entries` (
  `id` bigint(18) NOT NULL,
  `tag_id` bigint(18) DEFAULT NULL,
  `entrytype_id` bigint(18) NOT NULL,
  `number` bigint(18) DEFAULT NULL,
  `date` date NOT NULL,
  `dr_total` decimal(25,3) NOT NULL DEFAULT '0.000',
  `cr_total` decimal(25,3) NOT NULL DEFAULT '0.000',
  `cc_id` int(11) NOT NULL,
  `notes` varchar(500) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `entries`
--

INSERT INTO `entries` (`id`, `tag_id`, `entrytype_id`, `number`, `date`, `dr_total`, `cr_total`, `cc_id`, `notes`) VALUES
(10, NULL, 1, 1, '2017-09-05', 1000.000, 1000.000, 1, 'test'),
(11, NULL, 1, 2, '2017-09-05', 555.000, 555.000, 1, 'test'),
(12, NULL, 1, 3, '2017-09-10', 600.000, 600.000, 2, 'dasa');

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

--
-- بنية الجدول `entryitems`
--

CREATE TABLE `entryitems` (
  `id` bigint(18) NOT NULL,
  `entry_id` bigint(18) NOT NULL,
  `ledger_id` bigint(18) NOT NULL,
  `amount` decimal(25,3) NOT NULL DEFAULT '0.000',
  `dc` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `reconciliation_date` date DEFAULT NULL,
  `narration` varchar(500) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `entryitems`
--

INSERT INTO `entryitems` (`id`, `entry_id`, `ledger_id`, `amount`, `dc`, `reconciliation_date`, `narration`) VALUES
(1, 10, 10, 1000.000, 'D', NULL, ''),
(2, 10, 11, 1000.000, 'C', NULL, ''),
(3, 11, 10, 555.000, 'D', NULL, ''),
(4, 11, 11, 555.000, 'C', NULL, ''),
(5, 12, 10, 600.000, 'D', NULL, ''),
(6, 12, 11, 600.000, 'C', NULL, '');

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

--
-- بنية الجدول `entrytypes`
--

CREATE TABLE `entrytypes` (
  `id` bigint(18) NOT NULL,
  `label` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `description` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `base_type` int(2) NOT NULL DEFAULT '0',
  `numbering` int(2) NOT NULL DEFAULT '1',
  `prefix` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `suffix` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `zero_padding` int(2) NOT NULL DEFAULT '0',
  `restriction_bankcash` int(2) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `entrytypes`
--

INSERT INTO `entrytypes` (`id`, `label`, `name`, `description`, `base_type`, `numbering`, `prefix`, `suffix`, `zero_padding`, `restriction_bankcash`) VALUES
(1, 'type1', 'General', 'Contains General Purpose Daily Journals ', 1, 1, '', '', 0, 1);

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

--
-- بنية الجدول `feed_program`
--

CREATE TABLE `feed_program` (
  `feed_program_id` int(11) NOT NULL,
  `title` varchar(45) DEFAULT NULL,
  `start_date` datetime DEFAULT NULL,
  `end_date` datetime DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `horse_ref` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `feed_program`
--

INSERT INTO `feed_program` (`feed_program_id`, `title`, `start_date`, `end_date`, `is_active`, `horse_ref`) VALUES
(1, 'sasas\'', '2017-07-12 00:00:00', '2017-07-26 00:00:00', 1, 1);

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

--
-- بنية الجدول `feed_sch`
--

CREATE TABLE `feed_sch` (
  `feed_sch_id` int(11) NOT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `feed_ref` int(11) DEFAULT NULL,
  `qty` varchar(45) DEFAULT NULL,
  `uom_ref` int(11) DEFAULT NULL,
  `time` time DEFAULT NULL,
  `program_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `feed_sch`
--

INSERT INTO `feed_sch` (`feed_sch_id`, `horse_ref`, `feed_ref`, `qty`, `uom_ref`, `time`, `program_ref`) VALUES
(1, 1, 22, '12', 2, '09:45:00', 1);

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

--
-- بنية الجدول `groups`
--

CREATE TABLE `groups` (
  `id` bigint(18) NOT NULL,
  `parent_id` bigint(18) DEFAULT '0',
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `affects_gross` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `groups`
--

INSERT INTO `groups` (`id`, `parent_id`, `name`, `code`, `affects_gross`) VALUES
(1, NULL, 'Assets', '01', 0),
(2, NULL, 'Liabilities and Owners Equity', '02', 0),
(3, NULL, 'Incomes', '03', 0),
(4, NULL, 'Expenses', '04', 0),
(5, 1, 'Current Assets', '01-01', 1),
(6, 1, 'Long term assets', '01-02', 1),
(7, 2, 'Current Liabilities', '02-01', 0),
(9, 2, 'Equity', '02-03', 1),
(12, 4, 'Expense', '04-01', 1),
(13, 5, 'Cash and cash equivalents', '01-01-01', 1),
(14, 5, 'Biological Assets', '01-01-02', 1),
(15, 5, 'Accounts receivable', '01-01-03', 1),
(16, 5, 'Inventory', '01-01-04', 1),
(17, 5, 'Prepayment and other Assets', '01-01-05', 1),
(19, 6, 'Property and Equipments', '01-02-02', 1),
(22, 6, 'Other long term assets', '01-02-05', 1),
(23, 7, 'Salaries payable', '02-01-01', 1),
(24, 7, 'Accounts payable', '02-01-02', 1),
(25, 7, 'Accrued and Other Liabilities', '02-01-03', 1),
(28, 9, 'Capital', '02-03-01', 1),
(29, 9, 'Retained earnings (Deficit)', '02-03-02', 1),
(33, 12, 'Research and development', '04-01-01', 1),
(34, 12, 'Sales and marketing', '04-01-02', 1),
(35, 12, 'General and administrative', '04-01-03', 1),
(36, 12, 'Depreciation', '04-01-04', 1),
(37, 12, 'Finance Costs', '04-01-05', 1),
(42, 13, 'Cash in bank', '01-01-01-01', 1),
(43, 13, 'Cash on hand', '01-01-01-02', 1),
(44, 13, 'Petty Cash', '01-01-01-03', 1),
(45, 16, 'Medicine inventories', '01-01-04-01', 1),
(46, 16, 'Medical supplies inventories', '01-01-04-02', 1),
(47, 16, 'Fresh Semen inventories', '01-01-04-03', 1),
(48, 16, 'Frozen Semen Inventories', '01-01-04-04', 1),
(49, 16, 'Store Inventories', '01-01-04-05', 1),
(50, 16, 'Horse Foods', '01-01-04-06', 1),
(51, 16, 'Inventories-prescription food', '01-01-04-07', 1),
(52, 16, 'Inventories-non prescription food', '01-01-04-08', 1),
(53, 16, 'Inventories-supplements', '01-01-04-09', 1),
(54, 16, 'Inventories-others', '01-01-04-10', 1),
(55, 14, 'Recipient mares', '01-01-02-01', 1),
(56, 19, 'Office Furnitures', '01-02-02-01', 1),
(57, 19, 'Office Equipments', '01-02-02-02', 1),
(58, 19, 'Computers and Printers', '01-02-02-03', 1),
(59, 19, 'Mobile and other devices', '01-02-02-04', 1),
(60, 19, 'Medical Equipments', '01-02-02-05', 1),
(61, 19, 'Other Equipments', '01-02-02-06', 1),
(62, 19, 'Vehicles', '01-02-02-07', 1),
(63, 19, 'Building and Improvements', '01-02-02-08', 1),
(64, 22, 'Construction in Progress', '01-02-05-01', 1),
(65, 5, 'Intangible Assets', '01-01-06', 1),
(66, 65, 'Computer software', '01-01-06-01', 1),
(67, 2, 'Advances from related parties', '02-05', 1),
(68, 67, 'Advances from partners', '02-05-01', 1),
(69, 67, 'Advances from affiliates', '02-05-02', 1),
(70, 3, 'Revenues', '03-01', 1);

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

--
-- بنية الجدول `horse`
--

CREATE TABLE `horse` (
  `horse_id` int(11) NOT NULL,
  `horse_name` varchar(100) DEFAULT NULL,
  `reg_num` varchar(50) DEFAULT NULL,
  `passport` varchar(45) DEFAULT NULL,
  `sort_id` varchar(45) DEFAULT NULL,
  `neck_band` varchar(45) DEFAULT NULL,
  `birth_date` date DEFAULT NULL,
  `death_time` date DEFAULT NULL,
  `color` varchar(45) DEFAULT NULL,
  `microship` varchar(45) DEFAULT NULL,
  `category_ref` int(11) DEFAULT NULL,
  `group_ref` int(11) DEFAULT NULL,
  `sex` enum('Male','Female') DEFAULT NULL,
  `age` int(11) DEFAULT NULL,
  `address` varchar(45) DEFAULT NULL,
  `status` enum('reproduction','training','other') DEFAULT NULL,
  `location_ref` int(11) DEFAULT NULL,
  `comments` text,
  `image_url` varchar(100) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `created_user` int(11) DEFAULT NULL,
  `related_customer` int(11) DEFAULT NULL,
  `contract_number` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse`
--

INSERT INTO `horse` (`horse_id`, `horse_name`, `reg_num`, `passport`, `sort_id`, `neck_band`, `birth_date`, `death_time`, `color`, `microship`, `category_ref`, `group_ref`, `sex`, `age`, `address`, `status`, `location_ref`, `comments`, `image_url`, `is_active`, `created_date`, `created_user`, `related_customer`, `contract_number`) VALUES
(1, 'Demo Horse', '123456789', '700898', '10015', '15100', '2010-03-05', '0000-00-00', 'Black', '100-15', 1, 1, 'Female', 7, '', 'reproduction', 1, '', NULL, 1, '2017-09-11 16:50:37', 1, 1, '50100'),
(2, 'ghalia', '', '', '', '192', '2011-01-25', '0000-00-00', '', '', 1, 1, 'Female', 6, '', '', 0, '', NULL, 1, '2017-09-13 07:03:13', 1, 0, ''),
(3, 'Wielka Princessa', '', '', '', '', '0000-00-00', '0000-00-00', 'Black', '', 1, 0, 'Female', 0, '', '', 0, '', NULL, 1, '2017-09-16 09:31:29', 1, 0, ''),
(4, 'amamam', '876868', '', '', '', '2017-08-31', '0000-00-00', 'Grey', '', 1, 0, 'Female', 0, '', '', 0, '', NULL, 1, '2017-09-20 14:11:00', 1, 3, '50888888'),
(5, 'Prestic', '', '', '', '', '0000-00-00', '0000-00-00', 'Brown', '', 0, 0, 'Female', 0, '', 'reproduction', 0, '', NULL, 1, '2017-10-07 08:29:05', 1, 6, '9000-001'),
(7, 'Alexxanderr', '', '', '', '', '0000-00-00', '0000-00-00', 'Grey', '', 0, 0, 'Male', 0, '', 'training', 0, '', NULL, 1, '2017-10-07 08:37:32', 1, 7, '');

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

--
-- بنية الجدول `horse_boarding`
--

CREATE TABLE `horse_boarding` (
  `horse_boarding_id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `rate_ref` int(11) DEFAULT NULL,
  `checkin_date` datetime DEFAULT NULL,
  `checkout_date` datetime DEFAULT NULL,
  `comments` varchar(45) DEFAULT NULL,
  `actual_amount` varchar(45) DEFAULT NULL,
  `charge_date` datetime DEFAULT NULL,
  `last_charge_date` datetime DEFAULT NULL,
  `charged_user` int(11) DEFAULT NULL,
  `is_charged` varchar(45) DEFAULT NULL,
  `transaction_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_category`
--

CREATE TABLE `horse_category` (
  `horse_category_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse_category`
--

INSERT INTO `horse_category` (`horse_category_id`, `name`, `description`) VALUES
(1, 'Arabian', NULL),
(2, 'Western', NULL);

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

--
-- بنية الجدول `horse_entry_log`
--

CREATE TABLE `horse_entry_log` (
  `entry_log_id` int(11) NOT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `log_date` datetime DEFAULT NULL,
  `entry_type` enum('IN','OUT') DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `created_user` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_group`
--

CREATE TABLE `horse_group` (
  `horse_group_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse_group`
--

INSERT INTO `horse_group` (`horse_group_id`, `name`, `description`) VALUES
(1, 'Regular', ''),
(2, 'VIP', NULL),
(3, 'Special', NULL);

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

--
-- بنية الجدول `horse_insurance`
--

CREATE TABLE `horse_insurance` (
  `insurance_id` int(11) NOT NULL,
  `expiry_date` date DEFAULT NULL,
  `insurance_company` varchar(45) DEFAULT NULL,
  `policy` varchar(45) DEFAULT NULL,
  `agent` varchar(45) DEFAULT NULL,
  `contact_phone` varchar(45) DEFAULT NULL,
  `amount` decimal(10,0) DEFAULT NULL,
  `comment` varchar(45) DEFAULT NULL,
  `horse_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_location`
--

CREATE TABLE `horse_location` (
  `horse_location_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse_location`
--

INSERT INTO `horse_location` (`horse_location_id`, `name`, `description`) VALUES
(1, 'Main Stable', NULL);

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

--
-- بنية الجدول `horse_nomination`
--

CREATE TABLE `horse_nomination` (
  `nom_id` int(11) NOT NULL,
  `date` datetime DEFAULT NULL,
  `description` text,
  `horse_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_owner`
--

CREATE TABLE `horse_owner` (
  `horse_owner_id` int(11) NOT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `customer_ref` int(11) DEFAULT NULL,
  `percentage` varchar(45) DEFAULT NULL,
  `main_owner` tinyint(1) DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_pedigree`
--

CREATE TABLE `horse_pedigree` (
  `pedigree_id` int(11) NOT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `parent_ref` int(11) DEFAULT NULL,
  `level` int(11) DEFAULT NULL,
  `comment` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_procedure`
--

CREATE TABLE `horse_procedure` (
  `horse_procedure_id` int(11) NOT NULL,
  `horse_ref` int(11) DEFAULT NULL,
  `item_ref` int(11) DEFAULT NULL,
  `customer_ref` int(11) NOT NULL,
  `qty` int(11) DEFAULT NULL,
  `price` decimal(10,0) DEFAULT NULL,
  `unitprice` float NOT NULL,
  `performed_by` int(11) DEFAULT NULL,
  `proc_date` date DEFAULT NULL,
  `status_ref` int(11) DEFAULT NULL,
  `type_ref` int(11) DEFAULT NULL,
  `is_billed` tinyint(1) DEFAULT NULL,
  `comments` text,
  `created_on` datetime DEFAULT NULL,
  `created_user` int(11) NOT NULL,
  `transaction_ref` int(11) DEFAULT NULL,
  `checkup_ref` int(11) DEFAULT NULL,
  `cc_id` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse_procedure`
--

INSERT INTO `horse_procedure` (`horse_procedure_id`, `horse_ref`, `item_ref`, `customer_ref`, `qty`, `price`, `unitprice`, `performed_by`, `proc_date`, `status_ref`, `type_ref`, `is_billed`, `comments`, `created_on`, `created_user`, `transaction_ref`, `checkup_ref`, `cc_id`) VALUES
(79, 1, 1, 1, 2, 40, 20, 1, '2017-09-11', 1, 1, 0, NULL, '2017-09-11 05:16:51', 1, NULL, 1, 2),
(80, 1, 3, 1, 2, 200, 100, 1, '2017-09-11', 1, 1, 0, NULL, '2017-09-11 05:16:51', 1, NULL, 1, 2),
(81, 1, 22, 1, 3, 135, 45, 1, '2017-09-11', 1, 1, 0, NULL, '2017-09-11 05:16:51', 1, NULL, 1, 2),
(82, 1, 24, 1, 1, 120, 120, 1, '2017-09-11', 1, 1, 1, NULL, '2017-09-11 05:16:51', 1, 81, 1, 2),
(83, 3, 23, 0, 1, 2000, 2000, 2, '2017-09-16', 2, 0, 0, '', '2017-09-16 09:38:48', 1, NULL, NULL, 1),
(84, 4, 1, 3, 2, 40, 20, 0, '2017-09-20', 1, 0, 1, '', '2017-09-20 14:13:38', 1, 84, NULL, 1),
(85, 4, 1, 3, 2, 40, 20, 1, '2017-09-20', 1, 1, 1, NULL, '2017-09-20 02:16:49', 1, 84, 2, 2),
(86, 4, 3, 3, 3, 300, 100, 1, '2017-09-20', 1, 1, 1, NULL, '2017-09-20 02:16:49', 1, 84, 2, 2),
(87, 4, 24, 3, 1, 120, 120, 1, '2017-09-20', 1, 1, 1, NULL, '2017-09-20 02:19:43', 1, 84, 3, 2),
(88, 5, 23, 6, 1, 2000, 2000, 0, '2017-10-07', 1, 4, 0, '1-30 Sep /2017', '2017-10-07 14:01:28', 1, NULL, NULL, 0);

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

--
-- بنية الجدول `horse_show`
--

CREATE TABLE `horse_show` (
  `show_id` int(11) NOT NULL,
  `date` datetime DEFAULT NULL,
  `class_ref` int(11) DEFAULT NULL,
  `won_amount` decimal(10,0) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `horse_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `horse_status`
--

CREATE TABLE `horse_status` (
  `status_id` int(11) NOT NULL,
  `title` varchar(10) NOT NULL,
  `description` varchar(20) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `horse_status`
--

INSERT INTO `horse_status` (`status_id`, `title`, `description`) VALUES
(1, 'Good', ''),
(2, 'Not good', '');

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

--
-- بنية الجدول `invoice`
--

CREATE TABLE `invoice` (
  `invoice_id` int(11) NOT NULL,
  `date` date NOT NULL,
  `kind` enum('Credit','Debit') NOT NULL,
  `amount` decimal(11,0) NOT NULL,
  `discount` decimal(10,0) NOT NULL,
  `net_amount` decimal(11,0) NOT NULL,
  `transaction_type` enum('invoice','payment','charge') NOT NULL,
  `method` enum('cash','span','transfer') DEFAULT NULL,
  `reference_num` varchar(11) DEFAULT NULL,
  `description` text NOT NULL,
  `procedures` varchar(255) DEFAULT NULL,
  `customer_ref` int(5) NOT NULL,
  `created_by` int(11) NOT NULL,
  `created_date` date NOT NULL,
  `confirmed` tinyint(1) NOT NULL DEFAULT '0',
  `confirmed_date` date NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `invoice`
--

INSERT INTO `invoice` (`invoice_id`, `date`, `kind`, `amount`, `discount`, `net_amount`, `transaction_type`, `method`, `reference_num`, `description`, `procedures`, `customer_ref`, `created_by`, `created_date`, `confirmed`, `confirmed_date`) VALUES
(81, '2017-09-11', 'Debit', 120, 20, 100, 'invoice', NULL, NULL, '', '82', 1, 1, '2017-09-11', 0, '0000-00-00'),
(82, '2017-09-11', 'Debit', 350, 0, 350, 'charge', NULL, NULL, 'Other Fees', NULL, 1, 1, '2017-09-11', 0, '0000-00-00'),
(83, '2017-09-11', 'Credit', 100, 0, 100, 'payment', 'cash', '', '', NULL, 1, 1, '2017-09-11', 0, '0000-00-00'),
(84, '2017-09-20', 'Debit', 500, 10, 490, 'invoice', NULL, NULL, '', '84,85,86,87', 3, 1, '2017-09-20', 0, '0000-00-00'),
(85, '2017-09-20', 'Debit', 350, 0, 350, 'charge', NULL, NULL, 'Extra charges and services', NULL, 3, 1, '2017-09-20', 0, '0000-00-00'),
(86, '2017-09-20', 'Credit', 500, 0, 500, 'payment', 'cash', '', '', NULL, 3, 1, '2017-09-20', 0, '0000-00-00'),
(87, '2017-09-20', 'Credit', 1000, 0, 1000, 'payment', '', '', '', NULL, 3, 1, '2017-09-20', 0, '0000-00-00');

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

--
-- بنية الجدول `item`
--

CREATE TABLE `item` (
  `item_id` int(11) NOT NULL,
  `item_name` varchar(200) DEFAULT NULL,
  `item_code` varchar(200) NOT NULL,
  `item_type_ref` int(11) DEFAULT NULL,
  `item_category_ref` int(11) DEFAULT NULL,
  `uom_ref` int(11) DEFAULT NULL,
  `inventory_status` enum('service','inventory') DEFAULT NULL,
  `cost_price` decimal(10,0) DEFAULT NULL,
  `sell_price` double DEFAULT NULL,
  `available_stock` varchar(45) DEFAULT NULL,
  `alert_point` int(11) DEFAULT NULL,
  `remark` varchar(45) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL,
  `is_pos_visible` tinyint(1) DEFAULT NULL,
  `is_deleted` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `item`
--

INSERT INTO `item` (`item_id`, `item_name`, `item_code`, `item_type_ref`, `item_category_ref`, `uom_ref`, `inventory_status`, `cost_price`, `sell_price`, `available_stock`, `alert_point`, `remark`, `created_date`, `is_active`, `is_pos_visible`, `is_deleted`) VALUES
(1, 'Bmoz', '', NULL, NULL, 1, 'service', 10, 20, '1', 43534, NULL, '2017-09-06 18:00:03', 1, 1, 0),
(3, 'Oxct.', '', NULL, NULL, NULL, NULL, NULL, 100, NULL, NULL, NULL, NULL, NULL, 1, NULL),
(22, 'Grains ', '', NULL, 10, 1, 'service', 22, 45, '1', 1, NULL, '2017-07-20 00:00:00', 1, 1, 0),
(23, 'Monthly Boarding for mare', '', 1, NULL, NULL, 'service', NULL, 2000, NULL, NULL, 'this item is for test', '2017-09-07 00:00:00', 1, NULL, NULL),
(24, 'Semen Example 1 - Frozen', '', NULL, 2, NULL, NULL, 0, 120, NULL, NULL, NULL, '2017-10-09 00:00:00', NULL, NULL, NULL),
(25, 'Semen Example 2 - Frozen', '', NULL, 2, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '2017-09-10 00:00:00', NULL, NULL, NULL),
(26, 'Semen Example 1 - Fresh', '', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '0000-00-00 00:00:00', NULL, NULL, NULL),
(27, 'Semen Example 2 - Fresh', '', NULL, 1, NULL, NULL, NULL, NULL, NULL, NULL, 'test', '2017-09-06 00:00:00', NULL, NULL, NULL);

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

--
-- بنية الجدول `item_category`
--

CREATE TABLE `item_category` (
  `item_cat_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `item_category`
--

INSERT INTO `item_category` (`item_cat_id`, `name`, `description`) VALUES
(1, 'Fresh Semen', NULL),
(2, 'Frozen Semen', NULL),
(3, 'Vet Supplies/Medications', NULL),
(4, 'Board', NULL),
(5, 'Vet Fees', NULL),
(6, 'General Charge', NULL),
(7, 'Transportation', NULL),
(8, 'Account Adjustment', NULL),
(9, 'Booking Fees', NULL),
(10, 'Miscellaneous', NULL),
(11, 'Farrier', NULL),
(12, 'Service Charges	', NULL),
(13, 'Stud Fees	', NULL);

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

--
-- بنية الجدول `item_transaction`
--

CREATE TABLE `item_transaction` (
  `item_transaction_id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `item_ref` int(11) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `transaction_type` enum('begining','purchase') DEFAULT NULL,
  `date` datetime DEFAULT NULL,
  `po_ref` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `item_type`
--

CREATE TABLE `item_type` (
  `item_type_id` int(11) NOT NULL,
  `type_name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `ledgers`
--

CREATE TABLE `ledgers` (
  `id` bigint(18) NOT NULL,
  `group_id` bigint(18) NOT NULL,
  `name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `code` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
  `op_balance` decimal(25,3) NOT NULL DEFAULT '0.000',
  `op_balance_dc` char(1) COLLATE utf8_unicode_ci NOT NULL,
  `type` int(2) NOT NULL DEFAULT '0',
  `reconciliation` int(1) NOT NULL DEFAULT '0',
  `notes` varchar(500) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

--
-- إرجاع أو استيراد بيانات الجدول `ledgers`
--

INSERT INTO `ledgers` (`id`, `group_id`, `name`, `code`, `op_balance`, `op_balance_dc`, `type`, `reconciliation`, `notes`) VALUES
(5, 42, 'Samba (0634)', '01-01-01-01-0002', 0.000, 'D', 1, 0, ''),
(6, 42, 'Samba AJWAD', '01-01-01-01-0001', 0.000, 'D', 1, 0, ''),
(7, 42, 'NCB', '01-01-01-01-0003', 0.000, 'D', 1, 0, ''),
(8, 42, 'Al Rajhi', '01-01-01-01-0004', 0.000, 'D', 1, 0, ''),
(9, 42, 'Al Inma', '01-01-01-01-0005', 0.000, 'D', 1, 0, ''),
(10, 15, 'Customer Receivables ', '01-01-03-0001', 0.000, 'D', 0, 0, ''),
(11, 15, 'Employees Receivables ', '01-01-03-0002', 0.000, 'D', 0, 0, ''),
(12, 15, 'Suppliers Receivables ', '01-01-03-0003', 0.000, 'D', 0, 0, ''),
(13, 15, 'Other Receivables ', '01-01-03-0004', 0.000, 'D', 0, 0, ''),
(14, 47, 'Kahil Al Shaqab', '01-01-04-03-0001', 0.000, 'D', 0, 0, ''),
(15, 47, 'Wadee Al Shaqab', '01-01-04-03-0002', 0.000, 'D', 0, 0, ''),
(16, 49, 'EVA Mat 750pcs', '01-01-04-05-0001', 0.000, 'D', 0, 0, ''),
(17, 49, 'Rubber Sheet 550pcs', '01-01-04-05-0002', 0.000, 'D', 0, 0, ''),
(18, 50, 'Race Horse Cooked Mixed Feeds', '01-01-04-06-0001', 0.000, 'D', 0, 0, ''),
(19, 50, 'Special Feeds for Training', '01-01-04-06-0002', 0.000, 'D', 0, 0, ''),
(20, 17, 'Prepaid Rent', '01-01-05-0001', 0.000, 'D', 0, 0, ''),
(21, 17, 'Prepaid insurance', '01-01-05-0002', 0.000, 'D', 0, 0, ''),
(22, 17, 'Other prepayments', '01-01-05-0003', 0.000, 'D', 0, 0, ''),
(23, 17, 'Refundable deposits', '01-01-05-0004', 0.000, 'D', 0, 0, ''),
(24, 17, 'Accrued Revenues', '01-01-05-0005', 0.000, 'D', 0, 0, ''),
(25, 55, 'Mares - Sale', '01-01-02-01-0001', 0.000, 'D', 0, 0, ''),
(26, 55, 'Mares - Donations', '01-01-02-01-0002', 0.000, 'D', 0, 0, ''),
(27, 56, 'Acc depr-Office furnitures', '01-02-02-01-0001', 0.000, 'D', 0, 0, ''),
(28, 57, 'Acc depr-Office equipments', '01-02-02-02-0001', 0.000, 'D', 0, 0, ''),
(29, 58, 'Acc depr-Computers and printers', '01-02-02-03-0001', 0.000, 'D', 0, 0, ''),
(30, 59, 'Acc depr-mobile and other devices', '01-02-02-04-0001', 0.000, 'D', 0, 0, ''),
(31, 60, 'Acc depr-medical equipments', '01-02-02-05-0001', 0.000, 'D', 0, 0, ''),
(32, 61, 'Acc depr-other equipments', '01-02-02-06-0001', 0.000, 'D', 0, 0, ''),
(33, 62, 'Acc depr-vehicles', '01-02-02-07-0001', 0.000, 'D', 0, 0, ''),
(34, 63, 'Acc depr-Building and improvements', '01-02-02-08-0001', 0.000, 'D', 0, 0, ''),
(35, 66, 'Acc amort-computer software', '01-01-06-01-0001', 0.000, 'D', 0, 0, ''),
(36, 24, 'Payable to customers', '02-01-02-0001', 0.000, 'C', 0, 0, ''),
(37, 24, 'Payable to employees', '02-01-02-0002', 0.000, 'C', 0, 0, ''),
(38, 24, 'Payable to suppliers', '02-01-02-0003', 0.000, 'C', 0, 0, ''),
(39, 24, 'Other payable', '02-01-02-0004', 0.000, 'C', 0, 0, ''),
(40, 23, 'Salaries payable-veterinarians', '02-01-01-0001', 0.000, 'C', 0, 0, ''),
(41, 23, 'Salaries payable-trainer', '02-01-01-0002', 0.000, 'C', 0, 0, ''),
(42, 23, 'Salaries payable-groomers', '02-01-01-0003', 0.000, 'C', 0, 0, ''),
(43, 23, 'Salaries payable-mgt & admin', '02-01-01-0004', 0.000, 'C', 0, 0, ''),
(44, 25, 'Accrued payables', '02-01-03-0001', 0.000, 'C', 0, 0, ''),
(45, 25, 'Other liabilities', '02-01-03-0002', 0.000, 'C', 0, 0, ''),
(46, 68, 'Advances from partners-nasir Cash', '02-05-01-0001', 0.000, 'C', 0, 0, ''),
(47, 68, 'Advances from partners-nasir NCB', '02-05-01-0002', 0.000, 'C', 0, 0, ''),
(48, 68, 'Advances from partners-nasir Al Rajhi', '02-05-01-0003', 0.000, 'C', 0, 0, ''),
(49, 68, 'Advances from partners-nasir Riyad Bank', '02-05-01-0004', 0.000, 'C', 0, 0, ''),
(50, 68, 'Advances from partners-abdullah albhian', '02-05-01-0005', 0.000, 'C', 0, 0, ''),
(51, 68, 'Advances from partners-abdulaziz al bargash ', '02-05-01-0006', 0.000, 'C', 0, 0, ''),
(52, 69, 'Advances from AUVA', '02-05-02-0001', 0.000, 'C', 0, 0, ''),
(53, 69, 'Advances from Banan', '02-05-02-0002', 0.000, 'C', 0, 0, ''),
(54, 69, 'Advances from AJWAD', '02-05-02-0003', 0.000, 'C', 0, 0, ''),
(55, 69, 'Advances from MALATH', '02-05-02-0004', 0.000, 'C', 0, 0, ''),
(56, 69, 'Advances from Mansoor Al Saeed', '02-05-02-0005', 0.000, 'C', 0, 0, ''),
(57, 9, 'Net profit or loss', '02-03-0003', 0.000, 'D', 0, 0, ''),
(58, 9, 'Statutory Reserve', '02-03-0004', 0.000, 'C', 0, 0, ''),
(59, 70, 'Revenues from Artificial Insemination', '03-01-0001', 0.000, 'C', 0, 0, ''),
(60, 70, 'Revenues from Frozen Semen Purchased', '03-01-0002', 0.000, 'C', 0, 0, ''),
(61, 70, 'Revenues from Embryo transfer', '03-01-0003', 0.000, 'C', 0, 0, ''),
(62, 70, 'Revenues from Breeding services', '03-01-0004', 0.000, 'C', 0, 0, ''),
(63, 70, 'Revenues from TrainingorReproduction', '03-01-0005', 0.000, 'C', 0, 0, ''),
(64, 70, 'Revenues from Stores', '03-01-0006', 0.000, 'C', 0, 0, ''),
(65, 70, 'Other revenues', '03-01-0007', 0.000, 'C', 0, 0, '');

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

--
-- بنية الجدول `login_attempts`
--

CREATE TABLE `login_attempts` (
  `id` int(11) UNSIGNED NOT NULL,
  `ip_address` varchar(15) NOT NULL,
  `login` varchar(100) NOT NULL,
  `time` int(11) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `procedure_status`
--

CREATE TABLE `procedure_status` (
  `procedure_status_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL,
  `is_active` tinyint(1) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `procedure_status`
--

INSERT INTO `procedure_status` (`procedure_status_id`, `name`, `description`, `is_active`) VALUES
(1, 'Done', NULL, 1),
(2, 'In Progress', NULL, NULL);

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

--
-- بنية الجدول `procedure_type`
--

CREATE TABLE `procedure_type` (
  `id_procedure_type` int(11) NOT NULL,
  `procedure_type_name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `procedure_type`
--

INSERT INTO `procedure_type` (`id_procedure_type`, `procedure_type_name`, `description`) VALUES
(1, 'Suppliement', 'Suppliement'),
(2, 'Monthly Training ', 'Training Monthly charges'),
(3, NULL, NULL),
(4, 'Boarding', NULL),
(5, 'Fresh Semen Card', NULL),
(6, NULL, NULL);

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

--
-- بنية الجدول `purchase_order`
--

CREATE TABLE `purchase_order` (
  `purchase_order_id` int(11) NOT NULL,
  `description` varchar(45) DEFAULT NULL,
  `order_date` datetime DEFAULT NULL,
  `done_by` int(11) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `purchase_orders_items`
--

CREATE TABLE `purchase_orders_items` (
  `purchase_order_item_id` int(11) NOT NULL,
  `purchase_order_id` int(11) DEFAULT NULL,
  `item_id` int(11) DEFAULT NULL,
  `quantity` float(11,2) NOT NULL,
  `price` float(11,2) NOT NULL DEFAULT '0.00',
  `currency_id` int(11) NOT NULL,
  `note` text NOT NULL,
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

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

--
-- بنية الجدول `show_class`
--

CREATE TABLE `show_class` (
  `show_class_id` int(11) NOT NULL,
  `show_name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `show_class`
--

INSERT INTO `show_class` (`show_class_id`, `show_name`, `description`) VALUES
(1, 'GCC Golden Show', NULL),
(2, 'Arab World Silver Stallion', NULL);

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

--
-- بنية الجدول `tags`
--

CREATE TABLE `tags` (
  `id` bigint(18) NOT NULL,
  `title` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
  `color` char(6) COLLATE utf8_unicode_ci NOT NULL,
  `background` char(6) COLLATE utf8_unicode_ci NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

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

--
-- بنية الجدول `uom`
--

CREATE TABLE `uom` (
  `uom_id` int(11) NOT NULL,
  `name` varchar(45) DEFAULT NULL,
  `description` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- إرجاع أو استيراد بيانات الجدول `uom`
--

INSERT INTO `uom` (`uom_id`, `name`, `description`) VALUES
(1, 'UOM', 'description'),
(2, 'Bottle', NULL),
(3, 'kilo', NULL),
(4, 'Milli', NULL);

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

--
-- بنية الجدول `u_groups`
--

CREATE TABLE `u_groups` (
  `id` mediumint(8) UNSIGNED NOT NULL,
  `name` varchar(20) NOT NULL,
  `description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `acc_logs`
--
ALTER TABLE `acc_logs`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD KEY `id` (`id`);

--
-- Indexes for table `activity_cal`
--
ALTER TABLE `activity_cal`
  ADD PRIMARY KEY (`activity_cal_id`);

--
-- Indexes for table `activity_type`
--
ALTER TABLE `activity_type`
  ADD PRIMARY KEY (`activity_type_id`);

--
-- Indexes for table `admin_groups`
--
ALTER TABLE `admin_groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `admin_login_attempts`
--
ALTER TABLE `admin_login_attempts`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `admin_users_groups`
--
ALTER TABLE `admin_users_groups`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `appointment`
--
ALTER TABLE `appointment`
  ADD PRIMARY KEY (`appointment_id`);

--
-- Indexes for table `apps_countries`
--
ALTER TABLE `apps_countries`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `boarding_rate`
--
ALTER TABLE `boarding_rate`
  ADD PRIMARY KEY (`boarding_rate_id`);

--
-- Indexes for table `checkup`
--
ALTER TABLE `checkup`
  ADD PRIMARY KEY (`checkup_id`);

--
-- Indexes for table `cost_center`
--
ALTER TABLE `cost_center`
  ADD PRIMARY KEY (`cost_center_id`);

--
-- Indexes for table `currency`
--
ALTER TABLE `currency`
  ADD PRIMARY KEY (`currency_id`);

--
-- Indexes for table `customer_group`
--
ALTER TABLE `customer_group`
  ADD PRIMARY KEY (`customer_group_id`);

--
-- Indexes for table `entries`
--
ALTER TABLE `entries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD KEY `id` (`id`),
  ADD KEY `tag_id` (`tag_id`),
  ADD KEY `entrytype_id` (`entrytype_id`);

--
-- Indexes for table `entryitems`
--
ALTER TABLE `entryitems`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD KEY `id` (`id`),
  ADD KEY `entry_id` (`entry_id`),
  ADD KEY `ledger_id` (`ledger_id`);

--
-- Indexes for table `entrytypes`
--
ALTER TABLE `entrytypes`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD UNIQUE KEY `label` (`label`),
  ADD KEY `id` (`id`);

--
-- Indexes for table `feed_program`
--
ALTER TABLE `feed_program`
  ADD PRIMARY KEY (`feed_program_id`);

--
-- Indexes for table `feed_sch`
--
ALTER TABLE `feed_sch`
  ADD PRIMARY KEY (`feed_sch_id`);

--
-- Indexes for table `groups`
--
ALTER TABLE `groups`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD UNIQUE KEY `code` (`code`),
  ADD KEY `id` (`id`),
  ADD KEY `parent_id` (`parent_id`);

--
-- Indexes for table `horse`
--
ALTER TABLE `horse`
  ADD PRIMARY KEY (`horse_id`);

--
-- Indexes for table `horse_boarding`
--
ALTER TABLE `horse_boarding`
  ADD PRIMARY KEY (`horse_boarding_id`);

--
-- Indexes for table `horse_category`
--
ALTER TABLE `horse_category`
  ADD PRIMARY KEY (`horse_category_id`);

--
-- Indexes for table `horse_entry_log`
--
ALTER TABLE `horse_entry_log`
  ADD PRIMARY KEY (`entry_log_id`);

--
-- Indexes for table `horse_group`
--
ALTER TABLE `horse_group`
  ADD PRIMARY KEY (`horse_group_id`);

--
-- Indexes for table `horse_insurance`
--
ALTER TABLE `horse_insurance`
  ADD PRIMARY KEY (`insurance_id`);

--
-- Indexes for table `horse_location`
--
ALTER TABLE `horse_location`
  ADD PRIMARY KEY (`horse_location_id`);

--
-- Indexes for table `horse_nomination`
--
ALTER TABLE `horse_nomination`
  ADD PRIMARY KEY (`nom_id`);

--
-- Indexes for table `horse_owner`
--
ALTER TABLE `horse_owner`
  ADD PRIMARY KEY (`horse_owner_id`);

--
-- Indexes for table `horse_pedigree`
--
ALTER TABLE `horse_pedigree`
  ADD PRIMARY KEY (`pedigree_id`);

--
-- Indexes for table `horse_procedure`
--
ALTER TABLE `horse_procedure`
  ADD PRIMARY KEY (`horse_procedure_id`);

--
-- Indexes for table `horse_show`
--
ALTER TABLE `horse_show`
  ADD PRIMARY KEY (`show_id`),
  ADD KEY `fk_horse_show_show_class` (`class_ref`);

--
-- Indexes for table `horse_status`
--
ALTER TABLE `horse_status`
  ADD PRIMARY KEY (`status_id`);

--
-- Indexes for table `invoice`
--
ALTER TABLE `invoice`
  ADD PRIMARY KEY (`invoice_id`);

--
-- Indexes for table `item`
--
ALTER TABLE `item`
  ADD PRIMARY KEY (`item_id`);

--
-- Indexes for table `item_category`
--
ALTER TABLE `item_category`
  ADD PRIMARY KEY (`item_cat_id`);

--
-- Indexes for table `item_transaction`
--
ALTER TABLE `item_transaction`
  ADD PRIMARY KEY (`item_transaction_id`);

--
-- Indexes for table `item_type`
--
ALTER TABLE `item_type`
  ADD PRIMARY KEY (`item_type_id`);

--
-- Indexes for table `ledgers`
--
ALTER TABLE `ledgers`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD UNIQUE KEY `code` (`code`),
  ADD KEY `id` (`id`),
  ADD KEY `group_id` (`group_id`);

--
-- Indexes for table `login_attempts`
--
ALTER TABLE `login_attempts`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `procedure_status`
--
ALTER TABLE `procedure_status`
  ADD PRIMARY KEY (`procedure_status_id`);

--
-- Indexes for table `procedure_type`
--
ALTER TABLE `procedure_type`
  ADD PRIMARY KEY (`id_procedure_type`);

--
-- Indexes for table `purchase_order`
--
ALTER TABLE `purchase_order`
  ADD PRIMARY KEY (`purchase_order_id`);

--
-- Indexes for table `purchase_orders_items`
--
ALTER TABLE `purchase_orders_items`
  ADD PRIMARY KEY (`purchase_order_item_id`);

--
-- Indexes for table `show_class`
--
ALTER TABLE `show_class`
  ADD PRIMARY KEY (`show_class_id`);

--
-- Indexes for table `tags`
--
ALTER TABLE `tags`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `unique_id` (`id`),
  ADD UNIQUE KEY `title` (`title`),
  ADD KEY `id` (`id`);

--
-- Indexes for table `uom`
--
ALTER TABLE `uom`
  ADD PRIMARY KEY (`uom_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `acc_logs`
--
ALTER TABLE `acc_logs`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `activity_cal`
--
ALTER TABLE `activity_cal`
  MODIFY `activity_cal_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `activity_type`
--
ALTER TABLE `activity_type`
  MODIFY `activity_type_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;

--
-- AUTO_INCREMENT for table `admin_groups`
--
ALTER TABLE `admin_groups`
  MODIFY `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `admin_login_attempts`
--
ALTER TABLE `admin_login_attempts`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `admin_users_groups`
--
ALTER TABLE `admin_users_groups`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `appointment`
--
ALTER TABLE `appointment`
  MODIFY `appointment_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `apps_countries`
--
ALTER TABLE `apps_countries`
  MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=296;

--
-- AUTO_INCREMENT for table `boarding_rate`
--
ALTER TABLE `boarding_rate`
  MODIFY `boarding_rate_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `checkup`
--
ALTER TABLE `checkup`
  MODIFY `checkup_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `cost_center`
--
ALTER TABLE `cost_center`
  MODIFY `cost_center_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `currency`
--
ALTER TABLE `currency`
  MODIFY `currency_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `customer_group`
--
ALTER TABLE `customer_group`
  MODIFY `customer_group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `entries`
--
ALTER TABLE `entries`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=13;

--
-- AUTO_INCREMENT for table `entryitems`
--
ALTER TABLE `entryitems`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `entrytypes`
--
ALTER TABLE `entrytypes`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `feed_program`
--
ALTER TABLE `feed_program`
  MODIFY `feed_program_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `feed_sch`
--
ALTER TABLE `feed_sch`
  MODIFY `feed_sch_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `groups`
--
ALTER TABLE `groups`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=71;

--
-- AUTO_INCREMENT for table `horse`
--
ALTER TABLE `horse`
  MODIFY `horse_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;

--
-- AUTO_INCREMENT for table `horse_boarding`
--
ALTER TABLE `horse_boarding`
  MODIFY `horse_boarding_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_category`
--
ALTER TABLE `horse_category`
  MODIFY `horse_category_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `horse_entry_log`
--
ALTER TABLE `horse_entry_log`
  MODIFY `entry_log_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_group`
--
ALTER TABLE `horse_group`
  MODIFY `horse_group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `horse_insurance`
--
ALTER TABLE `horse_insurance`
  MODIFY `insurance_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_location`
--
ALTER TABLE `horse_location`
  MODIFY `horse_location_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2;

--
-- AUTO_INCREMENT for table `horse_nomination`
--
ALTER TABLE `horse_nomination`
  MODIFY `nom_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_owner`
--
ALTER TABLE `horse_owner`
  MODIFY `horse_owner_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_pedigree`
--
ALTER TABLE `horse_pedigree`
  MODIFY `pedigree_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `horse_procedure`
--
ALTER TABLE `horse_procedure`
  MODIFY `horse_procedure_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=89;

--
-- AUTO_INCREMENT for table `horse_show`
--
ALTER TABLE `horse_show`
  MODIFY `show_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `invoice`
--
ALTER TABLE `invoice`
  MODIFY `invoice_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=88;

--
-- AUTO_INCREMENT for table `item`
--
ALTER TABLE `item`
  MODIFY `item_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28;

--
-- AUTO_INCREMENT for table `item_category`
--
ALTER TABLE `item_category`
  MODIFY `item_cat_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `item_transaction`
--
ALTER TABLE `item_transaction`
  MODIFY `item_transaction_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `item_type`
--
ALTER TABLE `item_type`
  MODIFY `item_type_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `ledgers`
--
ALTER TABLE `ledgers`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=66;

--
-- AUTO_INCREMENT for table `login_attempts`
--
ALTER TABLE `login_attempts`
  MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `procedure_status`
--
ALTER TABLE `procedure_status`
  MODIFY `procedure_status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `procedure_type`
--
ALTER TABLE `procedure_type`
  MODIFY `id_procedure_type` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;

--
-- AUTO_INCREMENT for table `purchase_order`
--
ALTER TABLE `purchase_order`
  MODIFY `purchase_order_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `purchase_orders_items`
--
ALTER TABLE `purchase_orders_items`
  MODIFY `purchase_order_item_id` int(11) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `show_class`
--
ALTER TABLE `show_class`
  MODIFY `show_class_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `tags`
--
ALTER TABLE `tags`
  MODIFY `id` bigint(18) NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `uom`
--
ALTER TABLE `uom`
  MODIFY `uom_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- قيود الجداول المُلقاة.
--

--
-- قيود الجداول `entries`
--
ALTER TABLE `entries`
  ADD CONSTRAINT `acc_entries_fk_check_entrytype_id` FOREIGN KEY (`entrytype_id`) REFERENCES `entrytypes` (`id`),
  ADD CONSTRAINT `acc_entries_fk_check_tag_id` FOREIGN KEY (`tag_id`) REFERENCES `tags` (`id`);

--
-- قيود الجداول `entryitems`
--
ALTER TABLE `entryitems`
  ADD CONSTRAINT `acc_entryitems_fk_check_entry_id` FOREIGN KEY (`entry_id`) REFERENCES `entries` (`id`),
  ADD CONSTRAINT `acc_entryitems_fk_check_ledger_id` FOREIGN KEY (`ledger_id`) REFERENCES `ledgers` (`id`);

--
-- قيود الجداول `groups`
--
ALTER TABLE `groups`
  ADD CONSTRAINT `acc_groups_fk_check_parent_id` FOREIGN KEY (`parent_id`) REFERENCES `groups` (`id`);

--
-- قيود الجداول `horse_show`
--
ALTER TABLE `horse_show`
  ADD CONSTRAINT `fk_horse_show_show_class` FOREIGN KEY (`class_ref`) REFERENCES `show_class` (`show_class_id`);

--
-- قيود الجداول `ledgers`
--
ALTER TABLE `ledgers`
  ADD CONSTRAINT `acc_ledgers_fk_check_group_id` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`);
COMMIT;

