mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-02-23 06:47:40 +01:00
Merge branch 'master' of https://github.com/devcode-it/openstamanager
This commit is contained in:
commit
9c07e51163
@ -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>';
|
||||||
|
}
|
@ -324,7 +324,8 @@ if (App::debug()) {
|
|||||||
<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL ORDER BY descrizione", "value": "" ]}
|
<br>{[ "type": "select", "label": "'.tr('Stato').'", "name": "idstatointervento", "required": 1, "values": "query=SELECT idstatointervento AS id, descrizione, colore AS _bgcolor_ FROM in_statiintervento WHERE deleted_at IS NULL ORDER BY descrizione", "value": "" ]}
|
||||||
<br>{[ "type":"checkbox", "label":"'.tr('Duplica righe').'", "name":"righe", "value":"" ]}
|
<br>{[ "type":"checkbox", "label":"'.tr('Duplica righe').'", "name":"righe", "value":"" ]}
|
||||||
<br>{[ "type":"checkbox", "label":"'.tr('Duplica sessioni').'", "name":"sessioni", "value":"" ]}
|
<br>{[ "type":"checkbox", "label":"'.tr('Duplica sessioni').'", "name":"sessioni", "value":"" ]}
|
||||||
<br>{[ "type":"checkbox", "label":"'.tr('Duplica impianti').'", "name":"impianti", "value":"" ]}',
|
<br>{[ "type":"checkbox", "label":"'.tr('Duplica impianti').'", "name":"impianti", "value":"" ]}
|
||||||
|
<style>.swal2-modal{ width:600px !important; }</style>',
|
||||||
'button' => tr('Procedi'),
|
'button' => tr('Procedi'),
|
||||||
'class' => 'btn btn-lg btn-warning',
|
'class' => 'btn btn-lg btn-warning',
|
||||||
'blank' => false,
|
'blank' => false,
|
||||||
|
@ -281,7 +281,34 @@ $tipi = $dbo->fetchArray('SELECT * FROM `in_tipiintervento`');
|
|||||||
|
|
||||||
$dataset = '';
|
$dataset = '';
|
||||||
foreach ($tipi as $tipo) {
|
foreach ($tipi as $tipo) {
|
||||||
$interventi = $dbo->fetchArray('SELECT COUNT(*) AS result, YEAR(in_interventi.data_richiesta) AS year, MONTH(in_interventi.data_richiesta) AS month FROM in_interventi WHERE in_interventi.idtipointervento = '.prepare($tipo['idtipointervento']).' AND in_interventi.data_richiesta BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(in_interventi.data_richiesta), MONTH(in_interventi.data_richiesta) ORDER BY YEAR(in_interventi.data_richiesta) ASC, MONTH(in_interventi.data_richiesta) ASC');
|
$interventi = $dbo->fetchArray('SELECT
|
||||||
|
COUNT(in_interventi.id) AS result,
|
||||||
|
YEAR(sessioni.orario_fine) AS `year`,
|
||||||
|
MONTH(sessioni.orario_fine) AS `month`
|
||||||
|
FROM
|
||||||
|
in_interventi
|
||||||
|
LEFT JOIN(
|
||||||
|
SELECT
|
||||||
|
in_interventi_tecnici.idintervento,
|
||||||
|
MAX(orario_fine) AS orario_fine
|
||||||
|
FROM
|
||||||
|
in_interventi_tecnici
|
||||||
|
GROUP BY
|
||||||
|
idintervento
|
||||||
|
) sessioni
|
||||||
|
ON
|
||||||
|
in_interventi.id = sessioni.idintervento
|
||||||
|
WHERE
|
||||||
|
in_interventi.idtipointervento = '.prepare($tipo['idtipointervento']).' AND IFNULL(
|
||||||
|
sessioni.orario_fine,
|
||||||
|
in_interventi.data_richiesta
|
||||||
|
) BETWEEN '.prepare($start).' AND '.prepare($end).'
|
||||||
|
GROUP BY
|
||||||
|
YEAR(sessioni.orario_fine),
|
||||||
|
MONTH(sessioni.orario_fine)
|
||||||
|
ORDER BY
|
||||||
|
YEAR(sessioni.orario_fine) ASC,
|
||||||
|
MONTH(sessioni.orario_fine) ASC');
|
||||||
|
|
||||||
$interventi = Stats::monthly($interventi, $start, $end);
|
$interventi = Stats::monthly($interventi, $start, $end);
|
||||||
|
|
||||||
@ -337,7 +364,8 @@ $(document).ready(function() {
|
|||||||
// Ore interventi per tipologia
|
// Ore interventi per tipologia
|
||||||
$dataset = '';
|
$dataset = '';
|
||||||
foreach ($tipi as $tipo) {
|
foreach ($tipi as $tipo) {
|
||||||
$interventi = $dbo->fetchArray('SELECT ROUND( SUM(in_interventi_tecnici.ore), 2 ) AS result, YEAR(in_interventi.data_richiesta) AS year, MONTH(in_interventi.data_richiesta) AS month FROM in_interventi INNER JOIN in_interventi_tecnici ON in_interventi.id=in_interventi_tecnici.idintervento WHERE in_interventi.idtipointervento = '.prepare($tipo['idtipointervento']).' AND in_interventi.data_richiesta BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY YEAR(in_interventi.data_richiesta), MONTH(in_interventi.data_richiesta) ORDER BY YEAR(in_interventi.data_richiesta) ASC, MONTH(in_interventi.data_richiesta) ASC');
|
$interventi = $dbo->fetchArray('SELECT ROUND( SUM(in_interventi_tecnici.ore), 2 ) AS result, YEAR(in_interventi_tecnici.orario_fine) AS year, MONTH(in_interventi_tecnici.orario_fine) AS month FROM in_interventi INNER JOIN in_interventi_tecnici ON in_interventi.id=in_interventi_tecnici.idintervento WHERE in_interventi.idtipointervento = '.prepare($tipo['idtipointervento']).' AND in_interventi.data_richiesta BETWEEN '.prepare($start).' AND '.prepare($end).' GROUP BY
|
||||||
|
YEAR(in_interventi_tecnici.orario_fine), MONTH(in_interventi_tecnici.orario_fine) ORDER BY YEAR(in_interventi_tecnici.orario_fine) ASC, MONTH(in_interventi_tecnici.orario_fine) ASC');
|
||||||
|
|
||||||
$interventi = Stats::monthly($interventi, $start, $end);
|
$interventi = Stats::monthly($interventi, $start, $end);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user