select
'02' as IDENTIFICADOR,
parcod as codigo,
pardes as nome,
null as IMEI,
paremail as email,
1 as codTipoUsuario,
0 as numPedidoAtual,
(parcod*100000) as numPedidoInicial,
(((parcod+1)*100000)-1) as numPedidoFinal,
case when parsit = 'A' then 1 else 0 end as ativo,
null as listasDePreco,
null as gruposProduto,
null as ocultarGruposDeProduto,
(select dc_saldo from f_calc_debcred(rca_fv_empparcod,rcaparcod,null,null,null) where dc_rca_cod = rcaparcod) as saldoFlex,
null as senhaAtual,
'SD'||CAST(parcod AS VARCHAR) as senhaNova,
null as segmentosRelacionados,
null as filiais,
null as codVendedorPai,
null as codHierarquiaLiberacaoPedido,
(select dc_saldo from f_calc_debcred(rca_fv_empparcod,rcaparcod,null,null,null) where dc_rca_cod = rcaparcod) as saldoFlexAcumulado,
0 as permiteCadastroCliente,
0 as permiteEdicaoCliente,
1 as permiteCadastroDeFotoDeProduto,
0 as permiteAdicionarRota,
0 as permiteControlarRota,
1 as permiteAdicionarRotaClientes,
1 as permiteControlarRotaClientes,
1 as capturarPosGeoNoPedido,
1 as exigeCapturaGPSEventos,
1 as exigeFotoEventos,
0 as exigeCheckinCheckout,
null as checkinRaio,
null as checkinDias,
0 as permiteVisualizarResumoVendas,
0 as exigeCheckout,
0 as permiteRegistroCobranca,
null as valorMinimoPedido
from par
join rca on rcaparcod = parcod
where rcaav = 'S' and parsit = 'A'
order by parcod
ExecutarScriptSempre
