Beispiel #1
0
 public function listar($ordem = "ASC", $campo = self::ID)
 {
     $info = parent::listar($ordem, $campo);
     if (!empty($info)) {
         $temp = new Pedido($info[self::ID]);
         $temp->setIdSessao($info[self::IDSESSAO]);
         $temp->quantidade = $info[self::QUANTIDADE];
         $temp->observacoes = $info[self::OBSERVACOES];
         $temp->estoque = $info[self::ESTOQUE];
         $temp->setData(new DataHora($info[self::DATA]));
         $temp->setStatus($info[self::STATUS]);
         $temp->estoque = $info[self::ESTOQUE];
         $temp->setDesconto($info[self::DESCONTO]);
         $temp->setTipoPagamento($info[self::TIPOPAGAMENTO]);
         $temp->setValor($info[self::VALOR]);
         $temp->setVendedor($info[self::VENDEDOR]);
         $lPEE = new ListaPedidoEnderecoEntregas();
         $lPEE->condicoes('', $temp->getId(), ListaPedidoEnderecoEntregas::IDSESSAO);
         if ($lPEE->getTotal() > 0) {
             $temp->setEndereco($lPEE->listar());
         }
         $lP = new ListaPessoas();
         $lP->condicoes('', $info[self::IDSESSAO], ListaPessoas::ID);
         if ($lP->getTotal() > 0) {
             $temp->setCliente($lP->listar());
         }
         return $temp;
     }
 }
 function repeatTemplateByArray($con)
 {
     global $iGR;
     $lP = new ListaPessoas();
     while ($rs = $con->getRegistro()) {
         if ($rs['valorcompras'] > 0 && ($_POST['ordenar'] == 1 || $_POST['ordenar'] == 2) || $_POST['ordernar'] == null) {
             $lP->condicoes('', $rs['id'], ListaPessoas::ID);
             $p = $lP->listar();
             $iGR->repetir('repetir->Clientes');
             $iGR->enterRepeticao()->trocar('id.Cliente', $p->getId());
             $iGR->enterRepeticao()->trocar('nome.Cliente', $p->nome);
             $iGR->enterRepeticao()->trocar('dataNascimento.Cliente', $p->getDataNasc() ? $p->getDataNasc()->mostrar() : '');
             $iGR->enterRepeticao()->trocar('cpf.Cliente', $p->cpf ? $p->cpf : $p->cnpj);
             if ($p->getTelefone()->getTotal() > 0) {
                 $tel = $p->getTelefone()->listar();
                 $iGR->enterRepeticao()->trocar('telefone.Telefone.Cliente', $tel->ddd . "-" . $tel->telefone);
             }
             if ($p->getEndereco()->getTotal() > 0) {
                 $end = $p->getEndereco()->listar();
                 $iGR->enterRepeticao()->trocar('logradouro.Endereco.Cliente', $end->logradouro);
                 $iGR->enterRepeticao()->trocar('numero.Endereco.Cliente', $end->numero);
                 $iGR->enterRepeticao()->trocar('bairro.Endereco.Cliente', $end->bairro);
                 $iGR->enterRepeticao()->trocar('cidade.Endereco.Cliente', $end->cidade);
                 $iGR->enterRepeticao()->trocar('estado.Endereco.Cliente', $end->estado);
                 $iGR->enterRepeticao()->trocar('cep.Endereco.Cliente', $end->getCep());
             }
             if ($p->getEmail()->getTotal() > 0) {
                 $email = $p->getEmail()->listar();
                 $iGR->enterRepeticao()->trocar('email.Email.Cliente', $email->email);
             }
             $iGR->enterRepeticao()->trocar('moeda', "R\$");
             $iGR->enterRepeticao()->trocar('valorCompras.Cliente', Numero::__CreateNumero($rs['valorcompras'])->moeda());
         }
     }
 }
Beispiel #3
0
 public function listar($ordem = "ASC", $campo = self::ID)
 {
     $info = parent::listar($ordem, $campo);
     if (!empty($info)) {
         $temp = new Ticket($info[self::ID]);
         parent::resgatarObjetos($info);
         $lP = new ListaPessoas();
         $lP->condicoes('', $info[self::CLIENTE], ListaPessoas::ID);
         if ($lP->getTotal() > 0) {
             $temp->setCliente($lP->listar());
         }
         $temp->setNivel($info[self::NIVEL]);
         $temp->setStatus($info[self::STATUS]);
         $temp->setSatisfacao($info[self::SATISFACAO]);
         $temp->titulo = $info[self::TITULO];
         $temp->setDataAlteracao(new DataHora($info[self::DATAHORA_ALTERACAO]));
         return $temp;
     }
 }
$lP->condicoes($aP);
$iTLCL->createRepeticao("repetir->Clientes");
if (!empty($_GET['busca'])) {
    $lP->condicoes('', "", '', '', "SELECT c.* FROM " . Sistema::$BDPrefixo . "pessoas c, " . Sistema::$BDPrefixo . "enderecos e WHERE ((c.nome LIKE '%" . $_GET['busca'] . "%' OR c.email LIKE '%" . $_GET['busca'] . "%') OR ((e.estado LIKE '%" . $_GET['busca'] . "%' OR e.cidade LIKE '%" . $_GET['busca'] . "%') AND c.id = e.ligacao))" . ($_SESSION['nivel'] == 3 ? " AND c.vendedor = '" . $_SESSION['idUsuario'] . "'" : "") . " GROUP BY c.id");
} elseif ($_SESSION['nivel'] == 3) {
    $lP->condicoes(array(1 => array("campo" => ListaPessoas::VENDEDOR, "valor" => $_SESSION['idUsuario'])));
}
$iTLCL->condicao("condicaoBusca", !empty($_SESSION['nivel']));
$iTLCL->trocar("linkCadastrar.Cliente", "?p=" . $_GET['p'] . "&a=cadastrarCliente");
$iTLCL->trocar('total.ListaClientes', $lP->getTotal());
$num = 40;
$primeiro = $_GET['pag'] * $num;
$total = $lP->getTotal();
$max = ceil($total / $num);
$lP->setParametros($primeiro)->setParametros($num + $primeiro, 'limite');
while ($p = $lP->listar("ASC", ListaPessoas::NOME)) {
    $iTLCL->repetir();
    $iTLCL->enterRepeticao()->condicao("condicaoRemover", !empty($_SESSION['nivel']));
    $bgColor = $lP->getParametros() % 2 == 0 ? '#FFFFFF' : '#EAEAEA';
    $iTLCL->enterRepeticao()->trocar("bgColorEmpresa", $bgColor);
    $tel = $p->getTelefone()->listar();
    $iTLCL->enterRepeticao()->trocar("id.Cliente", $p->getId());
    $iTLCL->enterRepeticao()->trocar("nome.Cliente", $p->nome);
    $iTLCL->enterRepeticao()->trocar("telefone.Cliente", "(" . $tel->ddd . ") " . $tel->telefone . " " . $tel->ramal);
    $iTLCL->enterRepeticao()->trocar("email.Cliente", $p->getEmail()->listar()->email);
    $iTLCL->enterRepeticao()->trocar("linkVisualizar.Cliente", "?p=" . $_GET['p'] . "&a=listarClientes&cliente=" . $p->getId());
    $iTLCL->enterRepeticao()->trocar("linkAlterar.Cliente", "?p=" . $_GET['p'] . "&a=alterarCliente&cliente=" . $p->getId());
    $iTLCL->enterRepeticao()->condicao("condicaoVisualizar", $p->tipo == 1);
}
$iTLCL->createRepeticao("repetir->Paginacao");
for ($i = 0; $i < $max; $i++) {
     $erro = "<b>Nome</b> não preenchido!<br><br>";
 } elseif (empty($_POST['pessoa'])) {
     $erro = "<b>Pessoa</b> não escolhido!<br><br>";
 } elseif (!empty($_POST['cpf']) && $_POST['pessoa'] == 'fisica') {
     if (!Strings::__VerificarCPF($_POST['cpf'])) {
         $erro = "<b>CPF</b> inválido!<br><br>";
     }
 } elseif (!empty($_POST['cnpj']) && $_POST['pessoa'] == 'juridica') {
     if (!Strings::__VerificarCNPJ($_POST['cnpj'])) {
         $erro = "<b>CNPJ</b> inválido!<br><br>";
     }
 }
 if (empty($erro)) {
     $lCL = new ListaPessoas();
     $lCL->condicoes('', $_GET['cliente'], ListaPessoas::ID);
     $cl = $lCL->listar();
     if ($_POST['pessoa'] == 'fisica') {
         $cl = new PessoaFisica($cl->getId());
         $cl->rg = $_POST['rg'];
         $cl->cpf = eregi_replace('\\.', '', eregi_replace('-', '', $_POST['cpf']));
         $cl->sexo = $_POST['sexo'];
         $cl->setDataNasc(new DataHora($_POST['dataNasc']));
     } elseif ($_POST['pessoa'] == 'juridica') {
         $cl = new PessoaJuridica($cl->getId());
         $cl->razaoSocial = $_POST['razaoSocial'];
         $cl->cnpj = eregi_replace('/', '', eregi_replace('\\.', '', eregi_replace('-', '', $_POST['cnpj'])));
     }
     $cl->nome = $_POST['nome'];
     $cl->emailPrimario = $_POST['emailPrimario'];
     $cl->sobreNome = $_POST['sobreNome'];
     $cl->usuario = $_POST['usuario'];
            $tP->texto = $_POST['texto'];
            $tP->nome = Sistema::$nomeEmpresa;
            $tP->setDataHora(new DataHora());
            if (!empty($_FILES['arquivo']['name'])) {
                $tP->setArquivo(Arquivos::__OpenArquivoByTEMP($_FILES['arquivo']));
            }
            $ti->addPostagem($tP);
        }
        $_POST = '';
        $javaScript .= Aviso::criar("Ticket salvo com sucesso!");
    } else {
        $javaScript .= Aviso::criar($erro);
    }
}
$iCT->condicao('condicao->alterar.Ticket', true);
$iCT->trocar("linkVoltar", "?p=" . $_GET['p'] . "&a=listarTickets");
$iCT->createRepeticao("repetir->Clientes");
$lP = new ListaPessoas();
while ($p = $lP->listar()) {
    $iCT->repetir();
    $iCT->enterRepeticao()->trocar("id.Cliente", $p->getId());
    $iCT->enterRepeticao()->trocar("nome.Cliente", $p->nome);
}
$iCT->trocar("titulo", $_POST['titulo']);
$iCT->trocar("cliente", $_POST['cliente']);
$iCT->trocar("nivel", $_POST['nivel']);
$iCT->trocar("status", $_POST['status']);
$iCT->createRepeticao("repetir->TicketPosts");
$iCT->createJavaScript();
$javaScript .= $iCT->javaScript->concluir();
$includePagina = $iCT->concluir();