public function postUpload() { $agente = Agente::find(1); if (Input::hasFile('file')) { $file = Input::file('file'); $name = $file->getClientOriginalName(); $extension = $file->getClientOriginalExtension(); $size = File::size($file); //dd($extension); $data = array('nombre' => $name, 'extension' => $extension, 'size' => $size); $rules = array('extension' => 'required|mimes:jpeg'); $messages = array('required' => 'El campo :attribute es obligatorio.', 'min' => 'El campo :attribute no puede tener menos de :min carácteres.', 'email' => 'El campo :attribute debe ser un email válido.', 'max' => 'El campo :attribute no puede tener más de :max carácteres.', 'unique' => 'La factura ingresada ya está agregada en la base de datos.', 'confirmed' => 'Los passwords no coinciden.', 'mimes' => 'El campo :attribute debe ser un archivo de tipo :values.'); $validation = Validator::make($rules, $messages); if ($validation->fails()) { return Redirect::route('logo-post')->withInput()->withErrors($validation); } else { if ($extension != 'jpg') { return Redirect::route('logo-post')->with('global', 'Es necesario que la imagen sea de extension .jpg.'); } else { $path = public_path() . '/assets/img/'; $newName = 'logo'; $subir = $file->move($path, $newName . '.' . $extension); return Redirect::route('agente.index')->with('create', 'El logo ha sido actualizado correctamente!'); } } } else { return Redirect::route('logo-post')->with('global', 'Es necesario que selecciones una imagen.'); } }
public function postBoxagente() { $input = Input::All(); $idAgente = $input['idAgente']; $agente = Agente::find($idAgente); $agente->localidad->provincia; return $agente->toJson(); }
public function getBorrar($id = null) { if ($id != null) { $agente = Agente::find($id); if ($agente != null) { $agente->delete(); } } return Redirect::action('AbmAgenteController@getIndex'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $reportesVentas = Reportesventa::find($id); if (is_null($reportesVentas)) { return Redirect::route('ventas.index')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> Pagina no encontrada'); } $ventas = DB::table('ventas')->where('id', '=', $reportesVentas->id_fecha)->first(); $agente = Agente::find(1); return View::make('reportesventas.edit', array('ventas' => $ventas, 'agente' => $agente))->with('reportesVentas', $reportesVentas); }
public function getGenerateTxt($desde, $hasta) { $reportes = Reporte::where('fecha', '>=', $desde)->where('fecha', '<=', $hasta)->get(); $facturas = Factura::all(); $agente = Agente::find(1); $proveedores = Proveedor::all(); $code = str_random(10); $content = \View::make('excel.txt')->with('reportes', $reportes)->with('facturas', $facturas)->with('agente', $agente)->with('proveedores', $proveedores); return \Response::make($content, '200')->header('Content-Type', 'plain/txt'); }
public function getIndexIslr($id) { $reportesislr = DB::table('reportesislr')->where('id', '=', $id)->first(); $facturasislr = DB::table('facturasislr')->where('id_reporteislr', '=', $id)->get(); $agente = Agente::find(1); $proveedor = DB::table('empleados')->where('id', '=', $reportesislr->id_empleado)->first(); $contador = 0; $pdf = PDF::loadView('pdfs.pdfislr', array('reportesislr' => $reportesislr, 'facturasislr' => $facturasislr, 'agente' => $agente, 'proveedor' => $proveedor))->setPaper('Carta')->setOrientation('landscape'); return $pdf->stream(); //var_dump($proveedor); }
public function home() { $agente = Agente::find(1); $totalAgente = DB::table('agente')->count(); $iva = DB::table('impuesto')->where('estatus', '=', 'actual')->first(); date_default_timezone_set('America/Caracas'); $dia = date('d'); $mes = date('m'); $anio = date('Y'); $hoy = $anio . '-' . $mes . '-' . $dia; $mesActual = $anio . '-' . $mes; $reportesIva = DB::table('reportes')->orderBy('id', 'DESC')->where('fecha', '=', $hoy)->get(); $reportesTodos = DB::table('reportes')->orderBy('n_comp', 'desc')->get(); $proveedores = Proveedor::all(); $totalDia = 0; $totalMes = 0; $contador = 0; $reportesIslr = DB::table('reportesislr')->where('fecha', '=', $hoy)->orderBy('fecha', 'desc')->get(); $empleados = Empleado::all(); $reportesIslrTodos = DB::table('reportesislr')->orderBy('fecha', 'desc')->get(); // Suscripcion $diaLicencia = date('d', strtotime($agente->hasta)); $mesLicencia = date('m', strtotime($agente->hasta)); $anioLicencia = date('Y', strtotime($agente->hasta)); $licencia = date('Y-m-d', strtotime($agente->hasta)); $fechaHoy = date('Y-m-d'); $datetime1 = new DateTime($fechaHoy); $datetime2 = new DateTime($licencia); $interval = $datetime1->diff($datetime2); $resta = $interval->format('%R%a'); $diasRestante = str_replace("+", "", $resta); //dd($diasRestante); $hoyLicencia = date('d-m-Y'); if ($hoyLicencia == $diaLicencia . '-' . $mesLicencia . '-' . $anioLicencia) { $mensaje = '<div class="alert alert-warning"> <button type="button" class="close" data-dismiss="alert">×</button> <p>Hasta hoy ' . date("d/m/Y", strtotime($hoyLicencia)) . ' puedes usar la aplicación</p> </div>'; } elseif ($diasRestante <= 30) { $mensaje = '<div class="alert alert-warning"> <button type="button" class="close" data-dismiss="alert">×</button> <p>Te quedan ' . $diasRestante . ' días de suscripción, Por favor ponte en contacto con <b>joserph.a@gmail.com<b></p> </div>'; } else { $mensaje = ''; } if (is_null($iva)) { $iva = 'vencido'; } return View::make('home', array('agente' => $agente, 'totalAgente' => $totalAgente, 'iva' => $iva, 'reportesIva' => $reportesIva, 'proveedores' => $proveedores, 'reportesTodos' => $reportesTodos, 'reportesIslr' => $reportesIslr, 'empleados' => $empleados, 'reportesIslrTodos' => $reportesIslrTodos))->with('contador', $contador)->with('totalDia', $totalDia)->with('totalMes', $totalMes)->with('hoy', $hoy)->with('mes', $mes)->with('anio', $anio)->with('mensaje', $mensaje); //return var_dump($reportesTodos); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (isset($_GET['buscar'])) { $buscar = Input::get('buscar'); $empleados = DB::table('empleados')->orderBy('created_at', 'desc')->where('tipo', 'LIKE', '%' . $buscar . '%')->orwhere('nombre', 'LIKE', '%' . $buscar . '%')->orwhere('rif', 'LIKE', '%' . $buscar . '%')->orwhere('direccion', 'LIKE', '%' . $buscar . '%')->orwhere('tlf', 'LIKE', '%' . $buscar . '%')->paginate(10); } else { $empleados = DB::table('empleados')->orderBy('created_at', 'desc')->paginate(10); } $agente = Agente::find(1); $contador = 0; $totalEmpleados = DB::table('empleados')->count(); return View::make('empleados.index', array('empleados' => $empleados, 'agente' => $agente, 'totalEmpleados' => $totalEmpleados))->with('contador', $contador); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (isset($_GET['buscar'])) { $buscar = Input::get('buscar'); $ventas = DB::table('reportesventas')->orderBy('created_at', 'desc')->where('n_zetas', 'LIKE', '%' . $buscar . '%')->orwhere('total_v', 'LIKE', '%' . $buscar . '%')->orwhere('tributado', 'LIKE', '%' . $buscar . '%')->orwhere('exento', 'LIKE', '%' . $buscar . '%')->orwhere('impuesto', 'LIKE', '%' . $buscar . '%')->paginate(10); } else { $ventas = DB::table('reportesventas')->orderBy('created_at', 'desc')->paginate(10); } $totalVentas = DB::table('reportesventas')->count(); $contador = 0; $agente = Agente::find(1); $fechaVentas = Venta::all(); return View::make('all-ventas.index', array('ventas' => $ventas, 'agente' => $agente, 'fechaVentas' => $fechaVentas, 'totalVentas' => $totalVentas))->with('contador', $contador); //var_dump($facturas); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (isset($_GET['buscar'])) { $buscar = Input::get('buscar'); $facturasislr = Facturaislr::orderBy('id', 'desc')->where('fecha_fac', 'LIKE', '%' . $buscar . '%')->orwhere('n_factura', 'LIKE', '%' . $buscar . '%')->orwhere('n_control', 'LIKE', '%' . $buscar . '%')->orwhere('total_compra', 'LIKE', '%' . $buscar . '%')->orwhere('base_imp', 'LIKE', '%' . $buscar . '%')->orwhere('impuesto_iva', 'LIKE', '%' . $buscar . '%')->orwhere('n_codigo', 'LIKE', '%' . $buscar . '%')->paginate(10); $facturasislr->each(function ($facturasislr) { $facturasislr->reporteislr; }); } else { $facturasislr = Facturaislr::orderBy('id', 'desc')->paginate(10); $facturasislr->each(function ($facturasislr) { $facturasislr->reporteislr; }); } $agente = Agente::find(1); $totalFactuasIslr = DB::table('facturasislr')->count(); $contador = 0; return View::make('facturasislr.index', array('agente' => $agente, 'totalFactuasIslr' => $totalFactuasIslr))->with('facturasislr', $facturasislr)->with('contador', $contador); }
*/ Route::filter('admon', function () { if (Auth::user()->id_rol != 0) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> No posee privilegios para acceder a esta pagina'); } }); /* | Editor filter. */ Route::filter('editor', function () { if (Auth::user()->id_rol != 0 && Auth::user()->id_rol != 1) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> No posee privilegios para acceder a esta pagina'); } }); Route::filter('suscription', function () { $agente = Agente::find(1); if (Suscripcion::count() == 0) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw"></i> Debe poseer una suscripción para disfrutar de la aplicación, Por favor ponte en contacto con <b>joserph.a@gmail.com</b>'); } elseif ($agente->estatus != 1) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw"></i> La suscripción no está activa, Por favor ponte en contacto con <b>joserph.a@gmail.com<b>'); } else { $dia = date('d', strtotime($agente->hasta)); $mes = date('m', strtotime($agente->hasta)); $anio = date('Y', strtotime($agente->hasta)); $hoy = date('d-m-Y'); if ($hoy == $dia . '-' . $mes . '-' . $anio) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw"></i> Hasta hoy ' . date('d/m/Y', strtotime($hoy)) . ' puedes usar la aplicación, Por favor ponte en contacto con <b>joserph.a@gmail.com<b>'); } elseif (date('d', strtotime($hoy)) > $dia && date('m', strtotime($hoy)) == $mes && date('Y', strtotime($hoy)) == $anio) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw"></i> Su suscripción vencio el dia ' . date('d/m/Y', strtotime($agente->hasta)) . ' y por esa razón no puedes usar la aplicación, Por favor ponte en contacto con <b>joserph.a@gmail.com<b>'); } elseif (date('m', strtotime($hoy)) > $mes && date('Y', strtotime($hoy)) == $anio) { return Redirect::route('home')->with('global', '<i class="fa fa-exclamation fa-fw"></i> Su suscripción vencio el dia ' . date('d/m/Y', strtotime($agente->hasta)) . ' y por esa razón no puedes usar la aplicación, Por favor ponte en contacto con <b>joserph.a@gmail.com<b>');
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $reportes = Reporte::find($id); if (is_null($reportes)) { return Redirect::route('reportes.index')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> Pagina no encontrada'); } $agente = Agente::find(1); $proveedores = Proveedor::orderBy('nombre', 'ASC')->lists('nombre', 'id'); return View::make('reportes.edit', array('agente' => $agente))->with('proveedores', $proveedores)->with('reportes', $reportes); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $reportesislr = Reporteislr::find($id); if (is_null($reportesislr)) { return Redirect::route('islr-reportes.index')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> Pagina no encontrada'); } $agente = Agente::find(1); $empleados = Empleado::orderBy('nombre', 'ASC')->lists('nombre', 'id'); return View::make('reportesislr.edit', array('agente' => $agente))->with('reportesislr', $reportesislr)->with('empleados', $empleados); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $ventas = Venta::find($id); if (is_null($ventas)) { return Redirect::route('ventas.index')->with('global', '<i class="fa fa-exclamation fa-fw x3"></i> Pagina no encontrada'); } $agente = Agente::find(1); return View::make('ventas.form')->with('ventas', $ventas)->with('agente', $agente); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $agente = Agente::find($id); if (is_null($agente)) { App::abort(404); } $agente->delete(); return Redirect::route('agente.index')->with('delete', 'El agente de retención <b>' . $agente->nombre . '</b> ha sido eliminado correctamente.'); }