se agrego , observacion y maraca en neas, y ademas se mejoro el reporte de inventario

main
Almacen 3 months ago
parent 6a32f97b88
commit 69bad80367

@ -46,79 +46,154 @@ class InventarioInicialController extends Controller
return response()->json(['valid' => $e], 401);
}
}
public function generarReporteInventario(Request $request)
{
if (!auth()->user()->hasPermissionTo('inventario reporte')) { // Corregido nombre del permiso
return response()->json(['valid' => false, 'error' => 'Usted no está autorizado'], 403);
}
ini_set('memory_limit', '512M');
ini_set('memory_limit', '1024M');
ini_set('pcre.backtrack_limit', '10000000');
set_time_limit(0);
// $request->validate([
// 'fecha_desde' => 'required|date',
// 'fecha_hasta' => 'required|date|after_or_equal:fecha_desde',
// ]);
try {
$registros = DB::table('inventario_inicials')
->select(
'inventario_inicials.*',
'bienes.codigo as bien_codigo',
'bienes.descripcion as bien_descripcion',
'bienes.marca',
'inventario_inicials.cuenta',
'unidad_medidas.nombre as unidad_medida',
DB::raw('ROUND(inventario_inicials.cantidad, 4) as cantidad'),
DB::raw('ROUND(inventario_inicials.precio, 4) as precio'),
DB::raw('ROUND(inventario_inicials.cantidad * inventario_inicials.precio, 4) as valor_total')
)
->join('bienes', 'bienes.id', '=', 'inventario_inicials.bienes_id')
->join('unidad_medidas', 'unidad_medidas.id', '=', 'bienes.id_unidad_medida')
->orderBy('bienes.descripcion', 'asc')
->get();
// $añoDesde = Carbon::parse($request->input('fecha_desde'))->year;
// $añoHasta = Carbon::parse($request->input('fecha_hasta'))->year;
// Filtrar registros por rango de fechas
$registros = DB::table('inventario_inicials')
->select(
'inventario_inicials.*',
'bienes.codigo as bien_codigo',
'bienes.descripcion as bien_descripcion',
'bienes.marca',
'inventario_inicials.cuenta',
'unidad_medidas.nombre as unidad_medida',
DB::raw('ROUND(inventario_inicials.cantidad, 4) as cantidad'),
DB::raw('ROUND(inventario_inicials.precio, 4) as precio'),
DB::raw('ROUND(inventario_inicials.cantidad * inventario_inicials.precio, 4) as valor_total')
)
->join('bienes', 'bienes.id', '=', 'inventario_inicials.bienes_id')
->join('unidad_medidas', 'unidad_medidas.id', '=', 'bienes.id_unidad_medida')
->orderBy('bienes.descripcion', 'asc')
->get();
// Generar PDF con MPDF
$mpdf = new \Mpdf\Mpdf([
'mode' => 'utf-8',
'format' => 'A4-P',
'margin_left' => 8,
'margin_right' => 8,
'margin_top' => 45,
'margin_bottom' => 35,
'margin_bottom' => 45,
'default_font' => 'dejavusans',
]);
// Márgenes y comportamiento del salto de página
$mpdf->SetAutoPageBreak(true, 45);
$mpdf->setAutoBottomMargin = 'stretch';
// Configuraciones de tabla
$mpdf->simpleTables = true;
$mpdf->packTableData = true;
$mpdf->keep_table_proportions = true;
$mpdf->use_kwt = true;
$mpdf->shrink_tables_to_fit = 0;
$mpdf->SetCompression(true);
// Header y Footer
$imgLogo = public_path('assets/images/UNAP.png');
$htmlHeader = view('reporteInventario._header', compact('imgLogo'))->render();
$mpdf->SetHTMLHeader($htmlHeader, '0');
$mpdf->SetHTMLHeader($htmlHeader);
$htmlFooter = view('reporteInventario._footer')->render();
$mpdf->SetHTMLFooter($htmlFooter, '0');
// Renderizar la vista de PDF
// Renderizar la vista en partes más pequeñas
$html = view('reporteInventario.index', compact('registros'))->render();
$mpdf->SetHTMLFooter($htmlFooter);
// Dividir en partes y escribir por fragmentos
$chunks = str_split($html, 25000); // Dividir cada 50,000 caracteres
foreach ($chunks as $chunk) {
$mpdf->WriteHTML($chunk);
}
// Render vista principal completa (sin dividir)
$html = view('reporteInventario.index', compact('registros'))->render();
$mpdf->WriteHTML($html);
// Descargar PDF
return response()->streamDownload(function () use ($mpdf) {
$mpdf->Output('reporte_inventario_inicial.pdf', 'D'); // 'D' fuerza la descarga
$mpdf->Output('reporte_inventario_inicial.pdf', 'D');
}, 'reporte_inventario_inicial.pdf');
} catch (\Exception $e) { // Especifica el tipo de excepción si es necesario
} catch (\Exception $e) {
return response()->json([
'success' => false,
'message' => $e->getMessage()
'message' => $e->getMessage(),
]);
}
}
// public function generarReporteInventario(Request $request)
// {
// ini_set('memory_limit', '1024M');
// ini_set('pcre.backtrack_limit', '10000000');
// set_time_limit(seconds: 0);
// try {
// $registros = DB::table('inventario_inicials')
// ->select(
// 'inventario_inicials.*',
// 'bienes.codigo as bien_codigo',
// 'bienes.descripcion as bien_descripcion',
// 'bienes.marca',
// 'inventario_inicials.cuenta',
// 'unidad_medidas.nombre as unidad_medida',
// DB::raw('ROUND(inventario_inicials.cantidad, 4) as cantidad'),
// DB::raw('ROUND(inventario_inicials.precio, 4) as precio'),
// DB::raw('ROUND(inventario_inicials.cantidad * inventario_inicials.precio, 4) as valor_total')
// )
// ->join('bienes', 'bienes.id', '=', 'inventario_inicials.bienes_id')
// ->join('unidad_medidas', 'unidad_medidas.id', '=', 'bienes.id_unidad_medida')
// ->orderBy('bienes.descripcion', 'asc')
// ->get();
// $mpdf = new \Mpdf\Mpdf([
// 'mode' => 'utf-8',
// 'format' => 'A4-P',
// 'margin_left' => 8,
// 'margin_right' => 8,
// 'margin_top' => 45,
// 'margin_bottom' => 45, // margen inferior ampliado
// 'default_font' => 'dejavusans',
// ]);
// // Mantener márgenes inferiores visibles
// $mpdf->SetAutoPageBreak(true, 45); // mismo valor que margin_bottom
// $mpdf->autoPageBreak = true;
// $mpdf->setAutoBottomMargin = 'stretch'; // fuerza margen dinámico
// // Configuración adicional (ya probada)
// $mpdf->simpleTables = true;
// $mpdf->packTableData = true;
// $mpdf->keep_table_proportions = true;
// $mpdf->use_kwt = true;
// $mpdf->shrink_tables_to_fit = 0;
// $mpdf->SetImportUse();
// $mpdf->SetCompression(true);
// // Header y Footer
// $imgLogo = public_path('assets/images/UNAP.png');
// $htmlHeader = view('reporteInventario._header', compact('imgLogo'))->render();
// $mpdf->SetHTMLHeader($htmlHeader);
// $htmlFooter = view('reporteInventario._footer')->render();
// $mpdf->SetHTMLFooter($htmlFooter);
// // Render vista principal
// $html = view('reporteInventario.index', compact('registros'))->render();
// // Dividir HTML en fragmentos grandes (evita pérdida de estilos)
// // $chunks = str_split($html, 50000);
// // foreach ($chunks as $chunk) {
// // $mpdf->WriteHTML($chunk);
// // }
// $mpdf->WriteHTML($html);
// // Descargar
// return response()->streamDownload(function () use ($mpdf) {
// $mpdf->Output('reporte_inventario_inicial.pdf', 'D');
// }, 'reporte_inventario_inicial.pdf');
// } catch (\Exception $e) {
// return response()->json([
// 'success' => false,
// 'message' => $e->getMessage(),
// ]);
// }
// }
public function listEnable()
{
@ -191,7 +266,7 @@ class InventarioInicialController extends Controller
$query = DB::table('inventario_inicials')
->join('bienes as b', 'b.id', '=', 'inventario_inicials.bienes_id')
->join('unidad_medidas as m', 'm.id', '=', 'b.id_unidad_medida')
->select('inventario_inicials.*', 'b.descripcion','m.nombre as nombre_medida')
->select('inventario_inicials.*', 'b.descripcion', 'm.nombre as nombre_medida')
->get(); // Usa first() si solo esperas un resultado
return response()->json(['data' => $query], 201);
@ -206,9 +281,9 @@ class InventarioInicialController extends Controller
$query = DB::table('inventario_inicials')
->join('bienes as b', 'b.id', '=', 'inventario_inicials.bienes_id')
->join('unidad_medidas as m', 'm.id', '=', 'b.id_unidad_medida')
->select('inventario_inicials.*', 'b.descripcion','m.nombre as nombre_medida')
->select('inventario_inicials.*', 'b.descripcion', 'm.nombre as nombre_medida')
->where('inventario_inicials.status', 1)
->where('inventario_inicials.cantidad','>', 0)
->where('inventario_inicials.cantidad', '>', 0)
->get(); // Usa first() si solo esperas un resultado
return response()->json(['data' => $query], 201);

@ -63,6 +63,7 @@ class NeaBienesController extends Controller
'precio' => 'required',
'cuenta_contable' => 'required',
'marca',
'observacion' => 'nullable|string',
'fecha_registro' => 'required',
// 'status' => 'required',
]);
@ -79,6 +80,7 @@ class NeaBienesController extends Controller
'id_unidad_medida' => $request->id_unidad_medida,
'fte_fto' => $request->fte_fto,
'precio' => $request->precio,
'observacion' => $request->observacion,
'cuenta_contable' => $request->cuenta_contable,
'fecha_registro' => $request->fecha_registro,
'created_at' => now(),
@ -110,6 +112,7 @@ class NeaBienesController extends Controller
'registros.*.precio' => 'required|numeric',
'registros.*.cuenta_contable' => 'required',
'registros.*.marca' => 'nullable|string',
'registros.*.observacion' => 'nullable|string',
'registros.*.fecha_registro' => 'required|date',
];
@ -292,6 +295,7 @@ class NeaBienesController extends Controller
'precio' => 'required',
'cuenta_contable' => 'required',
'marca' => 'nullable|string',
'observacion' => 'nullable|string',
'fecha_registro' => 'required',
]);
@ -311,6 +315,7 @@ class NeaBienesController extends Controller
'precio' => $request->precio,
'cuenta_contable' => $request->cuenta_contable,
'marca' => $request->marca,
'observacion' => $request->observacion,
'fecha_registro' => $request->fecha_registro,
'updated_at' => now(),
]);

@ -81,6 +81,8 @@ class PdfReportesController extends Controller
'nea_bienes.cantidad_inicial',
'nea_bienes.fte_fto',
'nea_bienes.precio',
'nea_bienes.marca',
'nea_bienes.observacion',
'nea_bienes.cuenta_contable',
'unidad_medidas.nombre as nombre_medida',
'bienes.descripcion',
@ -631,7 +633,7 @@ class PdfReportesController extends Controller
$fecha_hasta = Carbon::parse($request->input('fecha_hasta'))->endOfDay();
// Filtrar registros por rango de fechas
$reportes = DB::table('pecosa_bienes')
->select(
@ -648,7 +650,7 @@ class PdfReportesController extends Controller
->join('bienes as b', 'b.id', '=', 'i.bienes_id')
->join('pecosa_pedidos', 'pecosa_pedidos.id', '=', 'pecosa_bienes.id_pecosa_pedido')
->join('trabajadores', 'trabajadores.id', '=', 'pecosa_pedidos.id_trabajadores2')
->whereBetween('pecosa_pedidos.fecha', [$fecha_desde , $fecha_hasta])
->whereBetween('pecosa_pedidos.fecha', [$fecha_desde, $fecha_hasta])
->groupBy(
'pecosa_bienes.id_pecosa_pedido',
'pecosa_pedidos.codigo',
@ -661,7 +663,7 @@ class PdfReportesController extends Controller
)
->orderBy('fecha', 'asc')
->get();
// Generar el PDF
$mpdf = new \Mpdf\Mpdf([
@ -675,7 +677,7 @@ class PdfReportesController extends Controller
//
// Configurar encabezado y pie de página
$imgLogo = public_path('assets/images/UNAP.png');
$htmlHeader = view('relacionPecosa._header', compact('imgLogo', 'fecha_desde', 'fecha_hasta'))->render();
$mpdf->SetHTMLHeader($htmlHeader, '0');

@ -9,9 +9,10 @@
</head>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
body {
font-family: Arial, Helvetica, sans-serif;
}
.HeaderTitles {
width: 100%;
@ -297,15 +298,35 @@
width: 100%;
} */
.table_contend,
.th,
.td {
.table_contend {
width: 100%;
border: 1px solid black;
border-collapse: separate;
/* evita que se corten los bordes */
border-spacing: 0;
table-layout: auto;
}
.table_contend th,
.table_contend td {
border: 1px solid black;
border-collapse: collapse;
border-color: black;
padding: 3px 4px;
font-size: 11px;
word-wrap: break-word;
font-size: 10px;
white-space: normal;
vertical-align: middle;
}
tr {
page-break-inside: avoid !important;
}
thead {
display: table-header-group !important;
}
tfoot {
display: table-row-group !important;
}
.th {
@ -443,48 +464,35 @@
<div class="table_head">
<table class="table_contend">
<thead class="table_thead">
<tr class="tr">
<th style="border: 1px solid; width: 10%;">
ITEM
</th>
<th style="border: 1px solid; width: 40%;">
MARCA
</th>
<th style="border: 1px solid; width: 10%;">
CUENTA
</th>
<th style="border: 1px solid; width: 10%;">
UNIDAD
</th>
<th style="border: 1px solid; width: 10%;" >
CANTIDAD
</th>
<th style="border: 1px solid; width: 10%;">
PRECIO
</th>
<th style="border: 1px solid; width: 10%;" >
Valor Total
</th>
<tr>
<th style="width: 10%; text-align: center;">ITEM</th>
<th style="width: 40%;">MARCA</th>
<th style="width: 10%;">CUENTA</th>
<th style="width: 10%;">UNIDAD</th>
<th style="width: 10%;">CANTIDAD</th>
<th style="width: 10%;">PRECIO</th>
<th style="width: 10%;">VALOR TOTAL</th>
</tr>
</thead>
<tbody>
@foreach($registros as $registro)
@foreach($registros as $index => $registro)
<tr>
<td style="border: 1px solid; width: 10%;">{{ $registro->bien_codigo }}</td>
<td style="border: 1px solid; width: 40%;">{{ $registro->bien_descripcion }}</td>
<td style="border: 1px solid; width: 10%; text-align:center">{{ $registro->cuenta }}</td>
<td style="border: 1px solid; width: 10%; text-align:center">{{ $registro->unidad_medida }}</td>
<td style="border: 1px solid; width: 10%; text-align:center">{{ number_format($registro->cantidad, 2) }}</td>
<td style="border: 1px solid; width: 10%; text-align:center">{{ number_format($registro->precio, 2) }}</td>
<td style="border: 1px solid; width: 10%; text-align:center">{{ number_format($registro->cantidad * $registro->precio, 2) }}</td>
<td style="text-align: center;">{{ $index + 1 }}</td>
<td>{{ $registro->bien_descripcion ?? '-' }}</td>
<td style="text-align: center;">{{ $registro->cuenta ?? '-' }}</td>
<td style="text-align: center;">{{ $registro->unidad_medida ?? '-' }}</td>
<td style="text-align: center;">
{{ $registro->cantidad ? number_format($registro->cantidad, 2) : '-' }}</td>
<td style="text-align: center;">
{{ $registro->precio ? number_format($registro->precio, 2) : '-' }}</td>
<td style="text-align: center;">
{{ ($registro->cantidad && $registro->precio) ? number_format($registro->cantidad * $registro->precio, 2) : '-' }}
</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</body>
@ -492,4 +500,4 @@
</html>
<!-- <img src="{{ asset('assets/images/logoPosGrado.png') }}" alt="Tu Imagen" width="300" height="200"> -->
<!-- <img src="{{ asset('assets/images/logoPosGrado.png') }}" alt="Tu Imagen" width="300" height="200"> -->

@ -9,12 +9,13 @@
</head>
<style>
body {
font-family: Arial, Helvetica, sans-serif;
body {
font-family: Arial, Helvetica, sans-serif;
}
.HeaderTitles {
width: 100%;
border: #000;
border: #000;
/* border: 1px solid black;
border-collapse: collapse;
border-color: black; */
@ -22,21 +23,21 @@
.headerLogo {
width: 10%;
/* border: 1px solid black;
/* border: 1px solid black;
border-collapse: collapse;
border-color: black; */
}
.headerTitle {
width: 100%;
/* border: 1px solid black;
/* border: 1px solid black;
border-collapse: collapse;
border-color: black; */
}
.headerLogo {
width: 10%;
/* border: 1px solid black;
/* border: 1px solid black;
border-collapse: collapse;
border-color: black; */
}
@ -72,29 +73,30 @@
/*cuadro para fecha hora */
.date-box_d_m_a {
border-width: 1px;
border-color: black;
border-style: solid;
border-radius: 10px;
}
.date-box_d_m_a {
border-width: 1px;
border-color: black;
border-style: solid;
border-radius: 10px;
}
.header_d_m_a {
font-weight: bold;
font-size: 12px;
border-bottom: 1px solid gray;
border-radius: 30px;
}
.header_d_m_a {
font-weight: bold;
font-size: 12px;
border-bottom: 1px solid gray;
border-radius: 30px;
}
.content_d_m_a {
font-size: 12px;
.content_d_m_a {
font-size: 12px;
}
}
.date_d_m_a, .time_d_m_a {
font-size: 12px;
.date_d_m_a,
.time_d_m_a {
font-size: 12px;
}
}
.superpuesta {
@ -113,17 +115,20 @@
/* Eliminar el margen por defecto de los párrafos */
}
.title_g{
.title_g {
font-size: 12px;
margin: 10px auto;
}
.title_neas{
.title_neas {
font-size: 18px;
}
.title_numero{
.title_numero {
font-size: 14px;
}
.title {
color: black;
}
@ -162,26 +167,30 @@
width: 100%;
}
/* .head_conten_contenido{
width: 100%;
} */
.head_conten_contenido_celda{
.head_conten_contenido_celda {
border: 1px solid black;
border-radius: 10px;
}
}
table.head_conten_contenido {
width: 100%;
}
/* Eliminar bordes de las celdas */
table.head_conten_contenido td {
border: none; /* Sin borde en las celdas */
}
.head_1 {
/* Eliminar bordes de las celdas */
table.head_conten_contenido td {
border: none;
/* Sin borde en las celdas */
}
.head_1 {
/* color: red; */
font-size: 11px;
}
font-size: 11px;
}
.head_2 {
text-transform: uppercase;
@ -219,71 +228,82 @@
/* header */
.anio_header2{
.anio_header2 {
width: 100%;
text-align: center;
}
.header_conten1{
.header_conten1 {
width: 11%;
font-size: 11px;
}
.header_conten2{
.header_conten2 {
width: 30%;
font-size: 11px;
}
.header_conten3{
.header_conten3 {
width: 6%;
font-size: 11px;
}
.header_conten4{
.header_conten4 {
width: 10%;
font-size: 11px;
}
.header_conten5{
.header_conten5 {
width: 10%;
font-size: 11px;
}
.header_conten6{
.header_conten6 {
width: 10%;
font-size: 11px;
}
.header_conten1_1{
.header_conten1_1 {
width: 50%;
}
.header_conten1_2{
.header_conten1_2 {
width: 25%;
font-size: 11px;
}
.head_sub_almacen{
.head_sub_almacen {
font-size: 15px;
}
.header_conten1_3{
.header_conten1_3 {
width: 25%;
font-size: 11px;
}
.referencias_oficio{
font-size: 12px;
}
.referencias_oficio {
font-size: 12px;
}
/* */
@ -447,6 +467,7 @@
.promedioString {
width: 50px;
}
.promedio1 {
width: 15%;
font-size: 10px;
@ -529,49 +550,53 @@
<body>
<div class="body_cont">
<div class="table_head">
<table class="table_contend">
<table class="table_contend">
<thead class="table_thead">
<tr class="tr">
<th style="padding: 10px 0;" scope="col" style="border: 1px solid; width: 5%;">
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
CANTIDAD
CANTIDAD
</th>
<th scope="col" style="border: 1px solid; width: 40%;">
DESCRIPCIÓN
DESCRIPCIÓN
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
U. MEDIDA
U. MEDIDA
</th>
<th scope="col" style="border: 1px solid; width: 5%;">
FTE/FTO
FTE/FTO
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
C. CONTABLE
<th scope="col" style="border: 1px solid; width: 10%;">
C. CONTABLE
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
MARCA
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
P. UNITARIO
P. UNITARIO
</th>
<th scope="col" style="border: 1px solid; width: 10%;">
VALOR TOTAL
VALOR TOTAL
</th>
</tr>
</thead>
<tbody>
@foreach($pageData as $i => $data)
<tr>
<td style="border: 1px solid; width: 5%; text-align:center;">{{ $startIndex + $i }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->cantidad_inicial }}</td>
<td style="border: 1px solid; width: 40%;">{{ $data->descripcion }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->nombre_medida }}</td>
<td style="border: 1px solid; width: 5%; text-align:center;">{{ $data->fte_fto }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->cuenta_contable }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->precio }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->precio_total }}</td>
</tr>
@foreach($pageData as $i => $data)
<tr>
<td style="border: 1px solid; width: 5%; text-align:center;">{{ $startIndex + $i }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->cantidad_inicial }}</td>
<td style="border: 1px solid; width: 40%;">{{ $data->descripcion }} - {{ $data->observacion}}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->nombre_medida }}</td>
<td style="border: 1px solid; width: 5%; text-align:center;">{{ $data->fte_fto }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->cuenta_contable }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->marca }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->precio }}</td>
<td style="border: 1px solid; width: 10%; text-align:center;">{{ $data->precio_total }}</td>
</tr>
@endforeach
<tr>
<td class="index td" colspan="6">Sub Total S/ </td>
@ -587,4 +612,4 @@
</html>
<!-- <img src="{{ asset('assets/images/logoPosGrado.png') }}" alt="Tu Imagen" width="300" height="200"> -->
<!-- <img src="{{ asset('assets/images/logoPosGrado.png') }}" alt="Tu Imagen" width="300" height="200"> -->

@ -43,6 +43,7 @@ Route::get('/report-pecosas-detallada', [PdfReportesController::class, 'reportPe
Route::post('/report-pecosas-detallada', [PdfReportesController::class, 'reportPecosaListaDetalladaPDF']);
Route::get('/report-relacion-pecosas', [PdfReportesController::class, 'generatePdfRelacionPecosas']);
Route::post('/report-relacion-pecosas', [PdfReportesController::class, 'generatePdfRelacionPecosas']);
Route::get('/generarReporteInventario', [InventarioInicialController::class, 'generarReporteInventario'])->name('generarReporteInventario');
Route::middleware('auth:api')->group(function () {
@ -73,7 +74,6 @@ Route::middleware('auth:api')->group(function () {
Route::get('/report-pecosas', [PdfReportesController::class, 'reportPecosaPDF']);
Route::post('/report-pecosas', [PdfReportesController::class, 'reportPecosaPDF']);
Route::post('/report-pecosas-2023', [PdfReportesController::class, 'reportPecosa2023PDF']);
Route::get('/generarReporteInventario', [InventarioInicialController::class, 'generarReporteInventario'])->name('generarReporteInventario');
Route::post('/generarReporteInventario', [InventarioInicialController::class, 'generarReporteInventario'])->name('generarReporteInventario');
@ -208,4 +208,4 @@ Route::middleware('auth:api')->group(function () {
Route::get('lista-pecosa-bienes', [PecosaBienesController::class, 'listPecosaBienes']);
});
// generatePdfRelacionPecosas
// generatePdfRelacionPecosas

@ -1,4 +1,4 @@
const URL = "http://172.80.80.83:8050/api/"
const URL = "http://127.0.0.1:8000/api/"
// const URL = "http://142.93.54.11:8040/api/"

@ -82,6 +82,7 @@ function CrearBines({ visible, onHide, rowData, onSaveSuccess }) {
medida_salida: null,
cuenta_contable: "1501070203",
marca: "",
observacion: "",
fecha_registro: "",
},
]);
@ -135,6 +136,7 @@ function CrearBines({ visible, onHide, rowData, onSaveSuccess }) {
precio: bien.precio,
cuenta_contable: bien.cuenta_contable,
marca: bien.marca || null,
observacion: bien.observacion || null,
fecha_registro: bien.fecha_registro,
}));
@ -285,6 +287,7 @@ function CrearBines({ visible, onHide, rowData, onSaveSuccess }) {
<th style={{ width: "90px" }}>FTO</th>
<th style={{ width: "150px" }}>Cuenta Contable</th>
<th style={{ width: "150px" }}>Marca</th>
<th>Observacion</th>
<th>Fecha</th>
<th>Acción</th>
</tr>
@ -402,6 +405,26 @@ function CrearBines({ visible, onHide, rowData, onSaveSuccess }) {
</small>
)}
</td>
<td>
<textarea
value={bien.observacion}
onChange={(e) => {
actualizarCampo(bien.id, "observacion", e.target.value);
setErrores("");
autoResize(e); // Ajusta altura al escribir
}}
className="text-base text-color surface-overlay p-2 border-1 border-solid surface-border border-round appearance-none outline-none focus:border-primary w-full resize-none overflow-hidden"
rows={1}
ref={(el) => {
if (el) autoResize({ target: el }); // Ajusta altura al montar
}}
/>
{errores[`registros.${index}.observacion`] && (
<small className="p-error">
{errores[`registros.${index}.observacion`][0]}
</small>
)}
</td>
<td>
<input

@ -147,18 +147,18 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
const limPiarData = () => {
setIdTrabajadores("");
setTipoDeSede("ALMACEN CENTRAL DE OBRAS");
setTipoDeIngreso("NEA - TRANSFERENCIA");
setRecibidoPor("VICTOR FREDY VELASQUEZ JALLO");
setIdMeta("");
setTipoDeMoneda("S/");
setTipoDeAlmacen("ALMACEN CENTRAL DE OBRAS");
setDocumento("ACTA DE INTERNAMIENTO DE MATERIALES");
setTipoDeCambio("S/");
setTipoDeUso("CONSUMO");
setOficio("");
setFechaDeNea("");
setFechaDeRegistro("");
setTipoDeSede("ALMACEN CENTRAL DE OBRAS");
setTipoDeIngreso("NEA - TRANSFERENCIA");
setRecibidoPor("VICTOR FREDY VELASQUEZ JALLO");
setIdMeta("");
setTipoDeMoneda("S/");
setTipoDeAlmacen("ALMACEN CENTRAL DE OBRAS");
setDocumento("ACTA DE INTERNAMIENTO DE MATERIALES");
setTipoDeCambio("S/");
setTipoDeUso("CONSUMO");
setOficio("");
setFechaDeNea("");
setFechaDeRegistro("");
};
async function submitBienes(e) {
e.preventDefault();
@ -187,7 +187,7 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
});
if (response.status === 201) {
limPiarData();
limPiarData();
toast.current.show({
severity: "success",
summary: "Exito",
@ -200,6 +200,7 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
}
} catch (error) {
if (error.status === 403) {
setLoadingButton(false);
toast.current.show({
unstyled: true, // Desactiva los estilos por defecto
summary: "Aviso",
@ -216,6 +217,7 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
});
}
if (error.response.status === 422) {
setLoadingButton(false);
setErrorIdTrabajadores(error?.response.data?.id_trabajadores?.[0]);
setErrorTipoDeSede(error?.response.data?.tipo_de_sede?.[0]);
setErrorTipoDeIngreso(error?.response.data?.tipo_de_ingreso?.[0]);
@ -232,7 +234,10 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
}
if (error.response.status === 500) {
setError(error?.response?.data?.error);
setLoadingButton(false);
}
} finally {
setLoadingButton(false);
}
} else {
try {
@ -241,6 +246,7 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
});
if (response.status === 201) {
setLoadingButton(false);
toast.current.show({
severity: "success",
summary: "Exito",
@ -271,6 +277,7 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
});
}
if (error.response.status === 422) {
setLoadingButton(false);
setErrorIdTrabajadores(error?.response.data?.id_trabajadores?.[0]);
setErrorTipoDeSede(error?.response.data?.tipo_de_sede?.[0]);
setErrorTipoDeIngreso(error?.response.data?.tipo_de_ingreso?.[0]);
@ -286,8 +293,11 @@ function CreateEditNeaEntrada({ visible, onHide, rowData, onSaveSuccess }) {
setErrorFechaDeRegistro(error?.response.data?.fecha_de_registro?.[0]);
}
if (error.response.status === 500) {
setLoadingButton(false);
setError(error?.response?.data?.error);
}
} finally {
setLoadingButton(false);
}
}
}

@ -38,6 +38,7 @@ function EditBienes({ visible, onHide, rowData, onSaveSuccess }) {
const [errorCuenta, setErrorCuenta] = useState("");
const [errorMarca, setErrorMarca] = useState("");
const [errorFecha, setErrorFecha] = useState("");
const [errorObservacion, setErrorObservacion] = useState("");
async function getDataEnable() {
setLoading(true);
@ -98,9 +99,9 @@ function EditBienes({ visible, onHide, rowData, onSaveSuccess }) {
precio: bienToUpdate.precio,
cuenta_contable: bienToUpdate.cuenta_contable,
marca: bienToUpdate.marca,
observacion: bienToUpdate.observacion,
fecha_registro: bienToUpdate.fecha_registro,
};
console.log(body);
try {
const response = await axios.patch(`${apiPatchNeaBienes}${bienToUpdate.id}`, body, {
headers: { Authorization: `Bearer ${token}` },
@ -140,6 +141,7 @@ function EditBienes({ visible, onHide, rowData, onSaveSuccess }) {
setErrorCantidadInicial(error?.response.data?.cantidad_inicial?.[0]);
setErrorPrecio(error?.response.data?.precio?.[0]);
setErrorMarca(error?.response.data?.marca?.[0]);
setErrorObservacion(error?.response.data?.observacion?.[0]);
setErrorFecha(error?.response.data?.fecha_registro?.[0]);
}
}
@ -200,6 +202,7 @@ function EditBienes({ visible, onHide, rowData, onSaveSuccess }) {
<th style={{ width: "90px" }}>FTO</th>
<th style={{ width: "150px" }}>Cuenta Contable</th>
<th style={{ width: "200px" }}>Marca</th>
<th>Observacion</th>
<th>Fecha</th>
<th>Acción</th>
</tr>
@ -268,23 +271,37 @@ function EditBienes({ visible, onHide, rowData, onSaveSuccess }) {
<span style={{ color: "red" }}>{errorCuenta}</span>
</td>
<td>
<td>
<textarea
value={bien.marca}
onChange={(e) => {
handleInputChange(index, "marca", e.target.value);
autoResize(e); // Ajusta altura al escribir
}}
className="text-base text-color surface-overlay p-2 border-1 border-solid surface-border border-round appearance-none outline-none focus:border-primary w-full resize-none overflow-hidden"
rows={1}
ref={(el) => {
if (el) autoResize({ target: el }); // Ajusta al montar
}}
/>
</td>
<textarea
value={bien.marca}
onChange={(e) => {
handleInputChange(index, "marca", e.target.value);
autoResize(e); // Ajusta altura al escribir
}}
className="text-base text-color surface-overlay p-2 border-1 border-solid surface-border border-round appearance-none outline-none focus:border-primary w-full resize-none overflow-hidden"
rows={1}
ref={(el) => {
if (el) autoResize({ target: el }); // Ajusta al montar
}}
/>
<span style={{ color: "red" }}>{errorMarca}</span>
</td>
<td>
<textarea
value={bien.observacion}
onChange={(e) => {
handleInputChange(index, "observacion", e.target.value);
autoResize(e); // Ajusta altura al escribir
}}
className="text-base text-color surface-overlay p-2 border-1 border-solid surface-border border-round appearance-none outline-none focus:border-primary w-full resize-none overflow-hidden"
rows={1}
ref={(el) => {
if (el) autoResize({ target: el }); // Ajusta al montar
}}
/>
<span style={{ color: "red" }}>{errorObservacion}</span>
</td>
<td>
<input
type="date"

Loading…
Cancel
Save