

CREATE TABLE `account` (
  `account_id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `id` varchar(128) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `type` varchar(128) DEFAULT NULL,
  `subtype` varchar(128) DEFAULT NULL,
  `is_header` varchar(10) DEFAULT NULL,
  `is_subheader` varchar(10) DEFAULT NULL,
  `is_bank` varchar(10) DEFAULT NULL,
  `cash_postable` varchar(10) DEFAULT NULL,
  `description` text,
  `datetime` datetime DEFAULT NULL,
  `opening_balance` decimal(20,2) DEFAULT NULL,
  `balance` decimal(20,2) DEFAULT NULL,
  `order` int(11) DEFAULT NULL,
  `integrated` int(1) DEFAULT NULL,
  `integration_type` varchar(128) DEFAULT NULL,
  `default` int(1) DEFAULT NULL,
  `branch_id` int(11) DEFAULT NULL,
  `normal_sign` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`account_id`)
) ENGINE=MyISAM AUTO_INCREMENT=50 DEFAULT CHARSET=latin1

CREATE TABLE `account_transactions` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `journal` varchar(128) DEFAULT NULL,
  `account_id` varchar(128) DEFAULT '',
  `account_name` varchar(128) DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `type` varchar(10) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `reference` varchar(128) DEFAULT NULL,
  `description` varchar(128) DEFAULT NULL,
  `notes` varchar(128) DEFAULT NULL,
  `group` varchar(128) DEFAULT NULL,
  `applied` varchar(128) DEFAULT NULL,
  `applied_date` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `additional` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `group` varchar(128) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `checkin_id` int(11) DEFAULT NULL,
  `receipt_id` int(11) DEFAULT NULL,
  `room_number` int(11) DEFAULT NULL,
  `item_id` int(11) DEFAULT NULL,
  `item_name` varchar(128) DEFAULT NULL,
  `item_type` varchar(128) DEFAULT NULL,
  `item_desc` varchar(255) DEFAULT NULL,
  `discount` varchar(128) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `price_per_unit` decimal(20,2) DEFAULT NULL,
  `price` decimal(20,2) DEFAULT NULL,
  `regular_price` decimal(20,2) DEFAULT NULL,
  `paid` int(1) DEFAULT NULL,
  `staff_id` int(11) DEFAULT NULL,
  `paid_date` datetime DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `grooming_item` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=443 DEFAULT CHARSET=latin1

CREATE TABLE `agents` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `on_behalf` int(11) DEFAULT NULL,
  `registration_number` varchar(255) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  `contact_person` varchar(128) DEFAULT NULL,
  `contact_number` varchar(128) DEFAULT NULL,
  `address` text,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `modified_on` datetime DEFAULT NULL,
  `modified_by` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `block_dates` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `room_number` varchar(50) DEFAULT NULL,
  `date` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=59 DEFAULT CHARSET=utf8

CREATE TABLE `categories` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(128) DEFAULT NULL,
  `code` varchar(10) DEFAULT NULL,
  `description` text,
  `image` text,
  `image2` text,
  `image3` text,
  `pax` int(11) DEFAULT NULL,
  `online_booking_allotment` int(11) DEFAULT NULL,
  `pkey` varchar(255) DEFAULT NULL,
  `type` varchar(30) DEFAULT NULL,
  `first_free` int(11) DEFAULT NULL,
  `order` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`),
  FULLTEXT KEY `name` (`name`)
) ENGINE=MyISAM AUTO_INCREMENT=35 DEFAULT CHARSET=latin1

CREATE TABLE `checkins` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(128) DEFAULT NULL,
  `group` varchar(128) DEFAULT NULL,
  `pets` varchar(255) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `reservation_id` int(11) DEFAULT NULL,
  `check_in` date DEFAULT NULL,
  `check_in_time` time DEFAULT NULL,
  `check_in_by` int(11) DEFAULT NULL,
  `check_out` date DEFAULT NULL,
  `check_out_time` time DEFAULT NULL,
  `check_out_by` int(11) DEFAULT NULL,
  `actual_check_out` datetime DEFAULT NULL,
  `room_id` int(11) DEFAULT NULL,
  `room_number` varchar(40) DEFAULT NULL,
  `guest_id` int(11) DEFAULT NULL,
  `transfer_room` int(11) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `regular_rate` decimal(20,2) DEFAULT NULL,
  `discount` varchar(128) DEFAULT NULL,
  `rate` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `regular_amount` decimal(20,2) DEFAULT NULL,
  `key_deposit` decimal(20,2) DEFAULT NULL,
  `tourism_tax` decimal(20,2) DEFAULT NULL,
  `remarks` text,
  `nights` int(11) DEFAULT NULL,
  `regular_day_charge` decimal(20,2) DEFAULT NULL,
  `day_charge` decimal(20,2) DEFAULT NULL,
  `single` int(11) DEFAULT NULL,
  `single_rate` decimal(20,2) DEFAULT NULL,
  `single_rate_first` decimal(20,2) DEFAULT NULL,
  `rate_breakdown` text,
  `regular_rate_breakdown` text,
  `description` text,
  `notes` text,
  `foc` int(1) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `category` varchar(255) DEFAULT NULL,
  `category_name` varchar(255) DEFAULT NULL,
  `channel_id` varchar(255) DEFAULT NULL,
  `channel` varchar(255) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `void` int(11) DEFAULT NULL,
  `seen` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=668 DEFAULT CHARSET=latin1

CREATE TABLE `close_out` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date` date DEFAULT NULL,
  `days` text,
  `description` varchar(255) DEFAULT '',
  `type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=22 DEFAULT CHARSET=latin1

CREATE TABLE `commissions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `group` varchar(128) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `config` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `config` varchar(128) DEFAULT NULL,
  `value` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=165 DEFAULT CHARSET=latin1

CREATE TABLE `connections` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `service` varchar(255) DEFAULT NULL,
  `apikey` varchar(255) DEFAULT NULL,
  `last_activity_date` datetime DEFAULT NULL,
  `last_activity` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

CREATE TABLE `conversation` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `number` varchar(30) DEFAULT NULL,
  `message` longtext,
  `reply` longtext,
  `datetime` datetime DEFAULT NULL,
  `reply_datetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

CREATE TABLE `countries` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(128) DEFAULT NULL,
  `prefix` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=240 DEFAULT CHARSET=latin1

CREATE TABLE `credit_cards` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `type` varchar(255) DEFAULT NULL,
  `service_charge` varchar(255) DEFAULT NULL,
  `tax` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1

CREATE TABLE `deposit` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `group` varchar(128) DEFAULT NULL,
  `guest_id` varchar(128) DEFAULT NULL,
  `check_in` date DEFAULT NULL,
  `check_in_by` int(11) DEFAULT NULL,
  `check_out` date DEFAULT NULL,
  `check_out_by` int(11) DEFAULT NULL,
  `rate_type` varchar(100) DEFAULT NULL,
  `agent_type` varchar(100) DEFAULT NULL,
  `deposit_type` varchar(32) DEFAULT NULL,
  `mid` varchar(100) DEFAULT NULL,
  `booking_id` varchar(150) DEFAULT NULL,
  `deposit_amount` decimal(20,2) DEFAULT NULL,
  `transfer_amount` decimal(20,2) DEFAULT NULL,
  `key_deposit_amount` decimal(20,2) DEFAULT NULL,
  `deposit_card_type` varchar(128) DEFAULT NULL,
  `deposit_card_no` varchar(128) DEFAULT NULL,
  `deposit_ref_no` varchar(128) DEFAULT NULL,
  `rate` decimal(20,2) DEFAULT NULL,
  `completed` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `room_no` varchar(128) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `reservation_id` int(11) DEFAULT NULL,
  `void` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=9 DEFAULT CHARSET=latin1

CREATE TABLE `email_tac` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `email` varchar(255) DEFAULT NULL,
  `tac` varchar(6) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=99 DEFAULT CHARSET=utf8

CREATE TABLE `expenses` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `account_id` varchar(128) DEFAULT NULL,
  `withdrawn_account_id` varchar(128) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `payment_to` varchar(255) DEFAULT NULL,
  `supplier` varchar(255) DEFAULT NULL,
  `supplier_id` int(11) DEFAULT NULL,
  `memo` varchar(255) DEFAULT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `net_amount` decimal(20,2) DEFAULT NULL,
  `tax_amount` decimal(20,2) DEFAULT NULL,
  `tax_included` decimal(20,2) DEFAULT NULL,
  `void` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `guest_notes` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `guest_id` int(11) DEFAULT NULL,
  `notes` text,
  `datetime` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

CREATE TABLE `guests` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(128) DEFAULT NULL,
  `ident` varchar(128) DEFAULT NULL,
  `address` text,
  `address2` text,
  `postcode` varchar(10) DEFAULT NULL,
  `email` varchar(128) DEFAULT NULL,
  `alt_email` varchar(128) DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `alternative_contact` varchar(128) DEFAULT NULL,
  `alternative_mobile` varchar(128) DEFAULT NULL,
  `emergency_contact` varchar(128) DEFAULT NULL,
  `emergency_mobile` varchar(128) DEFAULT NULL,
  `city` varchar(128) DEFAULT NULL,
  `state` varchar(128) DEFAULT NULL,
  `country` varchar(128) DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `modified_on` datetime DEFAULT NULL,
  `modified_by` varchar(128) DEFAULT NULL,
  `vehicle_no` varchar(128) DEFAULT NULL,
  `remarks` text,
  `is_member` int(1) DEFAULT NULL,
  `member_since` date DEFAULT NULL,
  `password` varchar(255) DEFAULT NULL,
  `credits` decimal(20,2) DEFAULT NULL,
  `signup` int(1) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `opening_credits` decimal(20,2) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=1036 DEFAULT CHARSET=latin1

CREATE TABLE `invoices` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `check_in` date DEFAULT NULL,
  `date` date DEFAULT NULL,
  `guest_id` int(11) DEFAULT NULL,
  `guest_name` varchar(255) DEFAULT NULL,
  `guest_address` text,
  `guest_contact` varchar(255) DEFAULT NULL,
  `tourism_tax` decimal(20,2) DEFAULT NULL,
  `tax` decimal(20,2) DEFAULT NULL,
  `subtotal` decimal(20,2) DEFAULT NULL,
  `additional_total` decimal(20,2) DEFAULT NULL,
  `grand_total` decimal(20,2) DEFAULT NULL,
  `surcharge` decimal(20,2) DEFAULT NULL,
  `surcharge_name` varchar(255) DEFAULT NULL,
  `surcharge_inclusive` int(1) DEFAULT NULL,
  `tax_percentage` varchar(10) DEFAULT NULL,
  `tax_inclusive` int(1) DEFAULT NULL,
  `tax_name` varchar(32) DEFAULT NULL,
  `void` int(1) DEFAULT NULL,
  `payment_method` varchar(255) DEFAULT NULL,
  `total_payment` decimal(20,2) DEFAULT NULL,
  `reference_no` varchar(255) DEFAULT NULL,
  `card_type` varchar(255) DEFAULT NULL,
  `card_id` int(11) DEFAULT NULL,
  `card_no` varchar(255) DEFAULT NULL,
  `cash_amount` decimal(20,2) DEFAULT NULL,
  `credit_card_amount` decimal(20,2) DEFAULT NULL,
  `credit_card_fees` decimal(20,2) DEFAULT NULL,
  `credit_card_tax` decimal(20,2) DEFAULT NULL,
  `credit_card_fee_percentage` decimal(20,2) DEFAULT NULL,
  `credit_card_tax_percentage` decimal(20,2) DEFAULT NULL,
  `credit_card_sales` decimal(20,2) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `group` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10006 DEFAULT CHARSET=latin1

CREATE TABLE `item_categories` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `group` varchar(255) DEFAULT NULL,
  `description` longtext,
  `active` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=15 DEFAULT CHARSET=utf8

CREATE TABLE `items` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pos` int(1) DEFAULT NULL,
  `name` varchar(128) DEFAULT NULL,
  `sku` varchar(128) DEFAULT NULL,
  `frontend_group` varchar(128) DEFAULT NULL,
  `frontend_name` varchar(128) DEFAULT NULL,
  `frontend_subgroup` varchar(128) DEFAULT NULL,
  `frontend_qty` varchar(128) DEFAULT NULL,
  `frontend_price` varchar(128) DEFAULT NULL,
  `frontend_field` varchar(20) DEFAULT NULL,
  `frontend_code` longtext,
  `description` text,
  `price` decimal(20,2) DEFAULT NULL,
  `promo_price` decimal(20,2) DEFAULT NULL,
  `type` varchar(128) DEFAULT NULL,
  `has_stock` int(1) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `grooming_addon` int(1) DEFAULT NULL,
  `boarding_addon` int(1) DEFAULT NULL,
  `hide_price` int(1) DEFAULT NULL,
  `price_unit` varchar(128) DEFAULT NULL,
  `cid` int(11) DEFAULT NULL,
  `cost` decimal(20,2) DEFAULT NULL,
  `sort_order` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=81 DEFAULT CHARSET=latin1

CREATE TABLE `logs` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `module` varchar(255) DEFAULT NULL,
  `table` varchar(255) DEFAULT NULL,
  `record_id` varchar(255) DEFAULT NULL,
  `desc_id` varchar(255) DEFAULT '',
  `description` text,
  `datetime` datetime DEFAULT NULL,
  `performed_by` varchar(255) DEFAULT NULL,
  `data` longtext,
  PRIMARY KEY (`id`),
  KEY `module` (`module`),
  KEY `table` (`table`),
  KEY `record_id` (`record_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1

CREATE TABLE `payment_link` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `group` varchar(128) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `online_payment_id` varchar(128) DEFAULT NULL,
  `online_payment_data` text,
  `online_payment_completed` int(11) DEFAULT NULL,
  `online_payment_url` varchar(128) DEFAULT NULL,
  `callback_url` varchar(128) DEFAULT NULL,
  `remarks` text,
  `description` text,
  `complete_datetime` datetime DEFAULT NULL,
  `payment_method` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8

CREATE TABLE `payment_voucher_breakdown` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pv_id` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `account` text,
  `account_id` int(11) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `payment_method` varchar(128) DEFAULT NULL,
  `payment_reference` varchar(128) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `payment_voucher_items` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pv_id` int(11) DEFAULT NULL,
  `account_id` int(11) DEFAULT NULL,
  `account` varchar(128) DEFAULT NULL,
  `po_id` int(11) DEFAULT NULL,
  `cn_id` int(11) DEFAULT NULL,
  `dn_id` int(11) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `asset_id` int(11) DEFAULT NULL,
  `reference` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `description` text,
  `datetime` datetime DEFAULT NULL,
  `amount_payable` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `tax_code` varchar(255) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `payment_vouchers` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(128) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `account` varchar(128) DEFAULT NULL,
  `account_id` varchar(128) DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `amount_payable` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `void_date` datetime DEFAULT NULL,
  `tax` decimal(20,2) DEFAULT NULL,
  `tax_code` decimal(20,2) DEFAULT NULL,
  `tax_inclusive` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1

CREATE TABLE `payments` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `invoice_id` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `method` varchar(255) DEFAULT NULL,
  `reference` varchar(255) DEFAULT NULL,
  `is_deposit` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

CREATE TABLE `pet_deworm` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `deworm_date` date DEFAULT NULL,
  `deworm` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8

CREATE TABLE `pet_fso` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `flea_spot_on_date` date DEFAULT NULL,
  `flea_spot_on` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8

CREATE TABLE `pet_notes` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `notes` text,
  `datetime` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `public` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=19 DEFAULT CHARSET=utf8

CREATE TABLE `pet_photos` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `date` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8

CREATE TABLE `pet_vaccine` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `vaccine_date` date DEFAULT NULL,
  `vaccine_expiry_date` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=utf8

CREATE TABLE `pet_vaccine_photos` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `date` date DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8

CREATE TABLE `pet_weight` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `pet_id` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `weight` decimal(10,1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8

CREATE TABLE `pets` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `guest_id` int(11) DEFAULT NULL,
  `guest_name` varchar(255) DEFAULT NULL,
  `name` varchar(255) DEFAULT NULL,
  `breed` varchar(255) DEFAULT NULL,
  `gender` varchar(10) DEFAULT NULL,
  `coat_type` varchar(50) DEFAULT NULL,
  `medical_condition` varchar(255) DEFAULT NULL,
  `flea_spot_on` varchar(255) DEFAULT NULL,
  `flea_spot_on_date` date DEFAULT NULL,
  `neutered` int(1) DEFAULT NULL,
  `color` varchar(255) DEFAULT NULL,
  `dob` date DEFAULT NULL,
  `vaccine_date` date DEFAULT NULL,
  `vaccine_expiry_date` date DEFAULT NULL,
  `roaming_status` varchar(255) DEFAULT NULL,
  `weight` decimal(10,2) DEFAULT NULL,
  `photo` varchar(255) DEFAULT NULL,
  `vcard` varchar(255) DEFAULT NULL,
  `vcard_cover` varchar(255) DEFAULT NULL,
  `behavior` varchar(255) DEFAULT NULL,
  `deworm` varchar(255) DEFAULT NULL,
  `deworm_date` date DEFAULT NULL,
  `remarks` text,
  `guest_remarks` text,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=467 DEFAULT CHARSET=utf8

CREATE TABLE `pos_sale_items` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `sale_id` int(11) DEFAULT NULL,
  `item_id` int(11) DEFAULT NULL,
  `item_name` varchar(255) DEFAULT NULL,
  `unit_price` decimal(20,2) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `subtotal` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `discount` varchar(10) DEFAULT NULL,
  `discount_amount` decimal(20,2) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8

CREATE TABLE `pos_sales` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `datetime` datetime DEFAULT NULL,
  `pos_datetime` datetime DEFAULT NULL,
  `user_id` int(11) DEFAULT NULL,
  `user` varchar(255) DEFAULT NULL,
  `customer_id` int(11) DEFAULT NULL,
  `customer_name` varchar(255) DEFAULT NULL,
  `payment_method` varchar(20) DEFAULT NULL,
  `payment_type` varchar(20) DEFAULT NULL,
  `tendered_amount` decimal(20,2) DEFAULT NULL,
  `change_amount` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `rounding` decimal(20,2) DEFAULT NULL,
  `subtotal` decimal(20,2) DEFAULT NULL,
  `tax` decimal(20,2) DEFAULT NULL,
  `discount` varchar(20) DEFAULT NULL,
  `discount_amount` decimal(20,2) DEFAULT NULL,
  `status` varchar(255) DEFAULT NULL,
  `points` int(11) DEFAULT NULL,
  `void_datetime` datetime DEFAULT NULL,
  `void_by` varchar(255) DEFAULT NULL,
  `void_user_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=28 DEFAULT CHARSET=utf8

CREATE TABLE `public_holidays` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `date` date DEFAULT NULL,
  `description` varchar(255) DEFAULT '',
  `rate_type` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `rates` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `start_date` date DEFAULT NULL,
  `end_date` date DEFAULT NULL,
  `category` int(11) DEFAULT NULL,
  `rate` decimal(20,2) DEFAULT NULL,
  `rate_single_first` decimal(20,2) DEFAULT NULL,
  `rate_single` decimal(20,2) DEFAULT NULL,
  `rate_day` decimal(20,2) DEFAULT NULL,
  `weekend_rate_day` decimal(20,2) DEFAULT NULL,
  `weekend_rate` decimal(20,2) DEFAULT NULL,
  `weekend_rate_single_first` decimal(20,2) DEFAULT NULL,
  `weekend_rate_single` decimal(20,2) DEFAULT NULL,
  `agent_rate` decimal(20,2) DEFAULT NULL,
  `agent_weekend_rate` decimal(20,2) DEFAULT NULL,
  `govt_rate` decimal(20,2) DEFAULT NULL,
  `govt_weekend_rate` decimal(20,2) DEFAULT NULL,
  `promo_rate` decimal(20,2) DEFAULT NULL,
  `promo_weekend_rate` decimal(20,2) DEFAULT NULL,
  `promo_rate_single_first` decimal(20,2) DEFAULT NULL,
  `promo_rate_single` decimal(20,2) DEFAULT NULL,
  `promo_rate_day` decimal(20,2) DEFAULT NULL,
  `promo_weekend_rate_single_first` decimal(20,2) DEFAULT NULL,
  `promo_weekend_rate_single` decimal(20,2) DEFAULT NULL,
  `promo_weekend_rate_day` decimal(20,2) DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `priority` int(11) DEFAULT NULL,
  `agency` varchar(255) DEFAULT NULL,
  `pet_count` int(11) DEFAULT NULL,
  `agency_id` int(11) DEFAULT NULL,
  `promo_status` int(11) DEFAULT NULL,
  `remarks` text,
  `bulk` int(11) DEFAULT NULL,
  `bulk_discount` varchar(30) DEFAULT NULL,
  `bulk_free` int(11) DEFAULT NULL,
  `peak` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=20 DEFAULT CHARSET=latin1

CREATE TABLE `receipt` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(128) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `account_id` int(11) DEFAULT NULL,
  `account` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `cost` decimal(20,2) DEFAULT NULL,
  `amount_receivable` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `amount_fees` double(20,2) DEFAULT NULL,
  `amount_effective` double(20,2) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `void_date` datetime DEFAULT NULL,
  `tax` decimal(20,2) DEFAULT NULL,
  `tax_code` varchar(32) DEFAULT NULL,
  `tax_inclusive` int(1) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1

CREATE TABLE `receipt_breakdown` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `receipt_id` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `account` varchar(128) DEFAULT NULL,
  `account_id` int(11) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `amount_fees` decimal(20,2) DEFAULT NULL,
  `amount_effective` double(20,2) DEFAULT NULL,
  `payment_method` varchar(128) DEFAULT NULL,
  `payment_reference` varchar(128) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `description` text,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `receipt_items` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `receipt_id` int(11) DEFAULT NULL,
  `account_id` int(11) DEFAULT NULL,
  `account` varchar(128) DEFAULT NULL,
  `po_id` int(11) DEFAULT NULL,
  `cn_id` int(11) DEFAULT NULL,
  `dn_id` int(11) DEFAULT NULL,
  `invoice_id` int(11) DEFAULT NULL,
  `asset_id` int(11) DEFAULT NULL,
  `reference` varchar(128) DEFAULT NULL,
  `contact_id` int(11) DEFAULT NULL,
  `contact` varchar(128) DEFAULT NULL,
  `description` text,
  `datetime` datetime DEFAULT NULL,
  `amount_receivable` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1

CREATE TABLE `receipts` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `datetime` datetime DEFAULT NULL,
  `room_number` int(11) DEFAULT NULL,
  `checkin_id` int(11) DEFAULT NULL,
  `payment_method` varchar(128) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `tax` decimal(20,2) DEFAULT NULL,
  `tax_percentage` varchar(128) DEFAULT NULL,
  `grand_total` decimal(20,2) DEFAULT NULL,
  `tendered` decimal(20,2) DEFAULT NULL,
  `change` decimal(20,2) DEFAULT NULL,
  `card_type` int(11) DEFAULT NULL,
  `reference_no` varchar(128) DEFAULT NULL,
  `staff_id` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10001 DEFAULT CHARSET=latin1

CREATE TABLE `reservation_notes` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `group` varchar(128) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `note` text,
  `added_by` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8

CREATE TABLE `reservations` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `prefix` varchar(128) DEFAULT NULL,
  `group` varchar(128) DEFAULT NULL,
  `type` varchar(128) DEFAULT NULL,
  `pets` varchar(255) DEFAULT NULL,
  `pet_names` text,
  `check_in` date DEFAULT NULL,
  `check_out` date DEFAULT NULL,
  `eci_time` varchar(255) DEFAULT NULL,
  `eco_time` varchar(255) DEFAULT NULL,
  `guest_id` int(11) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `discount` varchar(128) DEFAULT NULL,
  `discount_amount` decimal(20,2) DEFAULT NULL,
  `subtotal` decimal(20,2) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `paid_amount` double(20,2) DEFAULT NULL,
  `deposit_amount` decimal(20,2) DEFAULT NULL,
  `rate_type` varchar(120) DEFAULT NULL,
  `agent_type` varchar(120) DEFAULT NULL,
  `payment_method` varchar(128) DEFAULT NULL,
  `date_transfer` date DEFAULT NULL,
  `ref_no` varchar(100) DEFAULT NULL,
  `mid` varchar(100) DEFAULT NULL,
  `booking_id` varchar(150) DEFAULT NULL,
  `remarks` varchar(128) DEFAULT NULL,
  `room_id` int(11) DEFAULT NULL,
  `room_number` int(11) DEFAULT NULL,
  `cancel_reason` text,
  `category` varchar(255) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `created_by` int(11) DEFAULT NULL,
  `online_payment_id` varchar(255) DEFAULT NULL,
  `online_payment_data` text,
  `online_payment_completed` int(1) DEFAULT NULL,
  `seen` int(1) DEFAULT NULL,
  `channel` varchar(30) DEFAULT NULL,
  `peak` int(1) DEFAULT NULL,
  `reminder` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10032 DEFAULT CHARSET=latin1

CREATE TABLE `rooms` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `category` int(11) DEFAULT NULL,
  `floor` int(3) DEFAULT NULL,
  `number` varchar(128) DEFAULT NULL,
  `rsvn_id` int(11) DEFAULT NULL,
  `guest_id` int(11) DEFAULT NULL,
  `check_in` date DEFAULT NULL,
  `backend` int(1) DEFAULT NULL,
  `check_out` date DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `status` varchar(128) DEFAULT NULL,
  `modified_on` datetime DEFAULT NULL,
  `modified_by` varchar(128) DEFAULT NULL,
  `housekeeping_status` varchar(128) DEFAULT NULL,
  `maintenance_status` varchar(128) DEFAULT NULL,
  `wakeup_call` time DEFAULT '00:00:00',
  `remarks` text,
  `grooming` varchar(3) DEFAULT NULL,
  `pos_left` varchar(10) DEFAULT NULL,
  `pos_top` varchar(10) DEFAULT NULL,
  `sort_order` int(5) DEFAULT NULL,
  `time` time DEFAULT NULL,
  `days` varchar(50) DEFAULT NULL,
  `exclude` varchar(255) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=140 DEFAULT CHARSET=latin1

CREATE TABLE `signature` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `rsvn_id` int(11) DEFAULT NULL,
  `signature` longtext,
  `nric` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=239 DEFAULT CHARSET=utf8

CREATE TABLE `states` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `country` varchar(250) COLLATE latin1_general_ci DEFAULT NULL,
  `state` varchar(250) COLLATE latin1_general_ci DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=4413 DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci

CREATE TABLE `stock` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `item_id` int(11) DEFAULT NULL,
  `date` date DEFAULT NULL,
  `reference_no` varchar(128) DEFAULT NULL,
  `description` varchar(255) DEFAULT NULL,
  `qty` int(11) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8

CREATE TABLE `suppliers` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `name` varchar(255) DEFAULT NULL,
  `registration_number` varchar(255) DEFAULT NULL,
  `country` varchar(255) DEFAULT NULL,
  `contact_person` varchar(128) DEFAULT NULL,
  `contact_number` varchar(128) DEFAULT NULL,
  `address` text,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `modified_on` datetime DEFAULT NULL,
  `modified_by` varchar(128) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1

CREATE TABLE `transaction` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `guest_id` int(11) DEFAULT NULL,
  `group_id` varchar(255) DEFAULT NULL,
  `transaction_type` varchar(255) DEFAULT NULL,
  `payment_type` varchar(255) DEFAULT NULL,
  `description` varbinary(255) DEFAULT NULL,
  `rate_type` varchar(255) DEFAULT NULL,
  `agent_type` varchar(255) DEFAULT NULL,
  `amount` decimal(20,2) DEFAULT NULL,
  `used` decimal(20,2) DEFAULT NULL,
  `credit` int(1) DEFAULT NULL,
  `created_date` datetime DEFAULT NULL,
  `created_by` varchar(255) DEFAULT NULL,
  `void` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8

CREATE TABLE `user_sessions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `username` varchar(255) DEFAULT NULL,
  `token` varchar(255) DEFAULT NULL,
  `last_activity` datetime DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `expiry` datetime DEFAULT NULL,
  `user_agent` text,
  `status` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=33 DEFAULT CHARSET=utf8

CREATE TABLE `user_types` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `type` varchar(255) DEFAULT NULL,
  `permissions` longtext,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8

CREATE TABLE `users` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(128) DEFAULT NULL,
  `password` varchar(128) DEFAULT NULL,
  `type` varchar(128) DEFAULT NULL,
  `firstname` varchar(128) DEFAULT NULL,
  `lastname` varchar(128) DEFAULT NULL,
  `ip` varchar(15) DEFAULT NULL,
  `last_login` datetime DEFAULT NULL,
  `card_no` varchar(255) DEFAULT NULL,
  `session` varchar(128) DEFAULT NULL,
  `timeout` varchar(128) DEFAULT NULL,
  `branch` varchar(128) DEFAULT NULL,
  `dev` int(11) DEFAULT NULL,
  `active` int(1) DEFAULT NULL,
  `flag` int(1) DEFAULT NULL,
  `hash` varchar(255) DEFAULT NULL,
  `status` varchar(32) DEFAULT NULL,
  `added_on` datetime DEFAULT NULL,
  `added_by` varchar(128) DEFAULT NULL,
  `modified_on` datetime DEFAULT NULL,
  `modified_by` varchar(128) DEFAULT NULL,
  `main` int(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=10017 DEFAULT CHARSET=latin1

CREATE TABLE `wa_chats` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `no` varchar(20) DEFAULT NULL,
  `datetime` datetime DEFAULT NULL,
  `msg` longtext,
  `response` longtext,
  `raw` longtext,
  PRIMARY KEY (`id`),
  KEY `no` (`no`)
) ENGINE=InnoDB AUTO_INCREMENT=66 DEFAULT CHARSET=utf8

CREATE TABLE `wa_sessions` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT,
  `no` varchar(20) DEFAULT NULL,
  `status` varchar(20) DEFAULT NULL,
  `stage` int(11) DEFAULT NULL,
  `last_update` datetime DEFAULT NULL,
  `booking_info` longtext,
  `booking_group` varchar(20) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `no` (`no`)
) ENGINE=InnoDB AUTO_INCREMENT=16 DEFAULT CHARSET=utf8