<?php
session_start();
require_once '../assets/db_connect.php';

header('Content-Type: application/json');

// Log the request
error_log("Test save_sale.php called with POST data: " . print_r($_POST, true));

// Simple test response
echo json_encode([
    'status' => 'success',
    'message' => 'Sale saved successfully (TEST MODE)',
    'sale_id' => 999,
    'invoice_no' => 'TEST-' . date('YmdHis'),
    'details' => [
        'total' => $_POST['total'] ?? '0.00',
        'status' => 'paid'
    ]
]);
exit;
?>