I would like you to collaborate with me, I want you to send me a pdfm report when I click on the button, what I want is for the current sale to not be closed and the report to be opened in a new one, this is my code of the form:
<form role="form" name="formulario" method="post" action="InformeReporteBeteitiva.php">
<br>
<div class="row">
<div class="col-lg-6 center-page">
<div class="input-daterange input-group" id="date-range">
<input type="text" class="form-control" name="start" id="start"/>
<span class="input-group-addon bg-success text-white b-0">a</span>
<input type="text" class="form-control" name="end" id="end"/>
<button type="submit" class="btn btn-success waves-effect w-md waves-light">Buscar</button>
</div>
</div>
</div>
</form>
And this is the code of the pdf report:
<?php
include 'plantilla.php';
require 'conexion.php';
$query = "SELECT * FROM
(
SELECT Nombre, Cedula, sum(HorasTrabajo) as HorasTrabajo,sum(VC) as VC, sum(VR) as VR, sum(PA) as PA,
sum(PRG) as PRG, sum(PRI) as PRI, sum(TAC) as TAC, sum(TRM) as TRM, sum(MLC) as MLC, sum(BENDA) as BENDA, sum(EVS) as EVS,
sum(ADM) as ADM, sum(CRG) as CRG, sum(CDS) as CDS, sum(CNST) as CNST, sum(MTA) as MTA, sum(MTDCH) as MTDCH, sum(MTDPT) as MTDPT,
sum(Otros) as Otros FROM reportebeteitiva
INNER JOIN trabajador ON reportebeteitiva.Trabajador = trabajador.idTrabajador
INNER JOIN centrocosto ON trabajador.CentroCosto = centrocosto.idCentroCosto
WHERE centrocosto.Estado = 'Activo' and trabajador.Estado = 'Activo' and Fecha BETWEEN '" . $_POST["start"] . "' AND '" . $_POST["end"] . "'
group by Nombre, Cedula WITH ROLLUP
)A WHERE ISNULL(Nombre) = ISNULL(Cedula)";
$resultado = $mysqli->query($query);
$pdf = new PDF();
$pdf->AliasNbPages();
$pdf->AddPage('L');
$pdf->SetFillColor('232','232','232');
$pdf->SetFont('Arial','B','10');
$pdf->Cell(37,6,'NOMBRE',1,0,'C',1);
$pdf->Cell(25,6,'CEDULA',1,0,'C',1);
$pdf->Cell(16,6,'HORAS',1,0,'C',1);
$pdf->Cell(10,6,'VC',1,0,'C',1);
$pdf->Cell(10,6,'VR',1,0,'C',1);
$pdf->Cell(10,6,'PA',1,0,'C',1);
$pdf->Cell(10,6,'PRG',1,0,'C',1);
$pdf->Cell(10,6,'PRI',1,0,'C',1);
$pdf->Cell(10,6,'TAC',1,0,'C',1);
$pdf->Cell(10,6,'TRM',1,0,'C',1);
$pdf->Cell(10,6,'MLC',1,0,'C',1);
$pdf->Cell(15,6,'BENDA',1,0,'C',1);
$pdf->Cell(10,6,'EVS',1,0,'C',1);
$pdf->Cell(10,6,'ADM',1,0,'C',1);
$pdf->Cell(10,6,'CRG',1,0,'C',1);
$pdf->Cell(10,6,'CDS',1,0,'C',1);
$pdf->Cell(13,6,'CNST',1,0,'C',1);
$pdf->Cell(10,6,'MTA',1,0,'C',1);
$pdf->Cell(15,6,'MTDCH',1,0,'C',1);
$pdf->Cell(15,6,'MTDPT',1,0,'C',1);
$pdf->Cell(15,6,'OTROS',1,1,'C',1);
$pdf->SetFont('Arial','','10');
while ($row = $resultado->fetch_assoc())
{
$pdf->Cell(37,6,utf8_decode($row['Nombre']),1,0,'C');
$pdf->Cell(25,6,$row['Cedula'],1,0,'C');
$pdf->Cell(16,6,$row['HorasTrabajo'],1,0,'C');
$pdf->Cell(10,6,$row['VC'] ,1,0,'C');
$pdf->Cell(10,6,$row['VR'] ,1,0,'C');
$pdf->Cell(10,6,$row['PA'] ,1,0,'C');
$pdf->Cell(10,6,$row['PRG'] ,1,0,'C');
$pdf->Cell(10,6,$row['PRI'] ,1,0,'C');
$pdf->Cell(10,6,$row['TAC'] ,1,0,'C');
$pdf->Cell(10,6,$row['TRM'] ,1,0,'C');
$pdf->Cell(10,6,$row['MLC'] ,1,0,'C');
$pdf->Cell(15,6,$row['BENDA'] ,1,0,'C');
$pdf->Cell(10,6,$row['EVS'] ,1,0,'C');
$pdf->Cell(10,6,$row['ADM'] ,1,0,'C');
$pdf->Cell(10,6,$row['CRG'] ,1,0,'C');
$pdf->Cell(10,6,$row['CDS'] ,1,0,'C');
$pdf->Cell(13,6,$row['CNST'] ,1,0,'C');
$pdf->Cell(10,6,$row['MTA'] ,1,0,'C');
$pdf->Cell(15,6,$row['MTDCH'] ,1,0,'C');
$pdf->Cell(15,6,$row['MTDPT'] ,1,0,'C');
$pdf->Cell(15,6,$row['Otros'] ,1,1,'C');
}
$pdf->Output();
?>