when we generate a report that has a calculated field, we get an error because it generates it twice.
C:\laragon\www\Pms2025\vendor\doctrine\dbal\src\Driver\API\MySQL\ExceptionConverter.php(55): An exception occurred while executing a query: SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name ‘TotalFactura’
in models:
// Get list of fields
private function sqlSelectFields(): string
{
return "*, (select sum(Cantidad*PrecioUnidad) from facturas_detalles where facturas_detalles.NumeroFactura=facturas.NumeroFactura) AS `TotalFactura`, (select sum(Cantidad*PrecioUnidad) from facturas_detalles where facturas_detalles.NumeroFactura=facturas.NumeroFactura) AS `TotalFactura`";
}