-- https://www.phpmyadmin.net/
--

START TRANSACTION;



--
-- Database: `kaslgrou_crm_mastermind`
--

-- --------------------------------------------------------

--
-- Stand-in structure for view `view_company_feature`
-- (See below for the actual view)
--
CREATE TABLE `view_company_feature` (
`id` int
,`magazine_id` int
,`magazine_name` varchar(255)
,`edition_name` varchar(255)
,`edition_id` varchar(255)
,`feature_id` int
,`feature_name` varchar(255)
,`company_id` int
,`company_name` varchar(255)
,`type` varchar(1)
);

-- --------------------------------------------------------

--
-- Stand-in structure for view `view_invoice_list`
-- (See below for the actual view)
--
CREATE TABLE `view_invoice_list` (
`id` int
,`invoice_date` date
,`invoice_no` varchar(100)
,`grand_total` decimal(10,2)
,`status` int
,`status_name` varchar(30)
,`company_id` int
,`company_name` varchar(255)
,`magazine_id` int
,`magazine_name` varchar(255)
,`edition_id` int
,`year` int
,`edition_name` varchar(255)
,`feature_id` int
,`feature_name` varchar(255)
,`ad_size` varchar(255)
);

-- --------------------------------------------------------

--
-- Structure for view `view_company_feature`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`kaslgrou`@`localhost` SQL SECURITY DEFINER VIEW `view_company_feature`  AS SELECT `a`.`id` AS `id`, `a`.`magazine_id` AS `magazine_id`, `m`.`magazine_name` AS `magazine_name`, `e`.`edition_name` AS `edition_name`, `a`.`edition_id` AS `edition_id`, `a`.`feature_id` AS `feature_id`, `f`.`feature_name` AS `feature_name`, `a`.`company_id` AS `company_id`, `c`.`company_name` AS `company_name`, 'A' AS `type` FROM ((((`crm_research_advertising_company` `a` join `crm_research_plan_picks_feature` `f` on((`f`.`id` = `a`.`feature_id`))) join `crm_master_edition` `e` on((`e`.`id` = `a`.`edition_id`))) join `crm_master_magazine` `m` on((`m`.`id` = `a`.`magazine_id`))) join `crm_company` `c` on((`a`.`company_id` = `c`.`id`)))union select `d`.`id` AS `id`,`d`.`magazine_id` AS `magazine_id`,`m`.`magazine_name` AS `magazine_name`,`d`.`edition_id` AS `edition_id`,`e`.`edition_name` AS `edition_name`,`d`.`feature_id` AS `feature_id`,`f`.`feature_name` AS `feature_name`,`d`.`company_id` AS `company_id`,`c`.`company_name` AS `company_name`,'A' AS `type` from ((((`crm_research_decision_making_company` `d` join `crm_research_plan_picks_feature` `f` on((`f`.`id` = `d`.`feature_id`))) join `crm_master_edition` `e` on((`e`.`id` = `d`.`edition_id`))) join `crm_master_magazine` `m` on((`m`.`id` = `d`.`magazine_id`))) join `crm_company` `c` on((`d`.`company_id` = `c`.`id`)))  ;

-- --------------------------------------------------------

--
-- Structure for view `view_invoice_list`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`kaslgrou`@`localhost` SQL SECURITY DEFINER VIEW `view_invoice_list`  AS SELECT `inv`.`id` AS `id`, `inv`.`invoice_date` AS `invoice_date`, `inv`.`invoice_no` AS `invoice_no`, `inv`.`grand_total` AS `grand_total`, `r`.`status` AS `status`, `s`.`status` AS `status_name`, `r`.`company_id` AS `company_id`, `c`.`company_name` AS `company_name`, `r`.`magazine_id` AS `magazine_id`, `m`.`magazine_name` AS `magazine_name`, `r`.`edition_id` AS `edition_id`, `e`.`year` AS `year`, `e`.`edition_name` AS `edition_name`, `r`.`feature_id` AS `feature_id`, `f`.`feature_name` AS `feature_name`, `ad`.`description` AS `ad_size` FROM (((((((`crm_sales_order_details` `inv` join `crm_research_advertising_company` `r` on((`inv`.`research_allocate_company_id` = `r`.`id`))) join `crm_company` `c` on((`c`.`id` = `r`.`company_id`))) join `crm_master_magazine` `m` on((`m`.`id` = `r`.`magazine_id`))) join `crm_master_edition` `e` on((`e`.`id` = `r`.`edition_id`))) join `crm_research_plan_picks_feature` `f` on((`f`.`id` = `r`.`feature_id`))) join `crm_master_advertisements` `ad` on((`ad`.`id` = `inv`.`ad_size`))) join `crm_master_sale_status` `s` on((`s`.`id` = `r`.`status`))) ;
COMMIT;

