Exemple #1
0
 public function nextPolizaEgreso($cuenta_bancaria_id)
 {
     $egreso = Egreso::withTrashed()->where('cuenta_bancaria_id', $cuenta_bancaria_id)->orderBy('poliza', 'DESC')->first(array('poliza'));
     if (isset($egreso)) {
         $egreso->poliza++;
         return $egreso->poliza;
     } else {
         return env('POLIZA_EGRESO_INICIAL', 1);
     }
 }
 public function chequesCirculacion($cuenta_bancaria_id, $aaaa, $mm)
 {
     $fecha = FechasUtility::fechasConciliacion($aaaa, $mm);
     $this->fecha_inicio = $fecha['inicial'];
     $this->fecha_fin = $fecha['final'];
     $circulacion = Egreso::withTrashed()->where('cuenta_bancaria_id', $cuenta_bancaria_id)->where('cheque', '!=', 0)->where('fecha', '<=', $this->fecha_fin)->whereNested(function ($query) {
         $query->where('fecha_cobro', '>', $this->fecha_fin);
         $query->orWhere('fecha_cobro', '=', '');
         $query->orWhere('fecha_cobro', '=', '0000-00-00');
         $query->orWhere('deleted_at', '>', $this->fecha_fin);
     })->with('benef', 'cuenta')->get();
     return view('conciliacion.chequesCirculacion', compact('circulacion'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     //Determina si se pueden borrar archivos
     $user = \Auth::user();
     $arr_roles = $user->roles()->lists('role_name')->all();
     if (array_search('Ejecutora', $arr_roles) !== false || array_search('Presupuesto', $arr_roles) !== false || array_search('Comprobacion', $arr_roles) !== false || array_search('Contabilidad', $arr_roles) !== false) {
         $borrar_archivo = true;
         $agregar_reembolsos = true;
     } else {
         $borrar_archivo = false;
         $agregar_reembolsos = false;
     }
     if (array_search('Ejecutora', $arr_roles) !== false || array_search('Presupuesto', $arr_roles) !== false) {
         $cancelar_cheque = true;
     } else {
         $cancelar_cheque = false;
     }
     $egreso = Egreso::withTrashed()->findOrFail($id);
     $egreso->load('ocs.archivos');
     $egreso->load('solicitudes.archivos');
     $archivos = [];
     $archivos = $egreso->archivos()->get();
     $archivos_ocs = $egreso->ocs->pluck('archivos', 'id');
     $archivos_solicitudes = $egreso->solicitudes->pluck('archivos', 'id');
     $archivos_relacionados = [];
     if (count($archivos_ocs) > 0) {
         $archivos_relacionados = $archivos_ocs;
     }
     if (count($archivos_solicitudes) > 0) {
         $archivos_relacionados = $archivos_solicitudes;
     }
     return view('egresos.infoEgreso', compact('egreso', 'archivos', 'archivos_relacionados', 'borrar_archivo', 'cancelar_cheque', 'agregar_reembolsos'));
 }