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

START TRANSACTION;



--
-- Database: `ycrm_satish`
--

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

--
-- Structure for view `vw_account_grid`
--

CREATE ALGORITHM=UNDEFINED DEFINER=`Satish_D`@`%` SQL SECURITY DEFINER VIEW `vw_account_grid`  AS SELECT `ma`.`account_id` AS `sr_no`, `ma`.`account_name` AS `account_name`, concat(`ao`.`first_name`,' ',`ao`.`last_name`) AS `account_owner`, `a_type`.`option_value` AS `account_type`, `ma`.`parent_account_name` AS `parent_account`, `l_type`.`option_value` AS `lead_type`, `itc`.`option_value` AS `is_tender_client`, `lb`.`option_value` AS `lead_bifurcation`, `mc`.`name` AS `nationality`, `sts`.`option_value` AS `status`, `ma`.`phone` AS `phone`, `mb`.`branch_name` AS `branch_name`, `ma`.`email_id` AS `email`, `ma`.`potential_amount` AS `potential_amount`, date_format(`ma`.`contract_renewal_date`,'%m/%d/%Y') AS `contract_renewal_date`, `ma`.`business_percentage` AS `business_percentage`, `ma`.`city` AS `city`, `ma`.`branch_code` AS `branch_code`, `ma`.`website` AS `website`, `ma`.`region` AS `region`, `ma`.`description` AS `description`, `gd`.`option_value` AS `group`, `ma`.`reason_for_dead` AS `reason_for_dead`, `ma`.`meeting_count` AS `meeting_count`, `aso`.`option_value` AS `account_source`, `ct`.`option_value` AS `corporate_type`, `ma`.`company_manpower_count` AS `company_manpower_count`, `ma`.`key_person_name_phone` AS `key_person_name_phone`, `ma`.`key_person_designation` AS `key_person_designation`, `ma`.`preferred_airline` AS `preferred_destinations`, `b2c`.`option_value` AS `b2b_category`, `hb`.`option_value` AS `handled_by`, `ma`.`travel_agency_owner` AS `travel_agency_owner`, date_format(`ma`.`new_date`,'%m/%d/%Y') AS `new_date`, date_format(`ma`.`in_process_date`,'%m/%d/%Y') AS `in_process_date`, date_format(`ma`.`dead_lead_date`,'%m/%d/%Y') AS `dead_lead_date`, date_format(`ma`.`existing_date`,'%m/%d/%Y') AS `existing_date`, date_format(`ma`.`converted_date`,'%m/%d/%Y') AS `converted_date`, date_format(`ma`.`last_sales_call_date`,'%m/%d/%Y') AS `last_sales_call_date`, date_format(`ma`.`sales_call_next_action_date`,'%m/%d/%Y') AS `sales_call_next_action_date`, `cas`.`option_value` AS `call_attempt_status`, `ma`.`last_sales_call_description` AS `last_sales_call_description`, `co`.`option_value` AS `call_outcome`, date_format(`ma`.`last_check_in_date`,'%m/%d/%Y') AS `last_check_in_date`, `ma`.`last_check_in_time` AS `last_check_in_time`, `ma`.`last_check_in_address` AS `last_check_in_address`, `ma`.`billing_street` AS `billing_address`, `ma`.`billing_city` AS `billing_city`, `ma`.`billing_state_province` AS `billing_state_province`, `ma`.`billing_zip_postal_code` AS `billing_zip_postal_code`, `ma`.`billing_country` AS `billing_country`, `ma`.`shipping_street` AS `shipping_address`, `ma`.`shipping_city` AS `shipping_city`, `ma`.`shipping_state_province` AS `shipping_state_province`, `ma`.`shipping_zip_postal_code` AS `shipping_zip_postal_code`, `ma`.`shipping_country` AS `shipping_country`, concat(`ucb`.`first_name`,' ',`ucb`.`last_name`) AS `created_by`, concat(`uub`.`first_name`,' ',`uub`.`last_name`) AS `last_modified_by`, date_format(`ma`.`created_on`,'%m-%d-%Y') AS `created_on`, date_format(`ma`.`updated_on`,'%m-%d-%Y') AS `updated_on`, `ma`.`branch_id` AS `branch_id`, `mb`.`region` AS `region_id`, `mb`.`group_data` AS `group_id` FROM (((((((((((((((((`mst_account` `ma` left join `mst_dropdown_option_values` `a_type` on((`ma`.`account_type` = `a_type`.`id`))) left join `mst_dropdown_option_values` `l_type` on((`ma`.`lead_type` = `l_type`.`id`))) left join `mst_dropdown_option_values` `itc` on((`ma`.`is_tender_client` = `itc`.`id`))) left join `mst_dropdown_option_values` `lb` on((`ma`.`lead_bifurcation` = `lb`.`id`))) left join `mst_dropdown_option_values` `sts` on((`ma`.`status` = `sts`.`id`))) left join `mst_branch` `mb` on((`ma`.`branch_id` = `mb`.`id`))) left join `mst_dropdown_option_values` `gd` on((`ma`.`group_data` = `gd`.`id`))) left join `mst_country` `mc` on((`ma`.`nationality` = `mc`.`id`))) left join `mst_dropdown_option_values` `cas` on((`ma`.`call_attempt_status` = `cas`.`id`))) left join `mst_dropdown_option_values` `co` on((`ma`.`call_outcome` = `co`.`id`))) left join `mst_dropdown_option_values` `ct` on((`ma`.`corporate_type` = `ct`.`id`))) left join `mst_dropdown_option_values` `aso` on((`ma`.`account_source` = `aso`.`id`))) left join `mst_dropdown_option_values` `b2c` on((`ma`.`b2b_category` = `b2c`.`id`))) left join `mst_dropdown_option_values` `hb` on((`ma`.`handled_by` = `hb`.`id`))) left join `mst_user` `ucb` on((`ma`.`created_by` = `ucb`.`id`))) left join `mst_user` `uub` on((`ma`.`last_modified_by` = `uub`.`id`))) left join `mst_user` `ao` on((`ma`.`account_owner` = `ao`.`id`))) ORDER BY `ma`.`account_id` ASC  ;

--
-- VIEW `vw_account_grid`
-- Data: None
--

COMMIT;

