CREATE TABLE mgw_contacts_mianzi (
  contact int(11) NOT NULL default '0',
  mianzi int(11) NOT NULL default '0',
  favorite1 varchar(255) default NULL,
  favorite2 varchar(255) default NULL,
  favorite3 varchar(255) default NULL,
  dislike1 varchar(255) default NULL,
  dislike2 varchar(255) default NULL,
  dislike3 varchar(255) default NULL,
  note text,
  lu_user int(11) default NULL,
  lu_date timestamp(14) NOT NULL,
  PRIMARY KEY  (contact)
) TYPE=MyISAM;


CREATE TABLE mgw_guanxi (
  contact int(11) NOT NULL default '0',
  opportunity int(11) NOT NULL default '0',
  owner int(11) NOT NULL default '0',
  confidence int(11) default '0',
  description text,
  ispublic int(11) default '0',
  lu_user int(11) default '0',
  lu_date timestamp(14) NOT NULL,
  PRIMARY KEY  (contact,opportunity)
) TYPE=MyISAM;


CREATE TABLE mgw_monitoring_history (
  id int(11) NOT NULL default '0',
  opportunity_id int(11) NOT NULL default '0',
  date timestamp(14) NOT NULL,
  contacted_person text,
  whatsdone text,
  comment text,
  userid int(11) default NULL,
  lu_user int(11) default NULL,
  lu_date timestamp(14) NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;


CREATE TABLE mgw_opportunity (
  id int(11) NOT NULL default '0',
  ownerid int(11) default '0',
  title varchar(250) default NULL,
  description text,
  accountid int(11) NOT NULL default '0',
  contactid int(11) NOT NULL default '0',
  salesmanagerid int(11) NOT NULL default '0',
  entrydate date default NULL,
  closedate date default NULL,
  salesstageid int(11) NOT NULL default '0',
  potential_revenue varchar(11) default '0',
  probability varchar(4) default '0',
  ispublic int(11) default '0',
  lu_user int(11) default '0',
  lu_date timestamp(14) NOT NULL,
  PRIMARY KEY  (id)
) TYPE=MyISAM;

CREATE TABLE mgw_mianzi (
  id tinyint(4) NOT NULL default '0',
  title varchar(128) NOT NULL default '0',
  PRIMARY KEY  (id)
) TYPE=MyISAM;


CREATE TABLE mgw_salesstage (
  id tinyint(4) NOT NULL default '0',
  title varchar(128) NOT NULL default '0',
  PRIMARY KEY  (id)
) TYPE=MyISAM;

INSERT INTO mgw_mianzi VALUES (1, 'URGENT: Need to be improved');
INSERT INTO mgw_mianzi VALUES (2, 'SERIOUS WARNING');
INSERT INTO mgw_mianzi VALUES (3, 'WARNING');
INSERT INTO mgw_mianzi VALUES (4, 'UNCERTAIN');
INSERT INTO mgw_mianzi VALUES (5, 'UNSTABLE');
INSERT INTO mgw_mianzi VALUES (6, 'STATBLE');
INSERT INTO mgw_mianzi VALUES (7, 'SATISFACTORY');
INSERT INTO mgw_mianzi VALUES (8, 'GOOD');
INSERT INTO mgw_mianzi VALUES (9, 'EXCELLENT');

INSERT INTO mgw_salesstage VALUES (1, 'Initial Contact');
INSERT INTO mgw_salesstage VALUES (2, 'Provide Documentation');
INSERT INTO mgw_salesstage VALUES (3, 'Demonstration');
INSERT INTO mgw_salesstage VALUES (4, 'Client Needs and Wants');
INSERT INTO mgw_salesstage VALUES (5, 'Making Offer');
INSERT INTO mgw_salesstage VALUES (6, 'Initial Negociation');
INSERT INTO mgw_salesstage VALUES (7, 'Official Negociation');
INSERT INTO mgw_salesstage VALUES (8, 'Final Negociation');
INSERT INTO mgw_salesstage VALUES (9, 'Contract Signature');
INSERT INTO mgw_salesstage VALUES (10, 'Installation and Maintainance');
