public function run()
 {
     $faker = Faker::create();
     foreach (range(1, 10) as $index) {
         Relatorio::create([]);
     }
 }
 public function run()
 {
     $faker = Faker::create('pt_BR');
     $clientes = Cliente::all();
     foreach ($clientes as $cliente) {
         $clientes_id[] = $cliente['id'];
     }
     $tarefas = Tarefa::all();
     foreach ($tarefas as $tarefa) {
         $tarefas_id[] = $tarefa['id'];
     }
     $relatorios = Relatorio::all();
     foreach ($relatorios as $relatorio) {
         $relatorios_id[] = $relatorio['id'];
     }
     foreach (range(1, 230) as $index) {
         $random_cliente_id = array_rand($clientes_id, 1);
         $random_tarefa_id = array_rand($tarefas_id, 1);
         Conversa::create(['data' => $faker->dateTime(), 'resumo' => $faker->text(50), 'cliente_id' => $random_cliente_id, 'tarefa_id' => $random_tarefa_id, 'relatorio_id' => '']);
     }
 }
 /**
  * Store a newly created despesa in storage.
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Despesa::$rules);
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     } else {
         $data['valor'] = number_format($data['valor'], 2, '.', '');
         $data['date'] = new Carbon($data['date'], 'America/Sao_Paulo');
         $data['date'] = $data['date']->format('Y-m-d');
         //return $data['date'];
         $despesa = Despesa::create($data);
         $relatorio = Relatorio::find(@$data['relatorio_id']);
         if ($relatorio) {
             $ids = explode(',', $relatorio->ids);
             $ids[] = $despesa->id;
             $relatorio->ids = implode(',', $ids);
             $relatorio->save();
         }
         // Alert
         $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Despesa registrada com sucesso'];
         Session::flash('alerts', $alert);
         return Redirect::to(URL::previous());
     }
 }
Beispiel #4
0
<?php

$tpl->addFile('CONTEUDO', 'html_libs/painel_home.html');
$relatorio = new Relatorio();
$geral = $relatorio->getGerais();
$tpl->LANCDESDE = ExplodeDateTime2($geral['first']);
$tpl->DADOSDESDE = getMesNome($geral['dados_desde']['mes_ref'], true) . "/" . $geral['dados_desde']['ano_ref'];
$default = array();
$default['notas'] = 0;
foreach ($geral['total_geral'] as $ucTipo) {
    $tpl->UCNOTAQTD = tratarValor($ucTipo['cnt']);
    $tpl->VALTOTAL = tratarValor($ucTipo['val'], true);
    $medida = $relatorio->getTipoMedida($ucTipo['tipo']);
    if ($medida != "Min" && $medida != "Mb" && $medida != "NDA") {
        $tpl->UCMEDIDA = $medida;
        $tpl->CONSTOTAL = tratarValor($ucTipo['cons']);
        $tpl->CONSMEDIA = tratarValor($ucTipo['cons'] / $ucTipo['cnt']);
        $tpl->block('SHOWCONS');
        $tpl->block('SHOWCONS2');
    }
    $tpl->VALMEDIA = tratarValor($ucTipo['val'] / $ucTipo['cnt'], true);
    $tpl->UCTIPONOME = $relatorio->getTipoNome($ucTipo['tipo']);
    $tpl->block('EACHUCTIPO');
    $default['notas'] += $ucTipo['cnt'];
}
$tpl->NUMNOTAS = tratarValor($default['notas']);
$tpl->UOQTD = $geral['unidades'][0];
$tpl->UCQTD = $geral['unidades'][1];
Beispiel #5
0
}

#Alerta{
	width: 350px;
	height: 200px;
	margin: 1em auto;
	margin-top:50px;
	overflow:auto;
	text-align:center;
	
		}
	
.txt_bold{
font-weight:bold;

}</style>';
switch ($acao) {
    case 'Visualizar':
        $relatorio = new Relatorio($tabela);
        $relatorio->Visualizar();
        break;
    case 'Entrada':
        $relatorio = new Relatorio('entrada');
        $relatorio->Entrada($datainicial, $datafinal, 's');
        break;
    case 'Saida':
        $relatorio = new Relatorio('saida');
        $relatorio->Entrada($datainicial, $datafinal, 's');
        break;
}
echo '</body></html>';
$tpl->UO_SIGLA = $uo->getSigla();
/***********************
	 MOSTRAR MENU COM ANOS
	***********************/
$iMin = 2012;
$iCalc = $anoAtual - 5;
$iFor = $iCalc < $iMin ? $iMin : $iCalc;
for ($i = $iFor; $i <= Date('Y'); $i++) {
    $tpl->ITEM_MENU_URL = "resumo_index.php?ano=" . $i;
    $tpl->ITEM_MENU_LINK = $i;
    $tpl->block('ITEM_MENU');
}
/***********************
	 MOSTRAR MENU COM ANOS
	***********************/
$rel = new Relatorio();
$cores = $rel->cores;
$ucTipos = $uo->getTiposServicos();
foreach ($ucTipos as $tipo) {
    //$tpl->BDCOLOR = "#4096EE";
    $tpl->BDCOLOR = $cores[$tipo];
    $ucSomas = $uo->getUcSomaByType($tipo, $anoAtual);
    $totais[0] = $totais[1] = 0;
    if ($ucSomas != null) {
        foreach ($ucSomas as $uc) {
            $tpl->UCRGI = $uc['rgi'];
            $tpl->UCNOME = $uc['compl'] . " - " . $uc['rua'];
            $tpl->UCTIPO = $rel->getTipoNome($uc['tipo']);
            $tpl->UCCHAVE = sha1($uc['id']);
            $tpl->ANOATUAL = $anoAtual;
            $tpl->STATUS = getAtivoText($uc['ativo']);
<?php

require_once 'relatorio.class.php';
$opcao = $_REQUEST['opcao'];
$__dataInicial = $_REQUEST['data_inicio'];
$__dataFinal = $_REQUEST['data_fim'];
$__tipo_inscricao = $_REQUEST['tipo_inscricao'];
$relatorio = new Relatorio();
switch ($opcao) {
    case "periodo":
        $relatorio->selecionarInscricoesPorPeriodo($__dataInicial, $__dataFinal);
        break;
    case "tipo_inscricao":
        $relatorio->selecionarInscricoesPorTipoInscricao($__tipo_inscricao);
        break;
    case "inscricoes_confirmadas":
        $relatorio->selecionarInscricoesComPagamentosConfirmados();
        break;
    case "inscricoes_confirmadas_periodo":
        $relatorio->selecionarInscricoesComPagamentosConfirmadosPorPeriodo($__dataInicial, $__dataFinal);
        break;
    case "ordem_alfabetica":
        $relatorio->selecionarInscricoesPorOdemAlfabetica();
        break;
    case "inscricoes_canceladas":
        $relatorio->selecionarInscricoesCanceladas();
        break;
    default:
        echo "Escolha uma opcao";
        break;
}
$model->assign_vars(array('_NOME_PROGRAMA' => $_nome_programa.".php"));

##############################################################################
##############               MSG DE ERRO OU SUCESSO           	##############
##############################################################################	

if (strlen($msg_codigo)>0){
	if ($msg_codigo == 1){
		array_push($msg_ok,"Informações salvas com sucesso!");
	}
}

try {
	$instituicao = $sessionFacade->recuperarInstituicao($_login_instituicao);

	$relatorio = new Relatorio();
	$relatorio->setInstituicao($instituicao);
	$relatorio->setAgruparPorData('t');
	$relatorio->setRelatorio('frequencia');
	$resultado = $relatorio->gerarRelatorio($sessionFacade);

	for($i= 0; $i < count($resultado); $i++) { 
		$model->assign_block_vars('relatorio', array(	'ALUNO'		=>	$resultado[$i][0],
														'RA'		=>	$resultado[$i][1],
														'NOME_ALUNO'=>	$resultado[$i][2],
														'DATA'		=>	$resultado[$i][3],
														'COUNT'		=>	$resultado[$i][4],
														'CLASSE'	=>	$i%2==0?"class='odd'":""
		));
	}
Beispiel #9
0
/**********************
	MOSTRAR DATAS EM FORM
	**********************/
for ($i = 1; $i <= 31; $i++) {
    $tpl->DIANUM = $i < 10 ? '0' . $i : $i;
    $tpl->block('EACH_DIA');
}
for ($i = 1; $i <= 12; $i++) {
    $tpl->MESNUM = $i < 10 ? '0' . $i : $i;
    $tpl->MESNOME = getMesNome($i, false);
    $tpl->block('EACH_MES');
}
/**********************
	MOSTRAR FILTROS DE FORM
	**********************/
$rel = new Relatorio();
$tipos = $rel->ucTipos;
$qtdTipos = count($tipos);
for ($i = 0; $i < $qtdTipos; $i++) {
    $tpl->FILTER_NAME = "Apenas " . $tipos[$i];
    $tpl->FILTER_QUERY = "c.tipo = {$i}";
    $tpl->block('FILTER_TIPO');
}
$filters = $rel->filters;
foreach ($filters as $title => $query) {
    $tpl->FILTER_NAME = $title;
    $tpl->FILTER_QUERY = $query;
    $tpl->block('FILTER_TIPO');
}
/********************************************
	  MOSTRAR TABELA COM NOTAS VINDAS DE $_POST
function showreport()
{
    $classname = $_GET['report'];
    $directory = "report/reports";
    $filename = "{$classname}.php";
    include_once "{$directory}/{$filename}";
    $class = new $classname();
    $data = $class->montar();
    #  var_dump($data);
    echo "<h1>Relatorio: {$class->titulo}</h1><br/>\n";
    echo "<a href=\"report/ods.php?report={$classname}\">ODS</a><br/>\n";
    echo "<a href=\"report/txt.php?report={$classname}\">TXT</a><br/>\n";
    $report = new Relatorio();
    $cabacalho = array();
    echo $report->montar($class->cabecalho, $data);
}
Beispiel #11
0
<?php

include_once 'class/master.inc.php';
include 'class/Relatorio.php';
$usuario = new Usuario();
$chamado = new Chamado();
$categoria = new Categoria();
$relatorio = new Relatorio();
$tplScripts = '<link rel="stylesheet" href="css/atender.css" media="screen" />';
$tplScripts .= '<script language="javascript" type="text/javascript" src="js/jquery.flot.js"></script>';
$tplScripts .= '<script language="javascript" type="text/javascript" src="js/relatorio.js"></script>';
$tplScripts .= '<!--[if lte IE 8]><script language="javascript" type="text/javascript" src="../excanvas.min.js"></script><![endif]-->';
#Média de atendimento geral
$mediaTempoAtendimentoGeral = $relatorio->GetMediaAtendimentoGeral();
if ($mediaTempoAtendimentoGeral) {
    foreach ($mediaTempoAtendimentoGeral as $m) {
        $tplMediaGeral .= "<tr><td>Total Geral de Atendimentos</td><td>" . $m['media'] . "</td></tr>";
    }
}
###################################
#Média de atendimento por categoria
$mediaTempoAtendimentoPorCategoria = $relatorio->GetMediaAtendimentoPorCategoria();
if ($mediaTempoAtendimentoPorCategoria) {
    foreach ($mediaTempoAtendimentoPorCategoria as $m) {
        $tplMediaPorCategoria .= "<tr><td>" . $m['descricao'] . "</td><td>" . $m['media'] . "</td></tr>";
    }
}
###################################
#Média de abertura de helpdesks por dia
$tplAberturaGeral .= "<tr><td>Chamados abertos</td><td>" . $relatorio->GetMediaAberturaPorDiaGeral('SEMANA') . "</td><td>" . $relatorio->GetMediaAberturaPorDiaGeral('MES') . "</td><td>" . $relatorio->GetMediaAberturaPorDiaGeral('ANO') . "</td></tr>";
###################################
 /**
  * Store a newly created email in storage.
  * SEND THE MAIL
  *
  * @return Response
  */
 public function store()
 {
     $validator = Validator::make($data = Input::all(), Email::$rules);
     //return Response::json($data);
     if ($validator->fails()) {
         if (Request::ajax()) {
             return Response::json('error', '503')->withErrors($validator);
         } else {
             return Redirect::back()->withErrors($validator)->withInput();
         }
     }
     // echo "<pre>";
     // print_r( $data );
     // echo "</pre>";
     // exit;
     switch ($data['owner_type']) {
         case 'pedido':
             $resource = Pedido::find($data['owner_id']);
             $view = 'layouts.email';
             //Corpo do email
             if ($resource) {
                 $resource->status = '2';
                 $resource->save();
             }
             break;
         case 'relatorio':
             $resource = Relatorio::find($data['owner_id']);
             $view = 'relatorios.email';
             unset($data['attachments']);
             if ($resource and Confide::user()) {
                 $resource->status = '2';
                 $resource->save();
             }
             break;
         case 'cliente':
             $resource = Cliente::find($data['owner_id']);
             $data['resource'] = $resource;
             // print_r($resource)  ;
             // exit;
             $view = 'clientes.email';
             break;
         default:
             $view = 'layouts.email';
             $resource = NULL;
             break;
     }
     /**
      *
      *	SEND THE MAILS
      *
      **/
     // SEND to EACH "TO"
     foreach ($data['to'] as $to) {
         $content = $data;
         $content['to'] = $to;
         // print_r($view);
         // exit;
         // DEBUG
         // return View::make( $view, array('email'=>$content, 'resource'=>$resource) );
         // exit;
         Mail::queue($view, array('email' => $content, 'resource' => $resource), function ($message) use($content, $to) {
             $message->to($to)->subject(@$content['subject']);
             /**
              *    ANEXA O PDF
              */
             // print_r($content['attachments']);
             // exit;
             if (isset($content['attachments']) and is_file($content['attachments'])) {
                 $attachment = $content['attachments'];
                 $message->attach($attachment);
             }
         });
         $email = Email::create($content);
         if ($email) {
             //$downloadLink   = url(  'pedidos/'.$email->owner_id.'/download');
             //$email->pdfLink = $downloadLink;
             //Swift_Preferences::getInstance()->setCacheType('disk')->setTempDir('/tmp');
             // //SEND THE MAIL
             // Mail::send('layouts.email', compact('email'), function($message)use($email){
             // 	//$message->from('*****@*****.**', 'L. Tonet');
             // 	$message->to( $email->to );
             // 	if( isset($email->cc) and !empty($email->cc)) {
             // 		 $message->cc( $email->cc );
             // 		 //append to report record
             // 		 $reportMsg = ' com CC: <'.$email->cc.'>';
             // 	}
             // 	$message->subject( @$email->subject );
             // 	/**
             // 	 *    ANEXA O PDF
             // 	 */
             // 	if(isset($email->attachments)){
             // 		 $file = strtolower($email->owner_type).'-'.$email->owner_id.'.pdf';
             // 		 $file = asset('pdf/'.$file);
             // 		 $attachment = Swift_Attachment::fromPath('pdf/'.$file);
             // 		 // Attach it to the message
             // 		 $message->attach($file);
             // 	}
             // 	//Log this
             // 	// Report::create([
             // 	//       'user_id'        => Auth::id(),
             // 	//       'status'         => 'success',
             // 	//       'event'          => 'sended',
             // 	//       'title'          => 'Pedido '.$email->owner_id.' enviado',
             // 	//       'resource_model' => 'Pedido',
             // 	//       'owner_id'    => $email->owner_id,
             // 	//       'resource_obj'   => json_encode($email),
             // 	//    ]);
             // });
         } else {
             echo 'não criado';
         }
         // Alert
         $alert[] = ['class' => 'alert-success', 'message' => '<strong><i class="fa fa-check"></i></strong> Enviado para <strong>' . $content['to'] . '</strong> !'];
     }
     Session::flash('alerts', $alert);
     return Redirect::to(URL::previous());
 }
    $tpl->block('EACH_ANOREF');
}
/********************************************
	  MOSTRAR TABELA COM NOTAS VINDAS DE $_POST
	********************************************/
if (getenv("REQUEST_METHOD") == "POST") {
    if (isset($_POST['mes_ref'], $_POST['ano_ref'])) {
        $mes = $_POST['mes_ref'] == "" ? "nulo" : $_POST['mes_ref'];
        $ano = $_POST['ano_ref'] <= Date('Y') || $_POST['ano_ref'] >= 2012 ? $_POST['ano_ref'] : Date('Y');
        $tpl->MESNOME = strtoupper(getMesNome($mes, false));
        $tpl->ANO = $ano;
        $sql_cont = "SELECT id FROM daee_contratos";
        $query_cont = mysql_query($sql_cont);
        $qtd = 0;
        $i = 0;
        $rel = new Relatorio();
        $rel->setUdds();
        $udds = $rel->udds;
        $cores = $rel->cores;
        $tipos = $rel->ucTipos;
        if (mysql_num_rows($query_cont) > 0) {
            while ($res = mysql_fetch_array($query_cont)) {
                $contrato = new Contrato($res['id']);
                $notas = $contrato->getFaltaNotas($mes, $ano);
                if ($notas[0]['ucid'] != null) {
                    $qtd += count($notas);
                    foreach ($notas as $nota) {
                        $consTipo = $nota['tipo'];
                        $tpl->UO = $udds[$nota['uo']];
                        $tpl->AUTOS = $contrato->geraNome();
                        $tpl->UC = "<b>" . $nota['rgi'] . "</b> - [ <small>" . $nota['endereco'] . "</small> ]";
 /**
  * PREVIEW PRINT   
  *
  * @param  string  $id
  * @return Response
  */
 public function printThis($id)
 {
     $relatorio = Relatorio::find($id);
     switch (@$relatorio->type) {
         case 'despesas':
             $despesas_ids = explode(',', $relatorio->ids);
             $despesas = Despesa::whereIn('id', $despesas_ids)->get();
             $relatorio->despesas = $despesas;
             // Total de despesas
             $total = 0;
             foreach ($relatorio->despesas as $despesa) {
                 $total += $despesa->valor;
                 // Fomata R$ despesas
                 $despesa->valor = number_format($despesa->valor, 2, ',', '.');
             }
             // Fomata R$ Total
             $relatorio->total = number_format($total, 2, ',', '.');
             break;
         case 'conversas':
             //Agrupa por cliente
             $groups = $relatorio->conversas->groupBy('cliente_id');
             $clientes_conversas = array();
             foreach ($groups as $cliente_id => $conversas) {
                 $client = Cliente::find($cliente_id);
                 if (count($client)) {
                     $client->conversas = $conversas;
                     $clientes_conversas[] = $client;
                 }
             }
             $relatorio->conversas = $clientes_conversas;
             break;
         default:
             return "???";
             break;
     }
     return View::make('relatorios.' . $relatorio->type . '.print', compact('relatorio'));
     return View::make('relatorios.' . $relatorio->type . '.print', compact('relatorio'));
 }
Beispiel #15
0
$model->assign_vars(array('_NOME_PROGRAMA' => $_nome_programa.".php"));

##############################################################################
##############               MSG DE ERRO OU SUCESSO           	##############
##############################################################################	

if (strlen($msg_codigo)>0){
	if ($msg_codigo == 1){
		array_push($msg_ok,"Informações salvas com sucesso!");
	}
}

try {
	$instituicao = $sessionFacade->recuperarInstituicao($_login_instituicao);

	$relatorio = new Relatorio();
	$relatorio->setInstituicao($instituicao);
	$relatorio->setRelatorio('prova');
	$resultado = $relatorio->gerarRelatorio($sessionFacade);

	for($i= 0; $i < count($resultado); $i++) { 
		$model->assign_block_vars('relatorio', array(	'ALUNO'		=>	$resultado[$i][0],
														'RA'		=>	$resultado[$i][1],
														'NOME_ALUNO'=>	$resultado[$i][2],
														'DATA'		=>	$resultado[$i][3],
														'PROVA'		=>	$resultado[$i][4],
														'CURSO'		=>	$resultado[$i][5],
														'DISCIPLINA'=>	$resultado[$i][6],
														'NOTA'		=>	$resultado[$i][7],
														'STATUS'	=>	$resultado[$i][8],
														'CLASSE'	=>	$i%2==0?"class='odd'":""
Beispiel #16
0
 public function __construct($titulo, $tipo, $opcoes = '')
 {
     parent::__construct($titulo, $tipo, $opcoes);
 }
Beispiel #17
0
<?php

include_once '../class/master.inc.php';
include_once '../class/Relatorio.php';
$usuario = new Usuario();
$chamado = new Chamado();
$categoria = new Categoria();
$relatorio = new Relatorio();
if (isset($_GET)) {
    switch ($_GET['action']) {
        #RETORNA TODAS AS RESPOSTAS DE UM DETERMINADO CHAMADO.
        case 'getRespostas':
            $respostas = $chamado->GetRespostas($_GET['idChamado']);
            $i = 1;
            if ($respostas) {
                foreach ($respostas as $resp) {
                    $tplRespostas .= "<div id='resposta" . $i % 2 . "'><h3>" . $resp['data'] . " - " . $usuario->GetUserByID($resp['usuario']);
                    if ($i != count($respostas)) {
                        //Se a resposta não for a primeira do chamado.
                        if (!$chamado->isFinalizado($_GET['idChamado'])) {
                            //Se não estiver finalizado
                            if ($_SESSION['grupo'] != "USUARIO") {
                                //Se o usuário logado NÃO FOR do grupo "Usuários"
                                if (in_array($usuario->GetNome($_SESSION['login']), array($chamado->GetSolicitante($_GET['idChamado']), $chamado->GetAtendente($_GET['idChamado'])))) {
                                    //Se o usuário pertence ao chamado.
                                    $tplRespostas .= "&nbsp;<a href='?action=delresp&resposta=" . $resp['id_resposta'] . "&id=" . $_GET['idChamado'] . "'><img id='deletar' name='" . $resp['data'] . "' src='images/delete.png' /></a>";
                                }
                            }
                        }
                    }
                    $tplRespostas .= "</h3>";