public function ventasXnegocio() { $response = \PlataformaVirtual\Models\Negocio::get(); foreach ($response as $r) { $ventas = \DB::table('negocio')->select(\DB::raw('count(documentoventa.codigo) AS cantidad'), \DB::raw('sum(documentoventa.totalventa) AS monto'))->join('documentoventa', 'documentoventa.codigonegocio', '=', 'negocio.codigo')->where('negocio.codigo', '=', $r->codigo)->first(); $r->ventas = $ventas; } return response()->json(['msg' => 'success', 'datos' => $response], 200); }
public function reporteAdmin01() { $reporte = \PlataformaVirtual\Models\Negocio::get(); foreach ($reporte as $r) { $ventas = \DB::table('negocio')->select(\DB::raw('count(documentoventa.codigo) AS cantidad'), \DB::raw('sum(documentoventa.totalventa) AS monto'))->join('documentoventa', 'documentoventa.codigonegocio', '=', 'negocio.codigo')->where('negocio.codigo', '=', $r->codigo)->first(); $r->ventas = $ventas; } $pdf = new reporteAdmin01(); $pdf->AddPage(); $pdf->SetFont('Arial', '', 10); $pdf->cabecera(); $pdf->BasicTable($reporte); $pdf->Output('reporte01', 'F'); exit; }
/** * Display a listing of the resource. * * @return Response */ public function lista_negocios() { $Empresas = \PlataformaVirtual\Models\Negocio::get(); return response()->json(['msg' => "Success", "empresas" => $Empresas->toArray()], 200); }