<?php
include 'conexion2.php';

$stmt = $pdo->prepare("
  UPDATE selling_price SET
    subtotal = ?, discount_amount = ?, others_charge = ?, payable_amount = ?,
    paid_amount = ?, due = ?, return_amount = ?
  WHERE price_id = ?
");

$ok = $stmt->execute([
  $_POST['subtotal'],
  $_POST['discount_amount'],

  $_POST['others_charge'],
  $_POST['payable_amount'],
  $_POST['paid_amount'],
  $_POST['due'],
  $_POST['return_amount'],
  $_POST['price_id']
]);

echo $ok ? "Factura actualizada con éxito." : "Error al actualizar.";
