Gestione colori barra avanzamento per qta evase in righe

This commit is contained in:
MatteoPistorello 2023-07-21 09:52:20 +02:00
parent 930c0e99a7
commit a28520b76e
4 changed files with 74 additions and 28 deletions

View File

@ -22,7 +22,6 @@ include_once __DIR__.'/init.php';
$block_edit = $record['is_completato']; $block_edit = $record['is_completato'];
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc']; $order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe(); $righe = $order_row_desc ? $contratto->getRighe()->sortByDesc('created_at') : $contratto->getRighe();
$direzione = $contratto->direzione;
$colspan = ($block_edit ? '5' : '6'); $colspan = ($block_edit ? '5' : '6');
echo ' echo '
@ -108,12 +107,25 @@ foreach ($righe as $riga) {
<td></td>'; <td></td>';
} else { } else {
// Quantità e unità di misura // Quantità e unità di misura
$progress_perc = $riga->qta_evasa * 100 / $riga->qta;
echo ' echo '
<td class="text-center"> <td class="text-center">
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]} {[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
<div class="progress" style="height:4px;"> <div class="progress" style="height:4px;">';
<div class="progress-bar progress-bar-primary" style="width:'.$progress_perc.'%"></div> // Visualizzazione evasione righe per documento
$evasione_bar = [];
$evasione_bar['dt_righe_ddt'] = 'info';
$evasione_bar['co_righe_documenti'] = 'primary';
$evasione_bar['in_righe_interventi'] = 'warning';
$evasione_bar['or_righe_ordini'] = 'success';
foreach ($evasione_bar as $table => $color) {
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
if ($perc_ev > 0) {
echo '
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
}
}
echo '
</div> </div>
</td>'; </td>';
@ -327,13 +339,11 @@ if (!$block_edit && sizeof($righe) > 0) {
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());"> <button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button>'; </button>
if ($direzione == 'entrata') {
echo' <button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());"> Confronta prezzi
Confronta prezzi </button>
</button>';
} echo'
</div>'; </div>';
} }
echo ' echo '

View File

@ -145,12 +145,25 @@ foreach ($righe as $riga) {
<td></td>'; <td></td>';
} else { } else {
// Quantità e unità di misura // Quantità e unità di misura
$progress_perc = $riga->qta_evasa * 100 / $riga->qta;
echo ' echo '
<td class="text-center"> <td class="text-center">
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]} {[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
<div class="progress" style="height:4px;"> <div class="progress" style="height:4px;">';
<div class="progress-bar progress-bar-primary" style="width:'.$progress_perc.'%"></div> // Visualizzazione evasione righe per documento
$evasione_bar = [];
$evasione_bar['dt_righe_ddt'] = 'info';
$evasione_bar['co_righe_documenti'] = 'primary';
$evasione_bar['in_righe_interventi'] = 'warning';
$evasione_bar['or_righe_ordini'] = 'success';
foreach ($evasione_bar as $table => $color) {
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
if ($perc_ev > 0) {
echo '
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
}
}
echo '
</div> </div>
</td>'; </td>';

View File

@ -197,12 +197,25 @@ foreach ($righe as $riga) {
<td></td>'; <td></td>';
} else { } else {
// Quantità e unità di misura // Quantità e unità di misura
$progress_perc = $riga->qta_evasa * 100 / $riga->qta;
echo ' echo '
<td class="text-center"> <td class="text-center">
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]} {[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
<div class="progress" style="height:4px;"> <div class="progress" style="height:4px;">';
<div class="progress-bar progress-bar-primary" style="width:'.$progress_perc.'%"></div> // Visualizzazione evasione righe per documento
$evasione_bar = [];
$evasione_bar['dt_righe_ddt'] = 'info';
$evasione_bar['co_righe_documenti'] = 'primary';
$evasione_bar['in_righe_interventi'] = 'warning';
$evasione_bar['or_righe_ordini'] = 'success';
foreach ($evasione_bar as $table => $color) {
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
if ($perc_ev > 0) {
echo '
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
}
}
echo '
</div> </div>
</td>'; </td>';

View File

@ -23,7 +23,6 @@ $block_edit = $record['is_completato'];
$order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc']; $order_row_desc = $_SESSION['module_'.$id_module]['order_row_desc'];
$righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe(); $righe = $order_row_desc ? $preventivo->getRighe()->sortByDesc('created_at') : $preventivo->getRighe();
$colspan = ($block_edit ? '6' : '7'); $colspan = ($block_edit ? '6' : '7');
$direzione = $preventivo->direzione;
echo ' echo '
<div class="table-responsive row-list"> <div class="table-responsive row-list">
@ -148,12 +147,25 @@ foreach ($righe as $riga) {
<td></td>'; <td></td>';
} else { } else {
// Quantità e unità di misura // Quantità e unità di misura
$progress_perc = $riga->qta_evasa * 100 / $riga->qta;
echo ' echo '
<td class="text-center"> <td class="text-center">
{[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]} {[ "type": "number", "name": "qta_'.$riga->id.'", "value": "'.$riga->qta.'", "min-value": "0", "onchange": "aggiornaInline($(this).closest(\'tr\').data(\'id\'))", "icon-before": "<span class=\'tip\' title=\''.($riga->confermato ? tr('Articolo confermato') : tr('Articolo non confermato')).'\'><i class=\''.($riga->confermato ? 'fa fa-check text-success' : 'fa fa-clock-o text-warning').'\'></i></span>", "icon-after": "<span class=\'tip\' title=\''.tr('Quantità evasa').' / '.tr('totale').': '.tr('_QTA_ / _TOT_', ['_QTA_' => numberFormat($riga->qta_evasa, 'qta'), '_TOT_' => numberFormat($riga->qta, 'qta')]).'\'>'.$riga->um.' <small><i class=\'text-muted fa fa-info-circle\'></i></small></span>", "disabled": "'.($riga->isSconto() ? 1 : 0).'", "disabled": "'.$block_edit.'" ]}
<div class="progress" style="height:4px;"> <div class="progress" style="height:4px;">';
<div class="progress-bar progress-bar-primary" style="width:'.$progress_perc.'%"></div> // Visualizzazione evasione righe per documento
$evasione_bar = [];
$evasione_bar['dt_righe_ddt'] = 'info';
$evasione_bar['co_righe_documenti'] = 'primary';
$evasione_bar['in_righe_interventi'] = 'warning';
$evasione_bar['or_righe_ordini'] = 'success';
foreach ($evasione_bar as $table => $color) {
$righe_ev = $dbo->table($table)->where('original_id', $riga->id)->where('original_type', get_class($riga))->get();
$perc_ev = $righe_ev->sum('qta') * 100 / $riga->qta;
if ($perc_ev > 0) {
echo '
<div class="progress-bar progress-bar-'.$color.'" style="width:'.$perc_ev.'%"></div>';
}
}
echo '
</div> </div>
</td>'; </td>';
@ -386,13 +398,11 @@ if (!$block_edit && sizeof($righe) > 0) {
<button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());"> <button type="button" class="btn btn-xs btn-default disabled" id="elimina_righe" onclick="rimuoviRiga(getSelectData());">
<i class="fa fa-trash"></i> <i class="fa fa-trash"></i>
</button>'; </button>
if ($direzione == 'entrata') {
echo' <button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());">
<button type="button" class="btn btn-xs btn-default disabled" id="confronta_righe" onclick="confrontaRighe(getSelectData());"> Confronta prezzi
Confronta prezzi </button>
</button>';
} echo'
</div>'; </div>';
} }
echo ' echo '