mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 14:57:46 +01:00
Ottimizzazione velocità di caricamento widget rate contrattuali
This commit is contained in:
parent
6e89a4a9b8
commit
53278cc717
@ -17,7 +17,7 @@
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
use Plugins\PianificazioneFatturazione\Pianificazione;
|
||||
|
||||
|
||||
include_once __DIR__.'/../../../core.php';
|
||||
|
||||
@ -36,40 +36,6 @@ $mesi = [
|
||||
12 => 'Dicembre',
|
||||
];
|
||||
|
||||
$pianificazioni = Pianificazione::doesntHave('fattura')
|
||||
->whereHas('contratto', function ($q) {
|
||||
$q->whereHas('stato', function ($q) {
|
||||
$q
|
||||
->where('is_fatturabile', 1)
|
||||
->where('descrizione', '<>', 'Concluso');
|
||||
});
|
||||
})->get();
|
||||
|
||||
|
||||
if ($pianificazioni->isEmpty()) {
|
||||
echo '<p>'.tr('Non ci sono fatture da emettere').'.</p>';
|
||||
return;
|
||||
}
|
||||
|
||||
$conteggio = Pianificazione::doesntHave('fattura')
|
||||
->selectRaw('month(co_fatturazione_contratti.data_scadenza) mese, count(*) conto')
|
||||
->whereHas('contratto', function ($q) {
|
||||
$q->whereHas('stato', function ($q) {
|
||||
$q
|
||||
->where('is_fatturabile', 1)
|
||||
->where('descrizione', '<>', 'Concluso');
|
||||
});
|
||||
})
|
||||
->whereYear('co_fatturazione_contratti.data_scadenza', date('Y'))
|
||||
->groupBy('mese')
|
||||
->get();
|
||||
|
||||
$raggruppamenti = $pianificazioni->groupBy(function ($item) {
|
||||
return ucfirst($item->data_scadenza->formatLocalized('%B %Y'));
|
||||
});
|
||||
|
||||
|
||||
|
||||
echo
|
||||
'<div class="container"
|
||||
<div class="row">
|
||||
|
Loading…
x
Reference in New Issue
Block a user