示例#1
0
    #==========================================================================================
    Route::resource('cities/localidades', 'cities\\LocalidadController');
    Route::resource('cities/calles', 'cities\\CalleController');
    Route::get('/cities/localidades/pais/{id}', function ($id) {
        return response()->json(['result' => 'Ok', 'response' => Localidad::listByFullName($id)]);
    });
    Route::get('/search/localidades', ['as' => 'cities.localidades.search', 'uses' => 'cities\\LocalidadController@search']);
    #==========================================================================================
    #=== users & home =========================================================================
    #==========================================================================================
    Route::get('home', ['as' => 'home', function () {
        $webpage = ['tab_title' => 'Inicio', 'active' => 'home', 'whereAmI' => '', 'routes_json' => json_encode(getUriByController()), 'routes' => getUriByController()];
        $generos = App\Genero::listByFullName();
        $paises = App\Pais::listByFullName();
        $ciudades = App\Localidad::listByFullName();
        $tdocs = App\TiposDocumentos::listByFullName(1);
        $entidades = App\Entidad::get();
        $data = ['webpage' => $webpage, 'generos' => $generos, 'paises' => $paises, 'localidades' => $ciudades, 'tipos_documentos' => $tdocs, 'entidades' => $entidades];
        return view('admin/home', $data);
    }]);
    /*Route::get('/tipos_documentos', function () {
          //DB::enableQueryLog();
          $q = Input::get("pais");
          $tipos = [];
          if ($q){
              $tipos = TiposDocumentos::where("pais_id","=",$q)->get();
          }
          $result["tipos_documentos"] = $tipos;
          return response()->json(['result' => 'Ok','response' => $result ]);
      });*/
});
示例#2
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');
 }
示例#3
0
 public function search()
 {
     //DB::enableQueryLog();
     $search_text = Input::get("text");
     $entidad = Input::get("entidad");
     $result = Persona::with(["tipo_documento", "tipo_documento.pais", "domicilio", "domicilio.calle", "domicilio.calle.localidad", "telefonos", "emails", "webpages"])->where("documento", 'LIKE', '%' . $search_text . '%')->orWhere(DB::raw('CONCAT(nombre, " ", apellido)'), 'LIKE', '%' . $search_text . '%')->orWhere(DB::raw('CONCAT(apellido, " ", nombre)'), 'LIKE', '%' . $search_text . '%')->limit('10')->get();
     $results = [];
     $entidades = Entidad::get();
     foreach ($result as $persona) {
         if (!empty($entidad)) {
             $entidad_lower = strtolower($entidad->nombre);
             $entidad_capitalized = ucfirst($entidad->nombre);
             $persona[$entidad_lower] = null;
             $model = 'App\\' . $entidad_capitalized;
             $ent = $model::where("persona_id", "=", $persona->id)->first();
             $persona[$entidad_lower] = $ent;
         } else {
             $models = [];
             foreach ($entidades as $entidad) {
                 $entidad_lower = strtolower($entidad->nombre);
                 $entidad_capitalized = ucfirst($entidad->nombre);
                 $persona[$entidad_lower] = null;
                 $model = 'App\\' . $entidad_capitalized;
                 $models[] = $model;
                 $ent = $model::where("persona_id", "=", $persona->id)->first();
                 $persona[$entidad_lower] = $ent;
             }
         }
         $persona->full_name = $persona->full_name;
         $results[] = $persona;
     }
     //dd(DB::getQueryLog());
     return response()->json(['result' => 'Ok', 'response' => $results]);
 }