2017-08-04 16:28:16 +02:00
< ? php
include_once __DIR__ . '/../../../core.php' ;
// Movimentazione degli articoli
echo '
< div class = " box " >
< div class = " box-header with-border " >
2017-09-04 12:02:29 +02:00
< h3 class = " box-title " > '.tr(' Movimenti ').' </ h3 >
2017-08-04 16:28:16 +02:00
</ div >
< div class = " box-body " > ' ;
// Calcolo la quantità dai movimenti in magazzino
$rst = $dbo -> fetchArray ( 'SELECT SUM(qta) AS qta_totale FROM mg_movimenti WHERE idarticolo=' . prepare ( $id_record ) . ' AND (idintervento IS NULL OR idautomezzo = 0)' );
$qta_totale = $rst [ 0 ][ 'qta_totale' ];
echo '
2017-09-04 12:02:29 +02:00
< p > '.tr(' Quantità calcolata dai movimenti ').' : '.Translator::numberToLocale($qta_totale).' '.$rs[0][' unita_misura '].' </ p > ' ;
2017-08-04 16:28:16 +02:00
// Elenco movimenti magazzino
2017-08-29 16:06:37 +02:00
$query = 'SELECT * FROM mg_movimenti WHERE idarticolo=' . prepare ( $id_record ) . ' ORDER BY created_at DESC' ;
2017-08-04 16:28:16 +02:00
if ( empty ( $_GET [ 'show_all1' ])) {
$query .= ' LIMIT 0, 20' ;
}
$rs2 = $dbo -> fetchArray ( $query );
if ( ! empty ( $rs2 )) {
if ( empty ( $_GET [ 'show_all1' ])) {
echo '
2017-09-04 12:02:29 +02:00
< p >< a href = " '. $rootdir .'/editor.php?id_module='. $id_module .'&id_record='. $id_record .'&show_all1=1#tab_'. $id_plugin .' " > [ '.tr(' Mostra tutti i movimenti ').' ] </ a ></ p > ' ;
2017-08-04 16:28:16 +02:00
} else {
echo '
2017-09-04 12:02:29 +02:00
< p >< a href = " '. $rootdir .'/editor.php?id_module='. $id_module .'&id_record='. $id_record .'&show_all1=0#tab_'. $id_plugin .' " > [ '.tr(' Mostra solo gli ultimi 20 movimenti ').' ] </ a ></ p > ' ;
2017-08-04 16:28:16 +02:00
}
echo '
< table class = " table table-striped table-condensed table-bordered " >
< tr >
2017-09-04 12:02:29 +02:00
< th class = " text-center " width = " 100 " > '.tr(' Q . tà ').' </ th >
< th width = " 720 " > '.tr(' Causale ').' </ th >
< th > '.tr(' Data ').' </ th >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
foreach ( $rs2 as $r ){
// Quantità
echo '
< tr >
< td class = " text-right " > '.Translator::numberToLocale($r[' qta ']).' </ td > ' ;
// Causale
echo '
< td > '.$r[' movimento '].' </ td > ' ;
// Data
echo '
2017-08-30 14:43:38 +02:00
< td > '.Translator::timestampToLocale($r[' created_at ']).' </ td >
2017-08-04 16:28:16 +02:00
</ tr > ' ;
}
echo '
</ table > ' ;
} else {
echo '
2017-09-04 12:02:29 +02:00
< p > '.tr(' Nessun movimento disponibile ').' ...</ p > ' ;
2017-08-04 16:28:16 +02:00
}
echo '
</ div >
</ div > ' ;