/**
  * Display a listing of the resource.
  *
  * @return Response
  */
 public function index()
 {
     date_default_timezone_set('America/Caracas');
     $ventas = Venta::all();
     $agente = Agente::find(1);
     $contador = 0;
     $mes = date('m');
     $anio = date('Y');
     $mesAnterior = date('m') - 1;
     if ($mesAnterior < 10) {
         $anterior = '0' . $mesAnterior . '-' . $anio;
     } else {
         $anterior = $mesAnterior . '-' . $anio;
     }
     $anteriorX2pr = $anterior - 1 . '-' . $anio;
     if ($anteriorX2pr < 10) {
         $anteriorX2 = '0' . $anteriorX2pr;
     } else {
         $anteriorX2 = $anteriorX2pr;
     }
     $actual = $mes . '-' . $anio;
     $reportesTodos = DB::table('reportes')->orderBy('n_comp', 'desc')->get();
     $proveedores = Proveedor::all();
     $totalImpuestoMes = 0;
     //dd($anteriorX2);
     return View::make('ventas.index', array('ventas' => $ventas, 'agente' => $agente, 'reportesTodos' => $reportesTodos, 'proveedores' => $proveedores, 'totalImpuestoMes' => $totalImpuestoMes))->with('contador', $contador)->with('mes', $mes)->with('anio', $anio)->with('mesAnterior', $mesAnterior)->with('anterior', $anterior)->with('actual', $actual)->with('anteriorX2', $anteriorX2);
 }
 public function getEditProveedor($id_proveedor)
 {
     $proveedor = Proveedor::find($id_proveedor);
     $localidades = Localidad::all();
     $proveedores = Proveedor::all();
     if (is_null($proveedor)) {
         App::abort(404);
     }
     return View::make('edit_proveedor')->with('proveedor', $proveedor)->with('localidades', $localidades);
 }
 public function getEditArticulo($id_articulo)
 {
     $articulo = Articulo::find($id_articulo);
     $rubros = Rubro::all();
     $proveedores = Proveedor::all();
     if (is_null($articulo)) {
         App::abort(404);
     }
     return View::make('edit_articulo')->with('articulo', $articulo)->with('rubros', $rubros)->with('proveedores', $proveedores);
 }
 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 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');
         $reportes = DB::table('reportes')->orderBy('created_at', 'desc')->where('n_comp', 'LIKE', '%' . $buscar . '%')->orwhere('fecha', 'LIKE', '%' . $buscar . '%')->orwhere('periodo', 'LIKE', '%' . $buscar . '%')->paginate(10);
     } else {
         $reportes = DB::table('reportes')->orderBy('created_at', 'desc')->paginate(10);
     }
     $totalReportes = DB::table('reportes')->count();
     $agente = Agente::find(1);
     $proveedores = Proveedor::all();
     return View::make('reportes.index', array('reportes' => $reportes, 'totalReportes' => $totalReportes, 'agente' => $agente, 'proveedores' => $proveedores));
     //return var_dump($reportes);
 }
 public function indexAction()
 {
     $records = Proveedor::all();
     $object = ["records" => $records, "FieldsIndex" => $this->FieldsIndex, "module" => $this->module, "key" => $this->key];
     return View::make($this->routeIndex, $object);
 }
Beispiel #8
0
                    <legend>Informaci&oacute;n B&aacute;sica</legend>

                    <div class="control-group">
                        {{Form::label('folio', 'Folio',array('class'=>'control-label'))}}
                        <div class="controls">
                            {{Form::text('folio',  ( Input::old('folio') || $create ? Input::old('folio') : $fxp->folio_fxp ),array('class' => 'input-small', 'placeholder'=>'Ingrese el Folio de la Factura...'))}}
                        </div>
                    </div>

                    <div class="control-group">
                        {{Form::label('proveedor', 'Proveedor',array('class'=>'control-label'))}}
                        <div class="controls">

                            <?php 
$dataset[''] = 'Seleecione un Proveedor.';
if (Proveedor::all()) {
    foreach (Proveedor::order_by('nombre', 'asc')->get() as $prov) {
        $dataset[$prov->id] = $prov->nombre;
    }
}
echo Form::select('proveedor_id', $dataset, Input::old('proveedor_id') || $create ? Input::old('proveedor_id') : $fxp->proveedor_id);
?>

                        </div>
                    </div>

                    <div class="control-group">
                        {{Form::label('fecha_exp', 'Fecha de Expedicion',array('class'=>'control-label'))}}
                        <div class="controls">
                            <!--{{Form::date('fecha_exp',  ( Input::old('fecha_exp') || $create ) ? Input::old('fecha_exp') : $fxp->fecha_expedicion,array('placeholder'=>'Formato Fecha Expedicion...', 'class' => 'date_picker'))}}-->
                            {{Form::text('fecha_exp', Input::old('fecha_exp') ? Input::old('fecha_exp') : ($create ? date("Y-m-d",time()) : date("Y-m-d", strtotime($fxp->fecha_expedicion))), array('placeholder'=>'Formato Fecha Expedicion...', 'class' => 'date_picker'))}}