mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 14:57:46 +01:00
Fix calcolo Fatturato per Statistiche Anagrafiche
This commit is contained in:
parent
b95f1fed26
commit
a4ced31e00
@ -83,10 +83,18 @@ $totale_ddt_uscita = $ddt_uscita->sum('totale_imponibile');
|
|||||||
$fatture_vendita = Fattura::whereBetween('data', [$start, $end])
|
$fatture_vendita = Fattura::whereBetween('data', [$start, $end])
|
||||||
->where('idanagrafica', $id_record)
|
->where('idanagrafica', $id_record)
|
||||||
->whereHas('tipo', function ($query) {
|
->whereHas('tipo', function ($query) {
|
||||||
$query->where('co_tipidocumento.dir', '=', 'entrata');
|
return $query->where('co_tipidocumento.dir', '=', 'entrata')
|
||||||
|
->where('co_tipidocumento.reversed', '=', 0);
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
$totale_fatture_vendita = $fatture_vendita->sum('totale_imponibile');
|
$note_credito = Fattura::whereBetween('data', [$start, $end])
|
||||||
|
->where('idanagrafica', $id_record)
|
||||||
|
->whereHas('tipo', function ($query) {
|
||||||
|
return $query->where('co_tipidocumento.dir', '=', 'entrata')
|
||||||
|
->where('co_tipidocumento.reversed', '=', 1);
|
||||||
|
})
|
||||||
|
->get();
|
||||||
|
$totale_fatture_vendita = $fatture_vendita->sum('totale_imponibile') - $note_credito->sum('totale_imponibile');
|
||||||
|
|
||||||
echo '
|
echo '
|
||||||
<div class="box box-info" id="row-'.$calendar_id.'">
|
<div class="box box-info" id="row-'.$calendar_id.'">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user