Fix minori
This commit is contained in:
parent
db64f3e4cc
commit
4f157aa519
|
@ -55,9 +55,7 @@ if (!empty($query)) {
|
||||||
$results['recordsFiltered'] = $data['count'];
|
$results['recordsFiltered'] = $data['count'];
|
||||||
|
|
||||||
// SOMME
|
// SOMME
|
||||||
if ($draw_numer == 1) {
|
$results['summable'] = Util\Query::getSums($structure, $search);
|
||||||
$results['summable'] = Util\Query::getSums($structure, $search);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allineamento delle righe
|
// Allineamento delle righe
|
||||||
$align = [];
|
$align = [];
|
||||||
|
|
|
@ -6,6 +6,14 @@ use Common\Components\Description;
|
||||||
|
|
||||||
abstract class Document extends Model
|
abstract class Document extends Model
|
||||||
{
|
{
|
||||||
|
protected $appends = [
|
||||||
|
'iva',
|
||||||
|
'imponibile',
|
||||||
|
'sconto',
|
||||||
|
'totale_imponibile',
|
||||||
|
'totale',
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti.
|
* Restituisce la collezione di righe e articoli con valori rilevanti per i conti.
|
||||||
*
|
*
|
||||||
|
|
|
@ -78,6 +78,57 @@ class Preventivo extends Document
|
||||||
return $model;
|
return $model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attributi Eloquent
|
||||||
|
|
||||||
|
public function getOreProgrammateAttribute()
|
||||||
|
{
|
||||||
|
if (!isset($this->info['ore_programmate'])) {
|
||||||
|
$sessioni = collect();
|
||||||
|
|
||||||
|
$interventi = $this->interventi()->whereHas('stato', function ($query) {
|
||||||
|
$query->where('completato', '=', 0);
|
||||||
|
})->get();
|
||||||
|
|
||||||
|
foreach ($interventi as $intervento) {
|
||||||
|
$sessioni = $sessioni->merge($intervento->sessioni);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info['ore_programmate'] = $sessioni->sum('ore');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->info['ore_programmate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOreCompletateAttribute()
|
||||||
|
{
|
||||||
|
if (!isset($this->info['ore_completate'])) {
|
||||||
|
$sessioni = collect();
|
||||||
|
|
||||||
|
$interventi = $this->interventi()->whereHas('stato', function ($query) {
|
||||||
|
$query->where('completato', '=', 1);
|
||||||
|
})->get();
|
||||||
|
|
||||||
|
foreach ($interventi as $intervento) {
|
||||||
|
$sessioni = $sessioni->merge($intervento->sessioni);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->info['ore_completate'] = $sessioni->sum('ore');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->info['ore_completate'];
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getOrePrevisteAttribute()
|
||||||
|
{
|
||||||
|
if (!isset($this->info['ore_previste'])) {
|
||||||
|
$sessioni = $this->getRighe()->where('um', 'ore');
|
||||||
|
|
||||||
|
$this->info['ore_previste'] = $sessioni->sum('qta');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->info['ore_previste'];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Restituisce il nome del modulo a cui l'oggetto è collegato.
|
* Restituisce il nome del modulo a cui l'oggetto è collegato.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue