1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-23 23:07:46 +01:00

Introduzione numero rata in Rate contrattuali

This commit is contained in:
Dasc3er 2020-08-27 15:28:31 +02:00
parent 62e4e9f29c
commit 577bf0d555
2 changed files with 17 additions and 4 deletions

View File

@ -65,6 +65,17 @@ class Pianificazione extends Document
return $this->belongsTo(Fattura::class, 'iddocumento'); return $this->belongsTo(Fattura::class, 'iddocumento');
} }
public function getNumeroPianificazione()
{
$pianificazioni = $this->contratto->pianificazioni;
$p = $this;
return $pianificazioni->search(function ($item) use ($p) {
return $item->id == $p->id;
}) + 1;
}
public function getRighe() public function getRighe()
{ {
$righe = $this->contratto->getRighe(); $righe = $this->contratto->getRighe();

View File

@ -54,6 +54,7 @@ foreach ($raggruppamenti as $mese => $raggruppamento) {
foreach ($pianificazioni as $pianificazione) { foreach ($pianificazioni as $pianificazione) {
$contratto = $pianificazione->contratto; $contratto = $pianificazione->contratto;
$anagrafica = $contratto->anagrafica; $anagrafica = $contratto->anagrafica;
$numero_pianificazioni = $contratto->pianificazioni()->count();
if (strtolower($pianificazione->data_scadenza->formatLocalized('%B %Y')) == strtolower($mese)) { if (strtolower($pianificazione->data_scadenza->formatLocalized('%B %Y')) == strtolower($mese)) {
echo ' echo '
@ -69,9 +70,10 @@ foreach ($raggruppamenti as $mese => $raggruppamento) {
<td> <td>
'.moneyFormat($pianificazione->totale).'<br> '.moneyFormat($pianificazione->totale).'<br>
<small>'.tr('_TOT_ / _NUM_ rate', [ <small>'.tr('Rata _IND_/_NUM_ (totale: _TOT_)', [
'_IND_' => numberFormat($pianificazione->getNumeroPianificazione(), 0),
'_NUM_' => numberFormat($numero_pianificazioni, 0),
'_TOT_' => moneyFormat($contratto->totale), '_TOT_' => moneyFormat($contratto->totale),
'_NUM_' => numberFormat($contratto->pianificazioni()->count(), 0),
]).'</small> ]).'</small>
</td>'; </td>';