예제 #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $input = Input::all();
     $validate = Validator::make($input, $this->fefas->rules);
     if ($validate->passes()) {
         $fefa = new Fefa($input);
         $fefa->save();
         return Redirect::to('/');
     } else {
         return Redirect::route('fefa.edit', ['chave' => $input['chave']])->withInput()->withErrors($validate)->with('message', 'Houve erros na validação dos dados.');
     }
 }
예제 #2
0
 public function listar($fefas)
 {
     $this->Cell(25, 4, 'Data Compra', 1, 0, "C", 1);
     $this->Cell(25, 4, 'NFE', 1, 0, "C", 1);
     $this->Cell(25, 4, 'Qtd. Macho', 1, 0, "C", 1);
     $this->Cell(25, 4, 'Peso Macho', 1, 0, "C", 1);
     $this->Cell(25, 4, 'Qtd. Femea', 1, 0, "C", 1);
     $this->Cell(25, 4, 'Peso Femea', 1, 0, "C", 1);
     $this->Cell(0, 4, 'Municipio', 1, 0, "C", 1);
     $this->Ln();
     foreach ($fefas as $fefa) {
         $this->Cell(25, 4, Format::dateView($fefa->data_compra), 1, 0, "C", 0);
         $this->Cell(25, 4, $fefa->nfe, 1, 0, "C", 0);
         $this->Cell(25, 4, $fefa->qtd_macho, 1, 0, "R", 0);
         $this->Cell(25, 4, $fefa->peso_macho, 1, 0, "R", 0);
         $this->Cell(25, 4, $fefa->qtd_femea, 1, 0, "R", 0);
         $this->Cell(25, 4, $fefa->peso_femea, 1, 0, "R", 0);
         $this->Cell(0, 4, substr(utf8_decode($fefa->cidade), 0, 22), 1, 0, "L", 0);
         $this->Ln();
     }
     $this->Ln();
     $this->Cell(30, 4, 'QTD MACHOS', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView($fefas->sum('qtd_macho')), 1, 0, "R", 0);
     $this->Cell(30, 4, 'PESO MACHOS', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView(Fefa::getTotalPeso('M', Input::get('cidade', null)), 2), 1, 0, "R", 0);
     $this->Ln();
     $this->Cell(30, 4, 'QTD FEMEA', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView($fefas->sum('qtd_femea')), 1, 0, "R", 0);
     $this->Cell(30, 4, 'PESO FEMEA', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView(Fefa::getTotalPeso('F', Input::get('cidade', null)), 2), 1, 0, "R", 0);
     $this->Ln();
     $this->Cell(30, 4, 'TOTAL QTD', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView($fefas->sum('qtd_femea') + $fefas->sum('qtd_macho'), 0), 1, 0, "R", 0);
     $this->Cell(30, 4, 'TOTAL PESO', 1, 0, "R", 1);
     $this->Cell(25, 4, Format::valorView(Fefa::getTotalPeso('M', Input::get('cidade', null)) + Fefa::getTotalPeso('F', Input::get('cidade', null)), 2), 1, 0, "R", 0);
 }
예제 #3
0
파일: routes.php 프로젝트: kuell/fefa
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', function () {
    return Redirect::to('/fefa');
});
Route::get('/fefa/relatorios', 'FefaController@getRelatorios');
Route::get('/fefa/relatorio/sif', 'FefaController@getRelatorioSif');
Route::get('/fefa/relatorio/fefa', 'FefaController@getRelatorioFefa');
Route::get('fefa/finalizar', function () {
    return View::make('finalizar');
});
Route::post('/fefa/finalizar', function () {
    $input = Input::all() + ['situacao' => 'fechado'];
    Fefa::abertas()->update($input);
    return 'Ok';
});
Route::resource('fefa', 'FefaController');