<?php
//require_once('../app/config.php');
//require_once('../app/TCPDF-main/tcpdf.php');

require_once('../app/config.php');
require_once('../app/TCPDF-main/tcpdf.php');

// Validar método de envío
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
    die('Acceso no permitido directamente');
}

// Crear PDF
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);

// Configurar documento
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Sistema de Ventas');
$pdf->SetTitle('Reporte de Ventas');
$pdf->SetMargins(15, 25, 15);
$pdf->AddPage();


$pdf->SetX(4);
$pdf->SetFont('kozminproregular', 'B', 12);
$pdf->SetFillColor(2, 157, 116);
$pdf->Cell(66, 5, "CHANG SHA 88", 0, 0, 'C');
$pdf->Ln(5);

$pdf->SetX(4);
$pdf->SetFont('kozminproregular', 'B', 12);
$pdf->SetFillColor(2, 157, 116);
$pdf->Cell(66, 5, "TICKET DE COCINA / 凉伴牛肉", 0, 0, 'C');
$pdf->Ln(5);

$pdf->SetX(4);
$pdf->SetFont('Courier', 'B', 10);
$pdf->SetTextColor(3, 3, 3); // Establece el color del texto (en este caso es Negro)
$pdf->SetFillColor(229, 229, 229); // establece el color del fondo de la celda (en este caso es GRIS)
$pdf->Cell(10, 3, 'CANT', 0, 0, 'C');
$pdf->Cell(56, 3, 'DESCRIPCI�N DE PRODUCTO', 0, 1, 'C');




// Generar PDF
$pdf->Output('reporte_ventas_' . date('Ymd_His') . '.pdf', 'I');