Miglioramento minori

This commit is contained in:
Thomas Zilio 2020-02-17 20:21:18 +01:00
parent f5d3f9628a
commit 7e78640fe8
4 changed files with 54 additions and 6 deletions

View File

@ -53,7 +53,7 @@ switch ($operazione) {
$riga = Riga::build($contratto);
$riga->descrizione = $descrizione_riga;
$riga->setPrezzoUnitario(post('prezzo_unitario'), post('idiva'));
$riga->setPrezzoUnitario($prezzo_unitario, $id_iva);
$riga->qta = $qta_riga;
$riga->save();
@ -75,6 +75,8 @@ switch ($operazione) {
// Creazione fattura
$fattura = Fattura::build($contratto->anagrafica, $tipo, $data, $id_segment);
$fattura->note = post('note');
$fattura->save();
// Copia righe
$righe = $pianificazione->getRighe();

View File

@ -53,6 +53,48 @@ echo '
</div>
</div>';
// Righe
echo '
<div class="box box-info">
<div class="box-header with-border">
<h3 class="box-title">
'.tr('Righe previste').'
</h3>
</div>
<div class="box-body">
<table class="table table-bordered table-striped table-hover table-condensed">
<thead>
<tr>
<th width="40%">'.tr('Descrizione').'</th>
<th class="text-center">'.tr('Q.').'</th>
<th class="text-center">'.tr('Prezzo unitario').'</th>
<th class="text-center">'.tr('IVA').'</th>
<th class="text-center">'.tr('Totale imponbile').'</th>
</tr>
</thead>
<tbody>';
$righe = $pianificazione->getRighe();
foreach ($righe as $riga) {
echo '
<tr>
<td>'.$riga->descrizione.'</td>
<td class="text-center">'.$riga->qta.'</td>
<td class="text-right">'.moneyFormat($riga->prezzo_unitario).'</td>
<td class="text-right">
'.moneyFormat($riga->iva).'<br>
<small class="help-block">'.$riga->aliquota->descrizione.'</small>
</td>
<td class="text-right">'.moneyFormat($riga->totale_imponibile).'</td>
</tr>';
}
echo '
</tbody>
</table>
</div>
</div>';
echo '
<!-- PULSANTI -->
<div class="row">

View File

@ -29,9 +29,9 @@ if (!$pianificazioni->isEmpty()) {
<thead>
<tr>
<th width="10%">'.tr('Scadenza').'</th>
<th width="15%">'.tr('Importo').'</th>
<th class="text-center" width="15%">'.tr('Importo').'</th>
<th>'.tr('Documento').'</th>
<th width="12%">#</th>
<th class="text-center" width="12%">#</th>
</tr>
</thead>
<tbody>';
@ -52,7 +52,7 @@ if (!$pianificazioni->isEmpty()) {
echo '
</td>
<td class="center">
<td class="text-right">
'.moneyFormat($pianificazione->totale).'
</td>';
@ -75,7 +75,7 @@ if (!$pianificazioni->isEmpty()) {
// Creazione fattura
echo '
<td>
<td class="text-center">
<button type="button" class="btn btn-primary btn-sm '.(!empty($fattura) ? 'disabled' : '').'" '.(!empty($fattura) ? 'disabled' : '').' onclick="crea_fattura('.$rata.')">
<i class="fa fa-euro"></i> '.tr('Crea fattura').'
</button>

View File

@ -76,7 +76,11 @@ class Pianificazione extends Document
return $item->id == $p->id;
});
return $righe->splice($index * $numero_righe, $numero_righe);
$skip = $pianificazioni->count();
return $righe->filter(function ($value, $key) use ($skip, $index) {
return $key % $skip == $index;
});
}
public function articoli()