<?php
  include_once "conexao.php";
  include_once "SendMail.php";
  require_once('RDinit.php');
  include_once "../controllers/ConfigCtl.php";

class ClienteClass
{
    private $con;
    private $pdo;

    private $codContaBancaria;

    private $cliId;
    private $bcoId;
    private $cliNomeRazao;
    private $cliFantasia;
    private $cliCpfCnpj;
    private $cliCpf;
    private $cliTipo;
    private $cliDataNascimento;
    private $cliSexo;
    private $cliRg;
    private $cliOrgaoEmissor;
    private $cliDataEmissaoRg;
    private $cliEmail;
    private $cliTelefone;
    private $cliNomePai;
    private $cliNomeMae;
    private $cliEstadoCivil;
    private $cliCodCbo;
    private $cliDescricaoCbo;
    private $cliPpe;

    private $cliLogradouro;
    private $cliNumero;
    private $cliComplemento;
    private $cliBairro;
    private $cliCidade;
    private $cliEstado;
    private $cliCep;

    private $cliDataAlteracao;
    private $cliStatus;

    private $cliSelfie;
    private $cliDocFrente;
    private $cliDocVerso;
    private $cliCompEndereco;

    private $cliDeviceId;

    private $cliSenha;

    private $cliSenhaPin;

    private $cliMostraSaldo;

    private $cliLoginBio;

    private $cliAgencia;
    private $cliConta;

    private $cliPushId;

    private $cliObs;
    private $cliRetornoKyc;

    private $planosId;

    private $cliRecebOutraConta;
    private $cliDepBanco;
    private $cliDepAgencia;
    private $cliDepConta;
    private $cliFaturamento;
    private $cliQtdeMaquinas;

    private $cliPolo;
    private $cliRepresentante;
    private $cliIdResponsavel;

    private $cliTipoTabela;
    private $cliTabela;
    private $cliCdxExpress;

    private $cliMcc;
    private $cliSoftDescriptor;

    private $retorno;
    private $mensagemRetorno;

    public function __construct()
    {
        $this->con = new Conexao();
        $this->pdo = $this->con->getConexao();
    }

    public function getClientePorId()
    {
        $id = $this->getCliId();

        $sql = "select * from cliente 
                where cli_id =:id";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $id, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function getClientePorAtarId()
    {
        $id = $this->getCodContaBancaria();

        $sql = "select * from cliente 
                where cli_atarId =:id";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $id, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este Atar ID.");
        }

        return $resultado;
    }

    public function getClientePorAdgIdBcoId()
    {
        $id = $this->getCodContaBancaria();
        $codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_atarId =:id and bco_id =:bcoId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $id, PDO::PARAM_STR);
        $resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este Atar ID.");
        }

        return $resultado;
    }

    public function getClientePorCpf()
    {
        $cpf = $this->getCliCpfCnpj();
        //$codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_cpfcnpj =:cpf and cli_status = 'ATIVO'";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
        //$resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function getClientePorCpfTodos()
    {
        $cpf = $this->getCliCpfCnpj();
        //$codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_cpfcnpj =:cpf";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
        //$resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function getClientePorCpfEmail()
    {
        $cpf = $this->getCliCpfCnpj();
        $email = $this->getCliEmail();
        $codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_cpfcnpj =:cpf and bco_id =:bcoId and cli_email =:email";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
        $resultado->bindParam(":email", $email, PDO::PARAM_STR);
        $resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado->rowCount() > 0){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function getClientePorTelefone()
    {
        $telefone = $this->getCliTelefone();
        $codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_telefone =:telefone and cli_status = 'ATIVO'";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
        //$resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function getClientePorDeviceId()
    {
        $deviceId = $this->getCliDeviceId();
        $codBanco = $this->getBcoId();

        $sql = "select * from cliente 
                where cli_deviceid =:deviceId and bco_id =:bcoId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":deviceId", $deviceId, PDO::PARAM_STR);
        $resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function adicionarConta()
    {
        $codCliente = $this->getCliId();
        $atarId = $this->getCodContaBancaria();

        $sql = "update cliente set cli_atarid =:atarId 
                where cli_id =:cliId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":atarId", $atarId, PDO::PARAM_STR);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function retornoKyc()
    {
        $codCliente = $this->getCliId();
        $kyc = $this->getCliRetornoKyc();

        $sql = "update cliente set cli_retornokyc =:kyc 
                where cli_id =:cliId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":kyc", $kyc, PDO::PARAM_STR);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Não encontrado Cliente com este ID.");
        }

        return $resultado;
    }

    public function alteraDispositivo()
    {
        $codCliente = $this->getCliId();
        $idDevice = $this->getCliDeviceId();

        $sql = "update cliente set cli_deviceid =:id 
                where cli_id =:cliId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $idDevice, PDO::PARAM_STR);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->execute();

        return $resultado;
    }

    public function listarTodos()
    {
        $sql = "select * from cliente 
                order by cli_nomerazao";
        $resultado = $this->pdo->prepare($sql);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Lista Vazia.");
        }

        return $resultado;
    }

    public function listarTodosPorAdmId($admId)
    {
        $sql = "select cli.* 
                from cliente cli, administrador_cliente adm
                where cli.cli_id = adm.cli_id and 
                adm.adm_id =:admId
                order by cli_nomerazao";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":admId", $admId, PDO::PARAM_INT);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Lista Vazia.");
        }

        return $resultado;
    }

    public function listarAtivos()
    {
        $sql = "select * from cliente where cli_status = 'ATIVO'
                order by cli_nomerazao";
        $resultado = $this->pdo->prepare($sql);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Lista Vazia.");
        }

        return $resultado;
    }

    public function listarPolosAtivos()
    {
        $sql = "select * from cliente where cli_status = 'ATIVO' and cli_polo = 1
                order by cli_nomerazao";
        $resultado = $this->pdo->prepare($sql);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Lista Vazia.");
        }

        return $resultado;
    }

    public function inserir()
    {
        $nome = $this->getCliNomeRazao();
        $fantasia = $this->getCliFantasia();
        $cpfCnpj = $this->getCliCpfCnpj();
        $cpf = $this->getCliCpf();
        $tipo = $this->getCliTipo();
        $dataNascimento = null;
        if (!empty($this->getCliDataNascimento()))
        {
            $dataNascimento = date('Y-m-d', strtotime($this->getCliDataNascimento()));
        }
        $sexo = $this->getCliSexo();
        $rg = $this->getCliRg();
        $orgaoEmissor = $this->getCliOrgaoEmissor();
        $dataEmissaoRg = null;
        if (!empty($this->getCliDataEmissaoRg()))
        {
            $dataEmissaoRg = date('Y-m-d', strtotime($this->getCliDataEmissaoRg()));
        }
        $email = trim($this->getCliEmail());
        $telefone = $this->getCliTelefone();
        $nomePai = $this->getCliNomePai();
        $nomeMae = $this->getCliNomeMae();
        $estadoCivil = $this->getCliEstadoCivil();
        $codCbo = $this->getCliCodCbo();
        $descCbo = $this->getCliDescricaoCbo();
        $ppe = $this->getCliPpe();

        $rua = $this->getCliLogradouro();
        $numero = $this->getCliNumero();
        $compl = $this->getCliComplemento();
        $bairro = $this->getCliBairro();
        $cidade = $this->getCliCidade();
        $estado = $this->getCliEstado();
        $cep = $this->getCliCep();

        $selfie = $this->getCliSelfie();
        $docFrente = $this->getCliDocFrente();
        $docVerso = $this->getCliDocVerso();
        $compEndereco = $this->getCliCompEndereco();

        $deviceId = $this->getCliDeviceId();
        $codBanco = $this->getBcoId();

        $recebOutraConta = $this->getCliRecebOutraConta();
        $depBanco = $this->getCliDepBanco();
        $depAgencia = $this->getCliDepAgencia();
        $depConta = $this->getCliDepConta();
        $faturamento = $this->getCliFaturamento();
        $maquinas = $this->getCliQtdeMaquinas();

        $responsavel = $this->getCliIdResponsavel();
        $tipotabela = $this->getCliTipoTabela();
        $tabela = $this->getCliTabela();
        $cdxexpress = $this->getCliCdxExpress();

        $mcc = $this->getCliMcc();
        $softdesc = trim(strtoupper($this->getCliSoftDescriptor()));

        $status = 'AGUARDANDO';

        if ($tipo == 'PESSOA FÍSICA'){
            $sql = "insert into cliente (cli_nomerazao, cli_cpfcnpj, cli_cpf, cli_tipo, 
                    cli_datanascimento, cli_sexo, cli_rg, cli_orgaoemissor,
                    cli_dataemissaorg, cli_email, cli_telefone, cli_nomepai, cli_nomemae, cli_estadocivil,
                    cli_codcbo, cli_descricaocbo, cli_logradouro, cli_numero, cli_complemento, cli_bairro,
                    cli_cidade, cli_estado, cli_cep, cli_status, cli_selfie, cli_docfrente, cli_docverso, cli_compendereco,
                    cli_deviceid, bco_id, cli_ppe,
                    cli_dep_banco, cli_dep_agencia, cli_dep_conta, cli_faturamento, cli_qtdemaquinas, cli_idresponsavel,
                    cli_receb_outraconta, cli_tipotabela, cli_tabela, cli_cdxexpress, cli_mcc, cli_softdescriptor)
                    values(:nome,:cnpj, :cpf, :tipo, :dataNascimento, :sexo,
                    :rg, :orgaoEmissor, :dataEmissaorg, :email, :telefone, :nomePai, :nomeMae, :estadoCivil,
                    :cbo, :descCbo, :rua, :numero, :compl, :bairro, :cidade, :estado, :cep, :status, :selfie, :docfrente,
                    :docverso, :compendereco, :deviceId, :codBanco, :ppe,
                    :cli_dep_banco, :cli_dep_agencia, :cli_dep_conta, :cli_faturamento, :cli_qtdemaquinas, :cli_idresponsavel,
                    :cli_receb_outraconta, :cli_tipotabela, :cli_tabela, :cli_cdxexpress, :cli_mcc, :cli_softdescriptor) ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":cnpj", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":dataNascimento", $dataNascimento);
            $resultado->bindParam(":sexo", $sexo, PDO::PARAM_STR);
            $resultado->bindParam(":rg", $rg, PDO::PARAM_STR);
            $resultado->bindParam(":orgaoEmissor", $orgaoEmissor, PDO::PARAM_STR);
            $resultado->bindParam(":dataEmissaorg", $dataEmissaoRg);
            $resultado->bindParam(":email", $email, PDO::PARAM_STR);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":nomePai", $nomePai, PDO::PARAM_STR);
            $resultado->bindParam(":nomeMae", $nomeMae, PDO::PARAM_STR);
            $resultado->bindParam(":estadoCivil", $estadoCivil, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":ppe", $ppe, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);

            $resultado->bindParam(":selfie", $selfie, PDO::PARAM_STR);
            $resultado->bindParam(":docfrente", $docFrente, PDO::PARAM_STR);
            $resultado->bindParam(":docverso", $docVerso, PDO::PARAM_STR);
            $resultado->bindParam(":compendereco", $compEndereco, PDO::PARAM_STR);

            $resultado->bindParam(":deviceId", $deviceId, PDO::PARAM_STR);
            $resultado->bindParam(":codBanco", $codBanco, PDO::PARAM_INT);

            $resultado->bindParam(":cli_receb_outraconta", $recebOutraConta, PDO::PARAM_INT);
            $resultado->bindParam(":cli_dep_banco", $depBanco, PDO::PARAM_STR);
            $resultado->bindParam(":cli_dep_agencia", $depAgencia, PDO::PARAM_STR);
            $resultado->bindParam(":cli_dep_conta", $depConta, PDO::PARAM_STR);
            $resultado->bindParam(":cli_faturamento", $faturamento);
            $resultado->bindParam(":cli_qtdemaquinas", $maquinas, PDO::PARAM_INT);

            $resultado->bindParam(":cli_idresponsavel", $responsavel, PDO::PARAM_INT);
            $resultado->bindParam(":cli_tipotabela", $tipotabela, PDO::PARAM_STR);
            $resultado->bindParam(":cli_tabela", $tabela, PDO::PARAM_STR);
            $resultado->bindParam(":cli_cdxexpress", $cdxexpress, PDO::PARAM_INT);

            $resultado->bindParam(":cli_mcc", $mcc, PDO::PARAM_STR);
            $resultado->bindParam(":cli_softdescriptor", $softdesc, PDO::PARAM_STR);

            $resultado->bindParam(":status", $status, PDO::PARAM_STR);
            $resultado->execute();
        }else{
            $sql = "insert into cliente (cli_nomerazao, cli_fantasia, cli_cpfcnpj, cli_cpf, cli_tipo, 
                    cli_email, cli_telefone, cli_codcbo, cli_descricaocbo, cli_logradouro, cli_numero, cli_complemento, cli_bairro,
                    cli_cidade, cli_estado, cli_cep, cli_status, cli_selfie, cli_docfrente, cli_docverso, cli_compendereco,
                    cli_dep_banco, cli_dep_agencia, cli_dep_conta, cli_faturamento, cli_qtdemaquinas, cli_idresponsavel,
                    cli_receb_outraconta, cli_tipotabela, cli_tabela, cli_cdxexpress, cli_mcc, cli_softdescriptor)
                    values(:nome, :fantasia, :cnpj, :cpf, :tipo,
                    :email, :telefone, :cbo, :descCbo, :rua, :numero, :compl, :bairro, :cidade, :estado, :cep,
                    :status, :selfie, :docfrente, :docverso, :compendereco,
                    :cli_dep_banco, :cli_dep_agencia, :cli_dep_conta, :cli_faturamento, :cli_qtdemaquinas, :cli_idresponsavel,
                    :cli_receb_outraconta, :cli_tipotabela, :cli_tabela, :cli_cdxexpress, :cli_mcc, :cli_softdescriptor) ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":fantasia", $fantasia, PDO::PARAM_STR);
            $resultado->bindParam(":cnpj", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":email", $email, PDO::PARAM_STR);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);

            $resultado->bindParam(":selfie", $selfie, PDO::PARAM_STR);
            $resultado->bindParam(":docfrente", $docFrente, PDO::PARAM_STR);
            $resultado->bindParam(":docverso", $docVerso, PDO::PARAM_STR);
            $resultado->bindParam(":compendereco", $compEndereco, PDO::PARAM_STR);

            $resultado->bindParam(":cli_receb_outraconta", $recebOutraConta, PDO::PARAM_INT);
            $resultado->bindParam(":cli_dep_banco", $depBanco, PDO::PARAM_STR);
            $resultado->bindParam(":cli_dep_agencia", $depAgencia, PDO::PARAM_STR);
            $resultado->bindParam(":cli_dep_conta", $depConta, PDO::PARAM_STR);
            $resultado->bindParam(":cli_faturamento", $faturamento);
            $resultado->bindParam(":cli_qtdemaquinas", $maquinas, PDO::PARAM_INT);

            $resultado->bindParam(":cli_idresponsavel", $responsavel, PDO::PARAM_INT);

            $resultado->bindParam(":cli_idresponsavel", $responsavel, PDO::PARAM_INT);
            $resultado->bindParam(":cli_tipotabela", $tipotabela, PDO::PARAM_STR);
            $resultado->bindParam(":cli_tabela", $tabela, PDO::PARAM_STR);
            $resultado->bindParam(":cli_cdxexpress", $cdxexpress, PDO::PARAM_INT);

            $resultado->bindParam(":cli_mcc", $mcc, PDO::PARAM_STR);
            $resultado->bindParam(":cli_softdescriptor", $softdesc, PDO::PARAM_STR);

            $resultado->bindParam(":status", $status, PDO::PARAM_STR);
            $resultado->execute();
        }

        if ($resultado){
            $this->setCliId($this->pdo->lastInsertId());
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a inserção de dados.");
        }

        return $resultado;
    }

    public function editar()
    {
        $codBanco = $this->getBcoId();
        $id = $this->getCliId();
        $nome = $this->getCliNomeRazao();
        $fantasia = $this->getCliFantasia();
        $cpfCnpj = $this->getCliCpfCnpj();
        $tipo = $this->getCliTipo();
        $dataNascimento = null;
        if (!empty($this->getCliDataNascimento()))
        {
            $dataNascimento = date('Y-m-d', strtotime($this->getCliDataNascimento()));
        }
        $sexo = $this->getCliSexo();
        $rg = $this->getCliRg();
        $orgaoEmissor = $this->getCliOrgaoEmissor();
        $dataEmissaoRg = null;
        if (!empty($this->getCliDataEmissaoRg()))
        {
            $dataEmissaoRg = date('Y-m-d', strtotime($this->getCliDataEmissaoRg()));
        }

        $telefone = $this->getCliTelefone();
        $nomePai = $this->getCliNomePai();
        $nomeMae = $this->getCliNomeMae();
        $estadoCivil = $this->getCliEstadoCivil();
        $codCbo = $this->getCliCodCbo();
        $descCbo = $this->getCliDescricaoCbo();

        $rua = $this->getCliLogradouro();
        $numero = $this->getCliNumero();
        $compl = $this->getCliComplemento();
        $bairro = $this->getCliBairro();
        $cidade = $this->getCliCidade();
        $estado = $this->getCliEstado();
        $cep = $this->getCliCep();
        $ppe = $this->getCliPpe();

        $polo = $this->getCliPolo();
        $representante = $this->getCliRepresentante();
        $responsavel = $this->getCliIdResponsavel();

        $mcc = $this->getCliMcc();
        $softdesc = trim(strtoupper($this->getCliSoftDescriptor()));

        $status = $this->getCliStatus();

        if ($tipo == 'PESSOA FÍSICA'){
            $sql = "update cliente set cli_nomerazao =:nome, cli_cpfcnpj =:cpf, cli_tipo =:tipo, 
                    cli_datanascimento =:dataNascimento,
                    cli_sexo =:sexo, cli_rg =:rg, cli_orgaoemissor =:orgaoEmissor,
                    cli_dataemissaorg =:dataEmissaorg, cli_telefone =:telefone, cli_nomepai =:nomePai, 
                    cli_nomemae =:nomeMae, cli_estadocivil =:estadoCivil, cli_codcbo =:cbo, cli_descricaocbo =:descCbo,
                    cli_dataalteracao = current_timestamp(), cli_logradouro =:rua, cli_numero =:numero, 
                    cli_complemento = :compl, cli_bairro = :bairro,
                    cli_cidade =:cidade, cli_estado =:estado, cli_cep =:cep, cli_status =:status, cli_ppe =:ppe,
                    bco_id =:codBanco, cli_polo =:polo, cli_representante =:representante, cli_idresponsavel =:responsavel,
                    cli_mcc = :cli_mcc, cli_softdescriptor = :cli_softdescriptor
                    where cli_id =:id ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $id, PDO::PARAM_INT);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":dataNascimento", $dataNascimento);
            $resultado->bindParam(":sexo", $sexo, PDO::PARAM_STR);
            $resultado->bindParam(":rg", $rg, PDO::PARAM_STR);
            $resultado->bindParam(":orgaoEmissor", $orgaoEmissor, PDO::PARAM_STR);
            $resultado->bindParam(":dataEmissaorg", $dataEmissaoRg);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":nomePai", $nomePai, PDO::PARAM_STR);
            $resultado->bindParam(":nomeMae", $nomeMae, PDO::PARAM_STR);
            $resultado->bindParam(":estadoCivil", $estadoCivil, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);
            $resultado->bindParam(":status", $status, PDO::PARAM_STR);
            $resultado->bindParam(":ppe", $ppe, PDO::PARAM_STR);
            $resultado->bindParam(":codBanco", $codBanco, PDO::PARAM_INT);
            $resultado->bindParam(":polo", $polo, PDO::PARAM_INT);
            $resultado->bindParam(":representante", $representante, PDO::PARAM_INT);
            $resultado->bindParam(":responsavel", $responsavel, PDO::PARAM_INT);

            $resultado->bindParam(":cli_mcc", $mcc, PDO::PARAM_STR);
            $resultado->bindParam(":cli_softdescriptor", $softdesc, PDO::PARAM_STR);

            $resultado->execute();
        }else{
            $sql = "update cliente set cli_nomerazao =:nome, cli_fantasia =:fantasia, cli_cpfcnpj =:cpf, 
                    cli_tipo =:tipo, cli_telefone =:telefone, cli_codcbo =:cbo, cli_descricaocbo =:descCbo,  
                    cli_logradouro =:rua, cli_numero =:numero, 
                    cli_complemento = :compl, cli_bairro = :bairro,
                    cli_cidade =:cidade, cli_estado =:estado, cli_cep =:cep, cli_status =:status,
                    cli_polo =:polo, cli_representante =:representante, cli_idresponsavel =:responsavel,
                    cli_mcc = :cli_mcc, cli_softdescriptor = :cli_softdescriptor
                    where cli_id =:id ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $id, PDO::PARAM_INT);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":fantasia", $fantasia, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);
            $resultado->bindParam(":status", $status, PDO::PARAM_STR);
            $resultado->bindParam(":polo", $polo, PDO::PARAM_INT);
            $resultado->bindParam(":representante", $representante, PDO::PARAM_INT);
            $resultado->bindParam(":responsavel", $responsavel, PDO::PARAM_INT);

            $resultado->bindParam(":cli_mcc", $mcc, PDO::PARAM_STR);
            $resultado->bindParam(":cli_softdescriptor", $softdesc, PDO::PARAM_STR);
            $resultado->execute();
        }

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a alteração de dados.");
        }

        return $resultado;
    }

    public function editarReenvio()
    {
        $codBanco = $this->getBcoId();
        $id = $this->getCliId();
        $nome = $this->getCliNomeRazao();
        $fantasia = $this->getCliFantasia();
        $cpfCnpj = $this->getCliCpfCnpj();
        $tipo = $this->getCliTipo();
        $dataNascimento = null;
        if (!empty($this->getCliDataNascimento()))
        {
            $dataNascimento = date('Y-m-d', strtotime($this->getCliDataNascimento()));
        }
        $sexo = $this->getCliSexo();
        $rg = $this->getCliRg();
        $orgaoEmissor = $this->getCliOrgaoEmissor();
        $dataEmissaoRg = null;
        if (!empty($this->getCliDataEmissaoRg()))
        {
            $dataEmissaoRg = date('Y-m-d', strtotime($this->getCliDataEmissaoRg()));
        }

        $telefone = $this->getCliTelefone();
        $nomePai = $this->getCliNomePai();
        $nomeMae = $this->getCliNomeMae();
        $estadoCivil = $this->getCliEstadoCivil();
        $codCbo = $this->getCliCodCbo();
        $descCbo = $this->getCliDescricaoCbo();

        $rua = $this->getCliLogradouro();
        $numero = $this->getCliNumero();
        $compl = $this->getCliComplemento();
        $bairro = $this->getCliBairro();
        $cidade = $this->getCliCidade();
        $estado = $this->getCliEstado();
        $cep = $this->getCliCep();
        $ppe = $this->getCliPpe();

        $selfie = $this->getCliSelfie();
        $docFrente = $this->getCliDocFrente();
        $docVerso = $this->getCliDocVerso();
        $compEndereco = $this->getCliCompEndereco();

        $status = $this->getCliStatus();

        if ($tipo == 'PESSOA FÍSICA'){
            $sql = "update cliente set cli_nomerazao =:nome, cli_cpfcnpj =:cpf, cli_tipo =:tipo, 
                    cli_datanascimento =:dataNascimento,
                    cli_sexo =:sexo, cli_rg =:rg, cli_orgaoemissor =:orgaoEmissor,
                    cli_dataemissaorg =:dataEmissaorg, cli_telefone =:telefone, cli_nomepai =:nomePai, 
                    cli_nomemae =:nomeMae, cli_estadocivil =:estadoCivil, cli_codcbo =:cbo, cli_descricaocbo =:descCbo,
                    cli_dataalteracao = current_timestamp(), cli_logradouro =:rua, cli_numero =:numero, 
                    cli_complemento =:compl, cli_bairro =:bairro,
                    cli_cidade =:cidade, cli_estado =:estado, cli_cep =:cep, cli_status =:status, cli_ppe =:ppe,
                    bco_id =:codBanco, cli_selfie =:selfie, cli_docfrente =:docfrente, cli_docverso =:docverso,
                    cli_compendereco =:compendereco
                    where cli_id =:id ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $id, PDO::PARAM_INT);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":dataNascimento", $dataNascimento);
            $resultado->bindParam(":sexo", $sexo, PDO::PARAM_STR);
            $resultado->bindParam(":rg", $rg, PDO::PARAM_STR);
            $resultado->bindParam(":orgaoEmissor", $orgaoEmissor, PDO::PARAM_STR);
            $resultado->bindParam(":dataEmissaorg", $dataEmissaoRg);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":nomePai", $nomePai, PDO::PARAM_STR);
            $resultado->bindParam(":nomeMae", $nomeMae, PDO::PARAM_STR);
            $resultado->bindParam(":estadoCivil", $estadoCivil, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);
            $resultado->bindParam(":status", $status, PDO::PARAM_STR);
            $resultado->bindParam(":ppe", $ppe, PDO::PARAM_STR);
            $resultado->bindParam(":codBanco", $codBanco, PDO::PARAM_INT);

            $resultado->bindParam(":selfie", $selfie, PDO::PARAM_STR);
            $resultado->bindParam(":docfrente", $docFrente, PDO::PARAM_STR);
            $resultado->bindParam(":docverso", $docVerso, PDO::PARAM_STR);
            $resultado->bindParam(":compendereco", $compEndereco, PDO::PARAM_STR);

            $resultado->execute();
        }else{
            $sql = "update cliente set cli_nomerazao =:nome, cli_fantasia =:fantasia, cli_cpfcnpj =:cpf, 
                    cli_tipo =:tipo, cli_telefone =:telefone, cli_codcbo =:cbo, cli_descricaocbo =:descCbo,  
                    cli_logradouro =:rua, cli_numero =:numero, 
                    cli_complemento = :compl, cli_bairro = :bairro,
                    cli_cidade =:cidade, cli_estado =:estado, cli_cep =:cep, cli_status =:status,
                    cli_selfie =:selfie, cli_docfrente =:docfrente, cli_docverso =:docverso,
                    cli_compendereco =:compendereco
                    where cli_id =:id ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $id, PDO::PARAM_INT);
            $resultado->bindParam(":nome", $nome, PDO::PARAM_STR);
            $resultado->bindParam(":fantasia", $fantasia, PDO::PARAM_STR);
            $resultado->bindParam(":cpf", $cpfCnpj, PDO::PARAM_STR);
            $resultado->bindParam(":tipo", $tipo, PDO::PARAM_STR);
            $resultado->bindParam(":telefone", $telefone, PDO::PARAM_STR);
            $resultado->bindParam(":cbo", $codCbo, PDO::PARAM_STR);
            $resultado->bindParam(":descCbo", $descCbo, PDO::PARAM_STR);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);
            $resultado->bindParam(":status", $status, PDO::PARAM_STR);

            $resultado->bindParam(":selfie", $selfie, PDO::PARAM_STR);
            $resultado->bindParam(":docfrente", $docFrente, PDO::PARAM_STR);
            $resultado->bindParam(":docverso", $docVerso, PDO::PARAM_STR);
            $resultado->bindParam(":compendereco", $compEndereco, PDO::PARAM_STR);

            $resultado->execute();
        }

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a alteração de dados.");
        }

        return $resultado;
    }

    public function alterarEndereco()
    {
        $id = $this->getCliId();

        $rua = $this->getCliLogradouro();
        $numero = $this->getCliNumero();
        $compl = $this->getCliComplemento();
        $bairro = $this->getCliBairro();
        $cidade = $this->getCliCidade();
        $estado = $this->getCliEstado();
        $cep = $this->getCliCep();

            $sql = "update cliente set  cli_logradouro =:rua, cli_numero =:numero, 
                    cli_complemento = :compl, cli_bairro = :bairro,
                    cli_cidade =:cidade, cli_estado =:estado, cli_cep =:cep
                    where cli_id =:id ";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $id, PDO::PARAM_INT);
            $resultado->bindParam(":rua", $rua, PDO::PARAM_STR);
            $resultado->bindParam(":numero", $numero, PDO::PARAM_STR);
            $resultado->bindParam(":compl", $compl, PDO::PARAM_STR);
            $resultado->bindParam(":bairro", $bairro, PDO::PARAM_STR);
            $resultado->bindParam(":cidade", $cidade, PDO::PARAM_STR);
            $resultado->bindParam(":estado", $estado, PDO::PARAM_STR);
            $resultado->bindParam(":cep", $cep, PDO::PARAM_STR);
            $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a alteração de dados.");
        }

        return $resultado;
    }

    public function criarAcesso()
    {

        $codCliente = $this->getCliId();
        $email = trim($this->getCliEmail());
        $nome = $this->getCliNomeRazao();
        $telefone = $this->getCliTelefone();
        $senha = random_int(100000,999999);
        $senhaSegura = sha1($senha);
        $codBanco = $this->getBcoId();

        $sql= "update cliente set cli_status = 'ATIVO', cli_senha =:senha
                where cli_id =:id";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");

            $Config = new ConfigCtl();
            $Config->setBcoId($codBanco);
            $dadosConfig = $Config->getConfigPorBcoId()->fetch(PDO::FETCH_OBJ);
            $comteleApiKey = $dadosConfig->comtele_apikey;

            $numeroCel = substr($telefone, 2);
            $urlComTele = "https://sms.comtele.com.br/api/v2/send";

            $nomeBanco = "CDX";

            $primeiroNome = explode(" ", $nome);

            $texto = "Oi, ".$primeiroNome[0]."! Esta é a sua senha provisória para o ". $nomeBanco. ": ".$senha.", estamos muito felizes em ter você conosco. Agora é só acessar o seu app e usar a senha provisória para fazer seu primeiro login. ";

            $dadosEnvio = json_encode(array(
                "Sender" => "",
                "Receivers"=>$telefone,
                "Content"=>$texto
            ));

            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL, $urlComTele);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $dadosEnvio);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
                    'auth-key:'.$comteleApiKey)
            );

            $result = curl_exec($ch);
            $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            $error = curl_error($ch);

            curl_close($ch);


            $tokenRD = $dadosConfig->rdstation_token;


            try {
                $rdStation = new \RDStation\RDStation($email);
                $rdStation->setApiToken($tokenRD);
                $rdStation->setLeadData('identifier', 'Cadastro Aprovado');
                $rdStation->setLeadData('name'		, $nome);
                $rdStation->setLeadData('nome'		, $nome);
                $rdStation->setLeadData('cargo'		, $senha);
                $rdStation->setLeadData('title'	    , $senha);

                $response = $rdStation->sendLead();

                $result = "enviado com sucesso";

            } catch (Exception $e) {

                $result = "Erro no Envio";
                $this->setRetorno("ERRO");
                $this->setMensagemRetorno("Ocorreu um erro durante o envio do email.");
            }

        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a criação de senha.");
        }

        return $resultado;
    }

    public function esqueciSenha()
    {
        $codBanco = $this->getBcoId();
        $codCliente = $this->getCliId();
        $email = $this->getCliEmail();
        $nome = $this->getCliNomeRazao();
        $telefone = $this->getCliTelefone();
        $senha = random_int(100000,999999);
        $senhaSegura = sha1($senha);

        $sql= "update cliente set cli_senha =:senha, cli_status = 'ATIVO', cli_alterasenha = 1 
                where cli_id =:id";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");

            //enviar email
            /*$mail = new SendMail();

            $pagina = file_get_contents('https://sportbank.webbanking.srv.br/docs/email/boasvindas2/index.php?nome='.$nome.'&codigo='.$senha);
            $to = $email;
            $subject = "SportBank - Senha de Acesso ao APP";
            //$message = "Olá, seu acesso ao APP da SportBank foi criado!, segue abaixo os dados: \n";
            //$message .= "senha: ".$senha;
            $message = $pagina;

            $mail->mailer->isHTML(true);
            $mail->mailer->AddAddress($to);
            $mail->mailer->Subject = $subject;
            $mail->mailer->Body = $message;

            $result = "";
            if (!$mail->mailer->Send()) {
                $result = $mail->mailer->ErrorInfo;
                $this->setRetorno("ERRO");
                $this->setMensagemRetorno($result);
            } else {
                $result = "enviado com sucesso";
            }*/

            $Config = new ConfigCtl();
            $Config->setBcoId($codBanco);
            $dadosConfig = $Config->getConfigPorBcoId()->fetch(PDO::FETCH_OBJ);
            $comteleApiKey = $dadosConfig->comtele_apikey;

            $numeroCel = substr($telefone, 2);
            $urlComTele = "https://sms.comtele.com.br/api/v2/send";


            $nomeBanco = "SportBank";
            if($codBanco == 2){
                $nomeBanco = "FeelBank";
            }

            $primeiroNome = explode(" ", $nome);

            $texto = "Oi, ".$primeiroNome[0]."! Esta é a sua senha provisória para o ". $nomeBanco. ": ".$senha.". Agora é só acessar o seu app e usar a senha provisória para fazer seu login. ";


            $dadosEnvio = json_encode(array(
                "Sender" => "",
                "Receivers"=>$telefone,
                "Content"=>$texto
            ));

            $ch = curl_init();

            curl_setopt($ch, CURLOPT_URL, $urlComTele);
            curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
            curl_setopt($ch, CURLOPT_POST, true);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            curl_setopt($ch, CURLOPT_POSTFIELDS, $dadosEnvio);
            curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
            curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
            curl_setopt( $ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json',
                    'auth-key:'.$comteleApiKey)
            );

            $result = curl_exec($ch);
            $httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
            $error = curl_error($ch);

            curl_close($ch);


            /*$tokenRD = $dadosConfig->rdstation_token;*/

            /*$tokenRD = "7c51b2707296fcdd1a35ec3f8c7f5e31";
            if($codBanco == 2){
                $tokenRD = "27bc1b3bfcc463c5c50779a5417128f6";
            }*/

            /*try {
                $rdStation = new \RDStation\RDStation($email);
                $rdStation->setApiToken($tokenRD);
                $rdStation->setLeadData('identifier', 'Cadastro Aprovado');
                //$rdStation->setLeadData('identifier', 'Confirmação e-mail');
                //$rdStation->setLeadData('identifier', 'Análise de documentos');
                //$rdStation->setLeadData('identifier', 'Cadastro reprovado');
                //$rdStation->setLeadData('identifier', 'Documentos faltantes');
                //$rdStation->setLeadData('email', 'juliano.fubu@gmail.com');
                $rdStation->setLeadData('name'		, $nome);
                $rdStation->setLeadData('nome'		, $nome);
                $rdStation->setLeadData('cargo'		, $senha);
                $rdStation->setLeadData('title'	    , $senha);

                $response = $rdStation->sendLead();

                //var_dump($response);

                $result = "enviado com sucesso";

            } catch (Exception $e) {

                //var_dump($e);
                $result = "Erro no Envio";
                $this->setRetorno("ERRO");
                $this->setMensagemRetorno("Ocorreu um erro durante o envio do email.");
            }*/

        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a criação de senha.");
        }

        return $resultado;
    }

    public function login()
    {
        $codBanco = $this->getBcoId();
        $cpf = $this->getCliCpfCnpj();
        $senha = $this->getCliSenha();
        $senhaSegura = sha1($senha);

        $sql = "select * from cliente where cli_cpfcnpj =:cpf and cli_senha =:senha and bco_id =:bco";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":bco", $codBanco, PDO::PARAM_INT);
        $resultado->bindParam(":cpf", $cpf, PDO::PARAM_STR);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado->rowCount() > 0){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a tentativa Login.");
        }

        return $resultado;

    }

    public function loginIdDevice()
    {
        $idDevice = $this->getCliDeviceId();
        $codBanco = $this->getBcoId();

        $sql = "select * from cliente where cli_deviceid =:id and cli_status ='ATIVO' and bco_id =:bco";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":bco", $codBanco, PDO::PARAM_INT);
        $resultado->bindParam(":id", $idDevice, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado->rowCount() > 0){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Ocorreu um erro durante a tentativa Login.");
        }

        return $resultado;

    }

    public function alteraMostraSaldo()
    {
        $codCliente = $this->getCliId();
        $mostra = $this->getCliMostraSaldo();

        $sql = "update cliente set cli_mostrasaldo =:mostra where cli_id =:id";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":mostra", $mostra, PDO::PARAM_INT);
        $resultado->execute();

        return $resultado;
    }

    public function alteraLoginBio()
    {
        $codCliente = $this->getCliId();
        $status = $this->getCliLoginBio();

        $sql = "update cliente set cli_loginbio =:status where cli_id =:id";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":status", $status, PDO::PARAM_INT);
        $resultado->execute();

        return $resultado;
    }

    public function alteraSenha()
    {
        $codCliente = $this->getCliId();
        $idDevice = $this->getCliDeviceId();
        $senha = $this->getCliSenha();
        $senhaSegura = sha1($senha);

        $sql = "update cliente set cli_senha =:senha, cli_alterasenha = 0 where cli_id =:id and cli_deviceid =:deviceId";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->bindParam(":deviceId", $idDevice, PDO::PARAM_STR);
        $resultado->execute();

        return $resultado;
    }

    public function alteraSenhaPin()
    {
        $codCliente = $this->getCliId();

        $senhaPin = $this->getCliSenhaPin();
        $senhaSegura = sha1($senhaPin);

        $sql = "update cliente set cli_senhapin =:senha where cli_id =:id ";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->execute();

        return $resultado;
    }

    public function testaSenhaPin()
    {
        $codCliente = $this->getCliId();

        $senhaPin = $this->getCliSenhaPin();
        $senhaSegura = sha1($senhaPin);

        $sql = "select * from cliente where cli_id =:id and cli_senhapin =:senha ";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":senha", $senhaSegura, PDO::PARAM_STR);
        $resultado->execute();

        if ($resultado->rowCount() > 0){
            $this->setRetorno("OK");
            $this->setMensagemRetorno("");
        }else{
            $this->setRetorno("ERRO");
            $this->setMensagemRetorno("Senha PIN não confere.");
        }

        return $resultado;

    }

    public function adicionaAgenciaConta()
    {
        $codCliente = $this->getCliId();
        $agencia = $this->getCliAgencia();
        $conta = $this->getCliConta();

        $sql = "update cliente set cli_agencia =:agencia, cli_conta =:conta where cli_id =:id";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":agencia", $agencia, PDO::PARAM_STR);
        $resultado->bindParam(":conta", $conta, PDO::PARAM_STR);
        $resultado->execute();

        return $resultado;
    }

    public function gravaPushId()
    {
        $codBanco = $this->getBcoId();
        $idDevice = $this->getCliDeviceId();
        $pushId = $this->getCliPushId();

        $sql = "update cliente set cli_pushid =:pushid where cli_deviceid =:id and bco_id =:bcoId";

        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $idDevice, PDO::PARAM_STR);
        $resultado->bindParam(":pushid", $pushId, PDO::PARAM_STR);
        $resultado->bindParam(":bcoId", $codBanco, PDO::PARAM_INT);
        $resultado->execute();

        return $resultado;
    }

    public function reenvioDocumentos($texto)
    {
        $codBanco = $this->getBcoId();
        $codCliente = $this->getCliId();
        $email = $this->getCliEmail();
        $nome = $this->getCliNomeRazao();

        $Config = new ConfigCtl();
        $Config->setBcoId($codBanco);
        $dadosConfig = $Config->getConfigPorBcoId()->fetch(PDO::FETCH_OBJ);
        $tokenRD = $dadosConfig->rdstation_token;

            /*$tokenRD = "7c51b2707296fcdd1a35ec3f8c7f5e31";
            if($codBanco == 2){
                $tokenRD = "27bc1b3bfcc463c5c50779a5417128f6";
            }*/

            try {
                $rdStation = new \RDStation\RDStation($email);
                $rdStation->setApiToken($tokenRD);
                //$rdStation->setLeadData('identifier', 'Boas-vindas');
                //$rdStation->setLeadData('identifier', 'Confirmação e-mail');
                //$rdStation->setLeadData('identifier', 'Análise de documentos');
                //$rdStation->setLeadData('identifier', 'Cadastro reprovado');
                $rdStation->setLeadData('identifier', 'Documentos faltantes');
                //$rdStation->setLeadData('email', 'juliano.fubu@gmail.com');
                $rdStation->setLeadData('name'		, $nome);
                $rdStation->setLeadData('nome'		, $nome);
                $rdStation->setLeadData('cargo'		, $texto);
                //$rdStation->setLeadData('title'	    , $senha);

                $response = $rdStation->sendLead();

                //var_dump($response);

                $result = "enviado com sucesso";

                $sql = "update cliente set cli_status = 'REENVIO' where cli_id =:id";
                $resultado = $this->pdo->prepare($sql);
                $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
                $resultado->execute();

            } catch (Exception $e) {

                //var_dump($e);
                $result = "Erro no Envio";

            }

        return $result;
    }

    public function recusarCadastro()
    {
        $codBanco = $this->getBcoId();
        $codCliente = $this->getCliId();
        $email = $this->getCliEmail();
        $nome = $this->getCliNomeRazao();
        $obs = $this->getCliObs();

        $Config = new ConfigCtl();
        $Config->setBcoId($codBanco);
        $dadosConfig = $Config->getConfigPorBcoId()->fetch(PDO::FETCH_OBJ);
        $tokenRD = $dadosConfig->rdstation_token;

        /*$tokenRD = "7c51b2707296fcdd1a35ec3f8c7f5e31";
        if($codBanco == 2){
            $tokenRD = "27bc1b3bfcc463c5c50779a5417128f6";
        }*/

        try {
            $rdStation = new \RDStation\RDStation($email);
            $rdStation->setApiToken($tokenRD);
            //$rdStation->setLeadData('identifier', 'Boas-vindas');
            //$rdStation->setLeadData('identifier', 'Confirmação e-mail');
            //$rdStation->setLeadData('identifier', 'Análise de documentos');
            $rdStation->setLeadData('identifier', 'Cadastro reprovado');
            //$rdStation->setLeadData('identifier', 'Documentos faltantes');
            //$rdStation->setLeadData('email', 'juliano.fubu@gmail.com');
            $rdStation->setLeadData('name'		, $nome);
            $rdStation->setLeadData('nome'		, $nome);
            //$rdStation->setLeadData('cargo'		, $texto);
            //$rdStation->setLeadData('title'	    , $senha);

            $response = $rdStation->sendLead();

            //var_dump($response);

            $result = "enviado com sucesso";

            $sql = "update cliente set cli_obs =:obs, cli_status = 'RECUSADO' where cli_id =:id";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
            $resultado->bindParam(":obs", $obs, PDO::PARAM_STR);
            $resultado->execute();

            $sql = "insert into cliente_recusado select * from cliente where cli_id =:id";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
            $resultado->execute();

            $sql = "delete from cliente where cli_id =:id";
            $resultado = $this->pdo->prepare($sql);
            $resultado->bindParam(":id", $codCliente, PDO::PARAM_INT);
            $resultado->execute();

        } catch (Exception $e) {

            //var_dump($e);
            $result = "Erro no Envio";

        }

        return $result;
    }

    public function aplicarTabela()
    {
        $codCliente = $this->getCliId();
        $tabela = $this->getPlanosId();

        $sql = "update cliente set planos_id =:id 
                where cli_id =:cliId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":id", $tabela, PDO::PARAM_INT);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->execute();

        //apaga os dados antigos
        $sql = "delete from cliente_planos_bandeira
                where cliente_id =:cliId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->execute();

        //insere novos dados tabela
        $sql = "INSERT INTO cliente_planos_bandeira
                (cliente_id, plano_id, bandeira, tipo, parcela, dias_pagamento, adquirente, cdx, polo, representante)
                SELECT :cliId, plano_id, bandeira, tipo, parcela, dias_pagamento, adquirente, cdx, polo, representante 
                  FROM planos_bandeira 
                  where plano_id =:planoId";
        $resultado = $this->pdo->prepare($sql);
        $resultado->bindParam(":cliId", $codCliente, PDO::PARAM_INT);
        $resultado->bindParam(":planoId", $tabela, PDO::PARAM_INT);
        $resultado->execute();

        return $resultado;
    }

    /**
     * @return mixed
     */
    public function getCliId()
    {
        return $this->cliId;
    }

    /**
     * @param mixed $cliId
     */
    public function setCliId($cliId)
    {
        $this->cliId = $cliId;
    }

    /**
     * @return mixed
     */
    public function getCliNomeRazao()
    {
        return $this->cliNomeRazao;
    }

    /**
     * @param mixed $cliNomeRazao
     */
    public function setCliNomeRazao($cliNomeRazao)
    {
        $this->cliNomeRazao = $cliNomeRazao;
    }

    /**
     * @return mixed
     */
    public function getCliFantasia()
    {
        return $this->cliFantasia;
    }

    /**
     * @param mixed $cliFantasia
     */
    public function setCliFantasia($cliFantasia)
    {
        $this->cliFantasia = $cliFantasia;
    }

    /**
     * @return mixed
     */
    public function getCliCpfCnpj()
    {
        return $this->cliCpfCnpj;
    }

    /**
     * @param mixed $cliCpfCnpj
     */
    public function setCliCpfCnpj($cliCpfCnpj)
    {
        $this->cliCpfCnpj = $cliCpfCnpj;
    }

    /**
     * @return mixed
     */
    public function getCliTipo()
    {
        return $this->cliTipo;
    }

    /**
     * @param mixed $cliTipo
     */
    public function setCliTipo($cliTipo)
    {
        $this->cliTipo = $cliTipo;
    }

    /**
     * @return mixed
     */
    public function getCliDataNascimento()
    {
        return $this->cliDataNascimento;
    }

    /**
     * @param mixed $cliDataNascimento
     */
    public function setCliDataNascimento($cliDataNascimento)
    {
        $this->cliDataNascimento = $cliDataNascimento;
    }

    /**
     * @return mixed
     */
    public function getCliSexo()
    {
        return $this->cliSexo;
    }

    /**
     * @param mixed $cliSexo
     */
    public function setCliSexo($cliSexo)
    {
        $this->cliSexo = $cliSexo;
    }

    /**
     * @return mixed
     */
    public function getCliRg()
    {
        return $this->cliRg;
    }

    /**
     * @param mixed $cliRg
     */
    public function setCliRg($cliRg)
    {
        $this->cliRg = $cliRg;
    }

    /**
     * @return mixed
     */
    public function getCliOrgaoEmissor()
    {
        return $this->cliOrgaoEmissor;
    }

    /**
     * @param mixed $cliOrgaoEmissor
     */
    public function setCliOrgaoEmissor($cliOrgaoEmissor)
    {
        $this->cliOrgaoEmissor = $cliOrgaoEmissor;
    }

    /**
     * @return mixed
     */
    public function getCliDataEmissaoRg()
    {
        return $this->cliDataEmissaoRg;
    }

    /**
     * @param mixed $cliDataEmissaoRg
     */
    public function setCliDataEmissaoRg($cliDataEmissaoRg)
    {
        $this->cliDataEmissaoRg = $cliDataEmissaoRg;
    }

    /**
     * @return mixed
     */
    public function getCliEmail()
    {
        return $this->cliEmail;
    }

    /**
     * @param mixed $cliEmail
     */
    public function setCliEmail($cliEmail)
    {
        $this->cliEmail = $cliEmail;
    }

    /**
     * @return mixed
     */
    public function getCliTelefone()
    {
        return $this->cliTelefone;
    }

    /**
     * @param mixed $cliTelefone
     */
    public function setCliTelefone($cliTelefone)
    {
        $this->cliTelefone = $cliTelefone;
    }

    /**
     * @return mixed
     */
    public function getCliNomePai()
    {
        return $this->cliNomePai;
    }

    /**
     * @param mixed $cliNomePai
     */
    public function setCliNomePai($cliNomePai)
    {
        $this->cliNomePai = $cliNomePai;
    }

    /**
     * @return mixed
     */
    public function getCliNomeMae()
    {
        return $this->cliNomeMae;
    }

    /**
     * @param mixed $cliNomeMae
     */
    public function setCliNomeMae($cliNomeMae)
    {
        $this->cliNomeMae = $cliNomeMae;
    }

    /**
     * @return mixed
     */
    public function getCliEstadoCivil()
    {
        return $this->cliEstadoCivil;
    }

    /**
     * @param mixed $cliEstadoCivil
     */
    public function setCliEstadoCivil($cliEstadoCivil)
    {
        $this->cliEstadoCivil = $cliEstadoCivil;
    }

    /**
     * @return mixed
     */
    public function getCliCodCbo()
    {
        return $this->cliCodCbo;
    }

    /**
     * @param mixed $cliCodCbo
     */
    public function setCliCodCbo($cliCodCbo)
    {
        $this->cliCodCbo = $cliCodCbo;
    }

    /**
     * @return mixed
     */
    public function getCliDescricaoCbo()
    {
        return $this->cliDescricaoCbo;
    }

    /**
     * @param mixed $cliDescricaoCbo
     */
    public function setCliDescricaoCbo($cliDescricaoCbo)
    {
        $this->cliDescricaoCbo = $cliDescricaoCbo;
    }

    /**
     * @return mixed
     */
    public function getCliDataAlteracao()
    {
        return $this->cliDataAlteracao;
    }

    /**
     * @param mixed $cliDataAlteracao
     */
    public function setCliDataAlteracao($cliDataAlteracao)
    {
        $this->cliDataAlteracao = $cliDataAlteracao;
    }

    /**
     * @return mixed
     */
    public function getCliStatus()
    {
        return $this->cliStatus;
    }

    /**
     * @param mixed $cliStatus
     */
    public function setCliStatus($cliStatus)
    {
        $this->cliStatus = $cliStatus;
    }

    /**
     * @return mixed
     */
    public function getRetorno()
    {
        return $this->retorno;
    }

    /**
     * @param mixed $retorno
     */
    public function setRetorno($retorno)
    {
        $this->retorno = $retorno;
    }

    /**
     * @return mixed
     */
    public function getMensagemRetorno()
    {
        return $this->mensagemRetorno;
    }

    /**
     * @param mixed $mensagemRetorno
     */
    public function setMensagemRetorno($mensagemRetorno)
    {
        $this->mensagemRetorno = $mensagemRetorno;
    }

    /**
     * @return mixed
     */
    public function getCliLogradouro()
    {
        return $this->cliLogradouro;
    }

    /**
     * @param mixed $cliLogradouro
     */
    public function setCliLogradouro($cliLogradouro)
    {
        $this->cliLogradouro = $cliLogradouro;
    }

    /**
     * @return mixed
     */
    public function getCliNumero()
    {
        return $this->cliNumero;
    }

    /**
     * @param mixed $cliNumero
     */
    public function setCliNumero($cliNumero)
    {
        $this->cliNumero = $cliNumero;
    }

    /**
     * @return mixed
     */
    public function getCliComplemento()
    {
        return $this->cliComplemento;
    }

    /**
     * @param mixed $cliComplemento
     */
    public function setCliComplemento($cliComplemento)
    {
        $this->cliComplemento = $cliComplemento;
    }

    /**
     * @return mixed
     */
    public function getCliBairro()
    {
        return $this->cliBairro;
    }

    /**
     * @param mixed $cliBairro
     */
    public function setCliBairro($cliBairro)
    {
        $this->cliBairro = $cliBairro;
    }

    /**
     * @return mixed
     */
    public function getCliCidade()
    {
        return $this->cliCidade;
    }

    /**
     * @param mixed $cliCidade
     */
    public function setCliCidade($cliCidade)
    {
        $this->cliCidade = $cliCidade;
    }

    /**
     * @return mixed
     */
    public function getCliEstado()
    {
        return $this->cliEstado;
    }

    /**
     * @param mixed $cliEstado
     */
    public function setCliEstado($cliEstado)
    {
        $this->cliEstado = $cliEstado;
    }

    /**
     * @return mixed
     */
    public function getCliCep()
    {
        return $this->cliCep;
    }

    /**
     * @param mixed $cliCep
     */
    public function setCliCep($cliCep)
    {
        $this->cliCep = $cliCep;
    }

    /**
     * @return mixed
     */
    public function getCodContaBancaria()
    {
        return $this->codContaBancaria;
    }

    /**
     * @param mixed $codContaBancaria
     */
    public function setCodContaBancaria($codContaBancaria)
    {
        $this->codContaBancaria = $codContaBancaria;
    }

    /**
     * @return mixed
     */
    public function getBcoId()
    {
        return $this->bcoId;
    }

    /**
     * @param mixed $bcoId
     */
    public function setBcoId($bcoId)
    {
        $this->bcoId = $bcoId;
    }

    /**
     * @return mixed
     */
    public function getCliSelfie()
    {
        return $this->cliSelfie;
    }

    /**
     * @param mixed $cliSelfie
     */
    public function setCliSelfie($cliSelfie)
    {
        $this->cliSelfie = $cliSelfie;
    }

    /**
     * @return mixed
     */
    public function getCliDocFrente()
    {
        return $this->cliDocFrente;
    }

    /**
     * @param mixed $cliDocFrente
     */
    public function setCliDocFrente($cliDocFrente)
    {
        $this->cliDocFrente = $cliDocFrente;
    }

    /**
     * @return mixed
     */
    public function getCliDocVerso()
    {
        return $this->cliDocVerso;
    }

    /**
     * @param mixed $cliDocVerso
     */
    public function setCliDocVerso($cliDocVerso)
    {
        $this->cliDocVerso = $cliDocVerso;
    }

    /**
     * @return mixed
     */
    public function getCliCompEndereco()
    {
        return $this->cliCompEndereco;
    }

    /**
     * @param mixed $cliCompEndereco
     */
    public function setCliCompEndereco($cliCompEndereco)
    {
        $this->cliCompEndereco = $cliCompEndereco;
    }

    /**
     * @return mixed
     */
    public function getCliDeviceId()
    {
        return $this->cliDeviceId;
    }

    /**
     * @param mixed $cliDeviceId
     */
    public function setCliDeviceId($cliDeviceId)
    {
        $this->cliDeviceId = $cliDeviceId;
    }

    /**
     * @return mixed
     */
    public function getCliMostraSaldo()
    {
        return $this->cliMostraSaldo;
    }

    /**
     * @param mixed $cliMostraSaldo
     */
    public function setCliMostraSaldo($cliMostraSaldo)
    {
        $this->cliMostraSaldo = $cliMostraSaldo;
    }

    /**
     * @return mixed
     */
    public function getCliSenha()
    {
        return $this->cliSenha;
    }

    /**
     * @param mixed $cliSenha
     */
    public function setCliSenha($cliSenha)
    {
        $this->cliSenha = $cliSenha;
    }

    /**
     * @return mixed
     */
    public function getCliPpe()
    {
        return $this->cliPpe;
    }

    /**
     * @param mixed $cliPpe
     */
    public function setCliPpe($cliPpe)
    {
        $this->cliPpe = $cliPpe;
    }

    /**
     * @return mixed
     */
    public function getCliLoginBio()
    {
        return $this->cliLoginBio;
    }

    /**
     * @param mixed $cliLoginBio
     */
    public function setCliLoginBio($cliLoginBio)
    {
        $this->cliLoginBio = $cliLoginBio;
    }

    /**
     * @return mixed
     */
    public function getCliAgencia()
    {
        return $this->cliAgencia;
    }

    /**
     * @param mixed $cliAgencia
     */
    public function setCliAgencia($cliAgencia)
    {
        $this->cliAgencia = $cliAgencia;
    }

    /**
     * @return mixed
     */
    public function getCliConta()
    {
        return $this->cliConta;
    }

    /**
     * @param mixed $cliConta
     */
    public function setCliConta($cliConta)
    {
        $this->cliConta = $cliConta;
    }

    /**
     * @return mixed
     */
    public function getCliPushId()
    {
        return $this->cliPushId;
    }

    /**
     * @param mixed $cliPushId
     */
    public function setCliPushId($cliPushId)
    {
        $this->cliPushId = $cliPushId;
    }

    /**
     * @return mixed
     */
    public function getCliSenhaPin()
    {
        return $this->cliSenhaPin;
    }

    /**
     * @param mixed $cliSenhaPin
     */
    public function setCliSenhaPin($cliSenhaPin)
    {
        $this->cliSenhaPin = $cliSenhaPin;
    }

    /**
     * @return mixed
     */
    public function getCliObs()
    {
        return $this->cliObs;
    }

    /**
     * @param mixed $cliObs
     */
    public function setCliObs($cliObs)
    {
        $this->cliObs = $cliObs;
    }

    /**
     * @return mixed
     */
    public function getCliRetornoKyc()
    {
        return $this->cliRetornoKyc;
    }

    /**
     * @param mixed $cliRetornoKyc
     */
    public function setCliRetornoKyc($cliRetornoKyc)
    {
        $this->cliRetornoKyc = $cliRetornoKyc;
    }

    /**
     * @return mixed
     */
    public function getPlanosId()
    {
        return $this->planosId;
    }

    /**
     * @param mixed $planosId
     */
    public function setPlanosId($planosId): void
    {
        $this->planosId = $planosId;
    }

    /**
     * @return mixed
     */
    public function getCliDepBanco()
    {
        return $this->cliDepBanco;
    }

    /**
     * @param mixed $cliDepBanco
     */
    public function setCliDepBanco($cliDepBanco): void
    {
        $this->cliDepBanco = $cliDepBanco;
    }

    /**
     * @return mixed
     */
    public function getCliDepAgencia()
    {
        return $this->cliDepAgencia;
    }

    /**
     * @param mixed $cliDepAgencia
     */
    public function setCliDepAgencia($cliDepAgencia): void
    {
        $this->cliDepAgencia = $cliDepAgencia;
    }

    /**
     * @return mixed
     */
    public function getCliDepConta()
    {
        return $this->cliDepConta;
    }

    /**
     * @param mixed $cliDepConta
     */
    public function setCliDepConta($cliDepConta): void
    {
        $this->cliDepConta = $cliDepConta;
    }

    /**
     * @return mixed
     */
    public function getCliFaturamento()
    {
        return $this->cliFaturamento;
    }

    /**
     * @param mixed $cliFaturamento
     */
    public function setCliFaturamento($cliFaturamento): void
    {
        $this->cliFaturamento = $cliFaturamento;
    }

    /**
     * @return mixed
     */
    public function getCliQtdeMaquinas()
    {
        return $this->cliQtdeMaquinas;
    }

    /**
     * @param mixed $cliQtdeMaquinas
     */
    public function setCliQtdeMaquinas($cliQtdeMaquinas): void
    {
        $this->cliQtdeMaquinas = $cliQtdeMaquinas;
    }

    /**
     * @return mixed
     */
    public function getCliPolo()
    {
        return $this->cliPolo;
    }

    /**
     * @param mixed $cliPolo
     */
    public function setCliPolo($cliPolo): void
    {
        $this->cliPolo = $cliPolo;
    }

    /**
     * @return mixed
     */
    public function getCliRepresentante()
    {
        return $this->cliRepresentante;
    }

    /**
     * @param mixed $cliRepresentante
     */
    public function setCliRepresentante($cliRepresentante): void
    {
        $this->cliRepresentante = $cliRepresentante;
    }

    /**
     * @return mixed
     */
    public function getCliIdResponsavel()
    {
        return $this->cliIdResponsavel;
    }

    /**
     * @param mixed $cliIdResponsavel
     */
    public function setCliIdResponsavel($cliIdResponsavel): void
    {
        $this->cliIdResponsavel = $cliIdResponsavel;
    }

    /**
     * @return mixed
     */
    public function getCliCpf()
    {
        return $this->cliCpf;
    }

    /**
     * @param mixed $cliCpf
     */
    public function setCliCpf($cliCpf): void
    {
        $this->cliCpf = $cliCpf;
    }

    /**
     * @return mixed
     */
    public function getCliRecebOutraConta()
    {
        return $this->cliRecebOutraConta;
    }

    /**
     * @param mixed $cliRecebOutraConta
     */
    public function setCliRecebOutraConta($cliRecebOutraConta): void
    {
        $this->cliRecebOutraConta = $cliRecebOutraConta;
    }

    /**
     * @return mixed
     */
    public function getCliTipoTabela()
    {
        return $this->cliTipoTabela;
    }

    /**
     * @param mixed $cliTipoTabela
     */
    public function setCliTipoTabela($cliTipoTabela): void
    {
        $this->cliTipoTabela = $cliTipoTabela;
    }

    /**
     * @return mixed
     */
    public function getCliTabela()
    {
        return $this->cliTabela;
    }

    /**
     * @param mixed $cliTabela
     */
    public function setCliTabela($cliTabela): void
    {
        $this->cliTabela = $cliTabela;
    }

    /**
     * @return mixed
     */
    public function getCliCdxExpress()
    {
        return $this->cliCdxExpress;
    }

    /**
     * @param mixed $cliCdxExpress
     */
    public function setCliCdxExpress($cliCdxExpress): void
    {
        $this->cliCdxExpress = $cliCdxExpress;
    }

    /**
     * @return mixed
     */
    public function getCliMcc()
    {
        return $this->cliMcc;
    }

    /**
     * @param mixed $cliMcc
     */
    public function setCliMcc($cliMcc): void
    {
        $this->cliMcc = $cliMcc;
    }

    /**
     * @return mixed
     */
    public function getCliSoftDescriptor()
    {
        return $this->cliSoftDescriptor;
    }

    /**
     * @param mixed $cliSoftDescriptor
     */
    public function setCliSoftDescriptor($cliSoftDescriptor): void
    {
        $this->cliSoftDescriptor = $cliSoftDescriptor;
    }


}