4157 - Mejorado el informe de desgloses y añadido información de documentos enlazados#69
Open
daniel89fg wants to merge 6 commits intomainfrom
Open
4157 - Mejorado el informe de desgloses y añadido información de documentos enlazados#69daniel89fg wants to merge 6 commits intomainfrom
daniel89fg wants to merge 6 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR significantly enhances the breakdown report by adding richer filters (including product/variant and company-dependent options), switching the output to a tabbed, on-screen view with optional XLS/PDF export, and wiring in links to related documents and entities.
Changes:
- Extends the breakdown report UI to include a product/variant autocomplete, dynamic warehouse and payment-method filters per company, and a post-submit result area with tabs for units, net amounts, and a document list.
- Refactors
ReportBreakdownto centralize filter initialization, build a structured$dataarray for the view (units/net/documents for both sales and purchases), and add export support viaExportManager(filters summary + three data pages) in XLS/PDF formats. - Introduces helper methods for building URLs to customers, variants, and documents, new AJAX endpoints for warehouses/payment methods/variants, and updates aggregation logic to use month-name keys instead of numeric indices.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 9 comments.
| File | Description |
|---|---|
| View/ReportBreakdown.html.twig | Reworks the filter form layout, adds product/variant and report type/format selectors, and renders the new tabbed units/net/document breakdown, with JS hooks for AJAX filters and autocompletes. |
| Controller/ReportBreakdown.php | Refactors filter initialization and reporting logic to populate $data for the view, adds export via ExportManager, new autocomplete/AJAX handlers, and new grouping/URL helper methods for customers, products, and documents. |
Comments suppressed due to low confidence (3)
Controller/ReportBreakdown.php:1152
- Here
$agrupadosis iterated to print CSV lines, but the line that previously populated it withgetDatosAgrupadosRef()has been commented out above, so$agrupadosis never defined. To avoid runtime notices and empty output, reintroduce the aggregation step (aligned with the new month-key structure) or remove this method if it is no longer reachable.
// agrupamos los datos por proveedor, referencia, año y mes
//$agrupados = $this->getDatosAgrupadosRef($data, 'codproveedor');
// imprimimos las líneas
foreach ($agrupados as $codproveedor => $referencias) {
foreach ($referencias as $referencia => $years) {
foreach ($years as $year => $meses) {
echo '"' . $codproveedor . '";' . $this->getNombreProveedor($codproveedor) . ';"' . $referencia . '";' . $year;
foreach ($meses as $mes) {
echo ';' . number_format($mes, FS_NF0, ',', '');
}
echo "\n";
}
echo ";;;;;;;;;;;;;;;\n";
}
echo ";;;;;;;;;;;;;;;\n";
Controller/ReportBreakdown.php:1216
- Similarly to the other CSV helpers, this method iterates
$agrupadosbut the call that was populating it withgetDatosAgrupadosRef()is now commented out, so$agrupadosis never defined. To prevent runtime errors and unusable CSVs, either reintroduce the aggregation step with the updated month keys or remove this method if CSV output is no longer part of the public behavior.
// agrupamos los datos por cliente, referencia, añi y mes
//$agrupados = $this->getDatosAgrupadosRef($data, 'codcliente');
// imprimimos las líneas
foreach ($agrupados as $codcliente => $referencias) {
foreach ($referencias as $referencia => $years) {
foreach ($years as $year => $meses) {
echo '"' . $codcliente . '";' . $this->getNombreCliente($codcliente) . ';"' . $referencia . '";' . $year;
foreach ($meses as $mes) {
echo ';' . number_format($mes, FS_NF0, ',', '');
Controller/ReportBreakdown.php:1072
getTotalesAgrupados()still assumes month indexes 1..13 when initializing$totales, butgetDatosAgrupados()/getDatosAgrupadosRef()now generate month keys like'january','february', … and'total'. Once$agrupadosis correctly populated again, this mismatch will cause notices and totals stored under unexpected keys; it would be safer to initialize and iterate totals using the same month key set as the aggregation functions (and to treat the annualtotalseparately if needed).
protected function getTotalesAgrupados(array $agrupados): array
{
$totales = [];
foreach ($agrupados as $years) {
foreach ($years as $year => $meses) {
if (!isset($totales[$year])) {
$totales[$year] = [
1 => 0, // enero
2 => 0,
3 => 0,
4 => 0,
5 => 0,
6 => 0,
7 => 0,
8 => 0,
9 => 0,
10 => 0,
11 => 0,
12 => 0, // diciembre
13 => 0 // total anual
];
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Tarea #4157