Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- phpMyAdmin SQL Dump
- -- version 4.7.4
- -- https://www.phpmyadmin.net/
- --
- -- Host: localhost
- -- Generation Time: Sep 29, 2017 at 10:12 AM
- -- Server version: 10.1.26-MariaDB
- -- PHP Version: 7.0.23
- SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
- SET AUTOCOMMIT = 0;
- START TRANSACTION;
- SET time_zone = "+00:00";
- /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
- /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
- /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
- /*!40101 SET NAMES utf8mb4 */;
- --
- -- Database: `crm_db`
- --
- DELIMITER $$
- --
- -- Procedures
- --
- DROP PROCEDURE IF EXISTS `build_email_list`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `build_email_list` (INOUT `email_list` VARCHAR(4000)) BEGIN
- DECLARE v_finished INTEGER DEFAULT 0;
- DECLARE v_email varchar(100) DEFAULT "";
- DEClARE email_cursor CURSOR FOR
- SELECT invoice_id FROM crm_invoices;
- DECLARE CONTINUE HANDLER
- FOR NOT FOUND SET v_finished = 1;
- OPEN email_cursor;
- get_email: LOOP
- FETCH email_cursor INTO v_email;
- IF v_finished = 1 THEN
- LEAVE get_email;
- END IF;
- SET email_list = CONCAT(v_email,";",email_list);
- END LOOP get_email;
- CLOSE email_cursor;
- END$$
- DROP PROCEDURE IF EXISTS `coba`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `coba` () NO SQL
- BEGIN
- SET @date_param = (SELECT DATE_FORMAT(CURDATE(), "%m%y"));
- SET @inv_code = (SELECT invoice_code FROM crm_invoice_details WHERE invoice_code LIKE CONCAT('%',@date_param,'%') ORDER BY invoice_detail_id DESC LIMIT 1);
- IF @inv_code IS null THEN
- SET @new_inv_code = CONCAT('INV-', @date_param, '00001');
- ELSE
- SET @new_numb_code = (SELECT SUBSTRING_INDEX(@inv_code, '-', -1));
- SET @new_code = @new_numb_code + 1;
- SET @sub_code = substring(@new_code, -5);
- SET @new_inv_code = CONCAT('INV-', @date_param, @sub_code);
- END IF;
- SELECT @new_inv_code;
- END$$
- DROP PROCEDURE IF EXISTS `sp_campaign_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_campaign_insert` (IN `name` VARCHAR(100), IN `description` TEXT, IN `start_date` DATE, IN `end_date` DATE, IN `status` ENUM('0','1'), IN `number` INT, IN `percentage_response` DOUBLE, IN `budget_cost_currency` ENUM('1','2'), IN `budget_cost` DOUBLE, IN `actual_cost_currency` ENUM('1','2'), IN `actual_cost` DOUBLE, IN `expected_revenue_currency` ENUM('1','2'), IN `expected_revenue` DOUBLE, IN `u_created` VARCHAR(100), IN `date_created` DATETIME, OUT `c_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT product_id AS p_id FROM crm_products where product_id in(', product_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_campaigns`(`campaign_name`, `campaign_description`, `campaign_start_date`, `campaign_end_date`, `campaign_status`, `campaign_number`, `campaign_percentage_response`, `campaign_budget_cost_currency`, `campaign_budget_cost`, `campaign_actual_cost_currency`, `campaign_actual_cost`, `campaign_expected_revenue_currency`, `campaign_expected_revenue`, `user_created`, `user_created_date`) VALUES (name, description, start_date, end_date, status, number, percentage_response, budget_cost_currency, budget_cost, actual_cost_currency, actual_cost, expected_revenue_currency, expected_revenue, u_created, date_created);
- SET c_id = LAST_INSERT_ID();
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_company_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_company_insert` (IN `code` VARCHAR(50), IN `name` VARCHAR(200), IN `parent` INT, IN `office_phone` VARCHAR(30), IN `industry` INT, IN `email` VARCHAR(100), IN `fax` VARCHAR(30), IN `employee` INT, IN `revenue` DOUBLE, IN `website` VARCHAR(100), IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `billing_address1` VARCHAR(255), IN `billing_address2` VARCHAR(255), IN `billing_city` VARCHAR(100), IN `billing_state` VARCHAR(100), IN `billing_zip_code` VARCHAR(10), IN `billing_country` VARCHAR(50), IN `right_permission` ENUM('1','2','3'), IN `u_created` VARCHAR(100), IN `date_created` DATETIME, IN `groups` INT, IN `customer` ENUM('0','1'), IN `user_list` VARCHAR(300), OUT `sukses` INT, OUT `company_id` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_companies`(`customer_code`, `company_name`, `company_parent`, `company_office_phone`, `company_industry`, `company_email`, `company_fax`, `company_employee`, `company_revenue`, `company_website`, `company_address1`, `company_address2`, `company_city`, `company_state`, `company_zip_code`, `company_country`, `company_billing_address1`, `company_billing_address2`, `company_billing_city`, `company_billing_state`, `company_billing_zip_code`, `company_billing_country`, `company_right_permission`, `user_created`, `user_created_date`, `company_groups`, `company_customer`) VALUES
- (code, name, parent, office_phone, industry, email, fax, employee, revenue, website, address1, address2, city, state, zip_code, country, billing_address1, billing_address2, billing_city, billing_state, billing_zip_code, billing_country, right_permission, u_created, date_created, groups, customer);
- SET @l_id = LAST_INSERT_ID();
- SET company_id = LAST_INSERT_ID();
- INSERT INTO `crm_users_companies`(`company_id`,`user_id`)
- SELECT @l_id,u_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_company_meeting_delete`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_company_meeting_delete` (IN `meet_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- START TRANSACTION;
- DELETE FROM company_meeting_users WHERE company_meeting_id = meet_id;
- DELETE FROM company_meeting WHERE company_meeting_id = meet_id;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_company_meeting_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_company_meeting_insert` (IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `company_meeting`(`company_id`, `company_meeting_name`, `company_meeting_location`, `company_meeting_start_date`, `company_meeting_end_date`, `company_meeting_description`, `company_meeting_date`, `company_meeting_user`) VALUES (l_id,name,location,start_date,end_date,description,date,user);
- SET @meet_id = LAST_INSERT_ID();
- INSERT INTO `company_meeting_users`(`company_meeting_id`,`company_user_id`)
- SELECT @meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_company_meeting_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_company_meeting_update` (IN `meet_id` INT, IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `company_meeting` SET
- `company_meeting_name`=name,
- `company_meeting_location`=location,
- `company_meeting_start_date`=start_date,
- `company_meeting_end_date`=end_date,
- `company_meeting_description`=description,
- `company_meeting_date`=date,
- `company_meeting_user`=user,
- `company_id`=l_id
- WHERE `company_meeting_id`=meet_id;
- delete from company_meeting_users where company_meeting_id=meet_id;
- REPLACE INTO `company_meeting_users`(`company_meeting_id`,`company_user_id`)
- SELECT meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_company_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_company_update` (IN `c_id` INT, IN `code` VARCHAR(50), IN `name` VARCHAR(200), IN `parent` INT, IN `office_phone` VARCHAR(30), IN `industry` INT, IN `email` VARCHAR(100), IN `fax` VARCHAR(30), IN `employee` INT, IN `revenue` DOUBLE, IN `website` VARCHAR(100), IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `billing_address1` VARCHAR(255), IN `billing_address2` VARCHAR(255), IN `billing_city` VARCHAR(100), IN `billing_state` VARCHAR(100), IN `billing_zip_code` VARCHAR(10), IN `billing_country` VARCHAR(50), IN `right_permission` ENUM('1','2','3'), IN `groups` INT, IN `customer` ENUM('0','1'), IN `u_modified` VARCHAR(100), IN `date_modified` DATETIME, IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `crm_companies` SET
- `customer_code`=code,
- `company_name`=name,
- `company_parent`=parent,
- `company_office_phone`=office_phone,
- `company_industry`=industry,
- `company_email`=email,
- `company_fax`=fax,
- `company_employee`=employee,
- `company_revenue`=revenue,
- `company_website`=website,
- `company_address1`=address1,
- `company_address2`=address2,
- `company_city`=city,
- `company_state`=state,
- `company_zip_code`=zip_code,
- `company_country`=country,
- `company_billing_address1`=billing_address1,
- `company_billing_address2`=billing_address2,
- `company_billing_city`=billing_city,
- `company_billing_state`=billing_state,
- `company_billing_zip_code`=billing_zip_code,
- `company_billing_country`=billing_country,
- `company_right_permission`=right_permission,
- `user_modified`=u_modified,
- `user_modified_date`=date_modified,
- `company_groups`=groups,
- `company_customer`=customer
- WHERE `company_id`=c_id;
- delete from crm_users_companies where company_id=c_id;
- REPLACE INTO `crm_users_companies`(`company_id`,`user_id`)
- SELECT c_id,u_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_contact_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_contact_insert` (IN `salutation` ENUM('1','2','3'), IN `first_name` VARCHAR(100), IN `last_name` VARCHAR(100), IN `job_title` VARCHAR(100), IN `company` VARCHAR(100), IN `department` VARCHAR(100), IN `email` VARCHAR(100), IN `office_phone` VARCHAR(30), IN `mobile_phone` VARCHAR(30), IN `industry` INT, IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `sources` INT, IN `photo` VARCHAR(100), IN `comp_id` INT, IN `right_permission` ENUM('1','2','3'), IN `groups` INT, IN `user_list` VARCHAR(300), OUT `sukses` INT, OUT `contact_id` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_peoples`(`people_salutation`, `people_first_name`, `people_last_name`, `people_job_title`, `people_company`, `people_department`, `people_email`, `people_office_phone`, `people_mobile_phone`, `people_industry`, `people_address1`, `people_address2`, `people_city`, `people_state`, `people_zip_code`, `people_country`, `people_source`, `people_photo`, `people_status`) VALUES (salutation, first_name, last_name, job_title, company, department, email, office_phone, mobile_phone, industry, address1, address2, city, state, zip_code, country, sources, photo, '2');
- SET @p_id = LAST_INSERT_ID();
- INSERT INTO `crm_contacts`(`people_id`, `contact_right_permission`, `contact_groups`, `company_id`) VALUES (@p_id, right_permission, groups, comp_id);
- SET @l_id = LAST_INSERT_ID();
- INSERT INTO `crm_users_contacts`(`contact_id`,`user_id`)
- SELECT @l_id,u_id from temp_cursor_table;
- SET contact_id = @l_id;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_contact_meeting_delete`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_contact_meeting_delete` (IN `meet_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- START TRANSACTION;
- DELETE FROM contact_meeting_users WHERE contact_meeting_id = meet_id;
- DELETE FROM contact_meeting WHERE contact_meeting_id = meet_id;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_contact_meeting_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_contact_meeting_insert` (IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `contact_meeting`(`contact_id`, `contact_meeting_name`, `contact_meeting_location`, `contact_meeting_start_date`, `contact_meeting_end_date`, `contact_meeting_description`, `contact_meeting_date`, `contact_meeting_user`) VALUES (l_id,name,location,start_date,end_date,description,date,user);
- SET @meet_id = LAST_INSERT_ID();
- INSERT INTO `contact_meeting_users`(`contact_meeting_id`,`contact_user_id`)
- SELECT @meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_contact_meeting_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_contact_meeting_update` (IN `meet_id` INT, IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `contact_meeting` SET
- `contact_meeting_name`=name,
- `contact_meeting_location`=location,
- `contact_meeting_start_date`=start_date,
- `contact_meeting_end_date`=end_date,
- `contact_meeting_description`=description,
- `contact_meeting_date`=date,
- `contact_meeting_user`=user,
- `contact_id`=l_id
- WHERE `contact_meeting_id`=meet_id;
- delete from contact_meeting_users where contact_meeting_id=meet_id;
- REPLACE INTO `contact_meeting_users`(`contact_meeting_id`,`contact_user_id`)
- SELECT meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_contact_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_contact_update` (IN `l_id` INT, IN `salutation` ENUM('1','2','3'), IN `first_name` VARCHAR(100), IN `last_name` VARCHAR(100), IN `job_title` VARCHAR(100), IN `company` VARCHAR(100), IN `department` VARCHAR(100), IN `email` VARCHAR(100), IN `office_phone` VARCHAR(30), IN `mobile_phone` VARCHAR(30), IN `industry` INT, IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `sources` INT, IN `photo` VARCHAR(100), IN `comp_id` INT, IN `right_permission` ENUM('1','2','3'), IN `groups` INT, IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `crm_peoples` a JOIN crm_contacts b ON a.people_id=b.people_id
- SET
- a.people_salutation=salutation,
- a.people_first_name=first_name,
- a.people_last_name=last_name,
- a.people_job_title=job_title,
- a.people_company=company,
- a.people_department=department,
- a.people_email=email,
- a.people_office_phone=office_phone,
- a.people_mobile_phone=mobile_phone,
- a.people_industry=industry,
- a.people_address1=address1,
- a.people_address2=address2,
- a.people_city=city,
- a.people_state=state,
- a.people_zip_code=zip_code,
- a.people_country=country,
- a.people_source=sources,
- a.people_photo=photo,
- b.contact_right_permission=right_permission,
- b.contact_groups=groups,
- b.company_id=comp_id
- WHERE b.contact_id = l_id;
- delete from crm_users_contacts where contact_id = l_id;
- REPLACE INTO `crm_users_contacts`(`contact_id`,`user_id`)
- SELECT l_id,u_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_convert_lead`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_convert_lead` (IN `l_id` INT, IN `comp_id` INT, IN `skip` ENUM('0','1'), IN `c_code` VARCHAR(50), IN `c_parent` INT, IN `c_office_phone` VARCHAR(30), IN `c_industry` INT, IN `c_email` VARCHAR(100), IN `c_fax` VARCHAR(30), IN `c_employee` INT, IN `c_revenue` DOUBLE, IN `c_website` VARCHAR(100), IN `c_address1` VARCHAR(255), IN `c_address2` VARCHAR(255), IN `c_city` VARCHAR(100), IN `c_state` VARCHAR(100), IN `c_zip_code` VARCHAR(10), IN `c_country` VARCHAR(50), IN `c_billing_address1` VARCHAR(255), IN `c_billing_address2` VARCHAR(255), IN `c_billing_city` VARCHAR(100), IN `c_billing_state` VARCHAR(100), IN `c_billing_zip_code` VARCHAR(10), IN `c_billing_country` VARCHAR(50), IN `c_right_permission` ENUM('1','2','3'), IN `c_u_created` VARCHAR(100), IN `c_date_created` DATETIME, IN `c_groups` INT, IN `c_customer` ENUM('0','1'), IN `o_code` VARCHAR(100), IN `o_name` VARCHAR(45), IN `o_stage_id` INT, IN `o_amount` DOUBLE, IN `o_expected_closing_date` DATETIME, IN `o_service` ENUM('1','2'), IN `o_campaign_id` INT, IN `product_list` VARCHAR(300), IN `uo_user_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE continue handler for not found set sukses = 0;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- SELECT a.lead_status,b.people_company into @l_status, @company from crm_leads a JOIN crm_peoples b ON a.people_id=b.people_id WHERE a.lead_id=l_id;
- IF comp_id is null THEN
- SET @comp_id = null;
- ELSE
- SET @comp_id = comp_id;
- END IF;
- IF @l_status= 1 THEN
- IF @comp_id IS null THEN
- INSERT INTO `crm_companies`(`customer_code`, `company_name`, `company_parent`, `company_office_phone`, `company_industry`,`company_email`, `company_fax`, `company_employee`, `company_revenue`, `company_website`, `company_address1`, `company_address2`, `company_city`, `company_state`, `company_zip_code`, `company_country`, `company_billing_address1`, `company_billing_address2`, `company_billing_city`, `company_billing_state`, `company_billing_zip_code`, `company_billing_country`, `company_right_permission`, `user_created`, `user_created_date`, `company_groups`, `company_customer`) VALUES
- (c_code, @company, c_parent, c_office_phone, c_industry, c_email, c_fax, c_employee, c_revenue, c_website, c_address1, c_address2, c_city, c_state, c_zip_code, c_country, c_billing_address1, c_billing_address2, c_billing_city, c_billing_state, c_billing_zip_code, c_billing_country, c_right_permission, c_u_created, c_date_created, c_groups, c_customer);
- set @comp_id = LAST_INSERT_ID();
- insert into crm_users_companies(company_id, user_id)
- SELECT @comp_id, user_id from crm_users_leads
- where lead_id = l_id;
- END IF;
- insert into crm_contacts(company_id,people_id,contact_right_permission,contact_groups)
- SELECT @comp_id,people_id,lead_right_permission,lead_groups from crm_leads where lead_id = l_id;
- set @c_id = LAST_INSERT_ID();
- UPDATE crm_leads set lead_status = '2'
- where lead_id = l_id;
- insert into crm_users_contacts(contact_id, user_id) VALUES (@c_id, uo_user_id);
- IF skip='0' THEN
- drop temporary table if exists temp_cursor_table;
- CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table (A Int, B Double);
- set @temp = concat('INSERT INTO temp_cursor_table (A,B) VALUES ', product_list);
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_opportunities`(`opportunity_code`,`opportunity_name`, `opportunity_stage_id`, `company_id`, `opportunity_amount`, `opportunity_expected_closing_date`, `opportunity_service`, `opportunity_campaign_id`) VALUES (o_code, o_name, o_stage_id, @comp_id, o_amount, o_expected_closing_date, o_service, o_campaign_id);
- SET @o_id = LAST_INSERT_ID();
- INSERT INTO crm_users_opportunities (user_id, opportunity_id) VALUES (uo_user_id, @o_id);
- INSERT INTO crm_opportunities_contacts(opportunity_id,contact_id) VALUES (@o_id,@c_id);
- INSERT INTO `crm_opportunities_products`(`opportunity_id`, `product_id`, `price`)
- SELECT @o_id, A, B from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- END IF;
- END if;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_delete`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_delete` (IN `l_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- delete from crm_users_leads where lead_id = l_id;
- DELETE crm_peoples, crm_leads
- FROM crm_peoples
- INNER JOIN crm_leads ON crm_peoples.people_id=crm_leads.people_id
- WHERE crm_leads.lead_id=l_id;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_insert` (IN `salutation` ENUM('1','2','3'), IN `first_name` VARCHAR(100), IN `last_name` VARCHAR(100), IN `job_title` VARCHAR(100), IN `company` VARCHAR(100), IN `department` VARCHAR(100), IN `email` VARCHAR(100), IN `office_phone` VARCHAR(30), IN `mobile_phone` VARCHAR(30), IN `industry` INT, IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `sources` INT, IN `photo` VARCHAR(100), IN `stat` ENUM('1','2'), IN `label` INT, IN `right_permission` ENUM('1','2','3'), IN `groups` INT, IN `u_created` VARCHAR(100), IN `date_created` DATETIME, IN `user_list` VARCHAR(300), OUT `sukses` INT, OUT `l_id` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_peoples`(`people_salutation`, `people_first_name`, `people_last_name`, `people_job_title`, `people_company`, `people_department`, `people_email`, `people_office_phone`, `people_mobile_phone`, `people_industry`, `people_address1`, `people_address2`, `people_city`, `people_state`, `people_zip_code`, `people_country`, `people_source`, `people_photo`, `people_status`) VALUES (salutation, first_name, last_name, job_title, company, department, email, office_phone, mobile_phone, industry, address1, address2, city, state, zip_code, country, sources, photo, stat);
- SET @p_id = LAST_INSERT_ID();
- INSERT INTO `crm_leads`(`lead_label`, `people_id`, `lead_right_permission`, `lead_groups`, `user_created`, `user_created_date`) VALUES (label, @p_id, right_permission, groups, u_created, date_created);
- SET l_id = LAST_INSERT_ID();
- INSERT INTO `crm_users_leads`(`lead_id`,`user_id`)
- SELECT l_id,u_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_meeting_delete`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_meeting_delete` (IN `meet_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- START TRANSACTION;
- DELETE FROM lead_meeting_users WHERE lead_meeting_id = meet_id;
- DELETE FROM lead_meeting WHERE lead_meeting_id = meet_id;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_meeting_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_meeting_insert` (IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `lead_meeting`(`lead_id`, `lead_meeting_name`, `lead_meeting_location`, `lead_meeting_start_date`, `lead_meeting_end_date`, `lead_meeting_description`, `lead_meeting_date`, `lead_meeting_user`) VALUES (l_id,name,location,start_date,end_date,description,date,user);
- SET @meet_id = LAST_INSERT_ID();
- INSERT INTO `lead_meeting_users`(`lead_meeting_id`,`lead_user_id`)
- SELECT @meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_meeting_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_meeting_update` (IN `meet_id` INT, IN `l_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `lead_meeting` SET
- `lead_meeting_name`=name,
- `lead_meeting_location`=location,
- `lead_meeting_start_date`=start_date,
- `lead_meeting_end_date`=end_date,
- `lead_meeting_description`=description,
- `lead_meeting_date`=date,
- `lead_meeting_user`=user,
- `lead_id`=l_id
- WHERE `lead_meeting_id`=meet_id;
- delete from lead_meeting_users where lead_meeting_id=meet_id;
- REPLACE INTO `lead_meeting_users`(`lead_meeting_id`,`lead_user_id`)
- SELECT meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_lead_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_lead_update` (IN `l_id` INT, IN `salutation` ENUM('1','2','3'), IN `first_name` VARCHAR(100), IN `last_name` VARCHAR(100), IN `job_title` VARCHAR(100), IN `company` VARCHAR(100), IN `department` VARCHAR(100), IN `email` VARCHAR(100), IN `office_phone` VARCHAR(30), IN `mobile_phone` VARCHAR(30), IN `industry` INT, IN `address1` VARCHAR(255), IN `address2` VARCHAR(255), IN `city` VARCHAR(100), IN `state` VARCHAR(100), IN `zip_code` VARCHAR(10), IN `country` VARCHAR(50), IN `sources` INT, IN `photo` VARCHAR(100), IN `status_p` ENUM('1','2'), IN `status_l` ENUM('1','2','3'), IN `label` INT, IN `right_permission` ENUM('1','2','3'), IN `groups` INT, IN `u_modified` VARCHAR(100), IN `date_modified` DATETIME, IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id AS u_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `crm_peoples` a JOIN crm_leads b ON a.people_id=b.people_id
- SET
- a.people_salutation=salutation,
- a.people_first_name=first_name,
- a.people_last_name=last_name,
- a.people_job_title=job_title,
- a.people_company=company,
- a.people_department=department,
- a.people_email=email,
- a.people_office_phone=office_phone,
- a.people_mobile_phone=mobile_phone,
- a.people_industry=industry,
- a.people_address1=address1,
- a.people_address2=address2,
- a.people_city=city,
- a.people_state=state,
- a.people_zip_code=zip_code,
- a.people_country=country,
- a.people_source=sources,
- a.people_photo=photo,
- a.people_status = status_p,
- b.lead_label=label,
- b.lead_right_permission=right_permission,
- b.lead_groups=groups,
- b.lead_status=status_l,
- b.user_modified=u_modified,
- b.user_modified_date=date_modified
- WHERE b.lead_id = l_id;
- delete from crm_users_leads where lead_id = l_id;
- REPLACE INTO `crm_users_leads`(`lead_id`,`user_id`)
- SELECT l_id,u_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_opportunity_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_opportunity_insert` (IN `code` VARCHAR(100), IN `name` VARCHAR(45), IN `stage_id` INT, IN `comp_id` INT, IN `amount` DOUBLE, IN `expected_closing_date` DATETIME, IN `service` ENUM('1','2'), IN `campaign_id` INT, IN `product_list` VARCHAR(300), IN `contact_list` VARCHAR(300), IN `user_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table (A Int, B Double);
- set @temp = concat('INSERT INTO temp_cursor_table (A,B) VALUES ', product_list);
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- drop temporary table if exists temp_contact;
- set @temp1 = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_contact AS (SELECT contact_id AS c_id FROM crm_contacts where contact_id in(', contact_list ,') )');
- prepare pst from @temp1;
- execute pst;
- drop prepare pst;
- INSERT INTO `crm_opportunities`(`opportunity_code`, `opportunity_name`, `opportunity_stage_id`, `company_id`, `opportunity_amount`, `opportunity_expected_closing_date`, `opportunity_service`, `opportunity_campaign_id`) VALUES (code, name, stage_id, comp_id, amount, expected_closing_date, service, campaign_id);
- SET @o_id = LAST_INSERT_ID();
- INSERT INTO crm_opportunities_contacts(opportunity_id,contact_id)
- SELECT @o_id,c_id from temp_contact;
- INSERT INTO `crm_opportunities_products`(`opportunity_id`, `product_id`, `price`)
- SELECT @o_id, A, B from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- SELECT @o_id,p_id from temp_cursor_table;
- INSERT INTO `crm_users_opportunities`(`user_id`,`opportunity_id`) VALUES (user_id, @o_id);
- drop temporary table if exists temp_cursor_table;
- drop temporary table if exists temp_contact;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_opportunity_meeting_delete`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_opportunity_meeting_delete` (IN `meet_id` INT, OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- START TRANSACTION;
- DELETE FROM opportunity_meeting_users WHERE opportunity_meeting_id = meet_id;
- DELETE FROM opportunity_meeting WHERE opportunity_meeting_id = meet_id;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_opportunity_meeting_insert`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_opportunity_meeting_insert` (IN `o_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- INSERT INTO `opportunity_meeting`(`opportunity_id`, `opportunity_meeting_name`, `opportunity_meeting_location`, `opportunity_meeting_start_date`, `opportunity_meeting_end_date`, `opportunity_meeting_description`, `opportunity_meeting_date`, `opportunity_meeting_user`) VALUES (o_id,name,location,start_date,end_date,description,date,user);
- SET @meet_id = LAST_INSERT_ID();
- INSERT INTO `opportunity_meeting_users`(`opportunity_meeting_id`,`opportunity_user_id`)
- SELECT @meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_opportunity_meeting_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_opportunity_meeting_update` (IN `meet_id` INT, IN `o_id` INT, IN `name` VARCHAR(100), IN `location` VARCHAR(255), IN `start_date` DATETIME, IN `end_date` DATETIME, IN `description` TEXT, IN `date` DATETIME, IN `user` VARCHAR(100), IN `user_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- set @temp = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table AS (SELECT user_id FROM crm_users where user_id in(', user_list ,') )');
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- UPDATE `opportunity_meeting` SET
- `opportunity_meeting_name`=name,
- `opportunity_meeting_location`=location,
- `opportunity_meeting_start_date`=start_date,
- `opportunity_meeting_end_date`=end_date,
- `opportunity_meeting_description`=description,
- `opportunity_meeting_date`=date,
- `opportunity_meeting_user`=user,
- `opportunity_id`=o_id
- WHERE `opportunity_meeting_id`=meet_id;
- delete from opportunity_meeting_users where opportunity_meeting_id=meet_id;
- REPLACE INTO `opportunity_meeting_users`(`opportunity_meeting_id`,`opportunity_user_id`)
- SELECT meet_id,user_id from temp_cursor_table;
- drop temporary table if exists temp_cursor_table;
- set sukses=1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_opportunity_update`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_opportunity_update` (IN `o_id` INT, IN `name` VARCHAR(45), IN `stage_id` INT, IN `comp_id` INT, IN `amount` DOUBLE, IN `expected_closing_date` DATETIME, IN `service` ENUM('1','2'), IN `campaign_id` INT, IN `product_list` VARCHAR(300), IN `contact_list` VARCHAR(300), OUT `sukses` INT) NO SQL
- BEGIN
- DECLARE exit handler for sqlexception
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("ERROR ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- DECLARE exit handler for sqlwarning
- BEGIN
- GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE,
- @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT;
- SET @full_error = CONCAT("Warning ", @errno, " (", @sqlstate, "): ", @text);
- SELECT @full_error;
- SET sukses=0;
- ROLLBACK;
- END;
- drop temporary table if exists temp_cursor_table;
- CREATE TEMPORARY TABLE IF NOT EXISTS temp_cursor_table (A Int, B Double);
- set @temp = concat('INSERT INTO temp_cursor_table (A,B) VALUES ', product_list);
- prepare pst from @temp;
- execute pst;
- drop prepare pst;
- drop temporary table if exists temp_contact;
- set @temp1 = concat('CREATE TEMPORARY TABLE IF NOT EXISTS temp_contact AS (SELECT contact_id AS c_id FROM crm_contacts where contact_id in(', contact_list ,') )');
- prepare pst from @temp1;
- execute pst;
- drop prepare pst;
- UPDATE `crm_opportunities` SET
- `opportunity_name`=name,
- `opportunity_stage_id`=stage_id,
- `company_id`=comp_id,
- `opportunity_amount`=amount,
- `opportunity_expected_closing_date`=expected_closing_date,
- `opportunity_service`=service,
- `opportunity_campaign_id`=campaign_id
- WHERE `opportunity_id`=o_id;
- delete from crm_opportunities_products where opportunity_id = o_id;
- REPLACE INTO `crm_opportunities_products`(`opportunity_id`, `product_id`,`pice`)
- SELECT o_id, A, B from temp_cursor_table;
- REPLACE INTO crm_opportunities_contacts(opportunity_id,contact_id)
- SELECT o_id,c_id from temp_contact;
- drop temporary table if exists temp_cursor_table;
- drop temporary table if exists temp_contact;
- SET sukses = 1;
- COMMIT;
- END$$
- DROP PROCEDURE IF EXISTS `sp_recuring_invoice`$$
- CREATE DEFINER=`root`@`localhost` PROCEDURE `sp_recuring_invoice` () BEGIN
- DECLARE v_finished INTEGER DEFAULT 0;
- DECLARE inv_id INTEGER DEFAULT 0;
- DECLARE inv_repeat_value INTEGER DEFAULT 0;
- DECLARE inv_repeat_type VARCHAR(5) DEFAULT "";
- DECLARE next_date DATE;
- DECLARE next_date_2 DATE;
- DECLARE inv_disc_type VARCHAR(2) DEFAULT "";
- DECLARE inv_disc_value DOUBLE DEFAULT 0;
- DECLARE inv_tax_percentage INTEGER DEFAULT 0;
- DECLARE inv_adj DOUBLE DEFAULT 0;
- DECLARE inv_type VARCHAR(2) DEFAULT "";
- DECLARE inv_cycle INTEGER DEFAULT 0;
- DECLARE inv_code VARCHAR(20);
- DEClARE invoice_cursor CURSOR FOR
- SELECT
- a.invoice_id,
- a.next_invoice_date,
- b.invoice_repeat_value,
- b.invoice_repeat_type,
- c.invoice_discount_type,
- c.invoice_discount_value,
- c.invoice_tax_percentage,
- c.invoice_adjustment,
- c.invoice_type,
- c.invoice_cycle
- FROM
- invoice_control a
- LEFT JOIN
- crm_invoices b ON a.invoice_id = b.invoice_id
- LEFT JOIN
- crm_invoice_details c ON b.invoice_id = c.invoice_id
- WHERE
- a.next_invoice_date = CURDATE() AND (b.invoice_end_date > NOW() OR b.invoice_expired = '1') AND b.invoice_type = '2';
- DECLARE CONTINUE HANDLER
- FOR NOT FOUND SET v_finished = 1;
- OPEN invoice_cursor;
- get_invoice: LOOP
- FETCH invoice_cursor INTO inv_id, next_date, inv_repeat_value, inv_repeat_type, inv_disc_type, inv_disc_value, inv_tax_percentage, inv_adj, inv_type, inv_cycle;
- SET @invoice_id = inv_id;
- SET @new_cycle = inv_cycle + 1;
- SET @inv_detail_id = (SELECT invoice_detail_id FROM crm_invoice_details WHERE invoice_id = @invoice_id ORDER BY invoice_detail_id DESC LIMIT 1);
- IF v_finished = 1 THEN
- LEAVE get_invoice;
- END IF;
- SET inv_code = make_inv_code();
- IF inv_repeat_type = '1' THEN
- SET next_date_2 = TIMESTAMPADD(DAY, inv_repeat_value, next_date);
- ELSEIF inv_repeat_type = '2' THEN
- SET next_date_2 = TIMESTAMPADD(WEEK, inv_repeat_value, next_date);
- ELSE
- SET next_date_2 = TIMESTAMPADD(MONTH, inv_repeat_value, next_date);
- END IF;
- INSERT INTO crm_invoice_details(`invoice_code`,`invoice_id`,`invoice_date`,`invoice_due_date`,`invoice_discount_type`,`invoice_discount_value`,`invoice_tax_percentage`,`invoice_adjustment`,`invoice_type`,`invoice_cycle`) VALUES (inv_code, inv_id, NOW(), null, inv_disc_type, inv_disc_value, inv_tax_percentage, inv_adj, inv_type, @new_cycle);
- SET @l_id = LAST_INSERT_ID();
- INSERT INTO crm_invoices_products(`invoice_detail_id`,`product_id`,`qty`, `price`, `is_campaign`) SELECT @l_id, product_id, qty, price, is_campaign FROM crm_invoices_products WHERE invoice_detail_id = @inv_detail_id;
- UPDATE invoice_control SET next_invoice_date = next_date_2 WHERE invoice_id = @invoice_id;
- END LOOP get_invoice;
- CLOSE invoice_cursor;
- END$$
- --
- -- Functions
- --
- DROP FUNCTION IF EXISTS `make_inv_code`$$
- CREATE DEFINER=`root`@`localhost` FUNCTION `make_inv_code` () RETURNS VARCHAR(20) CHARSET latin1 BEGIN
- SET
- @date_param =(
- SELECT DATE_FORMAT
- (CURDATE(),
- "%m%y")) ;
- SET
- @inv_code =(
- SELECT
- invoice_code
- FROM
- crm_invoice_details
- WHERE
- invoice_code LIKE CONCAT('%',
- @date_param,
- '%')
- ORDER BY
- invoice_detail_id DESC
- LIMIT 1
- ) ; IF @inv_code IS NULL THEN
- SET
- @new_inv_code = CONCAT('INV-',
- @date_param,
- '00001') ; ELSE
- SET
- @new_numb_code =(
- SELECT SUBSTRING_INDEX
- (@inv_code,
- '-',
- -1)
- ) ;
- SET
- @new_code = @new_numb_code + 1 ;
- SET
- @sub_code = SUBSTRING(@new_code,
- -5) ;
- SET
- @new_inv_code = CONCAT('INV-',
- @date_param,
- @sub_code) ;
- END IF ;
- RETURN
- @new_inv_code ;
- END$$
- DELIMITER ;
- -- --------------------------------------------------------
- --
- -- Table structure for table `coba`
- --
- DROP TABLE IF EXISTS `coba`;
- CREATE TABLE `coba` (
- `id` int(11) NOT NULL,
- `code` varchar(110) NOT NULL,
- `date` date NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `coba`
- --
- INSERT INTO `coba` (`id`, `code`, `date`) VALUES
- (1, 'INV-091700001', '2017-09-08'),
- (2, 'INV-091700001', '2017-09-14');
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_calls`
- --
- DROP TABLE IF EXISTS `company_calls`;
- CREATE TABLE `company_calls` (
- `company_call_id` int(11) NOT NULL,
- `company_call_title` varchar(100) DEFAULT NULL,
- `company_call_duration` int(11) DEFAULT NULL,
- `company_call_time` enum('1','2','3') DEFAULT '1' COMMENT '1= Second\n2= Minutes\n3=Hour\n',
- `company_call_notes` text,
- `company_call_date` datetime NOT NULL,
- `company_call_user` varchar(100) NOT NULL,
- `company_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_files`
- --
- DROP TABLE IF EXISTS `company_files`;
- CREATE TABLE `company_files` (
- `company_files_id` int(11) NOT NULL,
- `company_file_subject` varchar(100) DEFAULT NULL,
- `company_file_to` varchar(100) NOT NULL,
- `company_file_cc` varchar(100) DEFAULT NULL,
- `company_file_description` text,
- `company_file_name` varchar(100) NOT NULL,
- `company_file_date` datetime NOT NULL,
- `company_file_user` varchar(100) NOT NULL,
- `company_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_meeting`
- --
- DROP TABLE IF EXISTS `company_meeting`;
- CREATE TABLE `company_meeting` (
- `company_meeting_id` int(11) NOT NULL,
- `company_meeting_name` varchar(100) DEFAULT NULL,
- `company_meeting_location` varchar(255) DEFAULT NULL,
- `company_meeting_start_date` datetime DEFAULT NULL,
- `company_meeting_end_date` datetime DEFAULT NULL,
- `company_meeting_description` text,
- `company_meeting_date` datetime NOT NULL,
- `company_meeting_user` varchar(100) NOT NULL,
- `company_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_meeting_users`
- --
- DROP TABLE IF EXISTS `company_meeting_users`;
- CREATE TABLE `company_meeting_users` (
- `company_meeting_id` int(11) NOT NULL,
- `company_user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_notes`
- --
- DROP TABLE IF EXISTS `company_notes`;
- CREATE TABLE `company_notes` (
- `company_note_id` int(11) NOT NULL,
- `company_note_name` varchar(100) NOT NULL,
- `company_note_description` text,
- `company_note_date` datetime DEFAULT NULL,
- `company_note_user` varchar(100) DEFAULT NULL,
- `company_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `company_tasks`
- --
- DROP TABLE IF EXISTS `company_tasks`;
- CREATE TABLE `company_tasks` (
- `company_task_id` int(11) NOT NULL,
- `company_task_name` varchar(100) NOT NULL,
- `company_task_description` varchar(45) DEFAULT NULL,
- `company_task_status` int(11) DEFAULT NULL,
- `company_task_due_date` datetime DEFAULT NULL,
- `company_task_date` datetime NOT NULL,
- `company_task_user` varchar(100) NOT NULL,
- `company_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_calls`
- --
- DROP TABLE IF EXISTS `contact_calls`;
- CREATE TABLE `contact_calls` (
- `contact_call_id` int(11) NOT NULL,
- `contact_call_title` varchar(100) DEFAULT NULL,
- `contact_call_duration` int(11) DEFAULT NULL,
- `contact_call_time` enum('1','2','3') DEFAULT '1' COMMENT '1= Second\n2= Minutes\n3=Hour\n',
- `contact_call_notes` text,
- `contact_call_date` datetime NOT NULL,
- `contact_call_user` varchar(100) NOT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_files`
- --
- DROP TABLE IF EXISTS `contact_files`;
- CREATE TABLE `contact_files` (
- `contact_files_id` int(11) NOT NULL,
- `contact_file_subject` varchar(100) DEFAULT NULL,
- `contact_file_to` varchar(100) NOT NULL,
- `contact_file_cc` varchar(100) DEFAULT NULL,
- `contact_file_description` text,
- `contact_file_name` varchar(100) NOT NULL,
- `contact_file_date` datetime NOT NULL,
- `contact_file_user` varchar(100) NOT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_meeting`
- --
- DROP TABLE IF EXISTS `contact_meeting`;
- CREATE TABLE `contact_meeting` (
- `contact_meeting_id` int(11) NOT NULL,
- `contact_meeting_name` varchar(100) DEFAULT NULL,
- `contact_meeting_location` varchar(255) DEFAULT NULL,
- `contact_meeting_start_date` datetime DEFAULT NULL,
- `contact_meeting_end_date` datetime DEFAULT NULL,
- `contact_meeting_description` text,
- `contact_meeting_date` datetime NOT NULL,
- `contact_meeting_user` varchar(100) NOT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_meeting_users`
- --
- DROP TABLE IF EXISTS `contact_meeting_users`;
- CREATE TABLE `contact_meeting_users` (
- `contact_meeting_id` int(11) NOT NULL,
- `contact_user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_notes`
- --
- DROP TABLE IF EXISTS `contact_notes`;
- CREATE TABLE `contact_notes` (
- `contact_note_id` int(11) NOT NULL,
- `contact_note_name` varchar(100) NOT NULL,
- `contact_note_description` text,
- `contact_note_date` datetime DEFAULT NULL,
- `contact_note_user` varchar(100) DEFAULT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `contact_tasks`
- --
- DROP TABLE IF EXISTS `contact_tasks`;
- CREATE TABLE `contact_tasks` (
- `contact_task_id` int(11) NOT NULL,
- `contact_task_name` varchar(100) NOT NULL,
- `contact_task_description` varchar(45) DEFAULT NULL,
- `contact_task_status` int(11) DEFAULT NULL,
- `contact_task_due_date` datetime DEFAULT NULL,
- `contact_task_date` datetime NOT NULL,
- `contact_task_user` varchar(100) NOT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_campaigns`
- --
- DROP TABLE IF EXISTS `crm_campaigns`;
- CREATE TABLE `crm_campaigns` (
- `campaign_id` int(11) NOT NULL,
- `campaign_name` varchar(100) NOT NULL,
- `campaign_description` text,
- `campaign_start_date` date DEFAULT NULL,
- `campaign_end_date` date DEFAULT NULL,
- `campaign_status` enum('0','1') DEFAULT '0' COMMENT '0=Non aktif\n1= Aktif\n\n',
- `campaign_number` int(11) DEFAULT NULL,
- `campaign_percentage_response` double DEFAULT NULL,
- `campaign_budget_cost_currency` enum('1','2') DEFAULT NULL COMMENT '1= USD\n2 = IDR ',
- `campaign_budget_cost` double DEFAULT NULL,
- `campaign_actual_cost_currency` enum('1','2') DEFAULT NULL COMMENT '1= USD\n2 = IDR ',
- `campaign_actual_cost` double DEFAULT NULL,
- `campaign_expected_revenue_currency` enum('1','2') DEFAULT NULL COMMENT '1= USD\n2 = IDR ',
- `campaign_expected_revenue` double DEFAULT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_campaigns`
- --
- INSERT INTO `crm_campaigns` (`campaign_id`, `campaign_name`, `campaign_description`, `campaign_start_date`, `campaign_end_date`, `campaign_status`, `campaign_number`, `campaign_percentage_response`, `campaign_budget_cost_currency`, `campaign_budget_cost`, `campaign_actual_cost_currency`, `campaign_actual_cost`, `campaign_expected_revenue_currency`, `campaign_expected_revenue`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (1, 'Promo Hari Raya', 'Diskon untuk beberapa produk', '2017-08-28', '2017-09-30', '1', 400, 100, '1', 60000000, '1', 50000000, '1', 100000000, 'parinussa', '2017-08-28 16:59:04', NULL, NULL),
- (2, 'Promo Liburan', 'deskripsi', '2017-08-29', '2017-09-30', '1', 70, 70, '1', 50000000, '1', 40000000, '1', 70000000, 'adiputra', '2017-08-29 08:25:29', NULL, NULL),
- (4, 'SDYOC', 'sdyoc 25 %', '2017-09-03', '2017-09-30', '1', 50, 84, '1', 70000000, '1', 80000000, '1', 84000000, 'parinussa', '2017-09-06 03:50:57', NULL, '2017-09-06 04:15:10'),
- (5, 'Sibling', 'discount 20% for sibling', '2017-09-06', '2017-09-30', '1', 70, 50, '1', 40000000, '1', 30000000, '1', 50000000, 'parinussa', '2017-09-06 04:14:32', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_companies`
- --
- DROP TABLE IF EXISTS `crm_companies`;
- CREATE TABLE `crm_companies` (
- `company_id` int(11) NOT NULL,
- `customer_code` varchar(50) DEFAULT NULL,
- `company_name` varchar(200) DEFAULT NULL,
- `company_parent` int(11) DEFAULT NULL,
- `company_office_phone` varchar(30) DEFAULT NULL,
- `company_industry` int(11) DEFAULT NULL,
- `company_email` varchar(100) DEFAULT NULL,
- `company_fax` varchar(30) DEFAULT NULL,
- `company_employee` int(11) DEFAULT NULL,
- `company_revenue` double DEFAULT NULL,
- `company_website` varchar(100) DEFAULT NULL,
- `company_address1` varchar(255) DEFAULT NULL,
- `company_address2` varchar(255) DEFAULT NULL,
- `company_city` varchar(100) DEFAULT NULL,
- `company_state` varchar(100) DEFAULT NULL,
- `company_zip_code` varchar(10) DEFAULT NULL,
- `company_country` varchar(50) DEFAULT NULL,
- `company_billing_address1` varchar(255) DEFAULT NULL,
- `company_billing_address2` varchar(255) DEFAULT NULL,
- `company_billing_city` varchar(100) DEFAULT NULL,
- `company_billing_state` varchar(100) DEFAULT NULL,
- `company_billing_zip_code` varchar(10) DEFAULT NULL,
- `company_billing_country` varchar(50) DEFAULT NULL,
- `company_right_permission` enum('1','2','3') DEFAULT '1' COMMENT '1=owner2=group23=everyone',
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL,
- `company_groups` int(11) DEFAULT NULL,
- `company_customer` enum('0','1') DEFAULT '0' COMMENT '0=Not Customer\n1=Customer\n'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_companies`
- --
- INSERT INTO `crm_companies` (`company_id`, `customer_code`, `company_name`, `company_parent`, `company_office_phone`, `company_industry`, `company_email`, `company_fax`, `company_employee`, `company_revenue`, `company_website`, `company_address1`, `company_address2`, `company_city`, `company_state`, `company_zip_code`, `company_country`, `company_billing_address1`, `company_billing_address2`, `company_billing_city`, `company_billing_state`, `company_billing_zip_code`, `company_billing_country`, `company_right_permission`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`, `company_groups`, `company_customer`) VALUES
- (9, 'CST-091700002', 'PT. MLM Maju Bersama', NULL, '0812686763', 4, 'majubersama@yahoo.com', '0826673672', 43, 50000000, 'majubersama.com', 'Jl. Puyuh Raya', 'Kelapa Gading', 'Jakarta Utara', 'DKI Jakarta', '51183', 'Indonesia', 'Jl. Puyuh Raya', 'Kelapa Gading', 'Jakarta Utara', 'DKI Jakarta', '51183', 'Indonesia', '1', NULL, NULL, 'parinussa', '2017-09-19 10:44:17', NULL, '1'),
- (10, 'CST-091700003', 'Bangsa Cerdas', NULL, NULL, 4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, '0'),
- (11, NULL, 'Republic Of Koders', NULL, NULL, 4, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, '0'),
- (12, NULL, 'asdas', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, '0'),
- (13, 'CST-091700004', 'asdasd', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, '0'),
- (14, NULL, 'qweqweqweqweqw', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, '1', NULL, NULL, NULL, NULL, NULL, '0');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_companies_products`
- --
- DROP TABLE IF EXISTS `crm_companies_products`;
- CREATE TABLE `crm_companies_products` (
- `company_id` int(11) NOT NULL,
- `product_id` int(11) NOT NULL,
- `product_price` double NOT NULL,
- `status` enum('0','1') NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `crm_companies_products`
- --
- INSERT INTO `crm_companies_products` (`company_id`, `product_id`, `product_price`, `status`) VALUES
- (9, 8, 3000000, '1'),
- (9, 10, 20000000, '1'),
- (9, 12, 8000000, '1'),
- (10, 6, 4000000, '1'),
- (10, 9, 2000000, '1'),
- (13, 8, 3000000, '1'),
- (13, 10, 20000000, '1');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_contacts`
- --
- DROP TABLE IF EXISTS `crm_contacts`;
- CREATE TABLE `crm_contacts` (
- `contact_id` int(11) NOT NULL,
- `company_id` int(11) NOT NULL,
- `people_id` int(11) NOT NULL,
- `contact_right_permission` enum('1','2','3') DEFAULT NULL,
- `contact_groups` int(11) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_contacts`
- --
- INSERT INTO `crm_contacts` (`contact_id`, `company_id`, `people_id`, `contact_right_permission`, `contact_groups`) VALUES
- (13, 9, 18, '1', NULL),
- (14, 9, 17, '1', NULL),
- (15, 9, 20, '1', NULL),
- (16, 10, 19, '1', NULL),
- (17, 11, 21, '1', NULL),
- (18, 12, 26, '1', NULL),
- (19, 13, 27, '1', NULL),
- (20, 14, 28, '1', NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_employee`
- --
- DROP TABLE IF EXISTS `crm_employee`;
- CREATE TABLE `crm_employee` (
- `employee_id` int(11) NOT NULL,
- `employee_name` varchar(255) NOT NULL,
- `employee_manager_id` int(11) NOT NULL,
- `employee_mobile_phone` varchar(255) NOT NULL,
- `employee_email` varchar(255) NOT NULL,
- `employee_address` text NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_employee`
- --
- INSERT INTO `crm_employee` (`employee_id`, `employee_name`, `employee_manager_id`, `employee_mobile_phone`, `employee_email`, `employee_address`) VALUES
- (3, 'Surya', 18, '085386887878', 'employee@yahoo.com', 'jakarta utara'),
- (4, 'Helga Farida', 20, 'dasdas', 'dasaccccsd@adsd.asd', 'asdasdas');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_faq`
- --
- DROP TABLE IF EXISTS `crm_faq`;
- CREATE TABLE `crm_faq` (
- `faq_id` int(11) NOT NULL,
- `faq_title` varchar(255) NOT NULL,
- `faq_description` text NOT NULL,
- `faq_file` varchar(255) DEFAULT NULL,
- `faq_tag` varchar(255) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_groups`
- --
- DROP TABLE IF EXISTS `crm_groups`;
- CREATE TABLE `crm_groups` (
- `group_id` int(11) NOT NULL,
- `group_name` varchar(100) NOT NULL,
- `group_status` enum('0','1') DEFAULT '1' COMMENT '0= Non Aktif\n1= Aktif\n',
- `group_manager_id` int(11) DEFAULT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(45) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_groups`
- --
- INSERT INTO `crm_groups` (`group_id`, `group_name`, `group_status`, `group_manager_id`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (3, 'Marketing', '1', 18, 'admin', '2017-08-23 00:00:00', 'muhaliusman', '2017-09-26 07:19:22'),
- (4, 'Developer', '1', NULL, 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (5, 'Designer', '1', NULL, 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (6, 'Managemen', '1', NULL, 'muhaliusman', '2017-08-23 16:33:30', NULL, NULL),
- (7, 'Sales Canvas', '1', NULL, 'muhaliusman', '2017-08-29 07:25:34', NULL, NULL),
- (9, 'ini group baru', '1', 19, 'muhaliusman', '2017-09-27 09:22:38', 'muhaliusman', '2017-09-27 09:26:38');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_industry`
- --
- DROP TABLE IF EXISTS `crm_industry`;
- CREATE TABLE `crm_industry` (
- `industry_id` int(11) NOT NULL,
- `industry_name` varchar(100) NOT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_industry`
- --
- INSERT INTO `crm_industry` (`industry_id`, `industry_name`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (3, 'Manufacture', 'muhaliusman', '2017-08-25 04:06:27', NULL, '2017-09-12 06:41:45'),
- (4, 'Consumer Good', 'muhaliusman', '2017-08-25 04:06:36', NULL, NULL),
- (5, 'Development Center', 'muhaliusman', '2017-08-25 04:06:46', NULL, NULL),
- (6, 'Education', 'muhaliusman', '2017-08-25 04:06:53', NULL, NULL),
- (7, 'Services', 'muhaliusman', '2017-08-25 04:07:25', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_invoices`
- --
- DROP TABLE IF EXISTS `crm_invoices`;
- CREATE TABLE `crm_invoices` (
- `invoice_id` int(11) NOT NULL,
- `company_id` int(11) NOT NULL,
- `invoice_ref` varchar(45) DEFAULT NULL,
- `invoice_profile` varchar(100) DEFAULT NULL,
- `invoice_type` enum('1','2') NOT NULL COMMENT '1=One Time\n2=Recurring\n',
- `invoice_start_date` datetime DEFAULT NULL,
- `invoice_end_date` datetime DEFAULT NULL COMMENT ' ',
- `invoice_repeat_value` int(11) DEFAULT NULL,
- `invoice_repeat_type` enum('1','2','3') DEFAULT NULL COMMENT '1 =Day\n2= week\n3=Month\n',
- `invoice_expired` enum('0','1') DEFAULT NULL COMMENT '0=expired\n1=never expired\n',
- `term_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_invoices`
- --
- INSERT INTO `crm_invoices` (`invoice_id`, `company_id`, `invoice_ref`, `invoice_profile`, `invoice_type`, `invoice_start_date`, `invoice_end_date`, `invoice_repeat_value`, `invoice_repeat_type`, `invoice_expired`, `term_id`) VALUES
- (13, 9, '-', 'OPR-091700001', '1', '2017-09-19 17:46:35', NULL, NULL, '1', '1', 1),
- (14, 9, '-', 'OPR-091700002', '1', '2017-09-19 18:44:39', NULL, NULL, '1', '1', 1);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_invoices_products`
- --
- DROP TABLE IF EXISTS `crm_invoices_products`;
- CREATE TABLE `crm_invoices_products` (
- `invoice_detail_id` int(11) NOT NULL,
- `product_id` int(11) NOT NULL,
- `qty` int(11) DEFAULT NULL,
- `price` double DEFAULT NULL,
- `is_campaign` enum('0','1') NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_invoices_products`
- --
- INSERT INTO `crm_invoices_products` (`invoice_detail_id`, `product_id`, `qty`, `price`, `is_campaign`) VALUES
- (15, 8, 1, 3000000, '0'),
- (16, 10, 1, 20000000, '0'),
- (16, 12, 1, 8000000, '0');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_invoice_details`
- --
- DROP TABLE IF EXISTS `crm_invoice_details`;
- CREATE TABLE `crm_invoice_details` (
- `invoice_detail_id` int(11) NOT NULL,
- `invoice_code` varchar(50) NOT NULL,
- `invoice_id` int(11) NOT NULL,
- `invoice_date` datetime NOT NULL,
- `invoice_due_date` datetime DEFAULT NULL,
- `invoice_discount_type` enum('1','2') DEFAULT '1' COMMENT '1=Percentage2=Value',
- `invoice_discount_value` double DEFAULT NULL,
- `invoice_tax_percentage` double DEFAULT NULL,
- `invoice_adjustment` double DEFAULT NULL,
- `invoice_cycle` int(11) DEFAULT '1',
- `invoice_status` enum('1','2','3','4','5') NOT NULL DEFAULT '1'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_invoice_details`
- --
- INSERT INTO `crm_invoice_details` (`invoice_detail_id`, `invoice_code`, `invoice_id`, `invoice_date`, `invoice_due_date`, `invoice_discount_type`, `invoice_discount_value`, `invoice_tax_percentage`, `invoice_adjustment`, `invoice_cycle`, `invoice_status`) VALUES
- (15, 'INV-091700001', 13, '2017-09-19 10:46:35', '2017-09-26 00:00:00', '1', 0, 0, 0, 2, '4'),
- (16, 'INV-091700002', 14, '2017-09-19 11:44:40', '2017-09-26 00:00:00', '1', 840000, 3, 40000, 1, '2');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_leads`
- --
- DROP TABLE IF EXISTS `crm_leads`;
- CREATE TABLE `crm_leads` (
- `lead_id` int(11) NOT NULL,
- `lead_label` int(11) NOT NULL,
- `people_id` int(11) NOT NULL,
- `lead_right_permission` enum('1','2','3') DEFAULT NULL COMMENT '1=owner\n2=group2\n3=everyone\n\n',
- `lead_groups` int(11) DEFAULT NULL,
- `lead_status` enum('1','2','3') NOT NULL DEFAULT '1' COMMENT '1= Lead\n2 = Convert\n3 =Junk\n',
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_leads`
- --
- INSERT INTO `crm_leads` (`lead_id`, `lead_label`, `people_id`, `lead_right_permission`, `lead_groups`, `lead_status`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (14, 4, 17, '1', NULL, '2', 'parinussa', '2017-09-19 10:40:01', NULL, NULL),
- (15, 4, 18, '1', NULL, '2', 'parinussa', '2017-09-19 10:40:42', NULL, NULL),
- (16, 4, 19, '1', NULL, '2', 'parinussa', '2017-09-23 06:07:24', NULL, NULL),
- (17, 4, 21, '1', NULL, '2', 'parinussa', '2017-09-26 09:50:27', 'parinussa', '2017-09-26 09:52:37'),
- (18, 5, 26, '1', NULL, '2', 'parinussa', '2017-09-26 15:56:47', NULL, NULL),
- (19, 5, 27, '1', NULL, '2', 'parinussa', '2017-09-26 16:09:38', NULL, NULL),
- (20, 5, 28, '1', NULL, '2', 'parinussa', '2017-09-29 08:00:34', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_lead_label`
- --
- DROP TABLE IF EXISTS `crm_lead_label`;
- CREATE TABLE `crm_lead_label` (
- `lead_label_id` int(11) NOT NULL,
- `lead_label_name` varchar(100) NOT NULL,
- `lead_label_status_score` int(11) NOT NULL COMMENT '0-100'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_lead_label`
- --
- INSERT INTO `crm_lead_label` (`lead_label_id`, `lead_label_name`, `lead_label_status_score`) VALUES
- (4, 'New', 0),
- (5, 'Pikir-pikir', 30),
- (6, 'Negotiating', 50),
- (7, 'Interest', 80),
- (8, 'Deal', 100);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_modules`
- --
- DROP TABLE IF EXISTS `crm_modules`;
- CREATE TABLE `crm_modules` (
- `module_id` int(11) NOT NULL,
- `module_name` varchar(100) NOT NULL,
- `module_route` varchar(225) NOT NULL,
- `module_order` int(11) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_modules`
- --
- INSERT INTO `crm_modules` (`module_id`, `module_name`, `module_route`, `module_order`) VALUES
- (1, 'Leads', 'leads', NULL),
- (2, 'Contacts', 'contacts', NULL),
- (3, 'Companies', 'companies', NULL),
- (4, 'Opportunities', 'opportunities', NULL),
- (5, 'Products', 'products', NULL),
- (6, 'Campaigns', 'campaigns', NULL),
- (8, 'invoices', 'invoices', NULL),
- (9, 'recurring invoices', 'recurring-invoices', NULL),
- (10, 'customer', 'customers', NULL),
- (12, 'customer services', 'customer-services', NULL),
- (15, 'junk lead', 'junks', NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_news`
- --
- DROP TABLE IF EXISTS `crm_news`;
- CREATE TABLE `crm_news` (
- `news_id` int(11) NOT NULL,
- `news_title` varchar(150) NOT NULL,
- `news_description` text NOT NULL,
- `news_date` datetime NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_opportunities`
- --
- DROP TABLE IF EXISTS `crm_opportunities`;
- CREATE TABLE `crm_opportunities` (
- `opportunity_id` int(11) NOT NULL,
- `opportunity_code` varchar(100) DEFAULT NULL,
- `opportunity_name` varchar(45) DEFAULT NULL,
- `opportunity_stage_id` int(11) NOT NULL,
- `company_id` int(11) NOT NULL,
- `opportunity_amount` double DEFAULT NULL,
- `opportunity_expected_closing_date` datetime DEFAULT NULL,
- `opportunity_closing_date` datetime DEFAULT NULL,
- `opportunity_service` enum('1','2') DEFAULT NULL COMMENT '1= Product\n2=Campaign\n',
- `opportunity_campaign_id` int(11) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_opportunities`
- --
- INSERT INTO `crm_opportunities` (`opportunity_id`, `opportunity_code`, `opportunity_name`, `opportunity_stage_id`, `company_id`, `opportunity_amount`, `opportunity_expected_closing_date`, `opportunity_closing_date`, `opportunity_service`, `opportunity_campaign_id`) VALUES
- (9, 'OPR-091700001', 'Opportunity Pertama', 6, 9, 3000000, '2017-09-19 00:00:00', '2017-09-29 00:00:00', '1', NULL),
- (10, 'OPR-091700002', 'Opportunity baru', 6, 9, 28000000, '2017-09-19 00:00:00', '2017-09-30 00:00:00', '1', NULL),
- (11, 'OPR-091700003', 'asdas', 6, 10, 6000000, '2017-09-19 00:00:00', '2017-09-27 00:00:00', '1', NULL),
- (12, 'OPR-091700004', 'dasda', 6, 13, 23, '2017-09-26 00:00:00', '2017-09-26 00:00:00', '1', NULL),
- (13, 'OPR-091700005', 'sdadsfsafasf', 4, 14, 29, '2017-09-29 00:00:00', '2017-09-23 00:00:00', '1', NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_opportunities_contacts`
- --
- DROP TABLE IF EXISTS `crm_opportunities_contacts`;
- CREATE TABLE `crm_opportunities_contacts` (
- `opportunity_id` int(11) NOT NULL,
- `contact_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_opportunities_contacts`
- --
- INSERT INTO `crm_opportunities_contacts` (`opportunity_id`, `contact_id`) VALUES
- (9, 13),
- (10, 14),
- (11, 16),
- (12, 19),
- (13, 20);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_opportunities_products`
- --
- DROP TABLE IF EXISTS `crm_opportunities_products`;
- CREATE TABLE `crm_opportunities_products` (
- `opportunity_id` int(11) NOT NULL,
- `product_id` int(11) NOT NULL,
- `price` double DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_opportunities_products`
- --
- INSERT INTO `crm_opportunities_products` (`opportunity_id`, `product_id`, `price`) VALUES
- (9, 8, NULL),
- (10, 10, NULL),
- (10, 12, NULL),
- (11, 6, 3000),
- (11, 9, 4000),
- (12, 8, 3000000),
- (12, 10, 20000000),
- (13, 10, 20000000),
- (13, 13, 9000000);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_opportunity_stage`
- --
- DROP TABLE IF EXISTS `crm_opportunity_stage`;
- CREATE TABLE `crm_opportunity_stage` (
- `opportunity_stage_id` int(11) NOT NULL,
- `opportunity_stage_name` varchar(100) DEFAULT NULL,
- `opportunity_stage_status_score` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_opportunity_stage`
- --
- INSERT INTO `crm_opportunity_stage` (`opportunity_stage_id`, `opportunity_stage_name`, `opportunity_stage_status_score`) VALUES
- (4, 'Negotiating', 30),
- (5, 'New', 0),
- (6, 'Close Won', 100);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_payment`
- --
- DROP TABLE IF EXISTS `crm_payment`;
- CREATE TABLE `crm_payment` (
- `payment_id` int(11) NOT NULL,
- `payment_code` varchar(100) NOT NULL,
- `invoice_detail_id` int(11) DEFAULT NULL,
- `payment_amount_received` double NOT NULL,
- `payment_bank_charge` double DEFAULT NULL,
- `payment_method_id` int(11) DEFAULT NULL,
- `payment_date` datetime NOT NULL,
- `payment_ref` varchar(200) DEFAULT NULL,
- `payment_notes` varchar(200) DEFAULT NULL,
- `payment_file` varchar(200) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `crm_payment`
- --
- INSERT INTO `crm_payment` (`payment_id`, `payment_code`, `invoice_detail_id`, `payment_amount_received`, `payment_bank_charge`, `payment_method_id`, `payment_date`, `payment_ref`, `payment_notes`, `payment_file`) VALUES
- (3, 'PYM-091700001', 15, 3000000, 4000, 1, '2017-09-19 00:00:00', '-', 'pembayaran lunas', NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_payment_methods`
- --
- DROP TABLE IF EXISTS `crm_payment_methods`;
- CREATE TABLE `crm_payment_methods` (
- `payment_method_id` int(11) NOT NULL,
- `payment_method_name` varchar(200) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `crm_payment_methods`
- --
- INSERT INTO `crm_payment_methods` (`payment_method_id`, `payment_method_name`) VALUES
- (1, 'Bank Transfer'),
- (2, 'Cash');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_peoples`
- --
- DROP TABLE IF EXISTS `crm_peoples`;
- CREATE TABLE `crm_peoples` (
- `people_id` int(11) NOT NULL,
- `people_salutation` enum('1','2','3') DEFAULT NULL,
- `people_first_name` varchar(100) NOT NULL,
- `people_last_name` varchar(100) DEFAULT NULL,
- `people_job_title` varchar(100) DEFAULT NULL,
- `people_company` varchar(100) DEFAULT NULL,
- `people_department` varchar(100) DEFAULT NULL,
- `people_email` varchar(100) DEFAULT NULL,
- `people_office_phone` varchar(30) DEFAULT NULL,
- `people_mobile_phone` varchar(30) DEFAULT NULL,
- `people_industry` int(11) DEFAULT NULL,
- `people_address1` varchar(255) DEFAULT NULL,
- `people_address2` varchar(255) DEFAULT NULL,
- `people_city` varchar(100) DEFAULT NULL,
- `people_state` varchar(100) DEFAULT NULL,
- `people_zip_code` varchar(10) DEFAULT NULL,
- `people_country` varchar(50) DEFAULT NULL,
- `people_source` int(11) NOT NULL,
- `people_photo` varchar(100) DEFAULT NULL,
- `people_status` enum('1','2') NOT NULL COMMENT '1=Lead\n2=Customer\n'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_peoples`
- --
- INSERT INTO `crm_peoples` (`people_id`, `people_salutation`, `people_first_name`, `people_last_name`, `people_job_title`, `people_company`, `people_department`, `people_email`, `people_office_phone`, `people_mobile_phone`, `people_industry`, `people_address1`, `people_address2`, `people_city`, `people_state`, `people_zip_code`, `people_country`, `people_source`, `people_photo`, `people_status`) VALUES
- (17, '2', 'Herbert', 'Liau', 'Buruh', 'PT. MLM Maju Bersama', 'Marketing', 'herbertliau@yahoo.com', '082-32323232', '085736485999', 4, 'Jl. Puyuh Raya No.31', 'Kelapa Gading', 'Jakarta Timur', 'DKI Jakarta', '78388', 'Indonesia', 4, NULL, '1'),
- (18, '1', 'Fais', 'Nasrullah', 'Buruh', 'PT. MLM Maju Bersama', 'Marketing', 'fais@gmail.com', '082-32323232', '085736485999', 4, 'Jl. Puyuh Raya No.31', 'Kelapa Gading', 'Jakarta Timur', 'DKI Jakarta', '78388', 'Indonesia', 4, NULL, '1'),
- (19, '2', 'Fais', 'Nasrullah', 'Kepala Bagian', 'Bangsa Cerdas', NULL, 'fais@gmail.com', '08528398293', '08834834743', 4, 'Jl. Puyuh Raya no. 1 blok z2', 'Kelapa Gading', 'Jakarta Utara', 'DKI Jakarta', '892389', 'Indonesia', 6, NULL, '1'),
- (20, '1', 'New', 'Contact', 'Buruh', 'PT. MLM Maju Bersama', 'Perlindungan Anak', 'newcontac@gamail.com', '0832783283', '0832673627', 4, 'Jl. Kelapa Puyuh Raya no3', 'Kelapa Gading', 'Jakarta Utara', 'Jakarta', '84933', 'Indonesia', 4, NULL, '2'),
- (21, '2', 'Bambang', 'Bambang', 'Juru Ketik', 'Republic Of Koders', 'Juru Ketik', 'bambang@yahoo.com', '022-9892392', '085726372673', NULL, 'Jl. Kalimalang', NULL, NULL, NULL, NULL, NULL, 4, 'cc608e85-27d0-4b13-82fb-efb74713d778.jpg', '1'),
- (26, '2', 'dasda', 'asdasd', NULL, 'asdas', NULL, 'asdas@asd.asd', NULL, NULL, NULL, 'sadasdasdasd', NULL, NULL, NULL, NULL, NULL, 3, NULL, '1'),
- (27, '2', 'dasd', 'adasd', NULL, 'asdasd', NULL, 'ada@sds.ada', NULL, NULL, NULL, 'asdasdasdasd', NULL, NULL, NULL, NULL, NULL, 4, NULL, '1'),
- (28, '2', 'qweqweqw', 'eqweqweqwe', 'qweqweqweqwe', 'qweqweqweqweqw', NULL, 'eqweqwe@asda.asda', '123123123', '123123123', NULL, 'dasdasdasd', NULL, NULL, NULL, NULL, NULL, 5, NULL, '1');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_products`
- --
- DROP TABLE IF EXISTS `crm_products`;
- CREATE TABLE `crm_products` (
- `product_id` int(11) NOT NULL,
- `product_name` varchar(100) DEFAULT NULL,
- `product_category_id` int(11) DEFAULT NULL,
- `product_description` text,
- `product_type` enum('1','2','3') NOT NULL COMMENT '1=Product\n2=Services\n3=Subscription\n',
- `product_price_frequency` enum('1','2','3') DEFAULT NULL COMMENT '1=One Time\n2=Monthly\n3=Annually ',
- `product_price` double NOT NULL DEFAULT '0',
- `product_status` enum('0','1') NOT NULL DEFAULT '1' COMMENT '0=Non Aktif\n1=Aktif\n',
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_products`
- --
- INSERT INTO `crm_products` (`product_id`, `product_name`, `product_category_id`, `product_description`, `product_type`, `product_price_frequency`, `product_price`, `product_status`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (6, 'Back End Course, With PHP', 6, 'pembelajaran membahas tentang bagaimana membuat sebuah program menggunakan PHP', '2', '1', 4000000, '1', 'parinussa', '2017-08-25 04:21:47', 'parinussa', '2017-09-06 05:36:01'),
- (7, 'Angular 4 Course', 7, 'Belajar tentang angular 4', '2', '1', 9000000, '1', 'parinussa', '2017-08-25 04:23:07', NULL, NULL),
- (8, 'Animation With Macromedia 8', 9, 'Belajar membuat animasi', '2', '1', 3000000, '1', 'parinussa', '2017-08-25 04:23:45', NULL, NULL),
- (9, 'Crash Course', 7, 'Belajar membuat tampilan web dalam waktu 5 hari', '2', '1', 2000000, '1', 'parinussa', '2017-08-25 04:24:23', NULL, NULL),
- (10, 'Full Stack Web Dev', 5, 'belajar membuat web. mulai dari tampilan depan hingga bagian back end menggunakan PHP', '2', '1', 20000000, '1', 'parinussa', '2017-08-25 04:25:22', NULL, NULL),
- (11, 'Ionic', 7, 'belajar membuat mobile Apps hybrid menggunakan ionic', '2', '1', 15000000, '1', 'parinussa', '2017-08-25 04:26:06', NULL, NULL),
- (12, 'Junior coder Kmy', 9, 'game and apps', '2', '1', 8000000, '1', 'ardiansyah', '2017-08-29 08:07:36', 'adiputra', '2017-08-29 08:49:22'),
- (13, 'Junior Koder Pik', 5, 'junior koder', '1', '2', 9000000, '1', 'adiputra', '2017-08-29 08:49:50', NULL, NULL),
- (14, 'Junior Koder', 5, 'Kelas koding untuk anak di bawah 13 tahun', '2', '1', 9000000, '1', 'parinussa', '2017-09-06 03:16:44', 'parinussa', '2017-09-06 03:40:15');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_products_campaigns`
- --
- DROP TABLE IF EXISTS `crm_products_campaigns`;
- CREATE TABLE `crm_products_campaigns` (
- `product_id` int(11) NOT NULL,
- `campaign_id` int(11) NOT NULL,
- `discount_type` enum('1','2') DEFAULT NULL COMMENT '1=Percentage\n2=Fixed',
- `amount` double DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_products_campaigns`
- --
- INSERT INTO `crm_products_campaigns` (`product_id`, `campaign_id`, `discount_type`, `amount`) VALUES
- (6, 1, '1', 50),
- (9, 1, '2', 500000),
- (9, 4, '1', 25),
- (10, 4, '1', 25),
- (12, 2, '1', 50),
- (14, 5, '1', 20);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_product_categories`
- --
- DROP TABLE IF EXISTS `crm_product_categories`;
- CREATE TABLE `crm_product_categories` (
- `category_id` int(11) NOT NULL,
- `category_name` varchar(100) NOT NULL,
- `category_status` enum('0','1') DEFAULT '1' COMMENT '0=non aktif\n1=aktif',
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_product_categories`
- --
- INSERT INTO `crm_product_categories` (`category_id`, `category_name`, `category_status`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (5, 'Full Stack', '1', 'parinussa', '2017-08-25 04:20:53', NULL, NULL),
- (6, 'Back End Dev', '1', 'parinussa', '2017-08-25 04:21:09', NULL, NULL),
- (7, 'Front End Dev', '1', 'parinussa', '2017-08-25 04:21:17', NULL, NULL),
- (8, 'Design', '1', 'parinussa', '2017-08-25 04:21:24', NULL, NULL),
- (9, 'Animation', '1', 'parinussa', '2017-08-25 04:21:32', NULL, NULL),
- (10, 'adasdas', '1', 'parinussa', '2017-09-28 10:08:32', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_roles`
- --
- DROP TABLE IF EXISTS `crm_roles`;
- CREATE TABLE `crm_roles` (
- `role_id` int(11) NOT NULL COMMENT 'User Administrator Hard Code All access module',
- `role_name` varchar(100) DEFAULT NULL,
- `status` enum('0','1') DEFAULT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_roles`
- --
- INSERT INTO `crm_roles` (`role_id`, `role_name`, `status`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (1, 'Administrator', '1', 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (2, 'Marketing', '1', 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (3, 'Supervisor', '1', 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (4, 'CEO', '1', 'admin', '2017-08-23 00:00:00', NULL, NULL),
- (7, 'Developer', '1', 'muhaliusman', '2017-08-23 16:28:40', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_roles_modules`
- --
- DROP TABLE IF EXISTS `crm_roles_modules`;
- CREATE TABLE `crm_roles_modules` (
- `crm_roles_role_id` int(11) NOT NULL,
- `crm_modules_module_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_roles_modules`
- --
- INSERT INTO `crm_roles_modules` (`crm_roles_role_id`, `crm_modules_module_id`) VALUES
- (2, 1),
- (2, 8),
- (2, 10),
- (4, 1),
- (4, 2),
- (4, 3),
- (4, 4),
- (4, 5),
- (4, 6),
- (4, 8),
- (4, 9),
- (7, 1),
- (7, 2),
- (7, 3),
- (7, 4),
- (7, 5),
- (7, 6),
- (7, 8),
- (7, 9),
- (7, 10),
- (7, 12);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_setup_company`
- --
- DROP TABLE IF EXISTS `crm_setup_company`;
- CREATE TABLE `crm_setup_company` (
- `company_id` int(11) NOT NULL,
- `company_name` varchar(225) NOT NULL,
- `company_email` varchar(225) DEFAULT NULL,
- `company_address1` varchar(225) NOT NULL,
- `company_address2` varchar(100) DEFAULT NULL,
- `company_city` varchar(225) NOT NULL,
- `company_state` varchar(225) NOT NULL,
- `company_zip_code` varchar(50) NOT NULL,
- `company_country` varchar(225) NOT NULL,
- `company_phone` varchar(50) DEFAULT NULL,
- `company_logo` varchar(100) DEFAULT NULL,
- `company_fax` varchar(50) DEFAULT NULL,
- `company_website` varchar(100) DEFAULT NULL,
- `company_initial_setting` enum('0','1') DEFAULT '0'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_setup_company`
- --
- INSERT INTO `crm_setup_company` (`company_id`, `company_name`, `company_email`, `company_address1`, `company_address2`, `company_city`, `company_state`, `company_zip_code`, `company_country`, `company_phone`, `company_logo`, `company_fax`, `company_website`, `company_initial_setting`) VALUES
- (5, 'Republic Of Koders', 'official@republicofkoders.com', 'Jl. Puyuh Raya Blok Z2 No.1', NULL, 'Jakarta Utara', 'DKI Jakarta', '277374', 'Indonesia', '627366373', NULL, NULL, NULL, '1');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_source`
- --
- DROP TABLE IF EXISTS `crm_source`;
- CREATE TABLE `crm_source` (
- `source_id` int(11) NOT NULL,
- `source_name` varchar(100) NOT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_source`
- --
- INSERT INTO `crm_source` (`source_id`, `source_name`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (3, 'Facebook', 'muhaliusman', '2017-08-25 04:07:37', NULL, NULL),
- (4, 'Koran', 'muhaliusman', '2017-08-25 04:07:44', NULL, NULL),
- (5, 'Television', 'muhaliusman', '2017-08-25 04:07:53', NULL, NULL),
- (6, 'Exhibition', 'muhaliusman', '2017-08-25 04:08:15', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_terms`
- --
- DROP TABLE IF EXISTS `crm_terms`;
- CREATE TABLE `crm_terms` (
- `term_id` int(11) NOT NULL,
- `term_description` varchar(100) NOT NULL,
- `term_day` int(11) NOT NULL,
- `term_default` enum('0','1') DEFAULT '0' COMMENT '0=Not Default\n1=Default'
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_terms`
- --
- INSERT INTO `crm_terms` (`term_id`, `term_description`, `term_day`, `term_default`) VALUES
- (1, '1 Week', 7, '1'),
- (2, '1 Month', 30, '0');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_tickets`
- --
- DROP TABLE IF EXISTS `crm_tickets`;
- CREATE TABLE `crm_tickets` (
- `ticket_id` int(11) NOT NULL,
- `ticket_subject` varchar(255) NOT NULL,
- `ticket_customer_id` int(11) NOT NULL,
- `ticket_date` datetime NOT NULL,
- `ticket_type_id` int(11) NOT NULL,
- `ticket_priority` enum('1','2','3','4') NOT NULL COMMENT '1 = low, 2=medium, 3 = High, 4 = Urgent',
- `ticket_description` text NOT NULL,
- `ticket_status_id` int(11) NOT NULL,
- `ticket_file` varchar(255) NOT NULL,
- `ticket_note` text,
- `ticket_note_file` varchar(200) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_tickets`
- --
- INSERT INTO `crm_tickets` (`ticket_id`, `ticket_subject`, `ticket_customer_id`, `ticket_date`, `ticket_type_id`, `ticket_priority`, `ticket_description`, `ticket_status_id`, `ticket_file`, `ticket_note`, `ticket_note_file`) VALUES
- (8, 'Ticket Baru', 9, '2017-09-19 00:00:00', 2, '2', 'ini descriptionnya', 1, '521e48a7-925f-4d5f-8aef-ea9c11bb0c2f.pdf', NULL, NULL);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_tickets_employee`
- --
- DROP TABLE IF EXISTS `crm_tickets_employee`;
- CREATE TABLE `crm_tickets_employee` (
- `ticket_id` int(11) NOT NULL,
- `employee_id` int(11) NOT NULL,
- `date_assigned` datetime NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_ticket_status`
- --
- DROP TABLE IF EXISTS `crm_ticket_status`;
- CREATE TABLE `crm_ticket_status` (
- `ticket_status_id` int(11) NOT NULL,
- `ticket_status_name` varchar(255) NOT NULL,
- `ticket_status_score` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_ticket_status`
- --
- INSERT INTO `crm_ticket_status` (`ticket_status_id`, `ticket_status_name`, `ticket_status_score`) VALUES
- (1, 'New', 0),
- (2, 'On Process', 50),
- (3, 'Close', 100);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_ticket_type`
- --
- DROP TABLE IF EXISTS `crm_ticket_type`;
- CREATE TABLE `crm_ticket_type` (
- `ticket_type_id` int(11) NOT NULL,
- `ticket_type_name` varchar(255) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_ticket_type`
- --
- INSERT INTO `crm_ticket_type` (`ticket_type_id`, `ticket_type_name`) VALUES
- (1, 'Billing'),
- (2, 'Service');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_users`
- --
- DROP TABLE IF EXISTS `crm_users`;
- CREATE TABLE `crm_users` (
- `user_id` int(11) NOT NULL,
- `user_first_name` varchar(100) NOT NULL,
- `user_last_name` varchar(100) DEFAULT NULL,
- `user_job_title` varchar(50) DEFAULT NULL,
- `user_password` varchar(100) NOT NULL,
- `user_mobile` varchar(30) NOT NULL,
- `user_username` varchar(100) NOT NULL,
- `user_department` varchar(100) DEFAULT NULL,
- `user_email` varchar(100) NOT NULL,
- `user_photo` varchar(100) DEFAULT NULL,
- `user_status` enum('0','1') DEFAULT '1' COMMENT '0=Non-Aktif 1=Aktif',
- `user_group_id` int(11) DEFAULT NULL,
- `user_role_id` int(11) NOT NULL,
- `user_created` varchar(100) DEFAULT NULL,
- `user_created_date` datetime DEFAULT NULL,
- `user_modified` varchar(100) DEFAULT NULL,
- `user_modified_date` datetime DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_users`
- --
- INSERT INTO `crm_users` (`user_id`, `user_first_name`, `user_last_name`, `user_job_title`, `user_password`, `user_mobile`, `user_username`, `user_department`, `user_email`, `user_photo`, `user_status`, `user_group_id`, `user_role_id`, `user_created`, `user_created_date`, `user_modified`, `user_modified_date`) VALUES
- (17, 'Muhammad', 'Ali Usman', 'admin', '$2a$10$qXpkS/T8NTxadZfUConUA.RzYw37rVtaIEL9gSBGygkU25z6LJJNO', '085717647462', 'muhaliusman', 'Administrator', 'muh.aliusman@yahoo.co.id', '75cc29d7-d042-41c1-8068-55f45cc840f7.JPG', '1', 3, 1, 'admin', '2017-08-23 00:00:00', 'muhaliusman', '2017-09-27 17:37:30'),
- (18, 'Noval', 'Parinussa', 'Senior Programmer', '$2a$10$2Cn479SFX80weNkwlyrWA.wy78ldTIalxyy1ql5S9TLtaYAb9d0ty', '0856008793888', 'parinussa', 'Product Development', 'parinussa@gmail.com', NULL, '1', 4, 7, 'muhaliusman', '2017-08-23 16:30:05', 'muhaliusman', '2017-08-23 16:34:06'),
- (19, 'Adi', 'Putra', 'Software Enginer', '$2a$10$2Cn479SFX80weNkwlyrWA.wy78ldTIalxyy1ql5S9TLtaYAb9d0ty', '08590023889', 'adiputra', 'Product Development', 'adiputra@gmail.com', NULL, '1', 4, 7, 'muhaliusman', '2017-08-23 16:31:04', 'muhaliusman', '2017-08-23 16:34:00'),
- (20, 'Yusuf', 'Basori', 'Database Administrator', '$2a$10$2Cn479SFX80weNkwlyrWA.wy78ldTIalxyy1ql5S9TLtaYAb9d0ty', '087363536664', 'yusufbasori', 'Product Development', 'basori@gmail.com', NULL, '1', 4, 7, 'muhaliusman', '2017-08-23 16:32:07', 'muhaliusman', '2017-08-23 16:33:53'),
- (21, 'Jupiter', 'Zhuo', 'CEO', '$2a$10$2Cn479SFX80weNkwlyrWA.wy78ldTIalxyy1ql5S9TLtaYAb9d0ty', '0862752722', 'jupiter', 'Course', 'jupiter@gmail.com', NULL, '1', 6, 4, 'muhaliusman', '2017-08-23 16:33:13', 'muhaliusman', '2017-08-23 16:33:45'),
- (22, 'Ardi', 'Putra', 'Manager', '$2a$10$7QE8JDV6QLOcY29kC4FYG.a5RefbQJxcoex4TLPMZFY5PaDOLCjlW', '0856748878787', 'ardiansyah', 'Sales', 'ardi@yahoo.com', NULL, '1', 7, 2, 'muhaliusman', '2017-08-29 07:27:08', 'muhaliusman', '2017-09-27 15:08:26');
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_users_companies`
- --
- DROP TABLE IF EXISTS `crm_users_companies`;
- CREATE TABLE `crm_users_companies` (
- `company_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_users_companies`
- --
- INSERT INTO `crm_users_companies` (`company_id`, `user_id`) VALUES
- (9, 18),
- (9, 19),
- (10, 18),
- (11, 18),
- (12, 18),
- (13, 18),
- (14, 18);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_users_contacts`
- --
- DROP TABLE IF EXISTS `crm_users_contacts`;
- CREATE TABLE `crm_users_contacts` (
- `contact_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_users_contacts`
- --
- INSERT INTO `crm_users_contacts` (`contact_id`, `user_id`) VALUES
- (13, 18),
- (14, 18),
- (14, 19),
- (15, 18),
- (16, 18),
- (17, 18),
- (18, 18),
- (19, 18),
- (20, 18);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_users_leads`
- --
- DROP TABLE IF EXISTS `crm_users_leads`;
- CREATE TABLE `crm_users_leads` (
- `lead_id` int(11) NOT NULL,
- `user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `crm_users_leads`
- --
- INSERT INTO `crm_users_leads` (`lead_id`, `user_id`) VALUES
- (1, 18),
- (1, 19),
- (3, 18),
- (4, 18),
- (5, 18),
- (6, 18),
- (6, 19),
- (7, 19),
- (8, 22),
- (9, 18),
- (9, 20),
- (10, 18),
- (10, 19),
- (11, 18),
- (13, 18),
- (14, 18),
- (14, 19),
- (15, 18),
- (16, 18),
- (17, 18),
- (18, 18),
- (19, 18),
- (20, 18);
- -- --------------------------------------------------------
- --
- -- Table structure for table `crm_users_opportunities`
- --
- DROP TABLE IF EXISTS `crm_users_opportunities`;
- CREATE TABLE `crm_users_opportunities` (
- `user_id` int(11) DEFAULT NULL,
- `opportunity_id` int(11) DEFAULT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `crm_users_opportunities`
- --
- INSERT INTO `crm_users_opportunities` (`user_id`, `opportunity_id`) VALUES
- (18, 11),
- (18, 12),
- (18, 13);
- -- --------------------------------------------------------
- --
- -- Table structure for table `invoice_control`
- --
- DROP TABLE IF EXISTS `invoice_control`;
- CREATE TABLE `invoice_control` (
- `invoice_id` int(11) NOT NULL,
- `next_invoice_date` date NOT NULL,
- `repeat_invoice` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=latin1;
- --
- -- Dumping data for table `invoice_control`
- --
- INSERT INTO `invoice_control` (`invoice_id`, `next_invoice_date`, `repeat_invoice`) VALUES
- (1, '2017-09-08', 2),
- (2, '2017-09-14', 2);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_calls`
- --
- DROP TABLE IF EXISTS `lead_calls`;
- CREATE TABLE `lead_calls` (
- `lead_call_id` int(11) NOT NULL,
- `lead_call_title` varchar(100) DEFAULT NULL,
- `lead_call_duration` int(11) DEFAULT NULL,
- `lead_call_time` enum('1','2','3') DEFAULT '1' COMMENT '1= Second\n2= Minutes\n3=Hour\n',
- `lead_call_notes` text,
- `lead_call_date` datetime NOT NULL,
- `lead_call_user` varchar(100) NOT NULL,
- `lead_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_calls`
- --
- INSERT INTO `lead_calls` (`lead_call_id`, `lead_call_title`, `lead_call_duration`, `lead_call_time`, `lead_call_notes`, `lead_call_date`, `lead_call_user`, `lead_id`) VALUES
- (1, 'paggilan baru', 3, '2', 'panggilan baru', '2017-08-29 04:28:11', 'adiputra', 6),
- (2, 'enw', 50, '1', 'dasdasd', '2017-08-29 04:39:05', 'adiputra', 6),
- (3, 'panggilan baru', 20, '2', 'panggilan hari ini', '2017-08-29 04:39:31', 'adiputra', 6),
- (4, 'sdaas', 45, '1', 'adasdasd', '2017-08-29 04:41:21', 'adiputra', 6),
- (5, 'call', 5, '2', 'note', '2017-08-29 08:01:40', 'adiputra', 7),
- (6, 'call pertama', 3, '1', 'ini adalaha panggilan pertama', '2017-09-14 14:09:49', 'parinussa', 10);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_files`
- --
- DROP TABLE IF EXISTS `lead_files`;
- CREATE TABLE `lead_files` (
- `lead_files_id` int(11) NOT NULL,
- `lead_file_subject` varchar(100) DEFAULT NULL,
- `lead_file_to` varchar(100) NOT NULL,
- `lead_file_cc` varchar(100) DEFAULT NULL,
- `lead_file_description` text,
- `lead_file_name` varchar(100) NOT NULL,
- `lead_file_date` datetime NOT NULL,
- `lead_file_user` varchar(100) NOT NULL,
- `lead_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_files`
- --
- INSERT INTO `lead_files` (`lead_files_id`, `lead_file_subject`, `lead_file_to`, `lead_file_cc`, `lead_file_description`, `lead_file_name`, `lead_file_date`, `lead_file_user`, `lead_id`) VALUES
- (1, 'ini', 'wahyu@majubersama.com', 'adiputra@gmail.com,basori@gmail.com', 'ini file baru', '2addfdd3-6704-431f-86de-a18139310266.pdf', '2017-08-29 04:26:38', 'adiputra', 6),
- (2, 'New file 2', 'wahyu@majubersama.com', 'adiputra@gmail.com', 'e of Chichén Itzá altered the political spectrum in the Yucatán peninsula and began eroding the dominance of Coba. Beginning around 900 or 1000 AD, Coba must have begun', 'f1d6bcbd-6ceb-404e-8448-e6364f6e8360.pdf', '2017-08-29 04:31:45', 'adiputra', 6),
- (3, 'new file again', 'wahyu@majubersama.com', 'adiputra@gmail.com,,basori@gmail.com', 'ini baru lagi evidenced by the new buildings dating to the time 1200-1500 AD, now built in the typical Eastern coastal style. However, power centers and trading routes had moved to the coast,', '01c54204-323a-44b5-8079-8ad200671c25.pdf', '2017-08-29 04:32:17', 'adiputra', 6),
- (4, 'new file', 'wahyu@majubersama.com', 'adiputra@gmail.com,,parinussa@gmail.com', 'forcing cities like Coba into a secondary status, although somewhat more successful than its more ephemeral enemy Chichén Itzá. The greatest of the Coba kings was King Goon.', '643738aa-dfa1-4714-bf2b-7eb95c7ac59a.pdf', '2017-08-29 04:32:56', 'adiputra', 6),
- (5, 'subject', 'tohir@gmail.com', 'adiputra@gmail.com,parinussa@gmail.com', 'deskripsi file', '50eb20c1-3b8a-4d8a-8fc6-dc10973596a0.pdf', '2017-08-29 07:47:29', 'adiputra', 7),
- (6, 'sdfsdf', 'lead@yahoo.com', 'parinussa@gmail.com,muh.aliusman@yahoo.co.id', NULL, 'b6ce4ea4-f5a7-4c51-b5e5-07587d6c3a6b.jpg', '2017-09-14 14:06:59', 'parinussa', 10);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_meeting`
- --
- DROP TABLE IF EXISTS `lead_meeting`;
- CREATE TABLE `lead_meeting` (
- `lead_meeting_id` int(11) NOT NULL,
- `lead_meeting_name` varchar(100) DEFAULT NULL,
- `lead_meeting_location` varchar(255) DEFAULT NULL,
- `lead_meeting_start_date` datetime DEFAULT NULL,
- `lead_meeting_end_date` datetime DEFAULT NULL,
- `lead_meeting_description` text,
- `lead_meeting_date` datetime NOT NULL,
- `lead_meeting_user` varchar(100) NOT NULL,
- `lead_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_meeting`
- --
- INSERT INTO `lead_meeting` (`lead_meeting_id`, `lead_meeting_name`, `lead_meeting_location`, `lead_meeting_start_date`, `lead_meeting_end_date`, `lead_meeting_description`, `lead_meeting_date`, `lead_meeting_user`, `lead_id`) VALUES
- (1, 'CRM', 'KN', '2017-08-29 00:00:00', '2017-08-29 00:00:00', 'membahas project kn', '2017-08-29 04:29:00', 'adiputra', 6),
- (2, 'meeting', 'kemayoran', '2017-08-29 00:00:00', '2017-08-29 00:00:00', 'meeting', '2017-08-29 08:00:10', 'adiputra', 7),
- (3, 'meeting 2', 'kelapa gading', '2017-08-31 00:00:00', '2017-08-31 00:00:00', 'meeting kelapa gading', '2017-08-29 08:00:54', 'adiputra', 7);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_meeting_users`
- --
- DROP TABLE IF EXISTS `lead_meeting_users`;
- CREATE TABLE `lead_meeting_users` (
- `lead_meeting_id` int(11) NOT NULL,
- `lead_user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_meeting_users`
- --
- INSERT INTO `lead_meeting_users` (`lead_meeting_id`, `lead_user_id`) VALUES
- (1, 18),
- (1, 21),
- (2, 18),
- (3, 18);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_notes`
- --
- DROP TABLE IF EXISTS `lead_notes`;
- CREATE TABLE `lead_notes` (
- `lead_note_id` int(11) NOT NULL,
- `lead_note_name` varchar(100) NOT NULL,
- `lead_note_description` text,
- `lead_note_date` datetime NOT NULL,
- `lead_note_user` varchar(100) NOT NULL,
- `lead_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_notes`
- --
- INSERT INTO `lead_notes` (`lead_note_id`, `lead_note_name`, `lead_note_description`, `lead_note_date`, `lead_note_user`, `lead_id`) VALUES
- (1, 'Note Pertama', '<p>ini adalah descripsi note pertama</p>', '2017-08-28 16:34:17', 'parinussa', 3),
- (3, 'Note baru lgi', '<span style=\"color: rgb(34, 34, 34); font-family: sans-serif; font-size: 14px; letter-spacing: normal;\">oubled faced features that were found around the majority of the household clusters. These were often linked to the platforms that led to the sacbeobs. A lot of features found tended to connect to something or lead to something but the other end was left open-ended. Coba has many features that are platforms or on platforms. The last major linear </span>', '2017-08-29 04:30:46', 'adiputra', 6),
- (4, 'coba lagi', '<span style=\"color: rgb(34, 34, 34); font-family: sans-serif; font-size: 14px; letter-spacing: normal;\">by the new buildings dating to the time 1200-1500 AD, now built in the typical Eastern coastal style. However, power centers and trading routes had moved to the coast,</span>', '2017-08-29 04:31:07', 'adiputra', 6),
- (5, 'note', '<p>contoh note</p>', '2017-08-29 07:46:28', 'adiputra', 7),
- (6, 'Judul Note', '<p>Ini adalah judul note yang bisasa dilakukan</p>', '2017-09-14 13:59:29', 'parinussa', 10);
- -- --------------------------------------------------------
- --
- -- Table structure for table `lead_tasks`
- --
- DROP TABLE IF EXISTS `lead_tasks`;
- CREATE TABLE `lead_tasks` (
- `lead_task_id` int(11) NOT NULL,
- `lead_task_name` varchar(100) NOT NULL,
- `lead_task_description` varchar(45) DEFAULT NULL,
- `lead_task_status` int(11) DEFAULT NULL,
- `lead_task_due_date` datetime DEFAULT NULL,
- `lead_task_date` datetime NOT NULL,
- `lead_task_user` varchar(100) NOT NULL,
- `lead_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Dumping data for table `lead_tasks`
- --
- INSERT INTO `lead_tasks` (`lead_task_id`, `lead_task_name`, `lead_task_description`, `lead_task_status`, `lead_task_due_date`, `lead_task_date`, `lead_task_user`, `lead_id`) VALUES
- (1, 'Task Pertama', 'Ini task pertama untuk di follow up', 100, '2017-08-28 00:00:00', '2017-08-28 16:30:45', 'parinussa', 3),
- (2, 'Task Kedua', 'Ini Task Kedua', 30, '2017-08-28 00:00:00', '2017-08-28 16:31:14', 'parinussa', 3),
- (3, 'Task Ketiga', 'Ini isi task Ketiga', 40, '2017-08-28 00:00:00', '2017-08-28 16:31:40', 'parinussa', 3),
- (4, 'Task Keempat', 'ini task keempat', 60, '2017-08-28 00:00:00', '2017-08-28 16:32:57', 'parinussa', 3),
- (5, 'Task Kelima', 'ini task kelima', 20, '2017-08-28 00:00:00', '2017-08-28 16:33:24', 'parinussa', 3),
- (6, 'task keenam', 'ini task keenam', 30, '2017-08-28 00:00:00', '2017-08-28 16:33:48', 'parinussa', 3),
- (7, 'new task', 'this is new task', 50, '2017-08-29 00:00:00', '2017-08-29 04:35:13', 'adiputra', 6),
- (8, 'new task again', 'this is new task again', 40, '2017-08-29 00:00:00', '2017-08-29 04:35:32', 'adiputra', 6),
- (9, 'new task 2', 'a lengthy power struggle with Chichén Itzá, w', 40, '2017-08-29 00:00:00', '2017-08-29 04:35:55', 'adiputra', 6),
- (10, 'New Task 3', 'new task again', 70, '2017-08-29 00:00:00', '2017-08-29 04:36:12', 'adiputra', 6),
- (11, 'New Task 5', 'This is new task 5', 70, '2017-08-29 00:00:00', '2017-08-29 04:36:34', 'adiputra', 6),
- (12, 'Folloe up', 'deskripsi', 60, '2017-08-29 00:00:00', '2017-08-29 07:43:58', 'adiputra', 7),
- (13, 'task baru', 'deskripsi', 40, '2017-08-29 00:00:00', '2017-08-29 07:44:21', 'adiputra', 7),
- (14, 'Task Pertama', 'Ini Task Pertama', 80, '2017-09-14 00:00:00', '2017-09-14 13:58:55', 'parinussa', 10);
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_calls`
- --
- DROP TABLE IF EXISTS `opportunity_calls`;
- CREATE TABLE `opportunity_calls` (
- `opportunity_call_id` int(11) NOT NULL,
- `opportunity_call_title` varchar(100) DEFAULT NULL,
- `opportunity_call_duration` int(11) DEFAULT NULL,
- `opportunity_call_time` enum('1','2','3') DEFAULT '1' COMMENT '1= Second\n2= Minutes\n3=Hour\n',
- `opportunity_call_notes` text,
- `opportunity_call_date` datetime NOT NULL,
- `opportunity_call_user` varchar(100) NOT NULL,
- `opportunity_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_files`
- --
- DROP TABLE IF EXISTS `opportunity_files`;
- CREATE TABLE `opportunity_files` (
- `opportunity_files_id` int(11) NOT NULL,
- `opportunity_file_subject` varchar(100) DEFAULT NULL,
- `opportunity_file_to` varchar(100) NOT NULL,
- `opportunity_file_cc` varchar(100) DEFAULT NULL,
- `opportunity_file_description` text,
- `opportunity_file_name` varchar(100) NOT NULL,
- `opportunity_file_date` datetime NOT NULL,
- `opportunity_file_user` varchar(100) NOT NULL,
- `opportunity_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_meeting`
- --
- DROP TABLE IF EXISTS `opportunity_meeting`;
- CREATE TABLE `opportunity_meeting` (
- `opportunity_meeting_id` int(11) NOT NULL,
- `opportunity_meeting_name` varchar(100) DEFAULT NULL,
- `opportunity_meeting_location` varchar(255) DEFAULT NULL,
- `opportunity_meeting_start_date` datetime DEFAULT NULL,
- `opportunity_meeting_end_date` datetime DEFAULT NULL,
- `opportunity_meeting_description` text,
- `opportunity_meeting_date` datetime NOT NULL,
- `opportunity_meeting_user` varchar(100) NOT NULL,
- `opportunity_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_meeting_users`
- --
- DROP TABLE IF EXISTS `opportunity_meeting_users`;
- CREATE TABLE `opportunity_meeting_users` (
- `opportunity_meeting_id` int(11) NOT NULL,
- `opportunity_user_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_notes`
- --
- DROP TABLE IF EXISTS `opportunity_notes`;
- CREATE TABLE `opportunity_notes` (
- `opportunity_note_id` int(11) NOT NULL,
- `opportunity_note_name` varchar(100) NOT NULL,
- `opportunity_note_description` text,
- `opportunity_note_date` datetime DEFAULT NULL,
- `opportunity_note_user` varchar(100) DEFAULT NULL,
- `opportunity_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- -- --------------------------------------------------------
- --
- -- Table structure for table `opportunity_tasks`
- --
- DROP TABLE IF EXISTS `opportunity_tasks`;
- CREATE TABLE `opportunity_tasks` (
- `opportunity_task_id` int(11) NOT NULL,
- `opportunity_task_name` varchar(100) NOT NULL,
- `opportunity_task_description` varchar(45) DEFAULT NULL,
- `opportunity_task_status` int(11) DEFAULT NULL,
- `opportunity_task_due_date` datetime DEFAULT NULL,
- `opportunity_task_date` datetime NOT NULL,
- `opportunity_task_user` varchar(100) NOT NULL,
- `opportunity_id` int(11) NOT NULL
- ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
- --
- -- Indexes for dumped tables
- --
- --
- -- Indexes for table `coba`
- --
- ALTER TABLE `coba`
- ADD PRIMARY KEY (`id`);
- --
- -- Indexes for table `company_calls`
- --
- ALTER TABLE `company_calls`
- ADD PRIMARY KEY (`company_call_id`),
- ADD KEY `fk_company_calls_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `company_files`
- --
- ALTER TABLE `company_files`
- ADD PRIMARY KEY (`company_files_id`),
- ADD KEY `fk_company_files_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `company_meeting`
- --
- ALTER TABLE `company_meeting`
- ADD PRIMARY KEY (`company_meeting_id`),
- ADD KEY `fk_company_meeting_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `company_meeting_users`
- --
- ALTER TABLE `company_meeting_users`
- ADD PRIMARY KEY (`company_meeting_id`,`company_user_id`),
- ADD KEY `fk_company_meeting_has_crm_users_crm_users1_idx` (`company_user_id`),
- ADD KEY `fk_company_meeting_has_crm_users_company_meeting1_idx` (`company_meeting_id`);
- --
- -- Indexes for table `company_notes`
- --
- ALTER TABLE `company_notes`
- ADD PRIMARY KEY (`company_note_id`),
- ADD KEY `fk_company_notes_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `company_tasks`
- --
- ALTER TABLE `company_tasks`
- ADD PRIMARY KEY (`company_task_id`),
- ADD KEY `fk_company_tasks_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `contact_calls`
- --
- ALTER TABLE `contact_calls`
- ADD PRIMARY KEY (`contact_call_id`),
- ADD KEY `fk_customer_calls_crm_customers1_idx` (`contact_id`);
- --
- -- Indexes for table `contact_files`
- --
- ALTER TABLE `contact_files`
- ADD PRIMARY KEY (`contact_files_id`),
- ADD KEY `fk_customer_files_copy1_crm_customers1_idx` (`contact_id`);
- --
- -- Indexes for table `contact_meeting`
- --
- ALTER TABLE `contact_meeting`
- ADD PRIMARY KEY (`contact_meeting_id`),
- ADD KEY `fk_customer_meeting_crm_customers1_idx` (`contact_id`);
- --
- -- Indexes for table `contact_meeting_users`
- --
- ALTER TABLE `contact_meeting_users`
- ADD PRIMARY KEY (`contact_meeting_id`,`contact_user_id`),
- ADD KEY `fk_contact_meeting_has_crm_users_crm_users1_idx` (`contact_user_id`),
- ADD KEY `fk_contact_meeting_has_crm_users_contact_meeting1_idx` (`contact_meeting_id`);
- --
- -- Indexes for table `contact_notes`
- --
- ALTER TABLE `contact_notes`
- ADD PRIMARY KEY (`contact_note_id`),
- ADD KEY `fk_customer_notes_crm_customers1_idx` (`contact_id`);
- --
- -- Indexes for table `contact_tasks`
- --
- ALTER TABLE `contact_tasks`
- ADD PRIMARY KEY (`contact_task_id`),
- ADD KEY `fk_customer_tasks_crm_customers1_idx` (`contact_id`);
- --
- -- Indexes for table `crm_campaigns`
- --
- ALTER TABLE `crm_campaigns`
- ADD PRIMARY KEY (`campaign_id`);
- --
- -- Indexes for table `crm_companies`
- --
- ALTER TABLE `crm_companies`
- ADD PRIMARY KEY (`company_id`),
- ADD KEY `fk_crm_company_crm_industry1_idx` (`company_industry`),
- ADD KEY `fk_crm_company_crm_groups1_idx` (`company_groups`),
- ADD KEY `fk_crm_companies_crm_companies1_idx` (`company_parent`);
- --
- -- Indexes for table `crm_companies_products`
- --
- ALTER TABLE `crm_companies_products`
- ADD KEY `company_id` (`company_id`),
- ADD KEY `product_id` (`product_id`);
- --
- -- Indexes for table `crm_contacts`
- --
- ALTER TABLE `crm_contacts`
- ADD PRIMARY KEY (`contact_id`),
- ADD KEY `fk_crm_customer_crm_company1_idx` (`company_id`),
- ADD KEY `fk_crm_customer_crm_groups1_idx` (`contact_groups`),
- ADD KEY `fk_crm_customer_peoples1_idx` (`contact_id`),
- ADD KEY `fk_crm_contacts_crm_peoples1_idx` (`people_id`);
- --
- -- Indexes for table `crm_employee`
- --
- ALTER TABLE `crm_employee`
- ADD PRIMARY KEY (`employee_id`);
- --
- -- Indexes for table `crm_faq`
- --
- ALTER TABLE `crm_faq`
- ADD PRIMARY KEY (`faq_id`);
- --
- -- Indexes for table `crm_groups`
- --
- ALTER TABLE `crm_groups`
- ADD PRIMARY KEY (`group_id`),
- ADD KEY `group_manager_id` (`group_manager_id`);
- --
- -- Indexes for table `crm_industry`
- --
- ALTER TABLE `crm_industry`
- ADD PRIMARY KEY (`industry_id`);
- --
- -- Indexes for table `crm_invoices`
- --
- ALTER TABLE `crm_invoices`
- ADD PRIMARY KEY (`invoice_id`),
- ADD KEY `fk_crm_invoices_crm_terms1_idx` (`term_id`),
- ADD KEY `fk_crm_invoices_crm_companies1_idx` (`company_id`);
- --
- -- Indexes for table `crm_invoices_products`
- --
- ALTER TABLE `crm_invoices_products`
- ADD PRIMARY KEY (`invoice_detail_id`,`product_id`),
- ADD KEY `fk_crm_invoice_details_has_crm_products_crm_products1_idx` (`product_id`),
- ADD KEY `fk_crm_invoice_details_has_crm_products_crm_invoice_details_idx` (`invoice_detail_id`),
- ADD KEY `invoice_detail_id` (`invoice_detail_id`);
- --
- -- Indexes for table `crm_invoice_details`
- --
- ALTER TABLE `crm_invoice_details`
- ADD PRIMARY KEY (`invoice_detail_id`),
- ADD KEY `fk_crm_invoice_details_crm_invoices1_idx` (`invoice_id`);
- --
- -- Indexes for table `crm_leads`
- --
- ALTER TABLE `crm_leads`
- ADD PRIMARY KEY (`lead_id`),
- ADD KEY `fk_crm_leads_crm_lead_status1_idx` (`lead_label`),
- ADD KEY `fk_crm_leads_crm_groups1_idx` (`lead_groups`),
- ADD KEY `fk_crm_leads_crm_peoples1_idx` (`people_id`);
- --
- -- Indexes for table `crm_lead_label`
- --
- ALTER TABLE `crm_lead_label`
- ADD PRIMARY KEY (`lead_label_id`);
- --
- -- Indexes for table `crm_modules`
- --
- ALTER TABLE `crm_modules`
- ADD PRIMARY KEY (`module_id`);
- --
- -- Indexes for table `crm_news`
- --
- ALTER TABLE `crm_news`
- ADD PRIMARY KEY (`news_id`);
- --
- -- Indexes for table `crm_opportunities`
- --
- ALTER TABLE `crm_opportunities`
- ADD PRIMARY KEY (`opportunity_id`),
- ADD KEY `fk_crm_opportunities_crm_opportunity_stage1_idx` (`opportunity_stage_id`),
- ADD KEY `fk_crm_opportunities_crm_companies1_idx` (`company_id`),
- ADD KEY `fk_crm_opportunities_crm_campaigns1_idx` (`opportunity_campaign_id`);
- --
- -- Indexes for table `crm_opportunities_contacts`
- --
- ALTER TABLE `crm_opportunities_contacts`
- ADD PRIMARY KEY (`opportunity_id`,`contact_id`),
- ADD KEY `fk_crm_opportunities_has_crm_contacts_crm_contacts1_idx` (`contact_id`),
- ADD KEY `fk_crm_opportunities_has_crm_contacts_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `crm_opportunities_products`
- --
- ALTER TABLE `crm_opportunities_products`
- ADD PRIMARY KEY (`opportunity_id`,`product_id`),
- ADD KEY `fk_crm_opportunities_has_crm_products_crm_products1_idx` (`product_id`),
- ADD KEY `fk_crm_opportunities_has_crm_products_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `crm_opportunity_stage`
- --
- ALTER TABLE `crm_opportunity_stage`
- ADD PRIMARY KEY (`opportunity_stage_id`);
- --
- -- Indexes for table `crm_payment`
- --
- ALTER TABLE `crm_payment`
- ADD PRIMARY KEY (`payment_id`),
- ADD KEY `invoice_id` (`invoice_detail_id`),
- ADD KEY `payment_method_id` (`payment_method_id`);
- --
- -- Indexes for table `crm_payment_methods`
- --
- ALTER TABLE `crm_payment_methods`
- ADD PRIMARY KEY (`payment_method_id`);
- --
- -- Indexes for table `crm_peoples`
- --
- ALTER TABLE `crm_peoples`
- ADD PRIMARY KEY (`people_id`),
- ADD KEY `fk_peoples_crm_industry1_idx` (`people_industry`),
- ADD KEY `fk_peoples_crm_source1_idx` (`people_source`);
- --
- -- Indexes for table `crm_products`
- --
- ALTER TABLE `crm_products`
- ADD PRIMARY KEY (`product_id`),
- ADD KEY `crm_products_crm_product_categories_category_id_fk` (`product_category_id`);
- --
- -- Indexes for table `crm_products_campaigns`
- --
- ALTER TABLE `crm_products_campaigns`
- ADD PRIMARY KEY (`product_id`,`campaign_id`),
- ADD KEY `fk_crm_products_has_crm_campaigns_crm_campaigns1_idx` (`campaign_id`),
- ADD KEY `fk_crm_products_has_crm_campaigns_crm_products1_idx` (`product_id`);
- --
- -- Indexes for table `crm_product_categories`
- --
- ALTER TABLE `crm_product_categories`
- ADD PRIMARY KEY (`category_id`);
- --
- -- Indexes for table `crm_roles`
- --
- ALTER TABLE `crm_roles`
- ADD PRIMARY KEY (`role_id`);
- --
- -- Indexes for table `crm_roles_modules`
- --
- ALTER TABLE `crm_roles_modules`
- ADD PRIMARY KEY (`crm_roles_role_id`,`crm_modules_module_id`),
- ADD KEY `fk_crm_roles_has_crm_modules_crm_modules1_idx` (`crm_modules_module_id`),
- ADD KEY `fk_crm_roles_has_crm_modules_crm_roles1_idx` (`crm_roles_role_id`);
- --
- -- Indexes for table `crm_setup_company`
- --
- ALTER TABLE `crm_setup_company`
- ADD PRIMARY KEY (`company_id`);
- --
- -- Indexes for table `crm_source`
- --
- ALTER TABLE `crm_source`
- ADD PRIMARY KEY (`source_id`);
- --
- -- Indexes for table `crm_terms`
- --
- ALTER TABLE `crm_terms`
- ADD PRIMARY KEY (`term_id`);
- --
- -- Indexes for table `crm_tickets`
- --
- ALTER TABLE `crm_tickets`
- ADD PRIMARY KEY (`ticket_id`),
- ADD KEY `ticket_customer_id` (`ticket_customer_id`),
- ADD KEY `ticket_type_id` (`ticket_type_id`),
- ADD KEY `ticket_status_id` (`ticket_status_id`);
- --
- -- Indexes for table `crm_tickets_employee`
- --
- ALTER TABLE `crm_tickets_employee`
- ADD KEY `ticket_id` (`ticket_id`),
- ADD KEY `employee_id` (`employee_id`);
- --
- -- Indexes for table `crm_ticket_status`
- --
- ALTER TABLE `crm_ticket_status`
- ADD PRIMARY KEY (`ticket_status_id`);
- --
- -- Indexes for table `crm_ticket_type`
- --
- ALTER TABLE `crm_ticket_type`
- ADD PRIMARY KEY (`ticket_type_id`);
- --
- -- Indexes for table `crm_users`
- --
- ALTER TABLE `crm_users`
- ADD PRIMARY KEY (`user_id`),
- ADD UNIQUE KEY `crm_users_user_email_uindex` (`user_email`),
- ADD KEY `crm_users_crm_groups_group_id_fk` (`user_group_id`),
- ADD KEY `fk_crm_users_crm_roles1_idx` (`user_role_id`);
- --
- -- Indexes for table `crm_users_companies`
- --
- ALTER TABLE `crm_users_companies`
- ADD PRIMARY KEY (`company_id`,`user_id`),
- ADD KEY `fk_crm_company_has_crm_users_crm_users1_idx` (`user_id`),
- ADD KEY `fk_crm_company_has_crm_users_crm_company1_idx` (`company_id`);
- --
- -- Indexes for table `crm_users_contacts`
- --
- ALTER TABLE `crm_users_contacts`
- ADD PRIMARY KEY (`contact_id`,`user_id`),
- ADD KEY `fk_crm_users_has_crm_customer_crm_customer1_idx` (`contact_id`),
- ADD KEY `fk_crm_users_has_crm_customer_crm_users1_idx` (`user_id`);
- --
- -- Indexes for table `crm_users_leads`
- --
- ALTER TABLE `crm_users_leads`
- ADD PRIMARY KEY (`lead_id`,`user_id`),
- ADD KEY `fk_crm_users_has_crm_leads_crm_leads1_idx` (`lead_id`),
- ADD KEY `fk_crm_users_has_crm_leads_crm_users1_idx` (`user_id`);
- --
- -- Indexes for table `crm_users_opportunities`
- --
- ALTER TABLE `crm_users_opportunities`
- ADD KEY `user_id` (`user_id`),
- ADD KEY `opportunity_id` (`opportunity_id`);
- --
- -- Indexes for table `invoice_control`
- --
- ALTER TABLE `invoice_control`
- ADD PRIMARY KEY (`invoice_id`),
- ADD KEY `invoice_id` (`invoice_id`);
- --
- -- Indexes for table `lead_calls`
- --
- ALTER TABLE `lead_calls`
- ADD PRIMARY KEY (`lead_call_id`),
- ADD KEY `fk_lead_calls_crm_leads1_idx` (`lead_id`);
- --
- -- Indexes for table `lead_files`
- --
- ALTER TABLE `lead_files`
- ADD PRIMARY KEY (`lead_files_id`),
- ADD KEY `fk_lead_files_crm_leads1_idx` (`lead_id`);
- --
- -- Indexes for table `lead_meeting`
- --
- ALTER TABLE `lead_meeting`
- ADD PRIMARY KEY (`lead_meeting_id`),
- ADD KEY `fk_lead_meeting_crm_leads1_idx` (`lead_id`);
- --
- -- Indexes for table `lead_meeting_users`
- --
- ALTER TABLE `lead_meeting_users`
- ADD PRIMARY KEY (`lead_meeting_id`,`lead_user_id`),
- ADD KEY `fk_lead_meeting_has_crm_users_crm_users1_idx` (`lead_user_id`),
- ADD KEY `fk_lead_meeting_has_crm_users_lead_meeting1_idx` (`lead_meeting_id`);
- --
- -- Indexes for table `lead_notes`
- --
- ALTER TABLE `lead_notes`
- ADD PRIMARY KEY (`lead_note_id`),
- ADD KEY `fk_lead_notes_crm_leads1_idx` (`lead_id`);
- --
- -- Indexes for table `lead_tasks`
- --
- ALTER TABLE `lead_tasks`
- ADD PRIMARY KEY (`lead_task_id`),
- ADD KEY `fk_lead_task_crm_leads1_idx` (`lead_id`);
- --
- -- Indexes for table `opportunity_calls`
- --
- ALTER TABLE `opportunity_calls`
- ADD PRIMARY KEY (`opportunity_call_id`),
- ADD KEY `fk_opportunity_calls_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `opportunity_files`
- --
- ALTER TABLE `opportunity_files`
- ADD PRIMARY KEY (`opportunity_files_id`),
- ADD KEY `fk_opportunity_files_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `opportunity_meeting`
- --
- ALTER TABLE `opportunity_meeting`
- ADD PRIMARY KEY (`opportunity_meeting_id`),
- ADD KEY `fk_opportunity_meeting_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `opportunity_meeting_users`
- --
- ALTER TABLE `opportunity_meeting_users`
- ADD PRIMARY KEY (`opportunity_meeting_id`,`opportunity_user_id`),
- ADD KEY `fk_opportunity_meeting_has_crm_users_crm_users1_idx` (`opportunity_user_id`),
- ADD KEY `fk_opportunity_meeting_has_crm_users_opportunity_meeting1_idx` (`opportunity_meeting_id`);
- --
- -- Indexes for table `opportunity_notes`
- --
- ALTER TABLE `opportunity_notes`
- ADD PRIMARY KEY (`opportunity_note_id`),
- ADD KEY `fk_opportunity_notes_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- Indexes for table `opportunity_tasks`
- --
- ALTER TABLE `opportunity_tasks`
- ADD PRIMARY KEY (`opportunity_task_id`),
- ADD KEY `fk_opportunity_tasks_crm_opportunities1_idx` (`opportunity_id`);
- --
- -- AUTO_INCREMENT for dumped tables
- --
- --
- -- AUTO_INCREMENT for table `coba`
- --
- ALTER TABLE `coba`
- MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
- --
- -- AUTO_INCREMENT for table `company_calls`
- --
- ALTER TABLE `company_calls`
- MODIFY `company_call_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `company_files`
- --
- ALTER TABLE `company_files`
- MODIFY `company_files_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `company_meeting`
- --
- ALTER TABLE `company_meeting`
- MODIFY `company_meeting_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `company_notes`
- --
- ALTER TABLE `company_notes`
- MODIFY `company_note_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `company_tasks`
- --
- ALTER TABLE `company_tasks`
- MODIFY `company_task_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `contact_calls`
- --
- ALTER TABLE `contact_calls`
- MODIFY `contact_call_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `contact_files`
- --
- ALTER TABLE `contact_files`
- MODIFY `contact_files_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `contact_meeting`
- --
- ALTER TABLE `contact_meeting`
- MODIFY `contact_meeting_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `contact_notes`
- --
- ALTER TABLE `contact_notes`
- MODIFY `contact_note_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `contact_tasks`
- --
- ALTER TABLE `contact_tasks`
- MODIFY `contact_task_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `crm_campaigns`
- --
- ALTER TABLE `crm_campaigns`
- MODIFY `campaign_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
- --
- -- AUTO_INCREMENT for table `crm_companies`
- --
- ALTER TABLE `crm_companies`
- MODIFY `company_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
- --
- -- AUTO_INCREMENT for table `crm_contacts`
- --
- ALTER TABLE `crm_contacts`
- MODIFY `contact_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
- --
- -- AUTO_INCREMENT for table `crm_employee`
- --
- ALTER TABLE `crm_employee`
- MODIFY `employee_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
- --
- -- AUTO_INCREMENT for table `crm_faq`
- --
- ALTER TABLE `crm_faq`
- MODIFY `faq_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `crm_groups`
- --
- ALTER TABLE `crm_groups`
- MODIFY `group_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=10;
- --
- -- AUTO_INCREMENT for table `crm_industry`
- --
- ALTER TABLE `crm_industry`
- MODIFY `industry_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
- --
- -- AUTO_INCREMENT for table `crm_invoices`
- --
- ALTER TABLE `crm_invoices`
- MODIFY `invoice_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
- --
- -- AUTO_INCREMENT for table `crm_invoice_details`
- --
- ALTER TABLE `crm_invoice_details`
- MODIFY `invoice_detail_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=17;
- --
- -- AUTO_INCREMENT for table `crm_leads`
- --
- ALTER TABLE `crm_leads`
- MODIFY `lead_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
- --
- -- AUTO_INCREMENT for table `crm_lead_label`
- --
- ALTER TABLE `crm_lead_label`
- MODIFY `lead_label_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
- --
- -- AUTO_INCREMENT for table `crm_modules`
- --
- ALTER TABLE `crm_modules`
- MODIFY `module_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=16;
- --
- -- AUTO_INCREMENT for table `crm_news`
- --
- ALTER TABLE `crm_news`
- MODIFY `news_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `crm_opportunities`
- --
- ALTER TABLE `crm_opportunities`
- MODIFY `opportunity_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;
- --
- -- AUTO_INCREMENT for table `crm_opportunity_stage`
- --
- ALTER TABLE `crm_opportunity_stage`
- MODIFY `opportunity_stage_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
- --
- -- AUTO_INCREMENT for table `crm_payment`
- --
- ALTER TABLE `crm_payment`
- MODIFY `payment_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
- --
- -- AUTO_INCREMENT for table `crm_payment_methods`
- --
- ALTER TABLE `crm_payment_methods`
- MODIFY `payment_method_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
- --
- -- AUTO_INCREMENT for table `crm_peoples`
- --
- ALTER TABLE `crm_peoples`
- MODIFY `people_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=29;
- --
- -- AUTO_INCREMENT for table `crm_products`
- --
- ALTER TABLE `crm_products`
- MODIFY `product_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
- --
- -- AUTO_INCREMENT for table `crm_product_categories`
- --
- ALTER TABLE `crm_product_categories`
- MODIFY `category_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=11;
- --
- -- AUTO_INCREMENT for table `crm_roles`
- --
- ALTER TABLE `crm_roles`
- MODIFY `role_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'User Administrator Hard Code All access module', AUTO_INCREMENT=8;
- --
- -- AUTO_INCREMENT for table `crm_setup_company`
- --
- ALTER TABLE `crm_setup_company`
- MODIFY `company_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
- --
- -- AUTO_INCREMENT for table `crm_source`
- --
- ALTER TABLE `crm_source`
- MODIFY `source_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
- --
- -- AUTO_INCREMENT for table `crm_terms`
- --
- ALTER TABLE `crm_terms`
- MODIFY `term_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
- --
- -- AUTO_INCREMENT for table `crm_tickets`
- --
- ALTER TABLE `crm_tickets`
- MODIFY `ticket_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=9;
- --
- -- AUTO_INCREMENT for table `crm_ticket_status`
- --
- ALTER TABLE `crm_ticket_status`
- MODIFY `ticket_status_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
- --
- -- AUTO_INCREMENT for table `crm_ticket_type`
- --
- ALTER TABLE `crm_ticket_type`
- MODIFY `ticket_type_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
- --
- -- AUTO_INCREMENT for table `crm_users`
- --
- ALTER TABLE `crm_users`
- MODIFY `user_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=23;
- --
- -- AUTO_INCREMENT for table `lead_calls`
- --
- ALTER TABLE `lead_calls`
- MODIFY `lead_call_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
- --
- -- AUTO_INCREMENT for table `lead_files`
- --
- ALTER TABLE `lead_files`
- MODIFY `lead_files_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
- --
- -- AUTO_INCREMENT for table `lead_meeting`
- --
- ALTER TABLE `lead_meeting`
- MODIFY `lead_meeting_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
- --
- -- AUTO_INCREMENT for table `lead_notes`
- --
- ALTER TABLE `lead_notes`
- MODIFY `lead_note_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
- --
- -- AUTO_INCREMENT for table `lead_tasks`
- --
- ALTER TABLE `lead_tasks`
- MODIFY `lead_task_id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
- --
- -- AUTO_INCREMENT for table `opportunity_calls`
- --
- ALTER TABLE `opportunity_calls`
- MODIFY `opportunity_call_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `opportunity_files`
- --
- ALTER TABLE `opportunity_files`
- MODIFY `opportunity_files_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `opportunity_meeting`
- --
- ALTER TABLE `opportunity_meeting`
- MODIFY `opportunity_meeting_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `opportunity_notes`
- --
- ALTER TABLE `opportunity_notes`
- MODIFY `opportunity_note_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- AUTO_INCREMENT for table `opportunity_tasks`
- --
- ALTER TABLE `opportunity_tasks`
- MODIFY `opportunity_task_id` int(11) NOT NULL AUTO_INCREMENT;
- --
- -- Constraints for dumped tables
- --
- --
- -- Constraints for table `company_calls`
- --
- ALTER TABLE `company_calls`
- ADD CONSTRAINT `fk_company_calls_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `company_files`
- --
- ALTER TABLE `company_files`
- ADD CONSTRAINT `fk_company_files_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `company_meeting`
- --
- ALTER TABLE `company_meeting`
- ADD CONSTRAINT `fk_company_meeting_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `company_meeting_users`
- --
- ALTER TABLE `company_meeting_users`
- ADD CONSTRAINT `fk_company_meeting_has_crm_users_company_meeting1` FOREIGN KEY (`company_meeting_id`) REFERENCES `company_meeting` (`company_meeting_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_company_meeting_has_crm_users_crm_users1` FOREIGN KEY (`company_user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `company_notes`
- --
- ALTER TABLE `company_notes`
- ADD CONSTRAINT `fk_company_notes_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `company_tasks`
- --
- ALTER TABLE `company_tasks`
- ADD CONSTRAINT `fk_company_tasks_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_calls`
- --
- ALTER TABLE `contact_calls`
- ADD CONSTRAINT `fk_customer_calls_crm_customers1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_files`
- --
- ALTER TABLE `contact_files`
- ADD CONSTRAINT `fk_customer_files_copy1_crm_customers1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_meeting`
- --
- ALTER TABLE `contact_meeting`
- ADD CONSTRAINT `fk_customer_meeting_crm_customers1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_meeting_users`
- --
- ALTER TABLE `contact_meeting_users`
- ADD CONSTRAINT `fk_contact_meeting_has_crm_users_contact_meeting1` FOREIGN KEY (`contact_meeting_id`) REFERENCES `contact_meeting` (`contact_meeting_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_contact_meeting_has_crm_users_crm_users1` FOREIGN KEY (`contact_user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_notes`
- --
- ALTER TABLE `contact_notes`
- ADD CONSTRAINT `fk_customer_notes_crm_customers1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `contact_tasks`
- --
- ALTER TABLE `contact_tasks`
- ADD CONSTRAINT `fk_customer_tasks_crm_customers1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_companies`
- --
- ALTER TABLE `crm_companies`
- ADD CONSTRAINT `fk_crm_companies_crm_companies1` FOREIGN KEY (`company_parent`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_company_crm_groups1` FOREIGN KEY (`company_groups`) REFERENCES `crm_groups` (`group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_company_crm_industry1` FOREIGN KEY (`company_industry`) REFERENCES `crm_industry` (`industry_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_companies_products`
- --
- ALTER TABLE `crm_companies_products`
- ADD CONSTRAINT `crm_companies_products_ibfk_1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`),
- ADD CONSTRAINT `crm_companies_products_ibfk_2` FOREIGN KEY (`product_id`) REFERENCES `crm_products` (`product_id`);
- --
- -- Constraints for table `crm_contacts`
- --
- ALTER TABLE `crm_contacts`
- ADD CONSTRAINT `fk_crm_contacts_crm_peoples1` FOREIGN KEY (`people_id`) REFERENCES `crm_peoples` (`people_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_customer_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_customer_crm_groups1` FOREIGN KEY (`contact_groups`) REFERENCES `crm_groups` (`group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_invoices`
- --
- ALTER TABLE `crm_invoices`
- ADD CONSTRAINT `fk_crm_invoices_crm_companies1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_invoices_crm_terms1` FOREIGN KEY (`term_id`) REFERENCES `crm_terms` (`term_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_invoices_products`
- --
- ALTER TABLE `crm_invoices_products`
- ADD CONSTRAINT `fk_crm_invoice_details_has_crm_products_crm_invoice_detail` FOREIGN KEY (`invoice_detail_id`) REFERENCES `crm_invoice_details` (`invoice_detail_id`),
- ADD CONSTRAINT `fk_crm_invoice_details_has_crm_products_crm_products1` FOREIGN KEY (`product_id`) REFERENCES `crm_products` (`product_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_invoice_details`
- --
- ALTER TABLE `crm_invoice_details`
- ADD CONSTRAINT `fk_crm_invoice_details_crm_invoices1` FOREIGN KEY (`invoice_id`) REFERENCES `crm_invoices` (`invoice_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_leads`
- --
- ALTER TABLE `crm_leads`
- ADD CONSTRAINT `fk_crm_leads_crm_groups1` FOREIGN KEY (`lead_groups`) REFERENCES `crm_groups` (`group_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_leads_crm_lead_status1` FOREIGN KEY (`lead_label`) REFERENCES `crm_lead_label` (`lead_label_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_leads_crm_peoples1` FOREIGN KEY (`people_id`) REFERENCES `crm_peoples` (`people_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_opportunities`
- --
- ALTER TABLE `crm_opportunities`
- ADD CONSTRAINT `fk_crm_opportunities_crm_campaigns1` FOREIGN KEY (`opportunity_campaign_id`) REFERENCES `crm_campaigns` (`campaign_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_opportunities_crm_companies1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_opportunities_crm_opportunity_stage1` FOREIGN KEY (`opportunity_stage_id`) REFERENCES `crm_opportunity_stage` (`opportunity_stage_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_opportunities_contacts`
- --
- ALTER TABLE `crm_opportunities_contacts`
- ADD CONSTRAINT `fk_crm_opportunities_has_crm_contacts_crm_contacts1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_opportunities_has_crm_contacts_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_opportunities_products`
- --
- ALTER TABLE `crm_opportunities_products`
- ADD CONSTRAINT `fk_crm_opportunities_has_crm_products_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_opportunities_has_crm_products_crm_products1` FOREIGN KEY (`product_id`) REFERENCES `crm_products` (`product_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_payment`
- --
- ALTER TABLE `crm_payment`
- ADD CONSTRAINT `crm_payment_ibfk_1` FOREIGN KEY (`invoice_detail_id`) REFERENCES `crm_invoice_details` (`invoice_detail_id`),
- ADD CONSTRAINT `crm_payment_ibfk_2` FOREIGN KEY (`payment_method_id`) REFERENCES `crm_payment_methods` (`payment_method_id`);
- --
- -- Constraints for table `crm_peoples`
- --
- ALTER TABLE `crm_peoples`
- ADD CONSTRAINT `fk_peoples_crm_industry1` FOREIGN KEY (`people_industry`) REFERENCES `crm_industry` (`industry_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_peoples_crm_source1` FOREIGN KEY (`people_source`) REFERENCES `crm_source` (`source_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_products`
- --
- ALTER TABLE `crm_products`
- ADD CONSTRAINT `crm_products_crm_product_categories_category_id_fk` FOREIGN KEY (`product_category_id`) REFERENCES `crm_product_categories` (`category_id`);
- --
- -- Constraints for table `crm_products_campaigns`
- --
- ALTER TABLE `crm_products_campaigns`
- ADD CONSTRAINT `fk_crm_products_has_crm_campaigns_crm_campaigns1` FOREIGN KEY (`campaign_id`) REFERENCES `crm_campaigns` (`campaign_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_products_has_crm_campaigns_crm_products1` FOREIGN KEY (`product_id`) REFERENCES `crm_products` (`product_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_roles_modules`
- --
- ALTER TABLE `crm_roles_modules`
- ADD CONSTRAINT `fk_crm_roles_has_crm_modules_crm_modules1` FOREIGN KEY (`crm_modules_module_id`) REFERENCES `crm_modules` (`module_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_roles_has_crm_modules_crm_roles1` FOREIGN KEY (`crm_roles_role_id`) REFERENCES `crm_roles` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_tickets`
- --
- ALTER TABLE `crm_tickets`
- ADD CONSTRAINT `crm_tickets_ibfk_1` FOREIGN KEY (`ticket_customer_id`) REFERENCES `crm_companies` (`company_id`),
- ADD CONSTRAINT `crm_tickets_ibfk_2` FOREIGN KEY (`ticket_type_id`) REFERENCES `crm_ticket_type` (`ticket_type_id`),
- ADD CONSTRAINT `crm_tickets_ibfk_3` FOREIGN KEY (`ticket_status_id`) REFERENCES `crm_ticket_status` (`ticket_status_id`);
- --
- -- Constraints for table `crm_tickets_employee`
- --
- ALTER TABLE `crm_tickets_employee`
- ADD CONSTRAINT `crm_tickets_employee_ibfk_1` FOREIGN KEY (`ticket_id`) REFERENCES `crm_tickets` (`ticket_id`),
- ADD CONSTRAINT `crm_tickets_employee_ibfk_2` FOREIGN KEY (`employee_id`) REFERENCES `crm_employee` (`employee_id`);
- --
- -- Constraints for table `crm_users`
- --
- ALTER TABLE `crm_users`
- ADD CONSTRAINT `crm_users_crm_groups_group_id_fk` FOREIGN KEY (`user_group_id`) REFERENCES `crm_groups` (`group_id`),
- ADD CONSTRAINT `fk_crm_users_crm_roles1` FOREIGN KEY (`user_role_id`) REFERENCES `crm_roles` (`role_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_users_companies`
- --
- ALTER TABLE `crm_users_companies`
- ADD CONSTRAINT `fk_crm_company_has_crm_users_crm_company1` FOREIGN KEY (`company_id`) REFERENCES `crm_companies` (`company_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_company_has_crm_users_crm_users1` FOREIGN KEY (`user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_users_contacts`
- --
- ALTER TABLE `crm_users_contacts`
- ADD CONSTRAINT `fk_crm_users_has_crm_customer_crm_customer1` FOREIGN KEY (`contact_id`) REFERENCES `crm_contacts` (`contact_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_users_has_crm_customer_crm_users1` FOREIGN KEY (`user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_users_leads`
- --
- ALTER TABLE `crm_users_leads`
- ADD CONSTRAINT `fk_crm_users_has_crm_leads_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_crm_users_has_crm_leads_crm_users1` FOREIGN KEY (`user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `crm_users_opportunities`
- --
- ALTER TABLE `crm_users_opportunities`
- ADD CONSTRAINT `crm_users_opportunities_ibfk_1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE SET NULL ON UPDATE CASCADE,
- ADD CONSTRAINT `crm_users_opportunities_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE SET NULL ON UPDATE CASCADE;
- --
- -- Constraints for table `invoice_control`
- --
- ALTER TABLE `invoice_control`
- ADD CONSTRAINT `invoice_control_ibfk_1` FOREIGN KEY (`invoice_id`) REFERENCES `crm_invoices` (`invoice_id`);
- --
- -- Constraints for table `lead_calls`
- --
- ALTER TABLE `lead_calls`
- ADD CONSTRAINT `fk_lead_calls_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `lead_files`
- --
- ALTER TABLE `lead_files`
- ADD CONSTRAINT `fk_lead_files_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `lead_meeting`
- --
- ALTER TABLE `lead_meeting`
- ADD CONSTRAINT `fk_lead_meeting_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `lead_meeting_users`
- --
- ALTER TABLE `lead_meeting_users`
- ADD CONSTRAINT `fk_lead_meeting_has_crm_users_crm_users1` FOREIGN KEY (`lead_user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_lead_meeting_has_crm_users_lead_meeting1` FOREIGN KEY (`lead_meeting_id`) REFERENCES `lead_meeting` (`lead_meeting_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `lead_notes`
- --
- ALTER TABLE `lead_notes`
- ADD CONSTRAINT `fk_lead_notes_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `lead_tasks`
- --
- ALTER TABLE `lead_tasks`
- ADD CONSTRAINT `fk_lead_task_crm_leads1` FOREIGN KEY (`lead_id`) REFERENCES `crm_leads` (`lead_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_calls`
- --
- ALTER TABLE `opportunity_calls`
- ADD CONSTRAINT `fk_opportunity_calls_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_files`
- --
- ALTER TABLE `opportunity_files`
- ADD CONSTRAINT `fk_opportunity_files_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_meeting`
- --
- ALTER TABLE `opportunity_meeting`
- ADD CONSTRAINT `fk_opportunity_meeting_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_meeting_users`
- --
- ALTER TABLE `opportunity_meeting_users`
- ADD CONSTRAINT `fk_opportunity_meeting_has_crm_users_crm_users1` FOREIGN KEY (`opportunity_user_id`) REFERENCES `crm_users` (`user_id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
- ADD CONSTRAINT `fk_opportunity_meeting_has_crm_users_opportunity_meeting1` FOREIGN KEY (`opportunity_meeting_id`) REFERENCES `opportunity_meeting` (`opportunity_meeting_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_notes`
- --
- ALTER TABLE `opportunity_notes`
- ADD CONSTRAINT `fk_opportunity_notes_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- --
- -- Constraints for table `opportunity_tasks`
- --
- ALTER TABLE `opportunity_tasks`
- ADD CONSTRAINT `fk_opportunity_tasks_crm_opportunities1` FOREIGN KEY (`opportunity_id`) REFERENCES `crm_opportunities` (`opportunity_id`) ON DELETE NO ACTION ON UPDATE NO ACTION;
- DELIMITER $$
- --
- -- Events
- --
- DROP EVENT `test_event_03`$$
- CREATE DEFINER=`root`@`localhost` EVENT `test_event_03` ON SCHEDULE EVERY 1 DAY STARTS '2017-09-07 02:53:40' ON COMPLETION NOT PRESERVE ENABLE DO CALL sp_recuring_invoice$$
- DELIMITER ;
- COMMIT;
- /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
- /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
- /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement