mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 23:07:46 +01:00
Migliorie minori plugin giacenze
This commit is contained in:
parent
45171b4b67
commit
863ff987f1
@ -41,6 +41,25 @@ WHERE idarticolo = '.prepare($articolo->id)."
|
|||||||
GROUP BY or_ordini.id
|
GROUP BY or_ordini.id
|
||||||
HAVING qta_ordinata > 0";
|
HAVING qta_ordinata > 0";
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<div class="panel panel-primary">
|
||||||
|
<div class="panel-heading">
|
||||||
|
<h3 class="panel-title">'.tr('Articolo').'</h3>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel-body">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<span><b>'.tr("Codice: ").'</b>'.$articolo->codice.'</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-md-6">
|
||||||
|
<span><b>'.tr("Descrizione: ").'</b>'.$articolo->descrizione.'</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** Impegnato
|
** Impegnato
|
||||||
*/
|
*/
|
||||||
@ -240,8 +259,9 @@ echo '
|
|||||||
<table class="table table-striped table-condensed table-bordered">
|
<table class="table table-striped table-condensed table-bordered">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="400">'.tr('Sede').'</th>
|
<th>'.tr('Sede').'</th>
|
||||||
<th width="200">'.tr('Q.tà').'</th>
|
<th width="20%" class="text-center">'.tr('Q.tà').'</th>
|
||||||
|
<th width="5%" class="text-center">#</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
||||||
@ -252,6 +272,11 @@ foreach ($sedi as $sede) {
|
|||||||
<tr>
|
<tr>
|
||||||
<td>'.$sede['nomesede'].'</td>
|
<td>'.$sede['nomesede'].'</td>
|
||||||
<td class="text-right">'.numberFormat($giacenze[$sede['id']][0]).' '.$articolo->um.'</td>
|
<td class="text-right">'.numberFormat($giacenze[$sede['id']][0]).' '.$articolo->um.'</td>
|
||||||
|
<td class="text-center">
|
||||||
|
<a class="btn btn-xs btn-info" title="Dettagli" onclick="getDettagli('.$sede['id'].');">
|
||||||
|
<i class="fa fa-eye"></i>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
</tr>';
|
</tr>';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -262,3 +287,13 @@ foreach ($sedi as $sede) {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>';
|
</div>';
|
||||||
|
|
||||||
|
echo '
|
||||||
|
<script>
|
||||||
|
|
||||||
|
function getDettagli(idsede) {
|
||||||
|
// Apertura modal
|
||||||
|
openModal("'.tr('Dettagli').'", "'.$rootdir.'/modules/articoli/plugins/dettagli_giacenze.php?id_module=" + globals.id_module + "&id_record=" + globals.id_record + "&idsede=" + idsede );
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>';
|
116
modules/articoli/plugins/dettagli_giacenze.php
Executable file
116
modules/articoli/plugins/dettagli_giacenze.php
Executable file
@ -0,0 +1,116 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
* OpenSTAManager: il software gestionale open source per l'assistenza tecnica e la fatturazione
|
||||||
|
* Copyright (C) DevCode s.r.l.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
include_once __DIR__.'/../../../core.php';
|
||||||
|
|
||||||
|
use Modules\Articoli\Articolo;
|
||||||
|
|
||||||
|
$articolo = Articolo::find($id_record);
|
||||||
|
|
||||||
|
$idsede = (empty(get('idsede')) ? 0 : get('idsede'));
|
||||||
|
$movimenti = $articolo->movimentiComposti()
|
||||||
|
->where('idsede',$idsede)
|
||||||
|
->orderBy('mg_movimenti.data', 'DESC')
|
||||||
|
->orderBy('mg_movimenti.id', 'DESC');
|
||||||
|
|
||||||
|
// Raggruppamento per documento
|
||||||
|
$movimenti = $movimenti->get();
|
||||||
|
if (!empty($movimenti)) {
|
||||||
|
$totale = 0;
|
||||||
|
echo '
|
||||||
|
<div style="max-height:400px; overflow:auto;">
|
||||||
|
<table class="table table-striped table-condensed table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="text-center">'.tr('Q.tà').'</th>
|
||||||
|
<th class="text-center">'.tr('Q.tà progressiva').'</th>
|
||||||
|
<th>'.tr('Operazione').'</th>
|
||||||
|
<th class="text-center">'.tr('Data').'</th>
|
||||||
|
<th class="text-center" width="7%">#</th>
|
||||||
|
</tr>';
|
||||||
|
|
||||||
|
foreach ($movimenti as $i => $movimento) {
|
||||||
|
// Quantità progressiva
|
||||||
|
if ($i == 0) {
|
||||||
|
$movimento['progressivo_finale'] = $articolo->qta;
|
||||||
|
} else {
|
||||||
|
$movimento['progressivo_finale'] = $movimenti[$i - 1]['progressivo_iniziale'];
|
||||||
|
}
|
||||||
|
$movimento['progressivo_iniziale'] = $movimento['progressivo_finale'] - $movimento->qta;
|
||||||
|
$movimento['progressivo_iniziale'] = $movimento['progressivo_finale'] - $movimento->qta;
|
||||||
|
|
||||||
|
$movimenti[$i]['progressivo_iniziale'] = $movimento['progressivo_iniziale'];
|
||||||
|
$movimenti[$i]['progressivo_finale'] = $movimento['progressivo_finale'];
|
||||||
|
|
||||||
|
$totale += $movimento->qta;
|
||||||
|
|
||||||
|
// Quantità
|
||||||
|
echo '
|
||||||
|
<tr>
|
||||||
|
<td class="text-center">
|
||||||
|
'.numberFormat($movimento->qta, 'qta').' '.$record['um'].'
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td class="text-center">
|
||||||
|
'.numberFormat($movimento['progressivo_iniziale'], 'qta').' '.$record['um'].'
|
||||||
|
<i class="fa fa-arrow-circle-right"></i>
|
||||||
|
'.numberFormat($movimento['progressivo_finale'], 'qta').' '.$record['um'].'
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
'.$movimento->descrizione.''.($movimento->hasDocument() ? ' - '.reference($movimento->getDocument()) : '').'
|
||||||
|
</td>';
|
||||||
|
|
||||||
|
// Data
|
||||||
|
echo '
|
||||||
|
<td class="text-center">'.dateFormat($movimento->data).' <span class="tip" title="'.tr('Data di creazione del movimento: _DATE_', [
|
||||||
|
'_DATE_' => timestampFormat($movimento->created_at),
|
||||||
|
]).'"><i class="fa fa-question-circle-o"></i></span> </td>';
|
||||||
|
|
||||||
|
// Operazioni
|
||||||
|
echo '
|
||||||
|
<td class="text-center">';
|
||||||
|
|
||||||
|
if (Auth::admin() && $movimento->isManuale()) {
|
||||||
|
echo '
|
||||||
|
<a class="btn btn-danger btn-xs ask" data-backto="record-edit" data-op="delmovimento" data-idmovimento="'.$movimento['id'].'">
|
||||||
|
<i class="fa fa-trash"></i>
|
||||||
|
</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</td>
|
||||||
|
</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
echo '
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<table class="table table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="text-right">'.tr('Totale').'</th>
|
||||||
|
<th class="text-right" width="17.9%">'.Translator::numberToLocale($totale,'qta').' '.$articolo->um.'</th>
|
||||||
|
</tr>
|
||||||
|
</table>';
|
||||||
|
} else {
|
||||||
|
echo '
|
||||||
|
<div class="alert alert-info">
|
||||||
|
<i class="fa fa-info-circle"></i>
|
||||||
|
'.tr('Questo articolo non è ancora stato movimentato').'.
|
||||||
|
</div>';
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user