1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-24 15:27:43 +01:00

Bugfix ore Consuntivo Contratti

This commit is contained in:
Thomas Zilio 2020-07-02 15:37:22 +02:00
parent 3f7c3e42c1
commit 95550baa4b

View File

@ -6,6 +6,7 @@ use Modules\Interventi\Intervento;
// Tabella con riepilogo interventi // Tabella con riepilogo interventi
$interventi = Intervento::where('id_contratto', $id_record)->get(); $interventi = Intervento::where('id_contratto', $id_record)->get();
$totale_ore_completate = 0;
if (!empty($interventi)) { if (!empty($interventi)) {
echo ' echo '
<table class="table table-bordered table-condensed"> <table class="table table-bordered table-condensed">
@ -20,6 +21,8 @@ if (!empty($interventi)) {
// Tabella con i dati // Tabella con i dati
foreach ($interventi as $intervento) { foreach ($interventi as $intervento) {
$totale_ore_completate += !empty($intervento->stato->is_completato) ? $intervento->ore_totali : 0;
// Riga per il singolo intervento // Riga per il singolo intervento
echo ' echo '
<tr style="background:'.$intervento->stato->colore.';"> <tr style="background:'.$intervento->stato->colore.';">
@ -165,11 +168,11 @@ if (!empty($interventi)) {
} }
$array_interventi = $interventi->toArray(); $array_interventi = $interventi->toArray();
$totale_ore = sum(array_column($array_interventi, 'ore_totali'));
$totale_km = sum(array_column($array_interventi, 'km_totali')); $totale_km = sum(array_column($array_interventi, 'km_totali'));
$totale_costo = sum(array_column($array_interventi, 'spesa')); $totale_costo = sum(array_column($array_interventi, 'spesa'));
$totale_addebito = sum(array_column($array_interventi, 'imponibile')); $totale_addebito = sum(array_column($array_interventi, 'imponibile'));
$totale = sum(array_column($array_interventi, 'totale_imponibile')); $totale = sum(array_column($array_interventi, 'totale_imponibile'));
$totale_ore = sum(array_column($array_interventi, 'ore_totali'));
// Totali // Totali
echo ' echo '
@ -274,10 +277,10 @@ if (!empty($totale_ore_contratto)) {
<tr> <tr>
<td>'.tr('Ore erogate totali').':</td> <td>'.tr('Ore erogate totali').':</td>
<td class="text-right">'.Translator::numberToLocale($totale_ore_interventi).'</td> <td class="text-right">'.Translator::numberToLocale($totale_ore).'</td>
<td>'.tr('Ore residue totali').':</td> <td>'.tr('Ore residue totali').':</td>
<td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore_interventi)).'</td> <td class="text-right">'.Translator::numberToLocale(floatval($totale_ore_contratto) - floatval($totale_ore)).'</td>
</tr> </tr>
<tr> <tr>