public function indexAction() { /** * Total de clientes */ $modelClientes = new Model_DbTable_Cliente(); $this->view->clientes = $modelClientes->fetchAll(); /** * Total de propostas */ $modelProposta = new Model_DbTable_Proposta(); $propostas = $modelProposta->fetchAll(); $this->view->propostas = $propostas; $total_horas_propostas = 0; $total_valor_propostas = 0; foreach ($propostas as $proposta) { $total_horas_propostas += $proposta->proposta_horas; $total_valor_propostas += $proposta->proposta_valor; } $this->view->total_horas_proposta = $total_horas_propostas; $this->view->total_valor_proposta = $total_valor_propostas; /** * Total de Projetos */ $modelProjeto = new Model_DbTable_Projeto(); $projetos = $modelProjeto->fetchAll(); $this->view->projetos = $projetos; /** * Total Faturamento */ $modelFaturamento = new Model_DbTable_Faturamento(); $faturamentos = $modelFaturamento->fetchAll(); $faturamento_total = 0; $receber = 0; $recebido = 0; foreach ($faturamentos as $faturamento) { if ($faturamento->faturamento_status === self::STATUS_AGUARDANDO_PAGAMENTO) { $receber += $faturamento->faturamento_valor; } if ($faturamento->faturamento_status === self::STATUS_PAGO) { $recebido += $faturamento->faturamento_valor; } $faturamento_total += $faturamento->faturamento_valor; } $this->view->faturamento_total = $faturamento_total; $this->view->receber = $receber; $this->view->recebido = $recebido; /** * Total de Horas Trbalhadas */ $modelControleHoras = new Model_DbTable_ControleHoras(); $horas = $modelControleHoras->fetchAll(); $horas_trabalhadas = 0; foreach ($horas as $hora) { $zendDateInicio = new Zend_Date($hora->controle_horas_data_inicio); $zendDateFim = new Zend_Date($hora->controle_horas_data_fim); $horas_trabalhadas += $zendDateFim->sub($zendDateInicio)->get(Zend_Date::TIMESTAMP); } $this->view->horas = ceil($horas_trabalhadas / 3600); }
/** * * @return type */ private function getClientes() { $options = array("" => "Selecione..."); $modelCliente = new Model_DbTable_Cliente(); $clientes = $modelCliente->fetchAll(); foreach ($clientes as $cliente) { $options[$cliente->cliente_id] = $cliente->cliente_empresa ? $cliente->cliente_empresa : $cliente->cliente_nome; } return $options; }
public function indexAction() { // Saloes Cadastrados $modelSalao = new Model_DbTable_Salao(); //$where = $modelSalao->getDefaultAdapter()->quoteInto("salao_pre_cadastro = ?", 0); $totalSalao = $modelSalao->getCount(); $this->view->totalSalao = $totalSalao->count; // Clientes Cadastrados $modelCliente = new Model_DbTable_Cliente(); $totalCliente = $modelCliente->getCount(); $this->view->totalCliente = $totalCliente->count; // Consultas CEP (validas) $modelBuscaCep = new Model_DbTable_BucaCep(); $where = $modelBuscaCep->getDefaultAdapter()->quoteInto('busca_valida = ?', 1); $totalConsultaCep = $modelBuscaCep->getCount(1, $where); $this->view->totalConsultaCep = $totalConsultaCep->count; // agendamentos $modelAgenda = new Model_DbTable_Agenda(); $where = $modelAgenda->getDefaultAdapter()->quoteInto("agenda_manual is null", null); $totalAgendamentos = $modelAgenda->fetchAll($where); $this->view->totalAgendamentos = $totalAgendamentos->count(); }
/** * Detalhes do cadastro e acoes para os registros */ public function detalhesAction() { $cliente_id = $this->getRequest()->getParam("cliente"); /** * Busca os dados do cliente */ $modelCliente = new Model_DbTable_Cliente(); $cliente = $modelCliente->getById($cliente_id); $this->view->cliente = $cliente; $where = "cliente_id = {$cliente_id}"; /** * Busca quantidade de propostas */ $modelProposta = new Model_DbTable_Proposta(); $propostas = $modelProposta->fetchAll($where); $this->view->propostas = $propostas; /** * Busca quantidade de projetos */ $modelProjeto = new Model_DbTable_Projeto(); $projetos = $modelProjeto->fetchAll($where); $this->view->projetos = $projetos; /** * Faturamentos */ $modelFaturamento = new Model_DbTable_Faturamento(); $faturamento = $modelFaturamento->getTotalFaturadoCliente($cliente_id); $this->view->total_faturado = $faturamento->total_faturado ? $faturamento->total_faturado : 0; /** * Total de Horas */ $modelControleHoras = new Model_DbTable_ControleHoras(); }