feat(pdf) : refonte en-tête rapport poids case - étape 2
Inversion du sens de lecture du tableau principal : colonnes mois en ordre inverse, fixes (date naissance, poids, n° travail) à droite. Tri des bovins par n° de travail croissant. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -91,6 +91,22 @@ final readonly class BuildingCaseWeightsReportProvider implements ProviderInterf
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
usort($rows, static function (array $a, array $b): int {
|
||||||
|
$aw = (string) ($a['workNumber'] ?? '');
|
||||||
|
$bw = (string) ($b['workNumber'] ?? '');
|
||||||
|
if ('' === $aw && '' === $bw) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
if ('' === $aw) {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
if ('' === $bw) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (int) $aw <=> (int) $bw;
|
||||||
|
});
|
||||||
|
|
||||||
$monthHeaders = $this->buildMonthHeaders($firstArrivalDate, $headerBreedCode);
|
$monthHeaders = $this->buildMonthHeaders($firstArrivalDate, $headerBreedCode);
|
||||||
|
|
||||||
$dompdf = new Dompdf();
|
$dompdf = new Dompdf();
|
||||||
|
|||||||
@@ -253,30 +253,29 @@
|
|||||||
<table class="main">
|
<table class="main">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th rowspan="4" class="head-big" style="width:5%">N° de<br>travail</th>
|
{% for month in monthHeaders|default([])|reverse %}
|
||||||
<th rowspan="4" class="head-big" style="width:5%">N° de<br>travail</th>
|
|
||||||
<th rowspan="4" class="head-big head-big-weight" style="width:4%">Poids<br>(kg)</th>
|
|
||||||
<th rowspan="4" class="head-big" style="width:7%">Date de<br>naissance</th>
|
|
||||||
|
|
||||||
{% for month in monthHeaders|default([]) %}
|
|
||||||
<th class="month" style="width:6.58%">{{ month.name }}</th>
|
<th class="month" style="width:6.58%">{{ month.name }}</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
<th rowspan="4" class="head-big" style="width:7%">Date de<br>naissance</th>
|
||||||
|
<th rowspan="4" class="head-big head-big-weight" style="width:4%">Poids<br>(kg)</th>
|
||||||
|
<th rowspan="4" class="head-big" style="width:5%">N° de<br>travail</th>
|
||||||
|
<th rowspan="4" class="head-big" style="width:5%">N° de<br>travail</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
{% for month in monthHeaders|default([]) %}
|
{% for month in monthHeaders|default([])|reverse %}
|
||||||
<th class="days">{{ month.days }}</th>
|
<th class="days">{{ month.days }}</th>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th class="days">Foin</th>
|
|
||||||
<th class="days">Foin</th>
|
|
||||||
<th colspan="{{ monthHeaders|length -2 }}" class="sub-title">POIDS PAR MOIS</th>
|
<th colspan="{{ monthHeaders|length -2 }}" class="sub-title">POIDS PAR MOIS</th>
|
||||||
|
<th class="days">Foin</th>
|
||||||
|
<th class="days">Foin</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
{% for month in monthHeaders|default([]) %}
|
{% for month in monthHeaders|default([])|reverse %}
|
||||||
<th class="base">
|
<th class="base">
|
||||||
{% if month.baseValue is defined %}
|
{% if month.baseValue is defined %}
|
||||||
{{ month.baseValue|round(0, 'common') }} kg
|
{{ month.baseValue|round(0, 'common') }} kg
|
||||||
@@ -289,27 +288,28 @@
|
|||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
<tbody>
|
<tbody>
|
||||||
{# 11 lignes comme dans ton code (0..10) #}
|
{# 13 lignes comme dans ton code (0..12) #}
|
||||||
{% for i in 0..12 %}
|
{% for i in 0..12 %}
|
||||||
{% set row = rows[i] ?? null %}
|
{% set row = rows[i] ?? null %}
|
||||||
{% set baseWeight = row ? (row.receivedWeight ?? null) : null %}
|
{% set baseWeight = row ? (row.receivedWeight ?? null) : null %}
|
||||||
|
|
||||||
<tr class="data-row">
|
<tr class="data-row">
|
||||||
<td class="row-work"></td>
|
{% for idx in 0..(monthCount > 0 ? monthCount - 1 : 0) %}
|
||||||
<td class="row-work">{{ row ? (row.workNumber ?? '') : '' }}</td>
|
{% set reversedIdx = (monthCount - 1) - idx %}
|
||||||
<td class="row-weight">{{ baseWeight ?? '' }}</td>
|
{% set projectedWeight = row and row.projectedWeights is defined ? (row.projectedWeights[reversedIdx] ?? null) : null %}
|
||||||
|
<td class="row-month"{% if reversedIdx < 4 %} style="background:#e0e0e0;"{% endif %}>
|
||||||
|
{{ projectedWeight is not null ? projectedWeight|round(0, 'common') : '' }}
|
||||||
|
</td>
|
||||||
|
{% endfor %}
|
||||||
<td class="row-birth">
|
<td class="row-birth">
|
||||||
{% if row and row.birthDate %}
|
{% if row and row.birthDate %}
|
||||||
{% set birthParts = row.birthDate|split('/') %}
|
{% set birthParts = row.birthDate|split('/') %}
|
||||||
{{ birthParts|length == 3 ? birthParts[1] ~ '/' ~ birthParts[2] : row.birthDate }}
|
{{ birthParts|length == 3 ? birthParts[1] ~ '/' ~ birthParts[2] : row.birthDate }}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% for idx in 0..(monthCount > 0 ? monthCount - 1 : 0) %}
|
<td class="row-weight">{{ baseWeight ?? '' }}</td>
|
||||||
{% set projectedWeight = row and row.projectedWeights is defined ? (row.projectedWeights[idx] ?? null) : null %}
|
<td class="row-work">{{ row ? (row.workNumber ?? '') : '' }}</td>
|
||||||
<td class="row-month"{% if loop.index0 < 4 %} style="background:#e0e0e0;"{% endif %}>
|
<td class="row-work"></td>
|
||||||
{{ projectedWeight is not null ? projectedWeight|round(0, 'common') : '' }}
|
|
||||||
</td>
|
|
||||||
{% endfor %}
|
|
||||||
</tr>
|
</tr>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tbody>
|
</tbody>
|
||||||
|
|||||||
Reference in New Issue
Block a user