This commit is contained in:
Lizandro Guarnizo
2026-01-29 23:29:48 -05:00
parent 1bb9fa0548
commit 8c63191165
3 changed files with 8 additions and 8 deletions
@@ -43,8 +43,8 @@ class OjalPresillaResource extends Resource
->whereHas('referencia', function($q) use ($op) {
$q->where('orden_produccion_id', $op->id);
})->where('tipo', 'arreglo')->sum('cantidad');
$cobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class)
->whereHas('cobreable', function($q) use ($op) {
$cobros = \App\Models\Cobro::where('referencia_type', \App\Models\Confeccion::class)
->whereHas('referencia', function($q) use ($op) {
$q->where('orden_produccion_id', $op->id);
})->sum('cantidad');
$cantidadConfecciones = $cantidadRecibida - $arreglos - $cobros;
@@ -76,8 +76,8 @@ class OjalPresillaResource extends Resource
->whereHas('referencia', function($q) use ($state) {
$q->where('orden_produccion_id', $state);
})->where('tipo', 'arreglo')->sum('cantidad');
$cobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class)
->whereHas('cobreable', function($q) use ($state) {
$cobros = \App\Models\Cobro::where('referencia_type', \App\Models\Confeccion::class)
->whereHas('referencia', function($q) use ($state) {
$q->where('orden_produccion_id', $state);
})->sum('cantidad');
$cantidadConfecciones = $cantidadRecibida - $arreglos - $cobros;
+2 -2
View File
@@ -46,8 +46,8 @@ class Ojal extends Model
->whereHas('referencia', function($q) use ($opId) {
$q->where('orden_produccion_id', $opId);
})->where('tipo', 'arreglo')->sum('cantidad');
$totalCobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class)
->whereHas('cobreable', function($q) use ($opId) {
$totalCobros = \App\Models\Cobro::where('referencia_type', \App\Models\Confeccion::class)
->whereHas('referencia', function($q) use ($opId) {
$q->where('orden_produccion_id', $opId);
})->sum('cantidad');
$totalProducido = $totalRecibido - $totalArreglos - $totalCobros;
+2 -2
View File
@@ -44,8 +44,8 @@ class Prensilla extends Model
->whereHas('referencia', function($q) use ($opId) {
$q->where('orden_produccion_id', $opId);
})->where('tipo', 'arreglo')->sum('cantidad');
$totalCobros = \App\Models\Cobro::where('cobreable_type', \App\Models\Confeccion::class)
->whereHas('cobreable', function($q) use ($opId) {
$totalCobros = \App\Models\Cobro::where('referencia_type', \App\Models\Confeccion::class)
->whereHas('referencia', function($q) use ($opId) {
$q->where('orden_produccion_id', $opId);
})->sum('cantidad');
$totalProducido = $totalRecibido - $totalArreglos - $totalCobros;