<?php
require 'auth.php';
require 'conexao.php';

$id = intval($_GET['id'] ?? 0);
if (!$id) header('Location:listar_os.php');

$upd = $mysqli->prepare("UPDATE ordens_servico SET status='Finalizado', data_saida=NOW() WHERE id=?");
$upd->bind_param('i', $id);
$upd->execute();

header('Location:listar_os.php');
exit;
