/**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request|\Veterinaria\Http\Controllers\AtentionRequest|\Veterinaria\Http\Requests\AtentionRequest $request
  * @return \Illuminate\Http\Response
  */
 public function store(AtentionRequest $request)
 {
     $atentionsType = AtentionType::find($request['atentions_type_id']);
     $ticket = \Veterinaria\Ticket::all()->last();
     if ($ticket == null) {
         $number = 1;
     } else {
         $number = $ticket->number + 1;
     }
     $canceled = 0;
     Ticket::Create(['number' => $number, 'canceled' => $canceled]);
     $ticket = Ticket::all()->last();
     TicketProduct::Create(['ticket_id' => $ticket->id, 'description' => $atentionsType->description, 'quantity' => 1, 'price' => $atentionsType->price, 'subtotal' => $atentionsType->price]);
     Atention::create(['pet_id' => $request['pet_id'], 'atentions_type_id' => $request['atentions_type_id'], 'procedure' => $request['procedure'], 'treatment' => $request['treatment'], 'diagnosis' => $request['diagnosis'], 'prescription' => $request['prescription'], 'ticket_id' => $ticket->id]);
     Session::flash('message', 'La atención fue creada correctamente');
     return Redirect::to('atention/' . $request['pet_id'] . '/index');
 }
Пример #2
0
                            <input type="button" class="btn btn-primary" value="Buscar" id="search-btn"/>
                        </td>
                    </tr>
                </table>
            </div>

            <div class="form-group">
                <input type="hidden" name="_token" value="{{ csrf_token() }}" id="token"/>
                <table class="container-width">
                    <thead id="head"></thead>
                    <tbody id="data"></tbody>
                </table>
            </div>

            <?php 
$lastTicket = \Veterinaria\Ticket::all()->last();
if ($lastTicket == null) {
    $nextTicket = 1;
} else {
    $nextTicket = $lastTicket->number + 1;
}
?>

            <div class="form-group" id="detail" style="display: none">
                <h4>Detalle de Boleta</h4>
                <h5>Número de próxima Boleta: {{$nextTicket}}</h5>
                <table class="container-width">
                    <thead id="headDetail">
                        <tr>
                            <th style='width: 20%'>Nombre</th>
                            <th style='width: 20%'>Cantidad</th>
 public function canceled()
 {
     $tickets = Ticket::where('canceled', '=', 1)->paginate(10);
     return view('ticket.trash', compact('tickets'));
 }