
ALTER TABLE `facility` ADD `created_datetime` DATETIME NOT NULL ,
ADD `updated_datetime` DATETIME NOT NULL ,
ADD `created_by` INT NOT NULL ,
ADD `updated_by` INT NOT NULL ;

UPDATE `facility` SET `created_datetime` = '2015-06-12 12:00:00',
`updated_datetime` = '2015-06-12 12:00:00',
`created_by` = '1',
`updated_by` = '1';

ALTER TABLE `facility_item` ADD `created_datetime` DATETIME NOT NULL ,
ADD `updated_datetime` DATETIME NOT NULL ,
ADD `created_by` INT NOT NULL ,
ADD `updated_by` INT NOT NULL ;

UPDATE `facility_item` SET `created_datetime` = '2015-06-12 12:00:00',
`updated_datetime` = '2015-06-12 12:00:00',
`created_by` = '1',
`updated_by` = '1';

ALTER TABLE `facility_period` ADD `created_datetime` DATETIME NOT NULL ,
ADD `updated_datetime` DATETIME NOT NULL ,
ADD `created_by` INT NOT NULL ,
ADD `updated_by` INT NOT NULL ;

UPDATE `facility_period` SET `created_datetime` = '2015-06-12 12:00:00',
`updated_datetime` = '2015-06-12 12:00:00',
`created_by` = '1',
`updated_by` = '1';

ALTER TABLE `item` ADD `created_datetime` DATETIME NOT NULL ,
ADD `updated_datetime` DATETIME NOT NULL ,
ADD `created_by` INT NOT NULL ,
ADD `updated_by` INT NOT NULL ;

UPDATE `item` SET `created_datetime` = '2015-06-12 12:00:00',
`updated_datetime` = '2015-06-12 12:00:00',
`created_by` = '1',
`updated_by` = '1';

ALTER TABLE `general_message` ADD `status` VARCHAR( 1 ) NOT NULL DEFAULT 'A';

CREATE TABLE IF NOT EXISTS `booking` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `condo_id` int(11) NOT NULL,
  `user_id` int(11) NOT NULL,
  `condo_unit_id` int(11) NOT NULL,
  `booking_date` date NOT NULL,
  `booking_no` varchar(50) NOT NULL,
  `facility_id` int(11) NOT NULL,
  `purpose` varchar(255) NOT NULL,
  `deposit` decimal(10,2) DEFAULT NULL,
  `rental` decimal(10,2) DEFAULT NULL,
  `total` decimal(10,2) DEFAULT NULL,
  `no_of_guest` int(11) DEFAULT NULL,
  `salutation_id` int(11) DEFAULT NULL,
  `name` varchar(255) NOT NULL,
  `contact_no` varchar(50) DEFAULT NULL,
  `remark` text,
  `remark_office` text,
  `payment_due_date` date DEFAULT NULL,
  `deposit_payment_mode` int(1) NOT NULL DEFAULT '0',
  `deposit_cheque_no` varchar(25) DEFAULT NULL,
  `deposit_ref_no` varchar(25) DEFAULT NULL,
  `rental_payment_mode` int(1) NOT NULL DEFAULT '0',
  `rental_cheque_no` varchar(25) DEFAULT NULL,
  `rental_ref_no` varchar(25) DEFAULT NULL,
  `payment_made_by_name` varchar(50) DEFAULT NULL,
  `refund_amount` decimal(10,2) DEFAULT NULL,
  `refunded_to_by_name` varchar(50) DEFAULT NULL,
  `forfeiture` decimal(10,2) DEFAULT NULL,
  `approved_by` int(11) DEFAULT NULL,
  `approved_datetime` datetime DEFAULT NULL,
  `disapproved_by` int(11) DEFAULT NULL,
  `disapproved_datetime` datetime DEFAULT NULL,
  `cancelled_by` int(11) DEFAULT NULL,
  `cancelled_datetime` datetime DEFAULT NULL,
  `payment_received_by` int(11) DEFAULT NULL,
  `payment_received_datetime` datetime DEFAULT NULL,
  `refunded_by` int(11) DEFAULT NULL,
  `refunded_datetime` datetime DEFAULT NULL,
  `status` varchar(1) NOT NULL DEFAULT 'P',
  `created_datetime` datetime NOT NULL,
  `updated_datetime` datetime NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `booking_period` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `booking_id` int(11) NOT NULL,
  `facility_period_id` int(11) NOT NULL,
  `booking_date` date NOT NULL,
  `created_datetime` datetime NOT NULL,
  `updated_datetime` datetime NOT NULL,
  `created_by` int(11) NOT NULL,
  `updated_by` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

ALTER TABLE `condo` ADD `booking_terms_conditions` TEXT NULL AFTER `house_rules` ;

UPDATE `residenz`.`condo` SET `booking_terms_conditions` = "<h3>Terms &amp; Conditions</h3>

<hr />
<ul>
	<li>1. I, We have read the House Rules which have been enforced by the management and agree to abide by the conditions for the use of the facilities.</li>
	<li>2. I/We agree to indemnify the Management of any loses damages and breakages within the premises due to my /our negligence or will full misconduct and /or that of my/our invited guests and contractor. I/We will ensure that the premises will be cleaned and all debris and other items brought into the premises will be removed immediately upon completion of the function.</li>
	<li>3. Kindly please take note that the Function can only be held 10am to 10pm.</li>
	<li>4. I/We will submit the list of our guest to the management 1 day in advance before the actual function day.</li>
	<li>5. The management&#39;s decision on the booking of the facility is final and any dispute will not be entertained.</li>
	<li>6. Only booking&#39;s made with full payment in Advance + Deposit is considered valid.</li>
	<li>7. Cancellation less than 24 hours from the booking date - 50% refund</li>
	<li>8. Cancellation on the said date - NO REFUND</li>
	<li>9. Maximum 50 persons for family function only at Function Hall and Barbeque are. (Please attach your visitors listing for security clearance)</li>
	<li>10. Resident with maintenance fee in default to make account current before booking facility.</li>
	<li>11. The cost of cleaning and additional charges, if any will be deducted from the deposit and the balance will be refunded to the resident who made the reservation. If the cost exceed the deposit, the resident host shall be charged that amount.</li>
	<li>12. The rental charges and the security deposit will be given to the Management prior to the function.</li>
</ul>
" WHERE `condo`.`id` = 1;

