<?php
include '../config.php';

$id = $_GET['id']; // ID único da linha do item
$sql = $mysqli->query("SELECT * FROM nf_itens WHERE id = '$id'");
$reg = $sql->fetch_assoc();
?>
<!DOCTYPE html>
<html>
<head>
    <title>Impostos do Item</title>
    <style>
        body { background: #d4d0c8; font-family: Tahoma; font-size: 11px; padding: 10px; }
        fieldset { border: 2px inset #fff; margin-bottom: 10px; }
        input { border: 2px inset #fff; width: 100%; margin-bottom: 5px; }
        .btn { background: #c0c0c0; border: 2px solid; border-color: #fff #808080 #808080 #fff; cursor: pointer; padding: 5px 15px; font-weight: bold; }
    </style>
</head>
<body>
    <form method="POST" action="atualizar_banco.php">
        <input type="hidden" name="id" value="<?php echo $id; ?>">
        
        <fieldset>
            <legend>ICMS / ST</legend>
            Base ICMS: <input type="number" name="base_icms" step="0.01" value="<?php echo $reg['tax_base_icms']; ?>">
            Valor ICMS: <input type="number" name="valor_icms" step="0.01" value="<?php echo $reg['tax_valor_icms']; ?>">
            Valor ST: <input type="number" name="valor_st" step="0.01" value="<?php echo $reg['tax_valor_st']; ?>">
        </fieldset>

        <fieldset>
            <legend>PIS / COFINS / IPI</legend>
            Valor PIS: <input type="number" name="valor_pis" step="0.01" value="<?php echo $reg['tax_valor_pis']; ?>">
            Valor COFINS: <input type="number" name="valor_cofins" step="0.01" value="<?php echo $reg['tax_valor_cofins']; ?>">
            Valor IPI: <input type="number" name="valor_ipi" step="0.01" value="<?php echo $reg['tax_valor_ipi']; ?>">
        </fieldset>

        <div style="text-align: right;">
            <button type="submit" class="btn">SALVAR DADOS</button>
        </div>
    </form>
</body>
</html>