INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1324, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:11'),
(1325, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:11'),
(1326, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:12'),
(1327, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=6\r\nand FGT.user_id IN (2,3) \r\nand SINVEN.id IN  (9,10) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-21\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-21\'\r\nand FARETAX.date =\'2021-07-21\' group by FGT.id', '2021-07-16 07:40:16'),
(1328, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:27'),
(1329, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:40:27'),
(1330, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:28'),
(1331, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:28'),
(1332, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:29'),
(1333, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:40:29'),
(1334, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:29'),
(1335, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:30'),
(1336, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:30'),
(1337, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-21\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-21\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-21\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-21\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:40:37'),
(1338, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:38'),
(1339, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:39'),
(1340, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:39'),
(1341, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:40'),
(1342, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:40'),
(1343, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:40:40'),
(1344, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:41'),
(1345, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:41'),
(1346, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:41'),
(1347, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:44'),
(1348, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:46'),
(1349, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-21\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-21\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-21\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-21\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:40:47'),
(1350, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:48'),
(1351, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:49'),
(1352, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:49'),
(1353, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:50'),
(1354, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=1\r\nand FGT.user_id IN (2,3) \r\nand SINVEN.id IN  (9,10) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-21\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-21\'\r\nand FARETAX.date =\'2021-07-21\' group by FGT.id', '2021-07-16 07:40:51'),
(1355, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:52'),
(1356, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:40:52'),
(1357, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:40:52'),
(1358, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:40:52'),
(1359, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:40:53');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1360, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:04'),
(1361, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:05'),
(1362, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-22\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=297\r\n                            and arrival_airport_id=484\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-22\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-22\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-22\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:41:09'),
(1363, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-22\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=297\r\n                            and arrival_airport_id=484\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-22\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-22\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-22\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:41:09'),
(1364, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:09'),
(1365, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:41:09'),
(1366, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:09'),
(1367, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:10'),
(1368, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:10'),
(1369, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:14'),
(1370, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:41:14'),
(1371, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:14'),
(1372, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:14'),
(1373, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:14'),
(1374, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=7\r\nand FGT.user_id IN (2,3) \r\nand SINVEN.id IN  (9,10) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 07:41:17'),
(1375, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:25'),
(1376, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:41:25'),
(1377, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:41:26'),
(1378, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:26'),
(1379, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-19\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-19\'\r\nand FARETAX.date =\'2021-07-19\' group by FGT.id', '2021-07-16 07:41:26'),
(1380, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:41:26'),
(1381, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=7\r\nand FGT.user_id IN (2,3) \r\nand SINVEN.id IN  (9,10) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 07:42:06'),
(1382, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:51:45'),
(1383, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:51:54'),
(1384, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:53:56'),
(1385, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:53:56'),
(1386, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:53:56'),
(1387, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:53:57'),
(1388, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:53:57'),
(1389, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:54:31'),
(1390, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 297\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:54:34');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1391, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-21\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=297\r\n                            and arrival_airport_id=484\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-21\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-21\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-21\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:54:37'),
(1392, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:55:46'),
(1393, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 07:56:30'),
(1394, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:57:48'),
(1395, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:57:53'),
(1396, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:57:56'),
(1397, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:58:01'),
(1398, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:58:04'),
(1399, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 07:58:06'),
(1400, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:58:09'),
(1401, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-16\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-16\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-16\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-16\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:58:13'),
(1402, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2,3) ORDER BY PWSA.flight_date ASC', '2021-07-16 07:58:16'),
(1403, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-30\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2,3) \r\n                            and SINVEN.id IN  (9,10)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-30\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-30\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-30\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 07:58:19'),
(1404, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-19\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-19\'\r\nand FARETAX.date =\'2021-07-19\' group by FGT.id', '2021-07-16 08:00:40'),
(1405, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 08:06:24'),
(1406, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 08:06:27'),
(1407, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 08:06:29'),
(1408, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 08:06:32'),
(1409, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 08:06:35'),
(1410, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 08:07:00'),
(1411, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 08:07:02'),
(1412, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 08:07:04'),
(1413, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,8)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 08:07:07'),
(1414, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 08:07:28'),
(1415, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 08:07:43'),
(1416, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 08:07:45'),
(1417, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 08:07:47');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1418, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,8)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 08:07:50'),
(1419, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 09:21:35'),
(1420, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:33:16'),
(1421, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:33:16'),
(1422, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:33:22'),
(1423, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:33:22'),
(1424, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:33:36'),
(1425, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:33:36'),
(1426, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:33:44'),
(1427, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:33:44'),
(1428, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:35:03'),
(1429, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 09:35:03'),
(1430, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:36:10'),
(1431, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:36:10'),
(1432, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:36:42'),
(1433, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:36:42'),
(1434, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:40:43'),
(1435, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:40:43'),
(1436, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 09:49:28'),
(1437, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 09:49:30'),
(1438, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:53:28'),
(1439, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:53:28'),
(1440, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 09:53:38'),
(1441, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:53:39'),
(1442, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:53:39'),
(1443, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 09:53:44'),
(1444, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 09:53:45'),
(1445, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 09:53:50'),
(1446, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 09:53:50'),
(1447, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 09:53:50'),
(1448, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 09:53:50'),
(1449, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 09:53:50'),
(1450, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 09:53:50'),
(1451, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 09:53:51'),
(1452, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-18\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-18\'\r\nand FARETAX.date =\'2021-07-18\' group by FGT.id', '2021-07-16 09:53:57'),
(1453, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:54:21'),
(1454, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 09:54:21'),
(1455, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:07:26'),
(1456, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:07:26'),
(1457, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:07:26'),
(1458, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:07:26'),
(1459, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:07:26'),
(1460, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:07:29'),
(1461, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:07:32');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1462, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:07:40'),
(1463, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:07:41'),
(1464, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:07:44'),
(1465, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:07:45'),
(1466, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:07:45'),
(1467, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:07:45'),
(1468, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:07:45'),
(1469, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:07:45'),
(1470, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:07:46'),
(1471, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-20\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-20\'\r\nand FARETAX.date =\'2021-07-20\' group by FGT.id', '2021-07-16 10:07:49'),
(1472, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:08:24'),
(1473, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:11:09'),
(1474, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:13:10'),
(1475, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:13:10'),
(1476, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:14:47'),
(1477, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:14:47'),
(1478, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:15:09'),
(1479, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:15:09'),
(1480, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:00'),
(1481, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:00'),
(1482, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:14'),
(1483, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:14'),
(1484, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:29:35'),
(1485, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:29:35'),
(1486, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:46'),
(1487, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:29:46'),
(1488, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:31:05'),
(1489, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:31:05'),
(1490, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:32:14'),
(1491, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 10:32:14'),
(1492, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:33:02'),
(1493, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:33:04'),
(1494, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:33:06'),
(1495, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:33:09'),
(1496, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:33:09'),
(1497, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:33:11'),
(1498, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:33:11'),
(1499, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:33:12'),
(1500, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:33:12');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1501, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-20\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-20\'\r\nand FARETAX.date =\'2021-07-20\' group by FGT.id', '2021-07-16 10:33:16'),
(1502, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:35:58'),
(1503, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:36:38'),
(1504, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:36:44'),
(1505, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:36:45'),
(1506, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:36:48'),
(1507, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:36:49'),
(1508, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:36:49'),
(1509, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:36:49'),
(1510, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:36:49'),
(1511, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:36:49'),
(1512, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:36:50'),
(1513, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:39:43'),
(1514, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 10:39:43'),
(1515, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:00'),
(1516, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:02'),
(1517, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:40:05'),
(1518, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:06'),
(1519, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:07'),
(1520, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:07'),
(1521, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:08'),
(1522, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:13'),
(1523, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:14'),
(1524, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-18\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-18\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-18\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-18\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:40:15'),
(1525, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:16'),
(1526, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:40:17'),
(1527, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:17'),
(1528, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:40:18'),
(1529, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:41:59'),
(1530, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:42:01'),
(1531, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:42:02');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1532, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-19\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-19\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-19\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-19\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:42:05'),
(1533, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-19\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-19\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-19\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-19\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:42:05'),
(1534, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:42:05'),
(1535, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:42:05'),
(1536, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:42:05'),
(1537, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:42:05'),
(1538, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:42:06'),
(1539, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-19\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-19\'\r\nand FARETAX.date =\'2021-07-19\' group by FGT.id', '2021-07-16 10:42:09'),
(1540, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:43:11'),
(1541, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:43:28'),
(1542, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:43:36'),
(1543, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:43:37'),
(1544, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:43:40'),
(1545, 'website_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = USER.id\r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-20\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 1010\r\n                            and departure_airport_id=2110\r\n                            and  arrival_city_id=1740\r\n                            and arrival_airport_id=1394\r\n                            and FGT.user_id IN (2) \r\n                            and SINVEN.id IN  (9)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-20\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-20\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-20\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:43:40'),
(1546, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:43:40'),
(1547, 'website_websiteGetDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:43:40'),
(1548, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:43:40'),
(1549, 'website_websiteGetArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and SINVEN.share_to_user_id=2 and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 1010\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:43:40'),
(1550, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:43:40'),
(1551, 'webiste_websiteGetTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 1010 \r\nand flights.arrival_city_id = 1740\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:43:41'),
(1552, 'website_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = USER.id \r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=1\r\nand FGT.user_id IN (2) \r\nand SINVEN.id IN  (9) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-20\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-20\'\r\nand FARETAX.date =\'2021-07-20\' group by FGT.id', '2021-07-16 10:43:43'),
(1553, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:49:13'),
(1554, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:49:15'),
(1555, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:49:18'),
(1556, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,8)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:49:21'),
(1557, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:49:39'),
(1558, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:49:41'),
(1559, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:49:44');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1560, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:49:46'),
(1561, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:49:49'),
(1562, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:49:49'),
(1563, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:49:49'),
(1564, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:50:35'),
(1565, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:50:38'),
(1566, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:50:39'),
(1567, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:50:39'),
(1568, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:51:06'),
(1569, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:51:08'),
(1570, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:51:10'),
(1571, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-30\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-30\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-30\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-30\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:51:14'),
(1572, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-30\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-30\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-30\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-30\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:51:14'),
(1573, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:51:15'),
(1574, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:51:15'),
(1575, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:51:15'),
(1576, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:51:15'),
(1577, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:51:15'),
(1578, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-30\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-30\'\r\nand FARETAX.date =\'2021-07-30\' group by FGT.id', '2021-07-16 10:51:17'),
(1579, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:51:48');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1580, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:51:48'),
(1581, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:51:48'),
(1582, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:51:49'),
(1583, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:51:49'),
(1584, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-30\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-30\'\r\nand FARETAX.date =\'2021-07-30\' group by FGT.id', '2021-07-16 10:51:51'),
(1585, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 10:54:50'),
(1586, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 393\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 10:54:53'),
(1587, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=393\r\n                            and arrival_airport_id=1700\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 10:54:55'),
(1588, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=2\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:54:57'),
(1589, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=2\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 10:54:57'),
(1590, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 10:58:44'),
(1591, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 11:30:16'),
(1592, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 11:47:41'),
(1593, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 11:47:46'),
(1594, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 11:47:50'),
(1595, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 11:47:53'),
(1596, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 11:47:56'),
(1597, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 11:49:08'),
(1598, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 11:49:13'),
(1599, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 11:49:15'),
(1600, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-22\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-22\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-22\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-22\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 11:49:17'),
(1601, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=6\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 11:49:19'),
(1602, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=6\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 11:49:19');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1603, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-22\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-22\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-22\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-22\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 11:49:24'),
(1604, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 11:49:27'),
(1605, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-22\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-22\'\r\nand FARETAX.date =\'2021-07-22\' group by FGT.id', '2021-07-16 11:49:27'),
(1606, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 11:50:03'),
(1607, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 11:50:06'),
(1608, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 393\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 11:50:09'),
(1609, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 11:50:12'),
(1610, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 11:50:15'),
(1611, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 11:50:18'),
(1612, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 11:50:21'),
(1613, 'main_one_way_getSearchDetailsData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id,FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,\r\nFAS.payment_gatway_charges,FAS.amount,FAS.percentage, USER.company_name,USER.role_id,FARETAX.base_fare,FARETAX.fee_taxes,SINVEN.credit_limit as inventory_credit_limit,\r\nSINVEN.share_price_breakup as inventory_price_breckup,SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,\r\n(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info,FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id,\r\nFGT.departure_city_id,FGT.departure_airport_id,\r\nFGT.dep_terminal_no_id,FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,\r\nFGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name, arrival_airports.airport_code as arrival_airport_code, airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT \r\nINNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id\r\nINNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\nINNER join users as USER on USER.id = FGT.user_id \r\nINNER join flght_api_settings as FAS on FAS.user_id = 1\r\nINNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id\r\nINNER join cities as  departure_city on departure_city.id = FGT.departure_city_id \r\nINNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id\r\nINNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\nINNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id\r\nINNER join airlines as  airlines on airlines.id = FGT.airline_id \r\nWHERE FGT.status = 1\r\nand return_flight=0\r\nand FGT.id=4\r\nand FGT.user_id IN (3,2) \r\nand SINVEN.id IN  (11,13) \r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status=1 \r\nand FPNR.available_seat > 0\r\nand PSA.plan_no = share_plan \r\nand PSA.flight_date = \'2021-07-29\'\r\nand PSA.available_seats > 0 \r\nand FPNR.date =\'2021-07-29\'\r\nand FARETAX.date =\'2021-07-29\' group by FGT.id', '2021-07-16 11:50:21'),
(1614, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=2 ', '2021-07-16 11:52:15'),
(1615, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=2 ', '2021-07-16 11:52:15'),
(1616, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 11:58:35'),
(1617, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 12:39:35'),
(1618, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 12:39:35'),
(1619, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:40:43'),
(1620, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:40:43'),
(1621, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:40:58'),
(1622, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:40:58'),
(1623, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 12:49:26'),
(1624, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:49:54'),
(1625, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:49:54'),
(1626, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:50:37'),
(1627, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:50:37'),
(1628, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 12:50:44'),
(1629, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 12:50:44'),
(1630, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 12:50:48'),
(1631, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=3) as company_name,\r\n(select total_amount from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=3 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=2 and share_to_user_id=3 order by createdAt DESC limit 0,1', '2021-07-16 12:50:48'),
(1632, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:51:31'),
(1633, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=2) as company_name,\r\n(select total_amount from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=2 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=2 order by createdAt DESC limit 0,1', '2021-07-16 12:51:31'),
(1634, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:35'),
(1635, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:35'),
(1636, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:37'),
(1637, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:37'),
(1638, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:39'),
(1639, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:39'),
(1640, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:40'),
(1641, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 12:59:40'),
(1642, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 12:59:44'),
(1643, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 12:59:44'),
(1644, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:00:32'),
(1645, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:00:32'),
(1646, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:03:48'),
(1647, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:03:48'),
(1648, 'main_companyAccountDetails', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 13:09:36'),
(1649, 'website_return_getSearchData', 'select DATE_FORMAT(createdAt,\"%d-%m-%Y\")  as last_debited_date,amount as last_debited_amount,\r\navailable_balance as credit_limit,\r\n(SELECT company_name from users where id=1) as company_name,\r\n(select total_amount from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as last_transaction_amount,\r\n(select DATE_FORMAT(createdAt,\"%d-%m-%Y\") from flight_bookings where user_id=1 order by createdAt desc limit 0,1) as  last_transaction_date \r\nfrom accounts where share_by_user_id=3 and share_to_user_id=1 order by createdAt DESC limit 0,1', '2021-07-16 13:09:36'),
(1650, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 13:10:16'),
(1651, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 13:10:16'),
(1652, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=2 ', '2021-07-16 13:14:20'),
(1653, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=2 ', '2021-07-16 13:14:20'),
(1654, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:14:28'),
(1655, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=2 and share_to_user_id=3 ', '2021-07-16 13:14:28'),
(1656, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 13:14:52'),
(1657, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=3 ', '2021-07-16 13:14:52'),
(1658, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:02'),
(1659, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:02'),
(1660, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:06'),
(1661, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:06'),
(1662, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:09'),
(1663, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:09'),
(1664, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:10'),
(1665, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:15:10'),
(1666, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 13:15:33'),
(1667, 'main_getArrivalCities', 'select SINVEN.id as shared_inventory_plan_Id,flights.id, flights.arrival_city_id , flights.arrival_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name,airport.airport_code AS airport_code, arrival_city.name AS arrival_city_name, \r\n arrival_city.city_code AS arrival_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\nINNER JOIN airports AS airport ON  flights.arrival_airport_id = airport.id \r\nINNER JOIN cities AS arrival_city ON  flights.arrival_city_id = arrival_city.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=3  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n AND flights.departure_city_id = 543\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (3,2) \r\n GROUP BY arrival_city_id, arrival_airport_id ORDER BY flights.id DESC', '2021-07-16 13:15:36'),
(1668, 'main_getTicketAvailableDate', 'select  distinct PWSA.flight_date from planwise_seat_availabilities as PWSA \r\nINNER join flights AS flights on PWSA.flight_id = flights.id\r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id\r\nwhere flights.status = 1  \r\nand flights.departure_city_id = 543 \r\nand flights.arrival_city_id = 1010\r\nand ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now()\r\nand PWSA.plan_no=SINVEN.share_plan\r\nand PWSA.available_seats > 0 \r\nAND flights.return_flight = 0\r\nand SINVEN.status = 1\r\nand SINVEN.accepted_status =1 \r\nand flights.user_id IN (3,2) ORDER BY PWSA.flight_date ASC', '2021-07-16 13:15:38');
INSERT INTO `test` (`id`, `table_key`, `table_value`, `created`) VALUES
(1669, 'main_oneway_getSearchData', 'SELECT (select distinct role_id from users where id=SINVEN.share_to_user_id) as share_to_user_role_id, FAS.add_margin,FAS.margin,FAS.client_discount,FAS.vendor_discount,USER.company_name, USER.role_id, FARETAX.base_fare, FARETAX.fee_taxes, SINVEN.credit_limit as inventory_credit_limit, SINVEN.share_price_breakup as inventory_price_breckup, SINVEN.share_plan,SINVEN.share_by_user_id,SINVEN.share_to_user_id,FGT.id as flight_id,FGT.user_id,(select option_value from options where user_id=FGT.user_id and option_key=\"special_info\" limit 0,1) as special_info, FGT.re_flight_number,FGT.flight_number,FGT.name,FGT.airline_id, FGT.departure_city_id,FGT.departure_airport_id,FGT.dep_terminal_no_id, FGT.departure_time,FGT.arrival_city_id,FGT.arrival_airport_id,FGT.arrival_terminal_no_id,FGT.arrival_date,FGT.arrival_time,FGT.return_flight,FGT.checkin_baggages_adult,FGT.checkin_baggages_infant,FGT.cabin_baggages_adult,FGT.cabin_baggages_children,FGT.checkin_baggages_children,FGT.cabin_baggages_children,FGT.cabin_baggages_infant,departure_city.country_id as departure_country_id,departure_city.name as departure_city_name,arrival_city.name as arrival_city_name, arrival_city.country_id as arrival_country_id,departure_airports.name as departure_airport_name,departure_airports.airport_code as departure_airport_code,arrival_airports.name as arrival_airport_name ,arrival_airports.airport_code as arrival_airport_code ,airlines.name as airlines_name,airlines.logo as airlines_logo,airlines.airline_no,airlines.airline_code,FPNR.date as ticket_date ,FPNR.return_dep_date as return_dep_date,FPNR.pnr_number as pnr_number,FPNR.infant_price as infant_price,FPNR.block_seat as block_seat,PSA.available_seats as total_available_seats FROM flights as FGT\r\n                            INNER join planwise_seat_availabilities as PSA on PSA.flight_id = FGT.id \r\n                            INNER join flight_pnrs as FPNR on FPNR.flight_id = FGT.id \r\n                            INNER join flight_fare_taxes as FARETAX on FARETAX.flight_id = FGT.id \r\n                            INNER join users as USER on USER.id = FGT.user_id \r\n                            INNER join flght_api_settings as FAS on FAS.user_id = 1 \r\n                            INNER join share_inventories as SINVEN on SINVEN.share_by_user_id = FGT.user_id \r\n                            INNER join cities as  departure_city on departure_city.id = FGT.departure_city_id\r\n                            INNER join cities as  arrival_city on arrival_city.id = FGT.arrival_city_id \r\n                            INNER join airports as  departure_airports on departure_airports.id = FGT.departure_airport_id \r\n                            INNER join airports as  arrival_airports on arrival_airports.id = FGT.arrival_airport_id \r\n                            INNER join airlines as  airlines on airlines.id = FGT.airline_id \r\n                            WHERE FGT.status = 1 \r\n                            and now() <=  ADDTIME(DATE_SUB(\'2021-07-29\',INTERVAL FGT.close_before_days DAY),FGT.close_before_time) \r\n                            and return_flight=0 \r\n                            and departure_city_id = 543\r\n                            and departure_airport_id=1023\r\n                            and  arrival_city_id=1010\r\n                            and arrival_airport_id=2110\r\n                            and FGT.user_id IN (3,2) \r\n                            and SINVEN.id IN  (11,13)  \r\n                            and PSA.plan_no = share_plan\r\n							and PSA.flight_date = \'2021-07-29\' \r\n                            and PSA.available_seats > 0\r\n                            and FPNR.available_seat > 0 \r\n                            and FPNR.date =\'2021-07-29\' \r\n                            and SINVEN.status = 1\r\n                            and SINVEN.accepted_status=1 \r\n                            and FARETAX.date =\'2021-07-29\' \r\n                            group by FPNR.flight_id ORDER by USER.role_id desc', '2021-07-16 13:15:41'),
(1670, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 13:18:30'),
(1671, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 1\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 13:18:32'),
(1672, 'main_getDepartureCities', 'SELECT SINVEN.id as shared_inventory_plan_Id,flights.id, flights.departure_city_id , flights.departure_airport_id , \r\nairport.id AS airport_id, airport.name AS airport_name, airport.airport_code AS airport_code,departure_city.name AS departure_city_name, departure_city.city_code AS departure_city_code,SINVEN.share_plan as vendor_share_plan\r\n FROM flights AS flights \r\n INNER JOIN airports AS airport ON  flights.departure_airport_id = airport.id \r\nINNER JOIN cities AS departure_city ON  flights.departure_city_id = departure_city.id \r\nINNER join share_inventories as SINVEN on SINVEN.share_by_user_id = flights.user_id \r\n INNER join planwise_seat_availabilities as PWSA on PWSA.flight_id = flights.id\r\n WHERE flights.status = 1 \r\n and PWSA.plan_no=SINVEN.share_plan \r\n and (SINVEN.share_to_user_id=2  OR SINVEN.share_to_user_id IN (select GROUP_CONCAT(id) from users where role_id=1)) and  ADDTIME(DATE_SUB(PWSA.flight_date,INTERVAL flights.close_before_days DAY),flights.close_before_time) >=  now() \r\n /*and SINVEN.id IN  (2,22) */\r\n and  PWSA.available_seats > 0 \r\n AND flights.return_flight = 0\r\n and SINVEN.status = 1 \r\n and SINVEN.accepted_status=1\r\n and flights.user_id IN (2,3) \r\n GROUP BY departure_city_id, departure_airport_id ORDER BY flights.id DESC ', '2021-07-16 13:18:38'),
(1673, 'main_checkFareandTaxesShared', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:28:10'),
(1674, 'website_return_getSearchData', 'SELECT * from share_inventories where share_by_user_id=3 and share_to_user_id=2 ', '2021-07-16 13:28:10');

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

--
-- Table structure for table `users`
--

CREATE TABLE `users` (
  `id` int NOT NULL,
  `primary_user_id` int DEFAULT NULL COMMENT ' primary user ID',
  `role_id` int NOT NULL DEFAULT '2' COMMENT ' 1-Admin,2-client,3-Master Vendor ,4-Normal Vendor',
  `agency_type_id` int DEFAULT NULL COMMENT ' Agency Id',
  `package_id` int DEFAULT NULL COMMENT ' Package ID',
  `user_reference_id` varchar(50) DEFAULT NULL,
  `name` varchar(225) DEFAULT NULL COMMENT ' Name Owner',
  `email` varchar(225) NOT NULL COMMENT ' Email Unique',
  `mobile` varchar(15) DEFAULT NULL COMMENT ' mobile unique',
  `image` varchar(225) DEFAULT NULL COMMENT 'Image',
  `credit_limit` varchar(225) DEFAULT NULL COMMENT 'Credit Limit',
  `address_2` varchar(225) DEFAULT NULL COMMENT 'Address 2',
  `phone` varchar(50) DEFAULT NULL COMMENT 'Phone',
  `address` varchar(225) DEFAULT NULL COMMENT ' address',
  `city` varchar(50) DEFAULT NULL COMMENT '  city',
  `state_id` int DEFAULT NULL COMMENT ' state id',
  `country_id` int DEFAULT NULL COMMENT ' Country id',
  `zipcode` varchar(6) DEFAULT NULL COMMENT ' Zipcode of area/city',
  `company_name` varchar(255) DEFAULT NULL COMMENT ' Company name',
  `contact_person_name` varchar(50) DEFAULT NULL COMMENT ' Conatct name',
  `contact_person_no` varchar(15) DEFAULT NULL COMMENT ' Contact person name',
  `iata_code` varchar(15) DEFAULT NULL COMMENT ' Contact person name',
  `website` varchar(225) DEFAULT NULL COMMENT ' website',
  `gst_no` varchar(15) DEFAULT NULL COMMENT ' GST NO',
  `pan_no` varchar(15) DEFAULT NULL COMMENT ' PAN CARD NO',
  `gst_doc` varchar(25) DEFAULT NULL COMMENT ' Image of gst doc name',
  `pan_doc` varchar(25) DEFAULT NULL COMMENT ' Image of PAN doc',
  `mail_otp` varchar(6) DEFAULT NULL COMMENT 'OTP on mail id',
  `password` varchar(120) DEFAULT NULL,
  `verified` tinyint(1) DEFAULT '0' COMMENT ' 0-not verified,1-verified',
  `status` tinyint(1) DEFAULT '1' COMMENT ' 0-inactive,1-active,2-delete',
  `device_token` varchar(25) DEFAULT NULL COMMENT ' Device token',
  `device_type` varchar(10) DEFAULT NULL COMMENT ' Device Type ',
  `createdAt` datetime DEFAULT NULL,
  `updatedAt` datetime DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `primary_user_id`, `role_id`, `agency_type_id`, `package_id`, `user_reference_id`, `name`, `email`, `mobile`, `image`, `credit_limit`, `address_2`, `phone`, `address`, `city`, `state_id`, `country_id`, `zipcode`, `company_name`, `contact_person_name`, `contact_person_no`, `iata_code`, `website`, `gst_no`, `pan_no`, `gst_doc`, `pan_doc`, `mail_otp`, `password`, `verified`, `status`, `device_token`, `device_type`, `createdAt`, `updatedAt`) VALUES
(1, NULL, 1, NULL, NULL, 'FARDvPRO1626155229780', 'Fareboutique ', 'fareboutique@gmail.com', '2589631475', '1627781644384.png', NULL, 'Rajasthan', NULL, 'jaipur', 'jaipur', 21, 93, '302013', 'Fareboutique LLP', NULL, NULL, NULL, 'fareboutique.com', 'wqdwefgwef', 'wefwerwere', NULL, NULL, NULL, '$2a$10$5j6p.owH1ElCbEzQDJRpneQXjjP7yEnvcuKsi9h1xzIXywUqtDa1e', 0, 1, '44634w8q7d7edwq6eqw46', 'android', '2021-07-13 05:47:09', '2021-07-13 05:51:28'),
(2, NULL, 3, NULL, NULL, 'RAMLBoeo1626155655088', 'Raman kumar', 'raman@gmail.com', '9874563215', '1627782435209.png', NULL, 'Rajasthan', NULL, 'kota', 'jaipur', 21, 93, '302013', 'Raman pvt ltd', NULL, NULL, NULL, 'raman.com', '', 'byspk028548', NULL, NULL, NULL, '$2a$10$6BKpnjMUHddvJAWIQdUgYOfKjL8TwCYSV/CylMh3VLfac9S0v7LhO', 0, 1, '44634w8q7d7edwq6eqw46', 'web', '2021-07-13 05:54:15', '2021-07-13 06:04:38'),
(3, NULL, 3, NULL, NULL, 'UJJaRsFV1626159478239', 'Ujjwal Raijada', 'ujjwal@gmail.com', '9352851051', '1627785733273.jpeg', NULL, 'C-Scheme', NULL, 'Shree Sheel Mohar', 'Jaipur', 21, 93, '302001', 'Travel World', NULL, NULL, NULL, 'www.travelworld.com', '', '', NULL, NULL, '592979', '$2a$10$G7qxkZlMvBIfx7cI3uj7n.Fdpy2YbPntXf3Lt3tWs5Hsl35kdULd6', 0, 0, '44634w8q7d7edwq6eqw46', 'web', '2021-07-13 06:57:58', '2021-07-16 10:36:48');

--
-- Indexes for dumped tables
--

--
-- Indexes for table `accounts`
--
ALTER TABLE `accounts`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `agency_types`
--
ALTER TABLE `agency_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `airlines`
--
ALTER TABLE `airlines`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `airports`
--
ALTER TABLE `airports`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD UNIQUE KEY `airport_code` (`airport_code`),
  ADD KEY `city_id` (`city_id`);

--
-- Indexes for table `cities`
--
ALTER TABLE `cities`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `country_id` (`country_id`),
  ADD KEY `state_id` (`state_id`);

--
-- Indexes for table `countries`
--
ALTER TABLE `countries`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `durations`
--
ALTER TABLE `durations`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `flght_api_settings`
--
ALTER TABLE `flght_api_settings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flights`
--
ALTER TABLE `flights`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_bookings`
--
ALTER TABLE `flight_bookings`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_booking_details`
--
ALTER TABLE `flight_booking_details`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_clubs`
--
ALTER TABLE `flight_clubs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_fare_taxes`
--
ALTER TABLE `flight_fare_taxes`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_plans`
--
ALTER TABLE `flight_plans`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_pnrs`
--
ALTER TABLE `flight_pnrs`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_stops`
--
ALTER TABLE `flight_stops`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `flight_ticket_prices`
--
ALTER TABLE `flight_ticket_prices`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `options`
--
ALTER TABLE `options`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `packages`
--
ALTER TABLE `packages`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `duration_id` (`duration_id`),
  ADD KEY `package_type_id` (`package_type_id`);

--
-- Indexes for table `package_types`
--
ALTER TABLE `package_types`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `plans`
--
ALTER TABLE `plans`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `plan_name` (`plan_name`);

--
-- Indexes for table `planwise_seat_availabilities`
--
ALTER TABLE `planwise_seat_availabilities`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `roles`
--
ALTER TABLE `roles`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `share_inventories`
--
ALTER TABLE `share_inventories`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `states`
--
ALTER TABLE `states`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`),
  ADD KEY `country_id` (`country_id`);

--
-- Indexes for table `terminals`
--
ALTER TABLE `terminals`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `name` (`name`);

--
-- Indexes for table `test`
--
ALTER TABLE `test`
  ADD PRIMARY KEY (`id`);

--
-- Indexes for table `users`
--
ALTER TABLE `users`
  ADD PRIMARY KEY (`id`),
  ADD UNIQUE KEY `users_email_unique` (`email`),
  ADD UNIQUE KEY `users_mobile_unique` (`mobile`),
  ADD KEY `role_id` (`role_id`),
  ADD KEY `agency_type_id` (`agency_type_id`),
  ADD KEY `package_id` (`package_id`),
  ADD KEY `state_id` (`state_id`),
  ADD KEY `country_id` (`country_id`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `accounts`
--
ALTER TABLE `accounts`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=36;

--
-- AUTO_INCREMENT for table `agency_types`
--
ALTER TABLE `agency_types`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `airlines`
--
ALTER TABLE `airlines`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=161;

--
-- AUTO_INCREMENT for table `airports`
--
ALTER TABLE `airports`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2637;

--
-- AUTO_INCREMENT for table `cities`
--
ALTER TABLE `cities`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2640;

--
-- AUTO_INCREMENT for table `countries`
--
ALTER TABLE `countries`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=221;

--
-- AUTO_INCREMENT for table `durations`
--
ALTER TABLE `durations`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `flght_api_settings`
--
ALTER TABLE `flght_api_settings`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;

--
-- AUTO_INCREMENT for table `flights`
--
ALTER TABLE `flights`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=12;

--
-- AUTO_INCREMENT for table `flight_bookings`
--
ALTER TABLE `flight_bookings`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `flight_booking_details`
--
ALTER TABLE `flight_booking_details`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `flight_clubs`
--
ALTER TABLE `flight_clubs`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `flight_fare_taxes`
--
ALTER TABLE `flight_fare_taxes`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=159;

--
-- AUTO_INCREMENT for table `flight_plans`
--
ALTER TABLE `flight_plans`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=45;

--
-- AUTO_INCREMENT for table `flight_pnrs`
--
ALTER TABLE `flight_pnrs`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=159;

--
-- AUTO_INCREMENT for table `flight_stops`
--
ALTER TABLE `flight_stops`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;

--
-- AUTO_INCREMENT for table `flight_ticket_prices`
--
ALTER TABLE `flight_ticket_prices`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1087;

--
-- AUTO_INCREMENT for table `options`
--
ALTER TABLE `options`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- AUTO_INCREMENT for table `packages`
--
ALTER TABLE `packages`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `package_types`
--
ALTER TABLE `package_types`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `plans`
--
ALTER TABLE `plans`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `planwise_seat_availabilities`
--
ALTER TABLE `planwise_seat_availabilities`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=633;

--
-- AUTO_INCREMENT for table `roles`
--
ALTER TABLE `roles`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;

--
-- AUTO_INCREMENT for table `share_inventories`
--
ALTER TABLE `share_inventories`
  MODIFY `id` bigint NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=14;

--
-- AUTO_INCREMENT for table `states`
--
ALTER TABLE `states`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=37;

--
-- AUTO_INCREMENT for table `terminals`
--
ALTER TABLE `terminals`
  MODIFY `id` int NOT NULL AUTO_INCREMENT;

--
-- AUTO_INCREMENT for table `test`
--
ALTER TABLE `test`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=1675;

--
-- AUTO_INCREMENT for table `users`
--
ALTER TABLE `users`
  MODIFY `id` int NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;

--
-- Constraints for dumped tables
--

--
-- Constraints for table `airports`
--
ALTER TABLE `airports`
  ADD CONSTRAINT `airports_ibfk_1` FOREIGN KEY (`city_id`) REFERENCES `cities` (`id`);

--
-- Constraints for table `cities`
--
ALTER TABLE `cities`
  ADD CONSTRAINT `cities_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`),
  ADD CONSTRAINT `cities_ibfk_2` FOREIGN KEY (`state_id`) REFERENCES `states` (`id`);

--
-- Constraints for table `packages`
--
ALTER TABLE `packages`
  ADD CONSTRAINT `packages_ibfk_1` FOREIGN KEY (`duration_id`) REFERENCES `durations` (`id`),
  ADD CONSTRAINT `packages_ibfk_2` FOREIGN KEY (`package_type_id`) REFERENCES `package_types` (`id`);

--
-- Constraints for table `states`
--
ALTER TABLE `states`
  ADD CONSTRAINT `states_ibfk_1` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`);

--
-- Constraints for table `users`
--
ALTER TABLE `users`
  ADD CONSTRAINT `users_ibfk_1` FOREIGN KEY (`role_id`) REFERENCES `roles` (`id`),
  ADD CONSTRAINT `users_ibfk_2` FOREIGN KEY (`agency_type_id`) REFERENCES `agency_types` (`id`),
  ADD CONSTRAINT `users_ibfk_3` FOREIGN KEY (`package_id`) REFERENCES `packages` (`id`),
  ADD CONSTRAINT `users_ibfk_4` FOREIGN KEY (`state_id`) REFERENCES `states` (`id`),
  ADD CONSTRAINT `users_ibfk_5` FOREIGN KEY (`country_id`) REFERENCES `countries` (`id`);
COMMIT;

