create print opname and mutations

This commit is contained in:
2025-06-19 18:02:20 +07:00
parent e478dc81bb
commit 82f9d7f466
6 changed files with 1029 additions and 1 deletions

View File

@@ -77,7 +77,8 @@ class OpnamesController extends Controller
->addColumn('action', function ($row) use ($menu) {
$btn = '<div class="d-flex">';
$btn .= '<a href="'.route('opnames.show', $row->id).'" class="btn btn-primary btn-sm">Detail</a>';
$btn .= '<a href="'.route('opnames.show', $row->id).'" class="btn btn-primary btn-sm" style="margin-right: 8px;">Detail</a>';
$btn .= '<a href="'.route('opnames.print', $row->id).'" class="btn btn-success btn-sm" target="_blank">Print</a>';
$btn .= '</div>';
@@ -477,5 +478,18 @@ class OpnamesController extends Controller
}
}
public function print($id)
{
try {
$opname = Opname::with(['details.product.category', 'user', 'dealer'])
->findOrFail($id);
return view('warehouse_management.opnames.print', compact('opname'));
} catch (\Exception $e) {
Log::error('Error printing opname: ' . $e->getMessage());
return back()->with('error', 'Gagal membuka halaman print opname.');
}
}
}