CREATE TABLE `bill` (
  `id` int(10) unsigned NOT NULL default '0',
  `projectid` int(10) NOT NULL default '0',
  `description` text,
  `create_date` date NOT NULL default '0000-00-00',
  `userid` varchar(15) NOT NULL default '',
  `status` varchar(30) NOT NULL default '',
  `contact_choose` varchar(25) NOT NULL default '',
  `contact_type` varchar(25) NOT NULL default '0',
  `customer_info` text NOT NULL,
  `company_onbill` int(1) NOT NULL default '0',
  PRIMARY KEY  (`id`)
);

CREATE TABLE `bill_line` (
  `id` int(10) NOT NULL auto_increment,
  `billid` int(10) NOT NULL default '0',
  `description` text,
  `fixed_billed` decimal(13,2) default '0.00',
  `calcoption` varchar(10) default NULL,
  `shortdescription` varchar(25) default NULL,
  `description_final` text,
  PRIMARY KEY  (`id`)
);

CREATE TABLE `discount` (
  `id` int(10) NOT NULL auto_increment,
  `type` int(1) NOT NULL default '0',
  `amount` decimal(10,2) NOT NULL default '0.00',
  `bill_line_id` int(10) NOT NULL default '0',
  `apply_on` varchar(10) NOT NULL default '',
  PRIMARY KEY  (`id`),
  UNIQUE KEY `id` (`id`)
);

alter table costregistration add bill_line_id int(10);
alter table costregistration add  costamount decimal(10,2);

alter table hours add bill_line_id int(10);
alter table hours add registered int(1);
alter table hours add onbill int(1);
alter table hours add hour_rate decimal(13,5);
