update ajuste de premios
This commit is contained in:
@@ -41,6 +41,7 @@ class ShowTop extends Component
|
|||||||
->get();
|
->get();
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
$consultaPremioEntregado = PremioEntregado::where('fecha', $monthYear)
|
$consultaPremioEntregado = PremioEntregado::where('fecha', $monthYear)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
@@ -53,21 +54,22 @@ class ShowTop extends Component
|
|||||||
|
|
||||||
public function entregarPremio()
|
public function entregarPremio()
|
||||||
{
|
{
|
||||||
$currentYear = date('Y');
|
$previousMonthDate = strtotime('first day of last month');
|
||||||
|
$month = date('m', $previousMonthDate);
|
||||||
|
$year = date('Y', $previousMonthDate);
|
||||||
|
|
||||||
|
|
||||||
$monthYear = date('m-Y', strtotime('last month'));
|
|
||||||
$month = date('m', strtotime('last month'));
|
|
||||||
$rangos = ['primero', 'segundo', 'tercero', 'cuarto', 'quinto', 'sexto', 'séptimo', 'octavo', 'noveno', 'décimo'];
|
$rangos = ['primero', 'segundo', 'tercero', 'cuarto', 'quinto', 'sexto', 'séptimo', 'octavo', 'noveno', 'décimo'];
|
||||||
|
|
||||||
|
|
||||||
$top_vendedores = User::with(['historiales_venta' => function ($query) use ($month, $currentYear) {
|
$top_vendedores = User::with(['historiales_venta' => function ($query) use ($month, $year) {
|
||||||
$query->whereMonth('fecha_inicio', $month)
|
$query->whereMonth('fecha_inicio', $month)
|
||||||
->whereYear('fecha_inicio', $currentYear)
|
->whereYear('fecha_inicio', $year)
|
||||||
->where('estado', 'activo');
|
->where('estado', 'activo');
|
||||||
}])
|
}])
|
||||||
->withCount(['historiales_venta' => function ($query) use ($month, $currentYear) {
|
->withCount(['historiales_venta' => function ($query) use ($month, $year) {
|
||||||
$query->whereMonth('fecha_inicio', $month)
|
$query->whereMonth('fecha_inicio', $month)
|
||||||
->whereYear('fecha_inicio', $currentYear)
|
->whereYear('fecha_inicio', $year)
|
||||||
->where('estado', 'activo');
|
->where('estado', 'activo');
|
||||||
}])
|
}])
|
||||||
->orderBy('historiales_venta_count', 'desc')
|
->orderBy('historiales_venta_count', 'desc')
|
||||||
@@ -96,7 +98,7 @@ class ShowTop extends Component
|
|||||||
|
|
||||||
PremioEntregado::create([
|
PremioEntregado::create([
|
||||||
'user_id' => Auth::user()->id,
|
'user_id' => Auth::user()->id,
|
||||||
'fecha' => $monthYear,
|
'fecha' => $year,
|
||||||
'entregado' => 1
|
'entregado' => 1
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,8 @@ class ShowUsuarios extends Component
|
|||||||
public $estadoTarifa = false;
|
public $estadoTarifa = false;
|
||||||
public $estadoPromo = false;
|
public $estadoPromo = false;
|
||||||
|
|
||||||
|
public $entradas = false;
|
||||||
|
|
||||||
protected $rules = [
|
protected $rules = [
|
||||||
'nombre' => 'required',
|
'nombre' => 'required',
|
||||||
'email' => 'required',
|
'email' => 'required',
|
||||||
@@ -99,7 +101,7 @@ class ShowUsuarios extends Component
|
|||||||
|
|
||||||
$consulta_tarifas = TarifaPromo::take(1);
|
$consulta_tarifas = TarifaPromo::take(1);
|
||||||
|
|
||||||
$consulta_usuarios = User::where('name', 'LIKE', '%' . $this->buscar . '%')->orWhere('email', 'LIKE', '%' . $this->buscar . '%')->with('rol', 'saldo')->orderBy('id', 'DESC')->withCount('historiales_venta')->paginate(15);
|
$consulta_usuarios = User::where('name', 'LIKE', '%' . $this->buscar . '%')->orWhere('email', 'LIKE', '%' . $this->buscar . '%')->with('rol', 'saldo')->orderBy('id', 'DESC')->withCount('historiales_venta')->paginate($this->entradas);
|
||||||
|
|
||||||
if (!empty($this->buscar_servicio)) {
|
if (!empty($this->buscar_servicio)) {
|
||||||
$this->consulta_tarifas = Tarifas::where('rol_id', $this->rol_usuario)->with([
|
$this->consulta_tarifas = Tarifas::where('rol_id', $this->rol_usuario)->with([
|
||||||
|
|||||||
Reference in New Issue
Block a user