Ejemplo n.º 1
0
 public function __construct()
 {
     $variable10 = Image::where("filename", "=", 'fcytlogo')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'fcytlogo';
         $variable10->filename = 'fcytlogo';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'fcyt')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'fcyt';
         $variable10->filename = 'fcyt';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'organigramafcyt')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'organigramafcyt';
         $variable10->filename = 'organigramafcyt';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'avatar1')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'avatar1';
         $variable10->filename = 'avatar1';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'avatar2')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'avatar2';
         $variable10->filename = 'avatar2';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'avatar3')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'avatar3';
         $variable10->filename = 'avatar3';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'avatar4')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'avatar4';
         $variable10->filename = 'avatar4';
         $variable10->save();
     }
     $variable10 = Image::where("filename", "=", 'avatar5')->first();
     if (empty($variable10)) {
         $variable10 = new Image();
         $variable10->original_name = 'avatar5';
         $variable10->filename = 'avatar5';
         $variable10->save();
     }
     $variable9 = Configuracion::where("estado", "=", 1)->first();
     //$variable9= Configuracion::all()->last();
     if (empty($variable9)) {
         $Configuracion = new Configuracion();
         $Configuracion->nombre = 'lugrawibe';
         $Configuracion->estado = 1;
         $Configuracion->logo = 'fcytlogo';
         $Configuracion->facultad = 'fcyt';
         $Configuracion->organigrama = 'organigramafcyt';
         $Configuracion->imgenuno = 'avatar1';
         $Configuracion->imgendos = 'avatar2';
         $Configuracion->imgentres = 'avatar3';
         $Configuracion->imgencuatro = 'avatar4';
         $Configuracion->imgencinco = 'avatar5';
         $Configuracion->save();
         $variable9 = Configuracion::findOrFail($Configuracion->id);
     }
     $variable8 = Materium::all()->last();
     if (!empty($variable8)) {
         $variable8 = $variable8->codigo + 1;
     }
     if (empty($variable8)) {
         $variable8 = 400;
     }
     $variable7 = Sistemapg::all()->last();
     if (!empty($variable7)) {
         $variable7 = $variable7->nombre_de_facultad;
     }
     if (empty($variable7)) {
         $Sistema = new Sistemapg();
         $Sistema->nombre_de_facultad = 'Lugrawibe';
         $Sistema->save();
         $variable7 = 'Lugrawibe';
     }
     $variable6 = Autoridad::all()->last();
     if (!empty($variable6)) {
         $variable6 = $variable6->codigo + 1;
     }
     if (empty($variable6)) {
         $variable6 = 400;
     }
     $variable5 = Docente::all()->last();
     if (!empty($variable5)) {
         $variable5 = $variable5->codigo + 1;
     }
     if (empty($variable5)) {
         $doc = new Docente();
         $doc->nombre = 'por designar';
         $doc->codigo = 399;
         $doc->save();
         $variable5 = 400;
     }
     $variable4 = Carrera::all()->last();
     if (!empty($variable4)) {
         $variable4 = $variable4->codigo + 1;
     }
     if (empty($variable4)) {
         $variable4 = 400;
     }
     $variable3 = Area::all()->last();
     if (!empty($variable3)) {
         $variable3 = $variable3->codigo + 1;
     }
     if (empty($variable3)) {
         $variable3 = 400;
     }
     $variable2 = tema::all()->last();
     if (!empty($variable2)) {
         $variable2 = $variable2->tema;
     }
     if (empty($variable2)) {
         $tema = new tema();
         $tema->tema = 'skin-black';
         $tema->menu = 'sidebar-mini';
         $tema->save();
         $variable2 = 'skin-black';
     }
     $variable1 = tema::all()->last();
     if (!empty($variable1)) {
         $variable1 = $variable1->menu;
     }
     if (empty($variable1)) {
         $variable1 = 'sidebar-mini';
     }
     $variablefecha = Carbon::now();
     $variablefecha = $variablefecha->format('d-m-Y');
     View::share('variablefecha', $variablefecha);
     View::share('variable1', $variable1);
     View::share('variable2', $variable2);
     View::share('variable3', $variable3);
     View::share('variable4', $variable4);
     View::share('variable5', $variable5);
     View::share('variable6', $variable6);
     View::share('variable7', $variable7);
     View::share('variable8', $variable8);
     View::share('variable9', $variable9);
 }
Ejemplo n.º 2
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     $v = \Validator::make($request->all(), ['nitfactura' => 'required|numeric', 'nomfactura' => 'required', 'tipfactura' => 'required', 'dirfactura' => 'required', 'telfactura' => 'required', 'maifactura' => 'email', 'logo' => 'required|image', 'marcagua' => 'image', 'venfactura' => 'required|numeric']);
     if ($v->fails()) {
         return redirect()->back()->withInput()->withErrors($v->errors());
     } else {
         Configuracion::where('id', $id)->update(['nit_factura' => $request->get('nitfactura'), 'nom_factura' => $request->get('nomfactura'), 'tip_factura' => $request->get('tipfactura'), 'dir_factura' => $request->get('dirfactura'), 'tel_factura' => $request->get('telfactura'), 'mailfactura' => $request->get('maifactura'), 'web_factura' => $request->get('webfactura'), 'logotipo' => $request->file('logo')->getClientOriginalName(), 'marcagua' => $request->file('marcagua')->getClientOriginalName(), 'dias_venc' => $request->get('venfactura'), 'pie_pagina' => $request->get('piefactura'), 'nota_factura' => $request->get('nota')]);
         \Storage::disk('local')->put($request->file('logo')->getClientOriginalName(), \File::get($request->file('logo')));
         \Storage::disk('local')->put($request->file('marcagua')->getClientOriginalName(), \File::get($request->file('marcagua')));
         return View('config.viewconfig')->with('mensaje', 'Configuración Actualizada Satisfactoriamente');
     }
 }
Ejemplo n.º 3
0
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function pdfshow($numfac)
 {
     //consultar id y fecha
     $factura = FacturaCab::select('cod_ent', 'fecfac')->where('numfac', $numfac)->first();
     $id = $factura->cod_ent;
     $fecha = $factura->fecfac;
     $config = Configuracion::where('estado', '1')->first();
     $entidad = Entidad::where('COD_ENT', $id)->first();
     //$dv = EntityController::calcularDV($id);
     $obj = new EntityController();
     $dv = $obj->calcularDV($id);
     $date = Carbon::createFromFormat('Y-m-d', $fecha);
     $fecven = Carbon::createFromFormat('Y-m-d', $fecha);
     $fecven = $fecven->addDays(30);
     $date = $date->format('d-m-Y');
     $fecven = $fecven->format('d-m-Y');
     $view = View('pdf.pdfconfig', ['id' => $id, 'nom_factura' => $config->nom_factura, 'logotipo' => $config->logotipo, 'nit_factura' => $config->nit_factura, 'tip_factura' => $config->tip_factura, 'dir_factura' => $config->dir_factura, 'tel_factura' => $config->tel_factura, 'mailfactura' => $config->mailfactura, 'web_factura' => $config->web_factura, 'nota_factura' => $config->nota_factura, 'fec_exp' => $date, 'fec_ven' => $fecven, 'nom_ent' => $entidad->NOM_ENT, 'nit_ent' => $id, 'dv' => $dv, 'dir_ent' => $entidad->DIR_ENT, 'tel_ent' => $entidad->TEL_ENT, 'numfac' => $numfac]);
     $pdf = \App::make('dompdf.wrapper');
     $pdf->loadHTML($view);
     return $pdf->stream($numfac . '.pdf');
 }