1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-02-18 12:30:35 +01:00

Aggiunta sede nella lista movimenti

This commit is contained in:
loviuz 2021-06-18 11:37:43 +02:00
parent 14f3ab3b89
commit e68ac072d8
2 changed files with 13 additions and 8 deletions

View File

@ -62,23 +62,24 @@ echo '
// Individuazione movimenti // Individuazione movimenti
$movimenti = $articolo->movimentiComposti() $movimenti = $articolo->movimentiComposti()
->orderBy('data', 'DESC') ->orderBy('mg_movimenti.data', 'DESC')
->orderBy('id', 'DESC'); ->orderBy('mg_movimenti.id', 'DESC');
if (empty($_GET['movimentazione_completa'])) { if (empty($_GET['movimentazione_completa'])) {
$movimenti->limit(20); $movimenti->limit(20);
} }
// Raggruppamento per documento // Raggruppamento per documento
$movimenti = $movimenti->get(); $movimenti = $movimenti->leftJoin('an_sedi', 'mg_movimenti.idsede', 'an_sedi.id')->get();
if (!empty($movimenti)) { if (!empty($movimenti)) {
echo ' echo '
<table class="table table-striped table-condensed table-bordered"> <table class="table table-striped table-condensed table-bordered">
<tr> <tr>
<th class="text-center">'.tr('Q.').'</th> <th class="text-center" width="120">'.tr('Q.').'</th>
<th class="text-center">'.tr('Q. progressiva').'</th> <th class="text-center">'.tr('Q. progressiva').'</th>
<th>'.tr('Operazione').'</th> <th>'.tr('Operazione').'</th>
<th class="text-center">'.tr('Data').'</th> <th class="text-center">'.tr('Sede').'</th>
<th class="text-center" width="7%">#</th> <th class="text-center" width="120">'.tr('Data').'</th>
<th class="text-center" width="80">#</th>
</tr>'; </tr>';
foreach ($movimenti as $i => $movimento) { foreach ($movimenti as $i => $movimento) {
@ -109,6 +110,10 @@ if (!empty($movimenti)) {
<td> <td>
'.$movimento->descrizione.''.($movimento->hasDocument() ? ' - '.reference($movimento->getDocument()) : '').' '.$movimento->descrizione.''.($movimento->hasDocument() ? ' - '.reference($movimento->getDocument()) : '').'
</td>
<td class="text-center">
'.( $movimento->nomesede ?: tr('Sede legale') ).'
</td>'; </td>';
// Data // Data

View File

@ -222,8 +222,8 @@ class Articolo extends Model
public function movimentiComposti() public function movimentiComposti()
{ {
return $this->movimenti() return $this->movimenti()
->selectRaw('*, sum(qta) as qta_documento, IFNULL(reference_type, id) as tipo_gruppo') ->selectRaw('*, sum(mg_movimenti.qta) as qta_documento, IFNULL(mg_movimenti.reference_type, mg_movimenti.id) as tipo_gruppo')
->groupBy('tipo_gruppo', 'reference_id'); ->groupBy('tipo_gruppo', 'mg_movimenti.reference_id');
} }
public function categoria() public function categoria()