PABX da Simples IP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

102 lines
5.2 KiB

-- Query integracao com venda+
select cf.conf_data::timestamp(0),
coalesce(substring(l.list_file_dados,1,32), '99') as vendedor_id,
b.client_razao_social,
b.client_email,
b.client_telefone,
case b.client_tipo_documento when('CNPJ')then 'J' when('IE')then 'J' else 'F' end as client_tipo_pessoa,
b.client_documento,
(select reg_sigla from mkt_regiao_estados where reg_uf = b.client_uf) as client_regiao,
b.client_uf,
b.client_municipio,
case when(cf.conf_status = '0')then 'PROSPECT' else 'LEAD' end as clinet_status,
b.client_id
from pbx_campanha_contato a, pbx_campanha_lista l, pbx_cliente b, pbx_campanha_contato_fone cf
where b.client_id = a.cont_identificador::int
and cf.cont_id = a.cont_id
and l.list_id = a.list_id
and a.list_id = 148;
2020-08-19 15:40:56
select * from pbx_cliente limit 10;
select * from pbx_campanha_contato_fone where list_id = 148 limit 10;
select * from pbx_campanha_lista limit 10;
select a.cmp_id, a.cmp_descricao, b.list_id, coalesce(b.list_dados_envio, a.cmp_dados_envio) as dados_envio, a.cmp_status, b.list_status
from pbx_campanha a, pbx_campanha_lista b
where b.cmp_id = a.cmp_id
and a.cmp_status = '1'
and a.cmp_tipo_campanha = '3'
and b.list_status = '1'
"marketing@simplesip.com.br", '$m@rk2t3ng_#'
--select * from pbx_campanha
select a.list_id, b.cont_id, b.cont_identificador as externo_id, b.cont_param1 as razao_social, initcap(b.cont_param2) as nome_contato, c.conf_id as registro_id, c.conf_fone as destino
from pbx_campanha_lista a, pbx_campanha_contato b, pbx_campanha_contato_fone c
where b.list_id = a.list_id
and c.cont_id = b.cont_id
and a.list_id = 148
and a.list_status = 1
and b.cont_discado = 0
and c.conf_discado = 0
and c.conf_status_lista = '9'
select * from pbx_campanha_contato_fone where list_id = 148 order by conf_id;
select * from pbx_cliente
alter table pbx_integracao_configuracao alter column type varchar(20);
select * from pbx_campanha_contato_fone where list_id = 147 and conf_status_lista = '9' order by conf_id;
update pbx_campanha_contato set cont_discado = '0' where list_id = 147 and cont_id = 56760;
update pbx_campanha_contato_fone set conf_discado = '0', conf_status = '0' where list_id = 147 and conf_id = 78923;
update pbx_campanha_contato_fone set conf_fone = 'amarildo.pereira@simplesip.com.br', conf_status_lista = '9' where conf_id = 78920; -- "adm@aptelecom.net.br"
update pbx_campanha_contato_fone set conf_fone = 'alan.pablo@simplesip.com.br', conf_status_lista = '9' where conf_id = 78923; --"atendimento@virtuanet.com.br"
update pbx_campanha_contato_fone set conf_fone = 'comercial@simplesip.com.br', conf_status_lista = '1' where conf_id = 78924; --"cnttelecom@hotmail.com"
update pbx_campanha_contato_fone set conf_fone = 'suporte@simplesip.com.br', conf_status_lista = '9' where conf_id = 78925; --"charlessidnei@gmail.com"
update pbx_campanha_contato_fone set conf_fone = 'amrldprr@gmail.com', conf_status_lista = '9' where conf_id = 78926; --"viatelecom.mt@hotmail.com"
update pbx_campanha_contato_fone set conf_fone = 'claudiaccostap@gmail.com', conf_status_lista = '1' where conf_id = 78927; --"suporte@twtelecom.com.br"
78920; -- "adm@aptelecom.net.br"
78923 --"atendimento@virtuanet.com.br"
78924 --"cnttelecom@hotmail.com"
78925 --"charlessidnei@gmail.com"
78926 --"viatelecom.mt@hotmail.com"
78927 --"suporte@twtelecom.com.br"
update pbx_campanha_contato_fone set conf_fone = 'amarildo.pereira@simplesip.com.br' where list_id = 69 and conf_id in(6297,6298,6299,6300,6301,6303,6304,6305,6306,6308,6309,6310,6311);
update pbx_campanha_contato_fone set conf_fone = 'amarildo.simplesip@gmail.com' where list_id = 69 and conf_id in(6302);
update pbx_campanha_contato_fone set conf_fone = 'luciene.franca@simplesip.com.br' where list_id = 69 and conf_id in(6307);
update pbx_campanha_contato_fone set conf_fone = 'pablo@simplesip.com.br' where list_id = 69 and conf_id = 6298;
update pbx_campanha_contato_fone set conf_fone = 'henrique.siqueira@simplesip.com.br' where list_id = 69 and conf_id = 6299;
update pbx_campanha_contato_fone set conf_fone = 'lucas.awade@simplesip.com.br' where list_id = 69 and conf_id = 6300;
update pbx_campanha_contato_fone set conf_fone = 'financeiro@simplesip.com.br' where list_id = 69 and conf_id = 6301;
update pbx_campanha_contato_fone set conf_fone = 'suporte@simplesip.com.br' where list_id = 69 and conf_id = 6303;
update pbx_campanha_contato_fone set conf_fone = 'comercial@simplesip.com.br' where list_id = 69 and conf_id = 6304;
update pbx_campanha_contato_fone set conf_fone = 'rafael.sousa@simplesip.com.br' where list_id = 69 and conf_id = 6305;
update pbx_campanha_contato_fone set conf_fone = 'alan.santos@simplesip.com.br' where list_id = 69 and conf_id = 6306;
update pbx_campanha_contato_fone set conf_fone = 'alessandra.neri@simplesip.com.br' where list_id = 69 and conf_id = 6308;
update pbx_campanha_contato_fone set conf_fone = 'edizelma.reis@simplesip.com.br' where list_id = 69 and conf_id = 6309;
update pbx_campanha_contato_fone set conf_fone = 'ozeias.ramos@simplesip.com.br' where list_id = 69 and conf_id = 6310;