/**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create($id)
 {
     $venda = Venda::find($id);
     $total = $venda->totalVenda($id);
     $entradas = Lancamento::where('venda_id', $id)->where('tipo', 'en')->get();
     $descontos = Lancamento::where('venda_id', $id)->where('tipo', 'dc')->get();
     $boletos = Lancamento::with('boleto')->where('venda_id', $id)->where('tipo', 'bo')->get();
     $cheques = Lancamento::where('venda_id', $id)->where('tipo', 'ch')->leftJoin('cheques', 'cheques.lancamento_id', '=', 'lancamentos.id')->leftJoin('bancos', 'cheques.banco_id', '=', 'bancos.id')->select('lancamentos.id', 'lancamentos.valor', 'lancamentos.descricao', 'lancamentos.data_vencimento', 'lancamentos.tipo', 'cheques.id as cheque_id', 'cheques.banco_id', 'cheques.numero', 'cheques.nome as nome_cheque', 'bancos.nome as nome_banco')->get();
     $bancos = Banco::with('cheques')->orderBy('nome')->select('nome', 'id')->get();
     return view('lancamentos.create', compact('venda', 'total', 'entradas', 'boletos', 'cheques', 'bancos', 'descontos'));
 }
Пример #2
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $venda = Venda::find($id);
     $total = 0;
     foreach ($venda->venda_itens as $itens) {
         $total += $itens->quantidade * $itens->preco_venda;
     }
     $entradas = \App\Models\Lancamento::where('venda_id', $id)->where('tipo', 'en')->get();
     $boletos = \App\Models\Lancamento::with('boleto')->where('venda_id', $id)->where('tipo', 'bo')->get();
     $cheques = \App\Models\Lancamento::with('cheque')->where('venda_id', $id)->where('tipo', 'ch')->get();
     return view('vendas.show', compact('venda', 'total', 'entradas', 'boletos', 'cheques'));
 }
Пример #3
0
 public static function getBoletos($id)
 {
     return Lancamento::with('boleto')->where('venda_id', $id)->where('tipo', 'bo')->get();
 }
 public function show_cheque($id)
 {
     $cheques = Lancamento::with('cheque')->where('venda_id', $id)->where('tipo', 'ch')->get();
     return view('lancamentos.show_cheques', compact('cheques'));
 }
Пример #5
0
 public function getListar(Request $request)
 {
     return Lancamento::with('categoria')->get();
 }