<?php
require_once 'conexion2.php';

$cliente_id = 1;

echo "<h3>Test de saldo</h3>";
$stmt = $pdo->prepare("SELECT balance, due FROM customer_to_store WHERE customer_id = ?");
$stmt->execute([$cliente_id]);
$saldos = $stmt->fetch(PDO::FETCH_ASSOC);
var_dump($saldos);

echo "<h3>Test de facturas</h3>";
$stmt = $pdo->prepare("SELECT si.invoice_id, si.created_at, sp.subtotal, sp.others_charge, sp.payable_amount, sp.paid_amount, sp.due, sp.due_paid, sp.return_amount 
  FROM selling_info si 
  JOIN selling_price sp ON si.invoice_id = sp.invoice_id 
  WHERE si.customer_id = ? 
  ORDER BY si.created_at DESC");
$stmt->execute([$cliente_id]);
$facturas = $stmt->fetchAll(PDO::FETCH_ASSOC);
var_dump($facturas);
